From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 13:50:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79F8A66CF2F; Mon, 26 Jul 2021 13:50:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYLsZ34jZz4dWk; Mon, 26 Jul 2021 13:50:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50DC218149; Mon, 26 Jul 2021 13:50:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QDoQ2K013038; Mon, 26 Jul 2021 13:50:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QDoQxf013037; Mon, 26 Jul 2021 13:50:26 GMT (envelope-from git) Date: Mon, 26 Jul 2021 13:50:26 GMT Message-Id: <202107261350.16QDoQxf013037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: af07a7ba5836 - stable/13 - zfs: add missed dependency of zfs module on zlib MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af07a7ba58363f4b6cdfb9cf456d6231c73a6b34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 13:50:26 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=af07a7ba58363f4b6cdfb9cf456d6231c73a6b34 commit af07a7ba58363f4b6cdfb9cf456d6231c73a6b34 Author: Konstantin Belousov AuthorDate: 2021-07-17 14:59:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:50:13 +0000 zfs: add missed dependency of zfs module on zlib (cherry picked from commit dbaad75f2834f40bfe74ebe393d2101967052036) --- sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c index d5ba0d93a569..1a7bcbabd0a5 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c @@ -371,3 +371,4 @@ MODULE_DEPEND(zfsctrl, krpc, 1, 1, 1); #endif MODULE_DEPEND(zfsctrl, acl_nfs4, 1, 1, 1); MODULE_DEPEND(zfsctrl, crypto, 1, 1, 1); +MODULE_DEPEND(zfsctrl, zlib, 1, 1, 1); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C44A266DAA7; Mon, 26 Jul 2021 15:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrB4kh4z3JbN; Mon, 26 Jul 2021 15:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C9AC190D4; Mon, 26 Jul 2021 15:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJM7Q025276; Mon, 26 Jul 2021 15:19:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJMPn025275; Mon, 26 Jul 2021 15:19:22 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:22 GMT Message-Id: <202107261519.16QFJMPn025275@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5955e8b93ece - stable/13 - mlx5: cqe64: update the tunneled bit name with recent PRM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5955e8b93ece64cb1f95d9c037c209eacfc77e10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:22 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5955e8b93ece64cb1f95d9c037c209eacfc77e10 commit 5955e8b93ece64cb1f95d9c037c209eacfc77e10 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:23:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:09 +0000 mlx5: cqe64: update the tunneled bit name with recent PRM (cherry picked from commit c8bdc78be19da5443c9186fa2fdb6e9427795565) --- sys/dev/mlx5/device.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/device.h b/sys/dev/mlx5/device.h index 69057d5f2470..64d4ed87d58f 100644 --- a/sys/dev/mlx5/device.h +++ b/sys/dev/mlx5/device.h @@ -662,8 +662,9 @@ struct mlx5_err_cqe { }; struct mlx5_cqe64 { - u8 tunneled_etc; - u8 rsvd0[3]; + u8 tls_outer_l3_tunneled; + u8 rsvd0; + __be16 wqe_id; u8 lro_tcppsh_abort_dupack; u8 lro_min_ttl; __be16 lro_tcp_win; @@ -724,7 +725,7 @@ static inline bool cqe_has_vlan(struct mlx5_cqe64 *cqe) static inline bool cqe_is_tunneled(struct mlx5_cqe64 *cqe) { - return cqe->tunneled_etc & 0x1; + return cqe->tls_outer_l3_tunneled & 0x1; } enum { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 182C266DAAA; Mon, 26 Jul 2021 15:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrC56SJz3JVl; Mon, 26 Jul 2021 15:19:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90DB419255; Mon, 26 Jul 2021 15:19:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJNve025300; Mon, 26 Jul 2021 15:19:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJN1s025299; Mon, 26 Jul 2021 15:19:23 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:23 GMT Message-Id: <202107261519.16QFJN1s025299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3e8436ec78b8 - stable/13 - mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3e8436ec78b89d40f4b405971f76791e6629fb2a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:24 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3e8436ec78b89d40f4b405971f76791e6629fb2a commit 3e8436ec78b89d40f4b405971f76791e6629fb2a Author: Konstantin Belousov AuthorDate: 2021-04-06 03:24:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5 (cherry picked from commit bc56a8f9e7abc20820757298cbb32c4aaa4fc0bc) --- sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index e7951682e56d..55c7896e3d52 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -66,7 +66,7 @@ #define BYPASS_MAX_FT 5 #define BYPASS_PRIO_MAX_FT 1 -#define KERNEL_MAX_FT 3 +#define KERNEL_MAX_FT 5 #define LEFTOVER_MAX_FT 1 #define KENREL_MIN_LEVEL 3 #define LEFTOVER_MIN_LEVEL KENREL_MIN_LEVEL + 1 From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7E7766DF81; Mon, 26 Jul 2021 15:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrD61bDz3JVr; Mon, 26 Jul 2021 15:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B53E319256; Mon, 26 Jul 2021 15:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJOPT025324; Mon, 26 Jul 2021 15:19:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJOPk025323; Mon, 26 Jul 2021 15:19:24 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:24 GMT Message-Id: <202107261519.16QFJOPk025323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 273cc11d5cb8 - stable/13 - mlx5en: increase the limit MLX5E_MAX_TX_HEADER MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 273cc11d5cb837ded7396a8cde486de2a5c4f221 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:25 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=273cc11d5cb837ded7396a8cde486de2a5c4f221 commit 273cc11d5cb837ded7396a8cde486de2a5c4f221 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:26:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: increase the limit MLX5E_MAX_TX_HEADER (cherry picked from commit 8b8c71d7ac31140277ab0383d22e6cb5c2d779d4) --- sys/dev/mlx5/mlx5_en/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 2ec47fa96a6d..86f44dda168c 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -125,7 +125,7 @@ #define MLX5E_SQ_TX_QUEUE_SIZE 4096 /* SQ drbr queue size */ #define MLX5E_MAX_TX_NUM_TC 8 /* units */ -#define MLX5E_MAX_TX_HEADER 128 /* bytes */ +#define MLX5E_MAX_TX_HEADER 192 /* bytes */ #define MLX5E_MAX_TX_PAYLOAD_SIZE 65536 /* bytes */ #define MLX5E_MAX_TX_MBUF_SIZE 65536 /* bytes */ #define MLX5E_MAX_TX_MBUF_FRAGS \ From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A86D66DB2D; Mon, 26 Jul 2021 15:19:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrG03V3z3JYV; Mon, 26 Jul 2021 15:19:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D58EF19627; Mon, 26 Jul 2021 15:19:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJPcP025354; Mon, 26 Jul 2021 15:19:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJPlW025353; Mon, 26 Jul 2021 15:19:25 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:25 GMT Message-Id: <202107261519.16QFJPlW025353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f9b965c23857 - stable/13 - mlx5en: style, remove redundant parentheses MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9b965c2385766f5eb5e9253f116900f02b0d048 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:26 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f9b965c2385766f5eb5e9253f116900f02b0d048 commit f9b965c2385766f5eb5e9253f116900f02b0d048 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:29:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: style, remove redundant parentheses (cherry picked from commit 16816f968917f15ba69fe56faafe4564439c6d47) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index c8dd21f6aadc..124d2afe414c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -256,7 +256,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) if (unlikely(mb->m_len < ETHER_HDR_LEN)) goto failure; if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { - if (unlikely(mb->m_len < (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN))) + if (unlikely(mb->m_len < ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)) goto failure; eth_type = ntohs(eh->evl_proto); eth_hdr_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F21366DAB0; Mon, 26 Jul 2021 15:19:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrH0nbVz3Jdr; Mon, 26 Jul 2021 15:19:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F156D19528; Mon, 26 Jul 2021 15:19:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJQD8025379; Mon, 26 Jul 2021 15:19:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJQjr025378; Mon, 26 Jul 2021 15:19:26 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:26 GMT Message-Id: <202107261519.16QFJQjr025378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: ed08b3711958 - stable/13 - mlx5en: eliminate magic constant MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ed08b3711958f690cc910b0540c881f5041f46a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:27 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ed08b3711958f690cc910b0540c881f5041f46a9 commit ed08b3711958f690cc910b0540c881f5041f46a9 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:30:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: eliminate magic constant (cherry picked from commit 1b36b3869f3be722dd15760ddcb4598b6dfe7cf7) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 124d2afe414c..1ba47e44ae96 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -277,7 +277,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) goto tcp_packet; case IPPROTO_UDP: ip_hlen = ip->ip_hl << 2; - eth_hdr_len += ip_hlen + 8; + eth_hdr_len += ip_hlen + sizeof(struct udphdr); th = NULL; goto udp_packet; default: @@ -293,7 +293,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) eth_hdr_len += sizeof(*ip6); goto tcp_packet; case IPPROTO_UDP: - eth_hdr_len += sizeof(*ip6) + 8; + eth_hdr_len += sizeof(*ip6) + sizeof(struct udphdr); th = NULL; goto udp_packet; default: From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1E7E66DAB2; Mon, 26 Jul 2021 15:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrK30jQz3Jbd; Mon, 26 Jul 2021 15:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45DA119529; Mon, 26 Jul 2021 15:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJTuw025427; Mon, 26 Jul 2021 15:19:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJTrA025426; Mon, 26 Jul 2021 15:19:29 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:29 GMT Message-Id: <202107261519.16QFJTrA025426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 64f13da9dce6 - stable/13 - mlx5en: allow software parser for created send queues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 64f13da9dce6803a16ccd0400f73369c68b5ccc9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:29 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=64f13da9dce6803a16ccd0400f73369c68b5ccc9 commit 64f13da9dce6803a16ccd0400f73369c68b5ccc9 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:42:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: allow software parser for created send queues (cherry picked from commit 5e12b3bb43bcc4aacc859242d7a653e64d6b339a) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 1adf83cf57f9..92a7fc97279f 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1733,6 +1733,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); MLX5_SET(sqc, sqc, tis_lst_sz, 1); MLX5_SET(sqc, sqc, flush_in_error_en, 1); + MLX5_SET(sqc, sqc, allow_swp, 1); MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC); MLX5_SET(wq, wq, uar_page, sq->priv->bfreg.index); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A19366D5F1; Mon, 26 Jul 2021 15:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrM2Jnjz3Jpt; Mon, 26 Jul 2021 15:19:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FCBF193D7; Mon, 26 Jul 2021 15:19:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJUTW025451; Mon, 26 Jul 2021 15:19:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJUl3025450; Mon, 26 Jul 2021 15:19:30 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:30 GMT Message-Id: <202107261519.16QFJUl3025450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 56e096ec869b - stable/13 - mlx5en: build TIRs to handle inner RSS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 56e096ec869b542fc39c31ab937d1fae3f7dd5eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:31 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56e096ec869b542fc39c31ab937d1fae3f7dd5eb commit 56e096ec869b542fc39c31ab937d1fae3f7dd5eb Author: Konstantin Belousov AuthorDate: 2021-04-06 03:43:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: build TIRs to handle inner RSS (cherry picked from commit fba6942f19f9cd6455f34658c8fff2ada1ee9691) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 106 +++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 44 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 92a7fc97279f..b5de6b3903fd 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2774,9 +2774,11 @@ mlx5e_get_rss_key(void *key_ptr) } static void -mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) +mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt, bool inner_vxlan) { void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer); + void *hfsi = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_inner); + void *hfs = inner_vxlan ? hfsi : hfso; __be32 *hkey; MLX5_SET(tirc, tirc, transport_domain, priv->tdn); @@ -2808,6 +2810,11 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) lro_timer_supported_periods[2])); } + if (inner_vxlan && + (priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + MLX5_SET(tirc, tirc, tunneled_offload_en, 1); + } + /* setup parameters for hashing TIR type, if any */ switch (tt) { case MLX5E_TT_ANY: @@ -2842,104 +2849,104 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) switch (tt) { case MLX5E_TT_IPV4_TCP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_TCP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV4)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV6_TCP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_TCP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV6)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV4_UDP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_UDP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV4)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV6_UDP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l4_prot_type, MLX5_L4_PROT_TYPE_UDP); #ifdef RSS if (!(rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6)) { - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); } else #endif - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_ALL); break; case MLX5E_TT_IPV4_IPSEC_AH: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV6_IPSEC_AH: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV4_IPSEC_ESP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV6_IPSEC_ESP: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP_IPSEC_SPI); break; case MLX5E_TT_IPV4: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV4); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); break; case MLX5E_TT_IPV6: - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, + MLX5_SET(rx_hash_field_select, hfs, l3_prot_type, MLX5_L3_PROT_TYPE_IPV6); - MLX5_SET(rx_hash_field_select, hfso, selected_fields, + MLX5_SET(rx_hash_field_select, hfs, selected_fields, MLX5_HASH_IP); break; @@ -2949,7 +2956,7 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) } static int -mlx5e_open_tir(struct mlx5e_priv *priv, int tt) +mlx5e_open_tir(struct mlx5e_priv *priv, int tt, bool inner_vxlan) { struct mlx5_core_dev *mdev = priv->mdev; u32 *in; @@ -2963,9 +2970,10 @@ mlx5e_open_tir(struct mlx5e_priv *priv, int tt) return (-ENOMEM); tirc = MLX5_ADDR_OF(create_tir_in, in, tir_context); - mlx5e_build_tir_ctx(priv, tirc, tt); + mlx5e_build_tir_ctx(priv, tirc, tt, inner_vxlan); - err = mlx5_core_create_tir(mdev, in, inlen, &priv->tirn[tt]); + err = mlx5_core_create_tir(mdev, in, inlen, inner_vxlan ? + &priv->tirn_inner_vxlan[tt] : &priv->tirn[tt]); kvfree(in); @@ -2973,19 +2981,20 @@ mlx5e_open_tir(struct mlx5e_priv *priv, int tt) } static void -mlx5e_close_tir(struct mlx5e_priv *priv, int tt) +mlx5e_close_tir(struct mlx5e_priv *priv, int tt, bool inner_vxlan) { - mlx5_core_destroy_tir(priv->mdev, priv->tirn[tt]); + mlx5_core_destroy_tir(priv->mdev, inner_vxlan ? + priv->tirn_inner_vxlan[tt] : priv->tirn[tt]); } static int -mlx5e_open_tirs(struct mlx5e_priv *priv) +mlx5e_open_tirs(struct mlx5e_priv *priv, bool inner_vxlan) { int err; int i; for (i = 0; i < MLX5E_NUM_TT; i++) { - err = mlx5e_open_tir(priv, i); + err = mlx5e_open_tir(priv, i, inner_vxlan); if (err) goto err_close_tirs; } @@ -2994,18 +3003,18 @@ mlx5e_open_tirs(struct mlx5e_priv *priv) err_close_tirs: for (i--; i >= 0; i--) - mlx5e_close_tir(priv, i); + mlx5e_close_tir(priv, i, inner_vxlan); return (err); } static void -mlx5e_close_tirs(struct mlx5e_priv *priv) +mlx5e_close_tirs(struct mlx5e_priv *priv, bool inner_vxlan) { int i; for (i = 0; i < MLX5E_NUM_TT; i++) - mlx5e_close_tir(priv, i); + mlx5e_close_tir(priv, i, inner_vxlan); } /* @@ -3113,16 +3122,21 @@ mlx5e_open_locked(struct ifnet *ifp) mlx5_en_err(ifp, "mlx5e_open_rqt failed, %d\n", err); goto err_close_channels; } - err = mlx5e_open_tirs(priv); + err = mlx5e_open_tirs(priv, false); if (err) { - mlx5_en_err(ifp, "mlx5e_open_tir failed, %d\n", err); + mlx5_en_err(ifp, "mlx5e_open_tir(main) failed, %d\n", err); goto err_close_rqls; } + err = mlx5e_open_tirs(priv, true); + if (err) { + mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", err); + goto err_close_tirs; + } err = mlx5e_open_flow_table(priv); if (err) { mlx5_en_err(ifp, "mlx5e_open_flow_table failed, %d\n", err); - goto err_close_tirs; + goto err_close_tirs_inner; } err = mlx5e_add_all_vlan_rules(priv); if (err) { @@ -3140,8 +3154,11 @@ mlx5e_open_locked(struct ifnet *ifp) err_close_flow_table: mlx5e_close_flow_table(priv); +err_close_tirs_inner: + mlx5e_close_tirs(priv, true); + err_close_tirs: - mlx5e_close_tirs(priv); + mlx5e_close_tirs(priv, false); err_close_rqls: mlx5e_close_rqt(priv); @@ -3189,7 +3206,8 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_del_all_vlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); - mlx5e_close_tirs(priv); + mlx5e_close_tirs(priv, true); + mlx5e_close_tirs(priv, false); mlx5e_close_rqt(priv); mlx5e_close_channels(priv); mlx5_vport_dealloc_q_counter(priv->mdev, From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFDD666DF39; Mon, 26 Jul 2021 15:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrM6HbMz3Jrs; Mon, 26 Jul 2021 15:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 915A71952A; Mon, 26 Jul 2021 15:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJVTE025481; Mon, 26 Jul 2021 15:19:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJViS025479; Mon, 26 Jul 2021 15:19:31 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:31 GMT Message-Id: <202107261519.16QFJViS025479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2ec7f3d2fe64 - stable/13 - mlx5en: handle offloaded Rx checksums calculated for tunneled packets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:32 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be commit 2ec7f3d2fe648efdc0f67da6981b0d0027a0b1be Author: Konstantin Belousov AuthorDate: 2021-04-06 03:44:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: handle offloaded Rx checksums calculated for tunneled packets (cherry picked from commit 149349e01ecd3a4655f7cbebe54973f6f0b0b371) --- sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c index 2bf189efc7e0..7cfd15b6aa5e 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c @@ -306,6 +306,10 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, } #else M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH); +#endif +#ifdef M_HASHTYPE_SETINNER + if (cqe_is_tunneled(cqe)) + M_HASHTYPE_SETINNER(mb); #endif } else { mb->m_pkthdr.flowid = rq->ix; @@ -313,7 +317,27 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe, } mb->m_pkthdr.rcvif = ifp; - if (likely(ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) && + if (cqe_is_tunneled(cqe)) { + /* + * CQE can be tunneled only if TIR is configured to + * enable parsing of tunneled payload, so no need to + * check for capabilities. + */ + if (((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK)) == + (CQE_L2_OK | CQE_L3_OK))) { + mb->m_pkthdr.csum_flags |= + CSUM_INNER_L3_CALC | CSUM_INNER_L3_VALID | + CSUM_IP_CHECKED | CSUM_IP_VALID | + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + mb->m_pkthdr.csum_data = htons(0xffff); + } + if (((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK)) == + (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK))) { + mb->m_pkthdr.csum_flags |= + CSUM_INNER_L4_CALC | CSUM_INNER_L4_VALID; + } + } else if (likely((ifp->if_capenable & (IFCAP_RXCSUM | + IFCAP_RXCSUM_IPV6)) != 0) && ((cqe->hds_ip_ext & (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK)) == (CQE_L2_OK | CQE_L3_OK | CQE_L4_OK))) { mb->m_pkthdr.csum_flags = From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 432E066D5F0; Mon, 26 Jul 2021 15:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrJ2hLbz3Jds; Mon, 26 Jul 2021 15:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 174E319425; Mon, 26 Jul 2021 15:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJSB5025403; Mon, 26 Jul 2021 15:19:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJSPC025402; Mon, 26 Jul 2021 15:19:28 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:28 GMT Message-Id: <202107261519.16QFJSPC025402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 8ab58a780df5 - stable/13 - mlx5en: register vxlan start/stop handlers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8ab58a780df5101047875c2b014ceb136a725ea8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:29 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8ab58a780df5101047875c2b014ceb136a725ea8 commit 8ab58a780df5101047875c2b014ceb136a725ea8 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:38:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: register vxlan start/stop handlers (cherry picked from commit 861a612d7bad4812630c9be55e7b59d8fe2cfa18) --- sys/dev/mlx5/mlx5_en/en.h | 25 ++ sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 674 +++++++++++++++++++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 + 3 files changed, 701 insertions(+), 8 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 86f44dda168c..ab30c7e2ca90 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -944,6 +944,18 @@ struct mlx5e_vlan_db { bool filter_disabled; }; +struct mlx5e_vxlan_db_el { + u_int refcount; + u_int proto; + u_int port; + struct mlx5_flow_rule *vxlan_ft_rule; + TAILQ_ENTRY(mlx5e_vxlan_db_el) link; +}; + +struct mlx5e_vxlan_db { + TAILQ_HEAD(, mlx5e_vxlan_db_el) head; +}; + struct mlx5e_flow_table { int num_groups; struct mlx5_flow_table *t; @@ -953,7 +965,11 @@ struct mlx5e_flow_table { struct mlx5e_flow_tables { struct mlx5_flow_namespace *ns; struct mlx5e_flow_table vlan; + struct mlx5e_flow_table vxlan; + struct mlx5_flow_rule *vxlan_catchall_ft_rule; struct mlx5e_flow_table main; + struct mlx5e_flow_table main_vxlan; + struct mlx5_flow_rule *main_vxlan_rule[MLX5E_NUM_TT]; struct mlx5e_flow_table inner_rss; }; @@ -1005,10 +1021,12 @@ struct mlx5e_priv { u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; u32 tirn[MLX5E_NUM_TT]; + u32 tirn_inner_vxlan[MLX5E_NUM_TT]; struct mlx5e_flow_tables fts; struct mlx5e_eth_addr_db eth_addr; struct mlx5e_vlan_db vlan; + struct mlx5e_vxlan_db vxlan; struct mlx5e_params params; struct mlx5e_params_ethtool params_ethtool; @@ -1035,6 +1053,8 @@ struct mlx5e_priv { struct ifmedia media; int media_status_last; int media_active_last; + eventhandler_tag vxlan_start; + eventhandler_tag vxlan_stop; struct callout watchdog; @@ -1124,6 +1144,11 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv); int mlx5e_add_all_vlan_rules(struct mlx5e_priv *priv); void mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv); +void mlx5e_vxlan_start(void *arg, struct ifnet *ifp, sa_family_t family, + u_int port); +void mlx5e_vxlan_stop(void *arg, struct ifnet *ifp, sa_family_t family, + u_int port); + static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 20e81fe806a5..f4f9e494308e 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -450,6 +450,226 @@ add_eth_addr_rule_out: return (err); } +static void +mlx5e_del_main_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5_flow_rule **ra = priv->fts.main_vxlan_rule, **r; + + r = &ra[MLX5E_TT_IPV6_IPSEC_ESP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_IPSEC_ESP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_IPSEC_AH]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_IPSEC_AH]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_TCP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_TCP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6_UDP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4_UDP]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV6]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_IPV4]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } + + r = &ra[MLX5E_TT_ANY]; + if (*r != NULL) { + mlx5_del_flow_rule(*r); + *r = NULL; + } +} + +static int +mlx5e_add_main_vxlan_rules_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv) +{ + struct mlx5_flow_destination dest = {}; + u8 mc_enable = 0; + struct mlx5_flow_rule **rule_p; + struct mlx5_flow_table *ft = priv->fts.main_vxlan.t; + u32 *tirn = priv->tirn_inner_vxlan; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR; + + mc_enable = MLX5_MATCH_INNER_HEADERS; + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4]; + dest.tir_num = tirn[MLX5E_TT_IPV4]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6]; + dest.tir_num = tirn[MLX5E_TT_IPV6]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ip_protocol); + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_UDP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_UDP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_UDP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_UDP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_UDP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_TCP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_TCP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_TCP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_TCP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_TCP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_AH); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_IPSEC_AH]; + dest.tir_num = tirn[MLX5E_TT_IPV4_IPSEC_AH]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_IPSEC_AH]; + dest.tir_num = tirn[MLX5E_TT_IPV6_IPSEC_AH]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + MLX5_SET(fte_match_param, mv, inner_headers.ip_protocol, IPPROTO_ESP); + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV4_IPSEC_ESP]; + dest.tir_num = tirn[MLX5E_TT_IPV4_IPSEC_ESP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, ETHERTYPE_IP); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_IPV6_IPSEC_ESP]; + dest.tir_num = tirn[MLX5E_TT_IPV6_IPSEC_ESP]; + MLX5_SET(fte_match_param, mv, inner_headers.ethertype, + ETHERTYPE_IPV6); + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + mc_enable = 0; + memset(mv, 0, MLX5_ST_SZ_BYTES(fte_match_param)); + memset(mc, 0, MLX5_ST_SZ_BYTES(fte_match_param)); + rule_p = &priv->fts.main_vxlan_rule[MLX5E_TT_ANY]; + dest.tir_num = tirn[MLX5E_TT_ANY]; + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + if (IS_ERR_OR_NULL(*rule_p)) + goto err_del_ai; + + return (0); + +err_del_ai: + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5e_del_main_vxlan_rules(priv); + + return (err); +} + +static int +mlx5e_add_main_vxlan_rules(struct mlx5e_priv *priv) +{ + u32 *match_criteria; + u32 *match_value; + int err = 0; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_main_vxlan_rules_out; + } + err = mlx5e_add_main_vxlan_rules_sub(priv, match_criteria, match_value); + +add_main_vxlan_rules_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + static int mlx5e_vport_context_update_vlans(struct mlx5e_priv *priv) { struct ifnet *ifp = priv->ifp; @@ -512,7 +732,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, int err = 0; dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; - dest.ft = priv->fts.main.t; + dest.ft = priv->fts.vxlan.t; mc_enable = MLX5_MATCH_OUTER_HEADERS; @@ -1267,14 +1487,87 @@ mlx5e_create_main_groups(struct mlx5e_flow_table *ft) return (err); } -static int mlx5e_create_main_flow_table(struct mlx5e_priv *priv) +#define MLX5E_MAIN_VXLAN_GROUP0_SIZE BIT(3) +#define MLX5E_MAIN_VXLAN_GROUP1_SIZE BIT(3) +#define MLX5E_MAIN_VXLAN_GROUP2_SIZE BIT(0) +static int +mlx5e_create_main_vxlan_groups_sub(struct mlx5e_flow_table *ft, u32 *in, + int inlen) +{ + u8 *mc = MLX5_ADDR_OF(create_flow_group_in, in, match_criteria); + int err; + int ix = 0; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_INNER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ip_protocol); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP0_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_INNER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, inner_headers.ethertype); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP1_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_MAIN_VXLAN_GROUP2_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + return (0); + +err_destory_groups: + err = PTR_ERR(ft->g[ft->num_groups]); + ft->g[ft->num_groups] = NULL; + mlx5e_destroy_groups(ft); + + return (err); +} + +static int +mlx5e_create_main_vxlan_groups(struct mlx5e_flow_table *ft) +{ + u32 *in; + int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); + int err; + + in = mlx5_vzalloc(inlen); + if (!in) + return (-ENOMEM); + + err = mlx5e_create_main_vxlan_groups_sub(ft, in, inlen); + + kvfree(in); + return (err); +} + + +static int +mlx5e_create_main_flow_table(struct mlx5e_priv *priv, bool inner_vxlan) { - struct mlx5e_flow_table *ft = &priv->fts.main; + struct mlx5e_flow_table *ft = inner_vxlan ? &priv->fts.main_vxlan : + &priv->fts.main; int err; ft->num_groups = 0; - ft->t = mlx5_create_flow_table(priv->fts.ns, 0, "main", - MLX5E_MAIN_TABLE_SIZE); + ft->t = mlx5_create_flow_table(priv->fts.ns, 0, + inner_vxlan ? "vxlan_main" : "main", MLX5E_MAIN_TABLE_SIZE); if (IS_ERR(ft->t)) { err = PTR_ERR(ft->t); @@ -1287,7 +1580,8 @@ static int mlx5e_create_main_flow_table(struct mlx5e_priv *priv) goto err_destroy_main_flow_table; } - err = mlx5e_create_main_groups(ft); + err = inner_vxlan ? mlx5e_create_main_vxlan_groups(ft) : + mlx5e_create_main_groups(ft); if (err) goto err_free_g; return (0); @@ -1307,6 +1601,11 @@ static void mlx5e_destroy_main_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.main); } +static void mlx5e_destroy_main_vxlan_flow_table(struct mlx5e_priv *priv) +{ + mlx5e_destroy_flow_table(&priv->fts.main_vxlan); +} + #define MLX5E_NUM_VLAN_GROUPS 3 #define MLX5E_VLAN_GROUP0_SIZE BIT(12) #define MLX5E_VLAN_GROUP1_SIZE BIT(1) @@ -1428,6 +1727,333 @@ mlx5e_destroy_vlan_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.vlan); } +static int +mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, + u32 *mc, u32 *mv, struct mlx5e_vxlan_db_el *el) +{ + struct mlx5_flow_table *ft = priv->fts.vxlan.t; + struct mlx5_flow_destination dest = {}; + u8 mc_enable; + struct mlx5_flow_rule **rule_p; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + dest.ft = priv->fts.main_vxlan.t; + + mc_enable = MLX5_MATCH_OUTER_HEADERS; + rule_p = &el->vxlan_ft_rule; + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); + MLX5_SET(fte_match_param, mv, outer_headers.ethertype, protocol); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); + MLX5_SET(fte_match_param, mv, outer_headers.ip_protocol, IPPROTO_UDP); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); + MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, port); + + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + + if (IS_ERR(*rule_p)) { + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5_en_err(priv->ifp, "add rule failed\n"); + } + + return (err); +} + +static struct mlx5e_vxlan_db_el * +mlx5e_vxlan_find_db_el(struct mlx5e_priv *priv, u_int proto, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (el->proto == proto && el->port == port) + return (el); + } + return (NULL); +} + +static struct mlx5e_vxlan_db_el * +mlx5e_vxlan_alloc_db_el(struct mlx5e_priv *priv, u_int proto, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + + el = mlx5_vzalloc(sizeof(*el)); + el->refcount = 1; + el->proto = proto; + el->port = port; + el->vxlan_ft_rule = NULL; + return (el); +} + +static int +mlx5e_vxlan_family_to_proto(sa_family_t family, u_int *proto) +{ + switch (family) { + case AF_INET: + *proto = ETHERTYPE_IP; + return (0); + case AF_INET6: + *proto = ETHERTYPE_IPV6; + return (0); + default: + return (-EINVAL); + } +} + +static int +mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + u32 *match_criteria; + u32 *match_value; + u_int proto; + int err; + + err = mlx5e_vxlan_family_to_proto(family, &proto); + if (err != 0) + return (err); + + el = mlx5e_vxlan_find_db_el(priv, proto, port); + if (el != NULL) { + el->refcount++; + return (0); + } + el = mlx5e_vxlan_alloc_db_el(priv, proto, port); + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_rule_sub(priv, proto, port, match_criteria, + match_value, el); + if (err == 0) { + TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); + } else { + kvfree(el); + } + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_add_vxlan_catchall_rule_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv) +{ + struct mlx5_flow_table *ft = priv->fts.vxlan.t; + struct mlx5_flow_destination dest = {}; + u8 mc_enable = 0; + struct mlx5_flow_rule **rule_p; + int err = 0; + + dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + dest.ft = priv->fts.main.t; + + rule_p = &priv->fts.vxlan_catchall_ft_rule; + *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); + + if (IS_ERR(*rule_p)) { + err = PTR_ERR(*rule_p); + *rule_p = NULL; + mlx5_en_err(priv->ifp, "add rule failed\n"); + } + + return (err); +} + + +static int +mlx5e_add_vxlan_catchall_rule(struct mlx5e_priv *priv) +{ + u32 *match_criteria; + u32 *match_value; + int err; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_catchall_rule_sub(priv, match_criteria, + match_value); + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; + u_int proto; + int err; + + err = mlx5e_vxlan_family_to_proto(family, &proto); + if (err != 0) + return (err); + + el = mlx5e_vxlan_find_db_el(priv, proto, port); + if (el == NULL) + return (0); + if (el->refcount > 1) { + el->refcount--; + return (0); + } + + mlx5_del_flow_rule(el->vxlan_ft_rule); + TAILQ_REMOVE(&priv->vxlan.head, el, link); + kvfree(el); + return (0); +} + +static void +mlx5e_del_vxlan_catchall_rule(struct mlx5e_priv *priv) +{ + mlx5_del_flow_rule(priv->fts.vxlan_catchall_ft_rule); +} + +void +mlx5e_vxlan_start(void *arg, struct ifnet *ifp __unused, sa_family_t family, + u_int port) +{ + struct mlx5e_priv *priv = arg; + int err; + + PRIV_LOCK(priv); + err = mlx5_vxlan_udp_port_add(priv->mdev, port); + if (err == 0 && test_bit(MLX5E_STATE_OPENED, &priv->state)) + mlx5e_add_vxlan_rule(priv, family, port); + PRIV_UNLOCK(priv); +} + +void +mlx5e_vxlan_stop(void *arg, struct ifnet *ifp __unused, sa_family_t family, + u_int port) +{ + struct mlx5e_priv *priv = arg; + + PRIV_LOCK(priv); + if (test_bit(MLX5E_STATE_OPENED, &priv->state)) + mlx5e_del_vxlan_rule(priv, family, port); + (void)mlx5_vxlan_udp_port_delete(priv->mdev, port); + PRIV_UNLOCK(priv); +} + +#define MLX5E_VXLAN_GROUP0_SIZE BIT(3) /* XXXKIB */ +#define MLX5E_VXLAN_GROUP1_SIZE BIT(0) +#define MLX5E_NUM_VXLAN_GROUPS BIT(1) +#define MLX5E_VXLAN_TABLE_SIZE \ + (MLX5E_VXLAN_GROUP0_SIZE + MLX5E_VXLAN_GROUP1_SIZE) + +static int +mlx5e_create_vxlan_groups_sub(struct mlx5e_flow_table *ft, u32 *in, + int inlen) +{ + int err; + int ix = 0; + u8 *mc = MLX5_ADDR_OF(create_flow_group_in, in, match_criteria); + + memset(in, 0, inlen); + MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_OUTER_HEADERS); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); + MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_VXLAN_GROUP0_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + memset(in, 0, inlen); + MLX5_SET_CFG(in, start_flow_index, ix); + ix += MLX5E_VXLAN_GROUP1_SIZE; + MLX5_SET_CFG(in, end_flow_index, ix - 1); + ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); + if (IS_ERR(ft->g[ft->num_groups])) + goto err_destory_groups; + ft->num_groups++; + + return (0); + +err_destory_groups: + err = PTR_ERR(ft->g[ft->num_groups]); + ft->g[ft->num_groups] = NULL; + mlx5e_destroy_groups(ft); + + return (err); +} + +static int +mlx5e_create_vxlan_groups(struct mlx5e_flow_table *ft) +{ + u32 *in; + int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); + int err; + + in = mlx5_vzalloc(inlen); + if (!in) + return (-ENOMEM); + + err = mlx5e_create_vxlan_groups_sub(ft, in, inlen); + + kvfree(in); + return (err); +} + +static int +mlx5e_create_vxlan_flow_table(struct mlx5e_priv *priv) +{ + struct mlx5e_flow_table *ft = &priv->fts.vxlan; + int err; + + ft->num_groups = 0; + ft->t = mlx5_create_flow_table(priv->fts.ns, 0, "vxlan", + MLX5E_VXLAN_TABLE_SIZE); + + if (IS_ERR(ft->t)) { + err = PTR_ERR(ft->t); + ft->t = NULL; + return (err); + } + ft->g = kcalloc(MLX5E_NUM_VXLAN_GROUPS, sizeof(*ft->g), GFP_KERNEL); + if (!ft->g) { + err = -ENOMEM; + goto err_destroy_vxlan_flow_table; + } + + err = mlx5e_create_vxlan_groups(ft); + if (err) + goto err_free_g; + + TAILQ_INIT(&priv->vxlan.head); + return (0); + +err_free_g: + kfree(ft->g); + +err_destroy_vxlan_flow_table: + mlx5_destroy_flow_table(ft->t); + ft->t = NULL; + + return (err); +} + #define MLX5E_NUM_INNER_RSS_GROUPS 3 #define MLX5E_INNER_RSS_GROUP0_SIZE BIT(3) #define MLX5E_INNER_RSS_GROUP1_SIZE BIT(1) @@ -1547,6 +2173,12 @@ static void mlx5e_destroy_inner_rss_flow_table(struct mlx5e_priv *priv) mlx5e_destroy_flow_table(&priv->fts.inner_rss); } +static void +mlx5e_destroy_vxlan_flow_table(struct mlx5e_priv *priv) +{ + mlx5e_destroy_flow_table(&priv->fts.vxlan); +} + int mlx5e_open_flow_table(struct mlx5e_priv *priv) { @@ -1559,18 +2191,40 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) if (err) return (err); - err = mlx5e_create_main_flow_table(priv); + err = mlx5e_create_vxlan_flow_table(priv); if (err) goto err_destroy_vlan_flow_table; - err = mlx5e_create_inner_rss_flow_table(priv); + err = mlx5e_create_main_flow_table(priv, false); + if (err) + goto err_destroy_vxlan_flow_table; + + err = mlx5e_create_main_flow_table(priv, true); if (err) goto err_destroy_main_flow_table; + err = mlx5e_create_inner_rss_flow_table(priv); + if (err) + goto err_destroy_main_vxlan_flow_table; + + err = mlx5e_add_vxlan_catchall_rule(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + + err = mlx5e_add_main_vxlan_rules(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + return (0); +err_destroy_inner_rss_flow_table: + mlx5e_destroy_inner_rss_flow_table(priv); +err_destroy_main_vxlan_flow_table: + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); +err_destroy_vxlan_flow_table: + mlx5e_destroy_vxlan_flow_table(priv); err_destroy_vlan_flow_table: mlx5e_destroy_vlan_flow_table(priv); @@ -1583,6 +2237,10 @@ mlx5e_close_flow_table(struct mlx5e_priv *priv) mlx5e_handle_ifp_addr(priv); mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_del_vxlan_catchall_rule(priv); + mlx5e_destroy_vxlan_flow_table(priv); + mlx5e_del_main_vxlan_rules(priv); mlx5e_destroy_main_flow_table(priv); + mlx5e_destroy_main_vxlan_flow_table(priv); mlx5e_destroy_vlan_flow_table(priv); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 296252875888..1adf83cf57f9 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -4558,6 +4558,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) priv->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, mlx5e_vlan_rx_kill_vid, priv, EVENTHANDLER_PRI_FIRST); + /* Register for VxLAN events */ + priv->vxlan_start = EVENTHANDLER_REGISTER(vxlan_start, + mlx5e_vxlan_start, priv, EVENTHANDLER_PRI_ANY); + priv->vxlan_stop = EVENTHANDLER_REGISTER(vxlan_stop, + mlx5e_vxlan_stop, priv, EVENTHANDLER_PRI_ANY); + /* Link is down by default */ if_link_state_change(ifp, LINK_STATE_DOWN); @@ -4660,6 +4666,10 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) EVENTHANDLER_DEREGISTER(vlan_config, priv->vlan_attach); if (priv->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, priv->vlan_detach); + if (priv->vxlan_start != NULL) + EVENTHANDLER_DEREGISTER(vxlan_start, priv->vxlan_start); + if (priv->vxlan_stop != NULL) + EVENTHANDLER_DEREGISTER(vxlan_stop, priv->vxlan_stop); /* make sure device gets closed */ PRIV_LOCK(priv); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 508AF66DDAB; Mon, 26 Jul 2021 15:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrR0F2lz3JkN; Mon, 26 Jul 2021 15:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2F9A193D8; Mon, 26 Jul 2021 15:19:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJXtn025529; Mon, 26 Jul 2021 15:19:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJXou025528; Mon, 26 Jul 2021 15:19:33 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:33 GMT Message-Id: <202107261519.16QFJXou025528@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d2fcc95d3404 - stable/13 - mlx5en: announce mce(4) capabilities for stateless VxLAN offloading MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2fcc95d340468ff78ff667b9fda6e56ea92cf1f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:35 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d2fcc95d340468ff78ff667b9fda6e56ea92cf1f commit d2fcc95d340468ff78ff667b9fda6e56ea92cf1f Author: Konstantin Belousov AuthorDate: 2021-04-06 03:46:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: announce mce(4) capabilities for stateless VxLAN offloading (cherry picked from commit bf202a8d7afb2e024d3d29d4d90e24b3925e9f06) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index b5de6b3903fd..26bd5e00d22d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3446,6 +3446,21 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (mask & IFCAP_WOL_MAGIC) ifp->if_capenable ^= IFCAP_WOL_MAGIC; + if (mask & IFCAP_VXLAN_HWCSUM) { + ifp->if_capenable ^= IFCAP_VXLAN_HWCSUM; + ifp->if_hwassist ^= CSUM_INNER_IP | CSUM_INNER_IP_UDP | + CSUM_INNER_IP_TCP | CSUM_INNER_IP6_UDP | + CSUM_INNER_IP6_TCP; + if (test_bit(MLX5E_STATE_OPENED, &priv->state)) { + mlx5e_close_locked(ifp); + mlx5e_open_locked(ifp); + } + } + if (mask & IFCAP_VXLAN_HWTSO) { + ifp->if_capenable ^= IFCAP_VXLAN_HWTSO; + ifp->if_hwassist ^= CSUM_INNER_IP_TSO | + CSUM_INNER_IP6_TSO; + } VLAN_CAPABILITIES(ifp); /* turn off LRO means also turn of HW LRO - if it's on */ @@ -4421,6 +4436,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) #ifdef RATELIMIT ifp->if_capabilities |= IFCAP_TXRTLMT | IFCAP_TXTLS_RTLMT; #endif + ifp->if_capabilities |= IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO; ifp->if_snd_tag_alloc = mlx5e_snd_tag_alloc; ifp->if_snd_tag_free = mlx5e_snd_tag_free; ifp->if_snd_tag_modify = mlx5e_snd_tag_modify; @@ -4441,6 +4457,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP); if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + if (ifp->if_capabilities & IFCAP_VXLAN_HWCSUM) + ifp->if_hwassist |= CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP | + CSUM_INNER_IP | CSUM_INNER_IP_UDP | CSUM_INNER_IP_TCP | + CSUM_ENCAP_VXLAN; + if (ifp->if_capabilities & IFCAP_VXLAN_HWTSO) + ifp->if_hwassist |= CSUM_INNER_IP6_TSO | CSUM_INNER_IP_TSO; /* ifnet sysctl tree */ sysctl_ctx_init(&priv->sysctl_ctx); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E1FB66DB4D; Mon, 26 Jul 2021 15:19:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrS2hYVz3Jq9; Mon, 26 Jul 2021 15:19:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DE3819629; Mon, 26 Jul 2021 15:19:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJaQY025577; Mon, 26 Jul 2021 15:19:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJaW3025576; Mon, 26 Jul 2021 15:19:36 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:36 GMT Message-Id: <202107261519.16QFJaW3025576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2226c0e78528 - stable/13 - mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2226c0e78528a94675a071dfcf079ee211dacdfa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:37 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2226c0e78528a94675a071dfcf079ee211dacdfa commit 2226c0e78528a94675a071dfcf079ee211dacdfa Author: Konstantin Belousov AuthorDate: 2021-04-14 07:03:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule (cherry picked from commit e012189d0265851c631261bdcb175727ba715b34) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index f4f9e494308e..9e10a3728b1d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1728,8 +1728,8 @@ mlx5e_destroy_vlan_flow_table(struct mlx5e_priv *priv) } static int -mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, - u32 *mc, u32 *mv, struct mlx5e_vxlan_db_el *el) +mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u32 *mc, u32 *mv, + struct mlx5e_vxlan_db_el *el) { struct mlx5_flow_table *ft = priv->fts.vxlan.t; struct mlx5_flow_destination dest = {}; @@ -1743,11 +1743,11 @@ mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, u_int protocol, u_int port, mc_enable = MLX5_MATCH_OUTER_HEADERS; rule_p = &el->vxlan_ft_rule; MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ethertype); - MLX5_SET(fte_match_param, mv, outer_headers.ethertype, protocol); + MLX5_SET(fte_match_param, mv, outer_headers.ethertype, el->proto); MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.ip_protocol); MLX5_SET(fte_match_param, mv, outer_headers.ip_protocol, IPPROTO_UDP); MLX5_SET_TO_ONES(fte_match_param, mc, outer_headers.udp_dport); - MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, port); + MLX5_SET(fte_match_param, mv, outer_headers.udp_dport, el->port); *rule_p = mlx5_add_flow_rule(ft, mc_enable, mc, mv, MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FS_ETH_FLOW_TAG, &dest); @@ -1829,8 +1829,7 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) goto add_vxlan_rule_out; } - err = mlx5e_add_vxlan_rule_sub(priv, proto, port, match_criteria, - match_value, el); + err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); } else { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F30E66DADC; Mon, 26 Jul 2021 15:19:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrW0fKdz3JqJ; Mon, 26 Jul 2021 15:19:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7236419257; Mon, 26 Jul 2021 15:19:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJc0G025639; Mon, 26 Jul 2021 15:19:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJcXq025638; Mon, 26 Jul 2021 15:19:38 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:38 GMT Message-Id: <202107261519.16QFJcXq025638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 779fd2390b97 - stable/13 - mlx5en: remove all dynamic vxlan steering rules on close and reinstall on open MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 779fd2390b97c18bcfc88ad717cef9c2171b5e85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:39 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=779fd2390b97c18bcfc88ad717cef9c2171b5e85 commit 779fd2390b97c18bcfc88ad717cef9c2171b5e85 Author: Konstantin Belousov AuthorDate: 2021-04-14 07:09:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: remove all dynamic vxlan steering rules on close and reinstall on open (cherry picked from commit 0e4cb0d5a487339cc7f5e151c466e20aeac1e4d9) --- sys/dev/mlx5/mlx5_en/en.h | 4 ++++ sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 36 ++++++++++++++++++++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 +++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index ab30c7e2ca90..e4b66bea8f60 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -948,6 +948,7 @@ struct mlx5e_vxlan_db_el { u_int refcount; u_int proto; u_int port; + bool installed; struct mlx5_flow_rule *vxlan_ft_rule; TAILQ_ENTRY(mlx5e_vxlan_db_el) link; }; @@ -1149,6 +1150,9 @@ void mlx5e_vxlan_start(void *arg, struct ifnet *ifp, sa_family_t family, void mlx5e_vxlan_stop(void *arg, struct ifnet *ifp, sa_family_t family, u_int port); +int mlx5e_add_all_vxlan_rules(struct mlx5e_priv *priv); +void mlx5e_del_all_vxlan_rules(struct mlx5e_priv *priv); + static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 648dc199157c..a493e530a4c8 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1840,13 +1840,15 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) el = mlx5e_vxlan_find_db_el(priv, proto, port); if (el != NULL) { el->refcount++; - return (0); + if (el->installed) + return (0); } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); err = mlx5e_add_vxlan_rule_from_db(priv, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); + el->installed = true; } else { kvfree(el); } @@ -1905,6 +1907,25 @@ add_vxlan_rule_out: return (err); } +int +mlx5e_add_all_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5e_vxlan_db_el *el; + int err; + + err = 0; + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (el->installed) + continue; + err = mlx5e_add_vxlan_rule_from_db(priv, el); + if (err != 0) + break; + el->installed = false; + } + + return (err); +} + static int mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) { @@ -1930,6 +1951,19 @@ mlx5e_del_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) return (0); } +void +mlx5e_del_all_vxlan_rules(struct mlx5e_priv *priv) +{ + struct mlx5e_vxlan_db_el *el; + + TAILQ_FOREACH(el, &priv->vxlan.head, link) { + if (!el->installed) + continue; + mlx5_del_flow_rule(el->vxlan_ft_rule); + el->installed = false; + } +} + static void mlx5e_del_vxlan_catchall_rule(struct mlx5e_priv *priv) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 26bd5e00d22d..9a01940ca90c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3144,6 +3144,12 @@ mlx5e_open_locked(struct ifnet *ifp) "mlx5e_add_all_vlan_rules failed, %d\n", err); goto err_close_flow_table; } + err = mlx5e_add_all_vxlan_rules(priv); + if (err) { + mlx5_en_err(ifp, + "mlx5e_add_all_vxlan_rules failed, %d\n", err); + goto err_del_vlan_rules; + } set_bit(MLX5E_STATE_OPENED, &priv->state); mlx5e_update_carrier(priv); @@ -3151,6 +3157,9 @@ mlx5e_open_locked(struct ifnet *ifp) return (0); +err_del_vlan_rules: + mlx5e_del_all_vlan_rules(priv); + err_close_flow_table: mlx5e_close_flow_table(priv); @@ -3204,6 +3213,7 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_set_rx_mode_core(priv); mlx5e_del_all_vlan_rules(priv); + mlx5e_del_all_vxlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); mlx5e_close_tirs(priv, true); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D689066DDBF; Mon, 26 Jul 2021 15:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrY4S3Kz3Jvf; Mon, 26 Jul 2021 15:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADEAB193DB; Mon, 26 Jul 2021 15:19:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJeZK025687; Mon, 26 Jul 2021 15:19:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJenm025686; Mon, 26 Jul 2021 15:19:40 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:40 GMT Message-Id: <202107261519.16QFJenm025686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 40fa8f462b33 - stable/13 - mlx5en: Fix for IPv6 VxLAN checksum offload. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 40fa8f462b33d4f30693a36ce7ba3ddd2b128143 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:42 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=40fa8f462b33d4f30693a36ce7ba3ddd2b128143 commit 40fa8f462b33d4f30693a36ce7ba3ddd2b128143 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: Fix for IPv6 VxLAN checksum offload. (cherry picked from commit 1918b253d36a82ccc171df40d9abb75923f1ece5) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 6bc0a91ca8ef..437910ee7964 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -423,7 +423,7 @@ mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, if (unlikely(ip_type != IPPROTO_UDP)) return (0); wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; - wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + wqe->eth.cs_flags = MLX5_ETH_WQE_L4_CSUM; eth_hdr_len += sizeof(*ip6); udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, sizeof(*udp)); @@ -483,7 +483,6 @@ mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, if (unlikely(ip6 == NULL)) return (0); wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; - wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_TYPE; ip_type = ip6->ip6_nxt; eth_hdr_len += sizeof(*ip6); @@ -833,7 +832,8 @@ top: uint8_t cs_mask; if (mb->m_pkthdr.csum_flags & - (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP)) { + (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP | + CSUM_INNER_IP6_TCP | CSUM_INNER_IP6_UDP)) { cs_mask = MLX5_ETH_WQE_L3_INNER_CSUM | MLX5_ETH_WQE_L4_INNER_CSUM | From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9ECD066E035; Mon, 26 Jul 2021 15:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrd42mHz3JnG; Mon, 26 Jul 2021 15:19:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DFE91952C; Mon, 26 Jul 2021 15:19:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJjgU025789; Mon, 26 Jul 2021 15:19:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJjdw025788; Mon, 26 Jul 2021 15:19:45 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:45 GMT Message-Id: <202107261519.16QFJjdw025788@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4348f0758c96 - stable/13 - mlx5: Fix PPLM register mapping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4348f0758c9685419db77882ed92d4a2cff94078 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:46 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4348f0758c9685419db77882ed92d4a2cff94078 commit 4348f0758c9685419db77882ed92d4a2cff94078 Author: Konstantin Belousov AuthorDate: 2021-04-21 14:12:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5: Fix PPLM register mapping (cherry picked from commit 06a3fd0e5c86ae4f00075c1571cf4e183e28b4c4) --- sys/dev/mlx5/mlx5_ifc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index f748ec876ef4..81e91e180b8c 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -8139,7 +8139,7 @@ struct mlx5_ifc_pplm_reg_bits { u8 fec_override_admin_100g_2x[0x10]; u8 fec_override_admin_50g_1x[0x10]; - u8 reserved_at_140[0xC0]; + u8 reserved_at_140[0x140]; }; struct mlx5_ifc_ppll_reg_bits { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4865366DAC3; Mon, 26 Jul 2021 15:19:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrP1MGwz3JmS; Mon, 26 Jul 2021 15:19:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B09EC19628; Mon, 26 Jul 2021 15:19:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJWh5025505; Mon, 26 Jul 2021 15:19:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJWdU025504; Mon, 26 Jul 2021 15:19:32 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:32 GMT Message-Id: <202107261519.16QFJWdU025504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 56fd9780ad57 - stable/13 - mlx5en: handle checksum and TSO offloading for VxLAN packets on TX MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 56fd9780ad57d06133e19bec13b0e54aae36b809 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:33 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56fd9780ad57d06133e19bec13b0e54aae36b809 commit 56fd9780ad57d06133e19bec13b0e54aae36b809 Author: Konstantin Belousov AuthorDate: 2021-04-06 03:45:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:10 +0000 mlx5en: handle checksum and TSO offloading for VxLAN packets on TX (cherry picked from commit 7c9febf9f11bec467ef79c6ff19d695ace7edb6b) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 289 +++++++++++++++++++++++++++++++++++++- 1 file changed, 287 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 1ba47e44ae96..6bc0a91ca8ef 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -332,6 +332,221 @@ failure: return (0); } +/* + * Locate a pointer inside a mbuf chain. Returns NULL upon failure. + */ +static inline void * +mlx5e_parse_mbuf_chain(const struct mbuf **mb, int *poffset, int eth_hdr_len, + int min_len) +{ + if (unlikely(mb[0]->m_len == eth_hdr_len)) { + poffset[0] = eth_hdr_len; + if (unlikely((mb[0] = mb[0]->m_next) == NULL)) + return (NULL); + } + if (unlikely(mb[0]->m_len < eth_hdr_len - poffset[0] + min_len)) + return (NULL); + return (mb[0]->m_data + eth_hdr_len - poffset[0]); +} + +/* + * This function parse IPv4 and IPv6 packets looking for UDP, VXLAN + * and TCP headers. + * + * The return value indicates the number of bytes from the beginning + * of the packet until the first byte after the TCP header. If this + * function returns zero, the parsing failed. + */ +static int +mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, + uint8_t cs_mask, uint8_t opcode) +{ + const struct ether_vlan_header *eh; + struct ip *ip4; + struct ip6_hdr *ip6; + struct tcphdr *th; + struct udphdr *udp; + bool has_outer_vlan_tag; + uint16_t eth_type; + uint8_t ip_type; + int pkt_hdr_len; + int eth_hdr_len; + int tcp_hlen; + int ip_hlen; + int offset; + + pkt_hdr_len = mb->m_pkthdr.len; + has_outer_vlan_tag = (mb->m_flags & M_VLANTAG) != 0; + offset = 0; + + eh = mtod(mb, const struct ether_vlan_header *); + if (unlikely(mb->m_len < ETHER_HDR_LEN)) + return (0); + + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + if (unlikely(mb->m_len < ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)) + return (0); + eth_type = eh->evl_proto; + eth_hdr_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + eth_type = eh->evl_encap_proto; + eth_hdr_len = ETHER_HDR_LEN; + } + + switch (eth_type) { + case htons(ETHERTYPE_IP): + ip4 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip4)); + if (unlikely(ip4 == NULL)) + return (0); + ip_type = ip4->ip_p; + if (unlikely(ip_type != IPPROTO_UDP)) + return (0); + wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + ip_hlen = ip4->ip_hl << 2; + eth_hdr_len += ip_hlen; + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_outer_l4_offset = eth_hdr_len / 2; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L4_TYPE; + eth_hdr_len += sizeof(*udp); + break; + case htons(ETHERTYPE_IPV6): + ip6 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip6)); + if (unlikely(ip6 == NULL)) + return (0); + ip_type = ip6->ip6_nxt; + if (unlikely(ip_type != IPPROTO_UDP)) + return (0); + wqe->eth.swp_outer_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; + eth_hdr_len += sizeof(*ip6); + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_outer_l4_offset = eth_hdr_len / 2; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L4_TYPE | + MLX5_ETH_WQE_SWP_OUTER_L3_TYPE; + eth_hdr_len += sizeof(*udp); + break; + default: + return (0); + } + + /* + * If the hardware is not computing inner IP checksum, then + * skip inlining the inner outer UDP and VXLAN header: + */ + if (unlikely((cs_mask & MLX5_ETH_WQE_L3_INNER_CSUM) == 0)) + goto done; + if (unlikely(mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + 8) == NULL)) + return (0); + eth_hdr_len += 8; + + /* Check for ethernet header again. */ + eh = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, ETHER_HDR_LEN); + if (unlikely(eh == NULL)) + return (0); + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + if (unlikely(mb->m_len < eth_hdr_len - offset + ETHER_HDR_LEN + + ETHER_VLAN_ENCAP_LEN)) + return (0); + eth_type = eh->evl_proto; + eth_hdr_len += ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + eth_type = eh->evl_encap_proto; + eth_hdr_len += ETHER_HDR_LEN; + } + + /* Check for IP header again. */ + switch (eth_type) { + case htons(ETHERTYPE_IP): + ip4 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip4)); + if (unlikely(ip4 == NULL)) + return (0); + wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; + ip_type = ip4->ip_p; + ip_hlen = ip4->ip_hl << 2; + eth_hdr_len += ip_hlen; + break; + case htons(ETHERTYPE_IPV6): + ip6 = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*ip6)); + if (unlikely(ip6 == NULL)) + return (0); + wqe->eth.swp_inner_l3_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_TYPE; + ip_type = ip6->ip6_nxt; + eth_hdr_len += sizeof(*ip6); + break; + default: + return (0); + } + + /* + * If the hardware is not computing inner UDP/TCP checksum, + * then skip inlining the inner UDP/TCP header: + */ + if (unlikely((cs_mask & MLX5_ETH_WQE_L4_INNER_CSUM) == 0)) + goto done; + + switch (ip_type) { + case IPPROTO_UDP: + udp = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*udp)); + if (unlikely(udp == NULL)) + return (0); + wqe->eth.swp_inner_l4_offset = (eth_hdr_len / 2); + wqe->eth.cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_TYPE; + eth_hdr_len += sizeof(*udp); + break; + case IPPROTO_TCP: + th = mlx5e_parse_mbuf_chain(&mb, &offset, eth_hdr_len, + sizeof(*th)); + if (unlikely(th == NULL)) + return (0); + wqe->eth.swp_inner_l4_offset = eth_hdr_len / 2; + wqe->eth.cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; + wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_TYPE; + tcp_hlen = th->th_off << 2; + eth_hdr_len += tcp_hlen; + break; + default: + return (0); + } +done: + if (unlikely(pkt_hdr_len < eth_hdr_len)) + return (0); + + /* Account for software inserted VLAN tag, if any. */ + if (unlikely(has_outer_vlan_tag)) { + wqe->eth.swp_outer_l3_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_outer_l4_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_inner_l3_offset += ETHER_VLAN_ENCAP_LEN / 2; + wqe->eth.swp_inner_l4_offset += ETHER_VLAN_ENCAP_LEN / 2; + } + + /* + * When inner checksums are set, outer L4 checksum flag must + * be disabled. + */ + if (wqe->eth.cs_flags & (MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM)) + wqe->eth.cs_flags &= ~MLX5_ETH_WQE_L4_CSUM; + + return (eth_hdr_len); +} + struct mlx5_wqe_dump_seg { struct mlx5_wqe_ctrl_seg ctrl; struct mlx5_wqe_data_seg data; @@ -574,8 +789,77 @@ top: num_pkts = DIV_ROUND_UP(payload_len, mss); sq->mbuf[pi].num_bytes = payload_len + (num_pkts * args.ihs); + sq->stats.tso_packets++; sq->stats.tso_bytes += payload_len; + } else if (mb->m_pkthdr.csum_flags & CSUM_ENCAP_VXLAN) { + /* check for inner TCP TSO first */ + if (mb->m_pkthdr.csum_flags & (CSUM_INNER_IP_TSO | + CSUM_INNER_IP6_TSO)) { + u32 payload_len; + u32 mss = mb->m_pkthdr.tso_segsz; + u32 num_pkts; + + wqe->eth.mss = cpu_to_be16(mss); + opcode = MLX5_OPCODE_LSO; + + if (likely(args.ihs == 0)) { + args.ihs = mlx5e_get_vxlan_header_size(mb, wqe, + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM, + opcode); + if (unlikely(args.ihs == 0)) { + err = EINVAL; + goto tx_drop; + } + } + + payload_len = mb->m_pkthdr.len - args.ihs; + if (payload_len == 0) + num_pkts = 1; + else + num_pkts = DIV_ROUND_UP(payload_len, mss); + sq->mbuf[pi].num_bytes = payload_len + + num_pkts * args.ihs; + + sq->stats.tso_packets++; + sq->stats.tso_bytes += payload_len; + } else { + opcode = MLX5_OPCODE_SEND; + + if (likely(args.ihs == 0)) { + uint8_t cs_mask; + + if (mb->m_pkthdr.csum_flags & + (CSUM_INNER_IP_TCP | CSUM_INNER_IP_UDP)) { + cs_mask = + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } else if (mb->m_pkthdr.csum_flags & CSUM_INNER_IP) { + cs_mask = + MLX5_ETH_WQE_L3_INNER_CSUM | + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } else { + cs_mask = + MLX5_ETH_WQE_L4_CSUM | + MLX5_ETH_WQE_L3_CSUM; + } + args.ihs = mlx5e_get_vxlan_header_size(mb, wqe, + cs_mask, opcode); + if (unlikely(args.ihs == 0)) { + err = EINVAL; + goto tx_drop; + } + } + + sq->mbuf[pi].num_bytes = max_t (unsigned int, + mb->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN); + } } else { opcode = MLX5_OPCODE_SEND; @@ -622,7 +906,7 @@ top: /* Range checks */ if (unlikely(args.ihs > (sq->max_inline - ETHER_VLAN_ENCAP_LEN))) { - if (mb->m_pkthdr.csum_flags & CSUM_TSO) { + if (mb->m_pkthdr.csum_flags & (CSUM_TSO | CSUM_ENCAP_VXLAN)) { err = EINVAL; goto tx_drop; } @@ -646,7 +930,8 @@ top: } else { /* check if inline header size is too big */ if (unlikely(args.ihs > sq->max_inline)) { - if (unlikely(mb->m_pkthdr.csum_flags & CSUM_TSO)) { + if (unlikely(mb->m_pkthdr.csum_flags & (CSUM_TSO | + CSUM_ENCAP_VXLAN))) { err = EINVAL; goto tx_drop; } From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7909966DDAF; Mon, 26 Jul 2021 15:19:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrR6q91z3Jc9; Mon, 26 Jul 2021 15:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A5FD193D9; Mon, 26 Jul 2021 15:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJYCZ025553; Mon, 26 Jul 2021 15:19:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJY9f025552; Mon, 26 Jul 2021 15:19:34 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:34 GMT Message-Id: <202107261519.16QFJY9f025552@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 692ba7de91a9 - stable/13 - mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 692ba7de91a934a4a91ec0a4f3c50c71ed2ed368 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:37 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=692ba7de91a934a4a91ec0a4f3c50c71ed2ed368 commit 692ba7de91a934a4a91ec0a4f3c50c71ed2ed368 Author: Konstantin Belousov AuthorDate: 2021-04-07 14:08:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL (cherry picked from commit 859e41e90165b00b99addf4c498b8ec031ba9df9) --- sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index 55c7896e3d52..320831b6e153 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -68,8 +68,8 @@ #define BYPASS_PRIO_MAX_FT 1 #define KERNEL_MAX_FT 5 #define LEFTOVER_MAX_FT 1 -#define KENREL_MIN_LEVEL 3 -#define LEFTOVER_MIN_LEVEL KENREL_MIN_LEVEL + 1 +#define KERNEL_MIN_LEVEL 3 +#define LEFTOVER_MIN_LEVEL KERNEL_MIN_LEVEL + 1 #define BYPASS_MIN_LEVEL MLX5_NUM_BYPASS_FTS + LEFTOVER_MIN_LEVEL struct node_caps { size_t arr_sz; @@ -113,7 +113,7 @@ struct init_tree_node { BYPASS_PRIO_MAX_FT), ADD_FT_PRIO("prio-mcast", 0, BYPASS_PRIO_MAX_FT))), - ADD_PRIO("kernel_prio", 0, KENREL_MIN_LEVEL, 0, {}, + ADD_PRIO("kernel_prio", 0, KERNEL_MIN_LEVEL, 0, {}, ADD_NS("kernel_ns", ADD_FT_PRIO("prio_kernel-0", 0, KERNEL_MAX_FT))), From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BE5566E086; Mon, 26 Jul 2021 15:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrX2zTWz3JqQ; Mon, 26 Jul 2021 15:19:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CD20193DA; Mon, 26 Jul 2021 15:19:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJd4U025663; Mon, 26 Jul 2021 15:19:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJdaI025662; Mon, 26 Jul 2021 15:19:39 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:39 GMT Message-Id: <202107261519.16QFJdaI025662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 518c3f34d020 - stable/13 - mlx5en: Honor IFCAP_VXLAN_HWCSUM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 518c3f34d020b49f7baa73001cb4e4af6d81d1c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:41 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=518c3f34d020b49f7baa73001cb4e4af6d81d1c7 commit 518c3f34d020b49f7baa73001cb4e4af6d81d1c7 Author: Konstantin Belousov AuthorDate: 2021-04-20 11:16:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: Honor IFCAP_VXLAN_HWCSUM (cherry picked from commit 48acda2b2d6d173a2231a3db153dd4709dcb5276) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 77 +++++++++++++++++++------------ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 44 ++++++++++-------- 2 files changed, 74 insertions(+), 47 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index a493e530a4c8..6be95550c713 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -732,7 +732,8 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, int err = 0; dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; - dest.ft = priv->fts.vxlan.t; + dest.ft = ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) ? + priv->fts.vxlan.t : priv->fts.main.t; mc_enable = MLX5_MATCH_OUTER_HEADERS; @@ -1845,13 +1846,15 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); - err = mlx5e_add_vxlan_rule_from_db(priv, el); - if (err == 0) { + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_vxlan_rule_from_db(priv, el); + if (err == 0) + el->installed = true; + } + if (err == 0) TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); - el->installed = true; - } else { + else kvfree(el); - } return (err); } @@ -2235,40 +2238,53 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) if (err) return (err); - err = mlx5e_create_vxlan_flow_table(priv); - if (err) - goto err_destroy_vlan_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_vxlan_flow_table(priv); + if (err) + goto err_destroy_vlan_flow_table; + } err = mlx5e_create_main_flow_table(priv, false); if (err) goto err_destroy_vxlan_flow_table; - err = mlx5e_create_main_flow_table(priv, true); - if (err) - goto err_destroy_main_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_main_flow_table(priv, true); + if (err) + goto err_destroy_main_flow_table; + } - err = mlx5e_create_inner_rss_flow_table(priv); - if (err) - goto err_destroy_main_vxlan_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_create_inner_rss_flow_table(priv); + if (err) + goto err_destroy_main_vxlan_flow_table; + } - err = mlx5e_add_vxlan_catchall_rule(priv); - if (err != 0) - goto err_destroy_inner_rss_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_vxlan_catchall_rule(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + } - err = mlx5e_add_main_vxlan_rules(priv); - if (err != 0) - goto err_destroy_inner_rss_flow_table; + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_main_vxlan_rules(priv); + if (err != 0) + goto err_destroy_inner_rss_flow_table; + } return (0); err_destroy_inner_rss_flow_table: - mlx5e_destroy_inner_rss_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_inner_rss_flow_table(priv); err_destroy_main_vxlan_flow_table: - mlx5e_destroy_main_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); err_destroy_vxlan_flow_table: - mlx5e_destroy_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_vxlan_flow_table(priv); err_destroy_vlan_flow_table: mlx5e_destroy_vlan_flow_table(priv); @@ -2280,11 +2296,14 @@ mlx5e_close_flow_table(struct mlx5e_priv *priv) { mlx5e_handle_ifp_addr(priv); - mlx5e_destroy_inner_rss_flow_table(priv); - mlx5e_del_vxlan_catchall_rule(priv); - mlx5e_destroy_vxlan_flow_table(priv); - mlx5e_del_main_vxlan_rules(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_del_vxlan_catchall_rule(priv); + mlx5e_destroy_vxlan_flow_table(priv); + mlx5e_del_main_vxlan_rules(priv); + } mlx5e_destroy_main_flow_table(priv); - mlx5e_destroy_main_vxlan_flow_table(priv); + if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_destroy_main_vxlan_flow_table(priv); mlx5e_destroy_vlan_flow_table(priv); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 9a01940ca90c..ab1d627c0fbc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2810,10 +2810,8 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt, bool inner_vxla lro_timer_supported_periods[2])); } - if (inner_vxlan && - (priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + if (inner_vxlan) MLX5_SET(tirc, tirc, tunneled_offload_en, 1); - } /* setup parameters for hashing TIR type, if any */ switch (tt) { @@ -3127,10 +3125,13 @@ mlx5e_open_locked(struct ifnet *ifp) mlx5_en_err(ifp, "mlx5e_open_tir(main) failed, %d\n", err); goto err_close_rqls; } - err = mlx5e_open_tirs(priv, true); - if (err) { - mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", err); - goto err_close_tirs; + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_open_tirs(priv, true); + if (err) { + mlx5_en_err(ifp, "mlx5e_open_tir(inner) failed, %d\n", + err); + goto err_close_tirs; + } } err = mlx5e_open_flow_table(priv); if (err) { @@ -3144,11 +3145,13 @@ mlx5e_open_locked(struct ifnet *ifp) "mlx5e_add_all_vlan_rules failed, %d\n", err); goto err_close_flow_table; } - err = mlx5e_add_all_vxlan_rules(priv); - if (err) { - mlx5_en_err(ifp, - "mlx5e_add_all_vxlan_rules failed, %d\n", err); - goto err_del_vlan_rules; + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { + err = mlx5e_add_all_vxlan_rules(priv); + if (err) { + mlx5_en_err(ifp, + "mlx5e_add_all_vxlan_rules failed, %d\n", err); + goto err_del_vlan_rules; + } } set_bit(MLX5E_STATE_OPENED, &priv->state); @@ -3164,7 +3167,8 @@ err_close_flow_table: mlx5e_close_flow_table(priv); err_close_tirs_inner: - mlx5e_close_tirs(priv, true); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_close_tirs(priv, true); err_close_tirs: mlx5e_close_tirs(priv, false); @@ -3213,10 +3217,12 @@ mlx5e_close_locked(struct ifnet *ifp) mlx5e_set_rx_mode_core(priv); mlx5e_del_all_vlan_rules(priv); - mlx5e_del_all_vxlan_rules(priv); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_del_all_vxlan_rules(priv); if_link_state_change(priv->ifp, LINK_STATE_DOWN); mlx5e_close_flow_table(priv); - mlx5e_close_tirs(priv, true); + if ((ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) + mlx5e_close_tirs(priv, true); mlx5e_close_tirs(priv, false); mlx5e_close_rqt(priv); mlx5e_close_channels(priv); @@ -3457,14 +3463,16 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) if (mask & IFCAP_WOL_MAGIC) ifp->if_capenable ^= IFCAP_WOL_MAGIC; if (mask & IFCAP_VXLAN_HWCSUM) { + int was_opened = test_bit(MLX5E_STATE_OPENED, + &priv->state); + if (was_opened) + mlx5e_close_locked(ifp); ifp->if_capenable ^= IFCAP_VXLAN_HWCSUM; ifp->if_hwassist ^= CSUM_INNER_IP | CSUM_INNER_IP_UDP | CSUM_INNER_IP_TCP | CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP; - if (test_bit(MLX5E_STATE_OPENED, &priv->state)) { - mlx5e_close_locked(ifp); + if (was_opened) mlx5e_open_locked(ifp); - } } if (mask & IFCAP_VXLAN_HWTSO) { ifp->if_capenable ^= IFCAP_VXLAN_HWTSO; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 273CA66E01F; Mon, 26 Jul 2021 15:19:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrT6dRhz3JhJ; Mon, 26 Jul 2021 15:19:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A1351962A; Mon, 26 Jul 2021 15:19:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJbYp025605; Mon, 26 Jul 2021 15:19:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJbTa025604; Mon, 26 Jul 2021 15:19:37 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:37 GMT Message-Id: <202107261519.16QFJbTa025604@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c0d0e85679ab - stable/13 - mlx5en: add mlx5e_add_vxlan_rule_from_db() helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c0d0e85679ab47c0efa371044ef9086c78a4f62b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:38 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c0d0e85679ab47c0efa371044ef9086c78a4f62b commit c0d0e85679ab47c0efa371044ef9086c78a4f62b Author: Konstantin Belousov AuthorDate: 2021-04-14 07:08:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: add mlx5e_add_vxlan_rule_from_db() helper (cherry picked from commit 559eaa44d91ad74973612843835a8248b3df7341) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 41 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 9e10a3728b1d..648dc199157c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1802,11 +1802,34 @@ mlx5e_vxlan_family_to_proto(sa_family_t family, u_int *proto) } static int -mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +mlx5e_add_vxlan_rule_from_db(struct mlx5e_priv *priv, + struct mlx5e_vxlan_db_el *el) { - struct mlx5e_vxlan_db_el *el; u32 *match_criteria; u32 *match_value; + int err; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; u_int proto; int err; @@ -1821,25 +1844,13 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); - match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); - match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); - if (match_value == NULL || match_criteria == NULL) { - mlx5_en_err(priv->ifp, "alloc failed\n"); - err = -ENOMEM; - goto add_vxlan_rule_out; - } - - err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); + err = mlx5e_add_vxlan_rule_from_db(priv, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); } else { kvfree(el); } -add_vxlan_rule_out: - kvfree(match_criteria); - kvfree(match_value); - return (err); } From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9780D66E02F; Mon, 26 Jul 2021 15:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrZ22NKz3Jvj; Mon, 26 Jul 2021 15:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCCCE1952B; Mon, 26 Jul 2021 15:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJfEu025711; Mon, 26 Jul 2021 15:19:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJfkG025710; Mon, 26 Jul 2021 15:19:41 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:41 GMT Message-Id: <202107261519.16QFJfkG025710@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 976a59ba6da5 - stable/13 - mlx5en: Add missing error case when creating VXLAN flow tables. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 976a59ba6da59a9bebd609f792e23303de5df903 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:42 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=976a59ba6da59a9bebd609f792e23303de5df903 commit 976a59ba6da59a9bebd609f792e23303de5df903 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: Add missing error case when creating VXLAN flow tables. (cherry picked from commit 2f7ce2326f9486e90cda2f0129331e1ab3694252) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 6be95550c713..cdfe19d910d1 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -2252,34 +2252,28 @@ mlx5e_open_flow_table(struct mlx5e_priv *priv) err = mlx5e_create_main_flow_table(priv, true); if (err) goto err_destroy_main_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_create_inner_rss_flow_table(priv); if (err) goto err_destroy_main_vxlan_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_add_vxlan_catchall_rule(priv); if (err != 0) goto err_destroy_inner_rss_flow_table; - } - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) { err = mlx5e_add_main_vxlan_rules(priv); if (err != 0) - goto err_destroy_inner_rss_flow_table; + goto err_destroy_vxlan_catchall_rule; } return (0); +err_destroy_vxlan_catchall_rule: + mlx5e_del_vxlan_catchall_rule(priv); err_destroy_inner_rss_flow_table: - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) - mlx5e_destroy_inner_rss_flow_table(priv); + mlx5e_destroy_inner_rss_flow_table(priv); err_destroy_main_vxlan_flow_table: - if ((priv->ifp->if_capenable & IFCAP_VXLAN_HWCSUM) != 0) - mlx5e_destroy_main_vxlan_flow_table(priv); + mlx5e_destroy_main_vxlan_flow_table(priv); err_destroy_main_flow_table: mlx5e_destroy_main_flow_table(priv); err_destroy_vxlan_flow_table: From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB91566DFBE; Mon, 26 Jul 2021 15:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrf4RrQz3K1T; Mon, 26 Jul 2021 15:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64D041962B; Mon, 26 Jul 2021 15:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJkTQ025813; Mon, 26 Jul 2021 15:19:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJkkr025812; Mon, 26 Jul 2021 15:19:46 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:46 GMT Message-Id: <202107261519.16QFJkkr025812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 180c45c1b4d3 - stable/13 - mlx5: Fix PBMC register mapping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 180c45c1b4d33a6d2c185e9a9bef30e8a35dd8c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:48 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=180c45c1b4d33a6d2c185e9a9bef30e8a35dd8c1 commit 180c45c1b4d33a6d2c185e9a9bef30e8a35dd8c1 Author: Konstantin Belousov AuthorDate: 2021-04-26 11:39:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:12 +0000 mlx5: Fix PBMC register mapping (cherry picked from commit 0fc0b62b0f7be49bcf4c5670a6c81386e333fb02) --- sys/dev/mlx5/mlx5_ifc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 81e91e180b8c..494180630500 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -8839,7 +8839,7 @@ struct mlx5_ifc_pbmc_reg_bits { struct mlx5_ifc_bufferx_reg_bits buffer[10]; - u8 reserved_at_2e0[0x40]; + u8 reserved_at_2e0[0x80]; }; struct mlx5_ifc_paos_reg_bits { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAFDB66DDCB; Mon, 26 Jul 2021 15:19:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrg6KZJz3Jw5; Mon, 26 Jul 2021 15:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 902681952D; Mon, 26 Jul 2021 15:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJlxC025838; Mon, 26 Jul 2021 15:19:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJlfc025837; Mon, 26 Jul 2021 15:19:47 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:47 GMT Message-Id: <202107261519.16QFJlfc025837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f2e512d09bbe - stable/13 - mlx5: add a knob to administratively disable mlx5 fw dump setup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f2e512d09bbe6f28b48a5df246b495c3f62eb0c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:49 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f2e512d09bbe6f28b48a5df246b495c3f62eb0c6 commit f2e512d09bbe6f28b48a5df246b495c3f62eb0c6 Author: Konstantin Belousov AuthorDate: 2021-07-05 07:55:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:12 +0000 mlx5: add a knob to administratively disable mlx5 fw dump setup (cherry picked from commit 8391db038df87e0fa5519617e3bb35a2cf78b41e) --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 09e8f9f7660a..7bb563846144 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -59,6 +59,11 @@ mlx5_fwdump_destroy_dd(struct mlx5_core_dev *mdev) mdev->dump_data = NULL; } +static int mlx5_fw_dump_enable = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_dump_enable, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &mlx5_fw_dump_enable, 0, + "Enable fw dump setup and op"); + void mlx5_fwdump_prep(struct mlx5_core_dev *mdev) { @@ -68,6 +73,14 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) u32 addr, in, out, next_addr; mdev->dump_data = NULL; + + TUNABLE_INT_FETCH("hw.mlx5.fw_dump_enable", &mlx5_fw_dump_enable); + if (!mlx5_fw_dump_enable) { + mlx5_core_warn(mdev, + "Firmware dump administratively prohibited\n"); + return; + } + error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D33066D7F1; Mon, 26 Jul 2021 15:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrb59MYz3Jn3; Mon, 26 Jul 2021 15:19:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02ED719722; Mon, 26 Jul 2021 15:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJgC4025737; Mon, 26 Jul 2021 15:19:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJglk025736; Mon, 26 Jul 2021 15:19:42 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:42 GMT Message-Id: <202107261519.16QFJglk025736@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a6925a8e34a5 - stable/13 - mlx5en: vxlan: do not report TCP inner packet as UDP for software parser MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a6925a8e34a5e57f4a2d3044d394e8954f1fba26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:44 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a6925a8e34a5e57f4a2d3044d394e8954f1fba26 commit a6925a8e34a5e57f4a2d3044d394e8954f1fba26 Author: Konstantin Belousov AuthorDate: 2021-07-22 11:53:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: vxlan: do not report TCP inner packet as UDP for software parser (cherry picked from commit 1db1e58d9384ff9171c248abbef71cf7aea5ebbe) --- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 437910ee7964..0e8e5f46d032 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -516,7 +516,6 @@ mlx5e_get_vxlan_header_size(const struct mbuf *mb, struct mlx5e_tx_wqe *wqe, return (0); wqe->eth.swp_inner_l4_offset = eth_hdr_len / 2; wqe->eth.cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; - wqe->eth.swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_TYPE; tcp_hlen = th->th_off << 2; eth_hdr_len += tcp_hlen; break; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7F6A66DDC5; Mon, 26 Jul 2021 15:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrc5H95z3Jvv; Mon, 26 Jul 2021 15:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 272A4193DC; Mon, 26 Jul 2021 15:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJiNW025765; Mon, 26 Jul 2021 15:19:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJiHx025764; Mon, 26 Jul 2021 15:19:44 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:44 GMT Message-Id: <202107261519.16QFJiHx025764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 14e2413289ae - stable/13 - mlx5en: add ASCII art providing an overview of flow tables organization MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 14e2413289aedabf20b521dcbe5e24b34ca0d34b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:47 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=14e2413289aedabf20b521dcbe5e24b34ca0d34b commit 14e2413289aedabf20b521dcbe5e24b34ca0d34b Author: Konstantin Belousov AuthorDate: 2021-04-26 22:38:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: add ASCII art providing an overview of flow tables organization (cherry picked from commit b1277d42d718cd42d04d39fa2d61873655e909b3) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index cdfe19d910d1..54fbe8e057cc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -31,6 +31,35 @@ #include #include +/* + * The flow tables with rules define the packet processing on receive. + * Currently, the following structure is set up to handle different offloads + * like VLAN decapsulation, packet classification, RSS hashing, VxLAN checksum + * offloading: + * + * + * +=========+ +=========+ +=================+ + * |VLAN ft: | |VxLAN | |VxLAN Main | + * |CTAG/STAG|------>| VNI|----->|Inner Proto Match|=====> Inner TIR n + * |VID/noVID|/ |Catch-all|\ | | + * +=========+ +=========+| +=================+ + * | + * | + * | + * v + * +=================+ + * |Main | + * |Outer Proto Match|=====> TIR n + * | | + * +=================+ + * + * The path through flow rules directs each packet into an appropriate TIR, + * according to the: + * - VLAN encapsulation + * - Outer protocol + * - Presence of inner protocol + */ + #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v) enum { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 15:19:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD2D166E0A4; Mon, 26 Jul 2021 15:19:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYNrj33Zdz3Jsn; Mon, 26 Jul 2021 15:19:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5F3419723; Mon, 26 Jul 2021 15:19:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QFJmG0025862; Mon, 26 Jul 2021 15:19:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJm9j025861; Mon, 26 Jul 2021 15:19:48 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:48 GMT Message-Id: <202107261519.16QFJm9j025861@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 9dee4f67892b - stable/13 - mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9dee4f67892bf82369e4fedf8353354f01346d93 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:49 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9dee4f67892bf82369e4fedf8353354f01346d93 commit 9dee4f67892bf82369e4fedf8353354f01346d93 Author: Konstantin Belousov AuthorDate: 2021-07-05 09:24:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:12 +0000 mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach (cherry picked from commit 78f5ebaed62e38caafc72f4ec1c0a7c2013e15c7) --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 7bb563846144..a23de943f4aa 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -81,17 +81,19 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) return; } + DROP_GIANT(); + error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ mlx5_core_warn(mdev, "Unable to find vendor-specific capability, error %d\n", error); - return; + goto pickup_g; } error = mlx5_vsc_lock(mdev); if (error != 0) - return; + goto pickup_g; error = mlx5_vsc_set_space(mdev, MLX5_VSC_DOMAIN_SCAN_CRSPACE); if (error != 0) { mlx5_core_warn(mdev, "VSC scan space is not supported\n"); @@ -180,6 +182,8 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) unlock_vsc: mlx5_vsc_unlock(mdev); +pickup_g: + PICKUP_GIANT(); } int From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2781A66F5C6; Mon, 26 Jul 2021 16:13:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2C0K3qz3pSL; Mon, 26 Jul 2021 16:13:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7B091A1A2; Mon, 26 Jul 2021 16:13:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGD6Cq005004; Mon, 26 Jul 2021 16:13:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGD69I005003; Mon, 26 Jul 2021 16:13:06 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:06 GMT Message-Id: <202107261613.16QGD69I005003@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 906117f77367 - stable/13 - mlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/s. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 906117f7736723fa035ea7ec33c160d0b1830cc0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:07 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=906117f7736723fa035ea7ec33c160d0b1830cc0 commit 906117f7736723fa035ea7ec33c160d0b1830cc0 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:28 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/s. Make the mlx5e_mode_table[] array one dimensional, because there is only one entry, 10G ER/LR, which share the same protocol bit. This patch only adds support for basic sub-type distinguishing for the extended protocol bits. Use verbose ifconfig eeprom output to get actual media type. Remove write only "connector_type" variable while at it. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit a888087fba37da7c968058062b644f4a79b558c3) --- sys/dev/mlx5/mlx5_core/mlx5_port.c | 15 ++ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 421 +++++++++++++++++------------------- sys/dev/mlx5/port.h | 85 ++------ 3 files changed, 232 insertions(+), 289 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_port.c b/sys/dev/mlx5/mlx5_core/mlx5_port.c index b74efc5351ea..b303c7b07c7d 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_port.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_port.c @@ -1221,6 +1221,21 @@ int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is } EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); +int mlx5_query_pddr_cable_type(struct mlx5_core_dev *mdev, u8 local_port, u8 *cable_type) +{ + u32 pddr_reg[MLX5_ST_SZ_DW(pddr_reg)] = {}; + int error; + + error = mlx5_query_pddr(mdev, local_port, MLX5_PDDR_MODULE_INFO_PAGE, + pddr_reg, sizeof(pddr_reg)); + if (error != 0) + return (error); + + *cable_type = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.cable_type); + return (0); +} +EXPORT_SYMBOL_GPL(mlx5_query_pddr_cable_type); + int mlx5_query_pddr_troubleshooting_info(struct mlx5_core_dev *mdev, u16 *monitor_opcode, u8 *status_message, size_t sm_len) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index ab1d627c0fbc..57da44e68de3 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,356 +57,301 @@ struct media { u64 baudrate; }; -static const struct media mlx5e_mode_table[MLX5E_LINK_SPEEDS_NUMBER][MLX5E_LINK_MODES_NUMBER] = { - - [MLX5E_1000BASE_CX_SGMII][MLX5E_SGMII] = { +static const struct media mlx5e_mode_table[MLX5E_LINK_SPEEDS_NUMBER] = +{ + [MLX5E_1000BASE_CX_SGMII] = { .subtype = IFM_1000_CX_SGMII, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_1000BASE_KX][MLX5E_KX] = { + [MLX5E_1000BASE_KX] = { .subtype = IFM_1000_KX, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_CX4][MLX5E_CX4] = { + [MLX5E_10GBASE_CX4] = { .subtype = IFM_10G_CX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KX4][MLX5E_KX4] = { + [MLX5E_10GBASE_KX4] = { .subtype = IFM_10G_KX4, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_KR][MLX5E_KR] = { + [MLX5E_10GBASE_KR] = { .subtype = IFM_10G_KR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_20GBASE_KR2][MLX5E_KR2] = { + [MLX5E_20GBASE_KR2] = { .subtype = IFM_20G_KR2, .baudrate = IF_Gbps(20ULL), }, - [MLX5E_40GBASE_CR4][MLX5E_CR4] = { + [MLX5E_40GBASE_CR4] = { .subtype = IFM_40G_CR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_KR4][MLX5E_KR4] = { + [MLX5E_40GBASE_KR4] = { .subtype = IFM_40G_KR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_56GBASE_R4][MLX5E_R] = { + [MLX5E_56GBASE_R4] = { .subtype = IFM_56G_R4, .baudrate = IF_Gbps(56ULL), }, - [MLX5E_10GBASE_CR][MLX5E_CR1] = { + [MLX5E_10GBASE_CR] = { .subtype = IFM_10G_CR1, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_SR][MLX5E_SR] = { + [MLX5E_10GBASE_SR] = { .subtype = IFM_10G_SR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER_LR][MLX5E_ER] = { + [MLX5E_10GBASE_ER_LR] = { .subtype = IFM_10G_ER, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_ER_LR][MLX5E_LR] = { - .subtype = IFM_10G_LR, - .baudrate = IF_Gbps(10ULL), - }, - [MLX5E_40GBASE_SR4][MLX5E_SR4] = { + [MLX5E_40GBASE_SR4] = { .subtype = IFM_40G_SR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_LR4_ER4][MLX5E_LR4] = { + [MLX5E_40GBASE_LR4_ER4] = { .subtype = IFM_40G_LR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_LR4_ER4][MLX5E_ER4] = { - .subtype = IFM_40G_ER4, - .baudrate = IF_Gbps(40ULL), - }, - [MLX5E_100GBASE_CR4][MLX5E_CR4] = { + [MLX5E_100GBASE_CR4] = { .subtype = IFM_100G_CR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_SR4][MLX5E_SR4] = { + [MLX5E_100GBASE_SR4] = { .subtype = IFM_100G_SR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_KR4][MLX5E_KR4] = { + [MLX5E_100GBASE_KR4] = { .subtype = IFM_100G_KR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GBASE_LR4][MLX5E_LR4] = { + [MLX5E_100GBASE_LR4] = { .subtype = IFM_100G_LR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100BASE_TX][MLX5E_TX] = { + [MLX5E_100BASE_TX] = { .subtype = IFM_100_TX, .baudrate = IF_Mbps(100ULL), }, - [MLX5E_1000BASE_T][MLX5E_T] = { + [MLX5E_1000BASE_T] = { .subtype = IFM_1000_T, .baudrate = IF_Mbps(1000ULL), }, - [MLX5E_10GBASE_T][MLX5E_T] = { + [MLX5E_10GBASE_T] = { .subtype = IFM_10G_T, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_25GBASE_CR][MLX5E_CR] = { + [MLX5E_25GBASE_CR] = { .subtype = IFM_25G_CR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_KR][MLX5E_KR] = { + [MLX5E_25GBASE_KR] = { .subtype = IFM_25G_KR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GBASE_SR][MLX5E_SR] = { + [MLX5E_25GBASE_SR] = { .subtype = IFM_25G_SR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_50GBASE_CR2][MLX5E_CR2] = { + [MLX5E_50GBASE_CR2] = { .subtype = IFM_50G_CR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GBASE_KR2][MLX5E_KR2] = { + [MLX5E_50GBASE_KR2] = { .subtype = IFM_50G_KR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GBASE_KR4][MLX5E_KR4] = { + [MLX5E_50GBASE_KR4] = { .subtype = IFM_50G_KR4, .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] = { +static const struct media mlx5e_ext_mode_table[MLX5E_EXT_LINK_SPEEDS_NUMBER][MLX5E_CABLE_TYPE_NUMBER] = +{ + /**/ + [MLX5E_SGMII_100M][MLX5E_CABLE_TYPE_UNKNOWN] = { .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] = { + + /**/ + [MLX5E_1000BASE_X_SGMII][MLX5E_CABLE_TYPE_UNKNOWN] = { .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] = { + [MLX5E_1000BASE_X_SGMII][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .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] = { + + /**/ + [MLX5E_5GBASE_R][MLX5E_CABLE_TYPE_UNKNOWN] = { .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, + [MLX5E_5GBASE_R][MLX5E_CABLE_TYPE_TWISTED_PAIR] = { + .subtype = IFM_5000_T, .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] = { + + /**/ + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_10G_KR, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_LR] = { - .subtype = IFM_10G_LR, + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_10G_CR1, .baudrate = IF_Gbps(10ULL), }, - [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_SR] = { + [MLX5E_10GBASE_XFI_XAUI_1][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .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] = { + + /**/ + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_40G_KR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_LR4] = { - .subtype = IFM_40G_LR4, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_40G_CR4, .baudrate = IF_Gbps(40ULL), }, - [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_SR4] = { + [MLX5E_40GBASE_XLAUI_4_XLPPI_4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .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] = { + /**/ + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { .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, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_25G_CR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_LR] = { - .subtype = IFM_25G_LR, + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_25G_SR, .baudrate = IF_Gbps(25ULL), }, - [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_T] = { + [MLX5E_25GAUI_1_25GBASE_CR_KR][MLX5E_CABLE_TYPE_TWISTED_PAIR] = { .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] = { + + /**/ + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { .subtype = IFM_50G_KR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_KR4] = { - .subtype = IFM_50G_KR4, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_50G_CR2, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_SR2] = { + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { .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, + + /**/ + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_50G_KR_PAM4, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CP] = { + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_50G_CP, .baudrate = IF_Gbps(50ULL), }, - [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_FR] = { - .subtype = IFM_50G_FR, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_50G_SR, .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_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR4, + .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CR4] = { + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_100G_CR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_KR4] = { - .subtype = IFM_100G_KR4, + [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_LR4] = { - .subtype = IFM_100G_LR4, + + /**/ + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR_PAM4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_CAUI_4_100GBASE_CR4_KR4][MLX5E_SR4] = { - .subtype = IFM_100G_SR4, + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_100G_CR_PAM4, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_SR2] = { - .subtype = IFM_100G_SR2, + [MLX5E_100GAUI_1_100GBASE_CR_KR][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR2, /* XXX */ .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CP2] = { + + /**/ + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_100G_KR4, + .baudrate = IF_Gbps(100ULL), + }, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_100G_CP2, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_KR2_PAM4] = { - .subtype = IFM_100G_KR2_PAM4, + [MLX5E_100GAUI_2_100GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_100G_SR2, .baudrate = IF_Gbps(100ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_DR4] = { - .subtype = IFM_200G_DR4, + + /**/ + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_200G_KR4_PAM4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_LR4] = { - .subtype = IFM_200G_LR4, + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { + .subtype = IFM_200G_CR4_PAM4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_SR4] = { - .subtype = IFM_200G_SR4, + [MLX5E_200GAUI_2_200GBASE_CR2_KR2][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_200G_SR4, /* XXX */ .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_FR4] = { - .subtype = IFM_200G_FR4, + + /**/ + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_200G_KR4_PAM4, .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CR4_PAM4] = { + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_PASSIVE_COPPER] = { .subtype = IFM_200G_CR4_PAM4, .baudrate = IF_Gbps(200ULL), }, - [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_KR4_PAM4] = { - .subtype = IFM_200G_KR4_PAM4, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4][MLX5E_CABLE_TYPE_OPTICAL_MODULE] = { + .subtype = IFM_200G_SR4, .baudrate = IF_Gbps(200ULL), }, + + /**/ + [MLX5E_400GAUI_8][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_400G_LR8, /* XXX */ + .baudrate = IF_Gbps(400ULL), + }, + + /**/ + [MLX5E_400GAUI_4_400GBASE_CR4_KR4][MLX5E_CABLE_TYPE_UNKNOWN] = { + .subtype = IFM_400G_LR8, /* XXX */ + .baudrate = IF_Gbps(400ULL), + }, }; DEBUGNET_DEFINE(mlx5_en); @@ -420,9 +365,10 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) u32 out[MLX5_ST_SZ_DW(ptys_reg)]; u32 eth_proto_oper; int error; + u8 i; + u8 cable_type; u8 port_state; u8 is_er_type; - u8 i, j; bool ext; struct media media_entry = {}; @@ -454,11 +400,23 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) i = ilog2(eth_proto_oper); - 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 (ext) { + error = mlx5_query_pddr_cable_type(mdev, 1, &cable_type); + if (error != 0) { + /* use fallback entry */ + media_entry = mlx5e_ext_mode_table[i][MLX5E_CABLE_TYPE_UNKNOWN]; + + mlx5_en_err(priv->ifp, + "query port pddr failed: %d\n", error); + } else { + media_entry = mlx5e_ext_mode_table[i][cable_type]; + + /* check if we should use fallback entry */ + if (media_entry.subtype == 0) + media_entry = mlx5e_ext_mode_table[i][MLX5E_CABLE_TYPE_UNKNOWN]; + } + } else { + media_entry = mlx5e_mode_table[i]; } if (media_entry.subtype == 0) { @@ -508,36 +466,35 @@ mlx5e_media_status(struct ifnet *dev, struct ifmediareq *ifmr) static u32 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 0: + goto done; case IFM_10G_LR: subtype = IFM_10G_ER; break; case IFM_40G_ER4: subtype = IFM_40G_LR4; break; + default: + break; } - 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); + if (ext) { + for (unsigned i = 0; i != MLX5E_EXT_LINK_SPEEDS_NUMBER; i++) { + for (unsigned j = 0; j != MLX5E_CABLE_TYPE_NUMBER; j++) { + if (mlx5e_ext_mode_table[i][j].subtype == subtype) + link_mode |= MLX5E_PROT_MASK(i); } } + } else { + for (unsigned i = 0; i != MLX5E_LINK_SPEEDS_NUMBER; i++) { + if (mlx5e_mode_table[i].subtype == subtype) + link_mode |= MLX5E_PROT_MASK(i); + } } - +done: return (link_mode); } @@ -4393,17 +4350,14 @@ 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]; struct pfil_head_args pa; int err; - int i,j; u32 eth_proto_cap; u32 out[MLX5_ST_SZ_DW(ptys_reg)]; - bool ext = 0; - u32 speeds_num; + bool ext; struct media media_entry = {}; if (mlx5e_check_required_hca_cap(mdev)) { @@ -4572,16 +4526,13 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5e_setup_pauseframes(priv); /* 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 { + ext = false; eth_proto_cap = 0; mlx5_en_err(ifp, "Query port media capability failed, %d\n", err); } @@ -4589,15 +4540,47 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifmedia_init(&priv->media, IFM_IMASK, mlx5e_media_change, mlx5e_media_status); - 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) + if (ext) { + for (unsigned i = 0; i != MLX5E_EXT_LINK_SPEEDS_NUMBER; i++) { + /* check if hardware has the right capability */ + if (MLX5E_PROT_MASK(i) & ~eth_proto_cap) continue; - if (MLX5E_PROT_MASK(i) & eth_proto_cap) + for (unsigned j = 0; j != MLX5E_CABLE_TYPE_NUMBER; j++) { + media_entry = mlx5e_ext_mode_table[i][j]; + if (media_entry.subtype == 0) + continue; + /* check if this subtype was already added */ + for (unsigned k = 0; k != i; k++) { + /* check if hardware has the right capability */ + if (MLX5E_PROT_MASK(k) & ~eth_proto_cap) + continue; + for (unsigned m = 0; m != MLX5E_CABLE_TYPE_NUMBER; m++) { + if (media_entry.subtype == mlx5e_ext_mode_table[k][m].subtype) + goto skip_ext_media; + } + } mlx5e_ifm_add(priv, media_entry.subtype); + skip_ext_media:; + } + } + } else { + for (unsigned i = 0; i != MLX5E_LINK_SPEEDS_NUMBER; i++) { + media_entry = mlx5e_mode_table[i]; + if (media_entry.subtype == 0) + continue; + if (MLX5E_PROT_MASK(i) & ~eth_proto_cap) + continue; + /* check if this subtype was already added */ + for (unsigned k = 0; k != i; k++) { + if (media_entry.subtype == mlx5e_mode_table[k].subtype) + goto skip_media; + } + mlx5e_ifm_add(priv, media_entry.subtype); + + /* NOTE: 10G ER and LR shares the same entry */ + if (media_entry.subtype == IFM_10G_ER) + mlx5e_ifm_add(priv, IFM_10G_LR); + skip_media:; } } diff --git a/sys/dev/mlx5/port.h b/sys/dev/mlx5/port.h index d46ae1303496..276ee12415d7 100644 --- a/sys/dev/mlx5/port.h +++ b/sys/dev/mlx5/port.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016-2018, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2016-2021, 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 @@ -108,7 +108,7 @@ enum mlx5e_link_speed { MLX5E_25GBASE_SR = 29, MLX5E_50GBASE_CR2 = 30, MLX5E_50GBASE_KR2 = 31, - MLX5E_LINK_SPEEDS_NUMBER, + MLX5E_LINK_SPEEDS_NUMBER = 32, }; enum mlx5e_ext_link_speed { @@ -122,78 +122,22 @@ enum mlx5e_ext_link_speed { MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR = 8, MLX5E_CAUI_4_100GBASE_CR4_KR4 = 9, MLX5E_100GAUI_2_100GBASE_CR2_KR2 = 10, + MLX5E_100GAUI_1_100GBASE_CR_KR = 11, MLX5E_200GAUI_4_200GBASE_CR4_KR4 = 12, + MLX5E_200GAUI_2_200GBASE_CR2_KR2 = 13, MLX5E_400GAUI_8 = 15, - MLX5E_EXT_LINK_SPEEDS_NUMBER, + MLX5E_400GAUI_4_400GBASE_CR4_KR4 = 16, + MLX5E_EXT_LINK_SPEEDS_NUMBER = 32, }; -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, -}; - -enum mlx5e_connector_type { - MLX5E_PORT_UNKNOWN = 0, - MLX5E_PORT_NONE = 1, - MLX5E_PORT_TP = 2, - MLX5E_PORT_AUI = 3, - MLX5E_PORT_BNC = 4, - MLX5E_PORT_MII = 5, - MLX5E_PORT_FIBRE = 6, - MLX5E_PORT_DA = 7, - MLX5E_PORT_OTHER = 8, - MLX5E_CONNECTOR_TYPE_NUMBER, +enum mlx5e_cable_type { + MLX5E_CABLE_TYPE_UNKNOWN = 0, + MLX5E_CABLE_TYPE_ACTIVE_CABLE = 1, + MLX5E_CABLE_TYPE_OPTICAL_MODULE = 2, + MLX5E_CABLE_TYPE_PASSIVE_COPPER = 3, + MLX5E_CABLE_TYPE_CABLE_UNPLUGGED = 4, + MLX5E_CABLE_TYPE_TWISTED_PAIR = 5, + MLX5E_CABLE_TYPE_NUMBER = 8, }; enum mlx5_qpts_trust_state { @@ -282,6 +226,7 @@ int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, const u8 *dscp2prio); int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio); int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type); +int mlx5_query_pddr_cable_type(struct mlx5_core_dev *mdev, u8 local_port, u8 *cable_type); u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper); int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E74766F438; Mon, 26 Jul 2021 16:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2D1Nbnz3pQB; Mon, 26 Jul 2021 16:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 153471A488; Mon, 26 Jul 2021 16:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGD7qb005035; Mon, 26 Jul 2021 16:13:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGD7Nw005034; Mon, 26 Jul 2021 16:13:07 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:07 GMT Message-Id: <202107261613.16QGD7Nw005034@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 24cf63c77833 - stable/13 - mlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 24cf63c77833ac8b23f48e7fc96c16eb5761cc84 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:08 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=24cf63c77833ac8b23f48e7fc96c16eb5761cc84 commit 24cf63c77833ac8b23f48e7fc96c16eb5761cc84 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:28 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4) On some environments, such as certain SRIOV VF configurations, RoCE is not supported for mlx5 Ethernet ports. Currently, the driver will not open IB device on that port. This is problematic, since we do want user-space RAW Ethernet (RAW_PACKET QPs) functionality to remain in place. For that end, enhance the relevant driver flows such that we do create a device instance in that case. Linux commit: ca5b91d63192ceaa41a6145f8c923debb64c71fa Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 626cb01d4439b85eba9632a7738cddc64b6ad42d) --- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 68dddeb8f1f1..b97d40ca8b99 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -3018,6 +3018,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, struct ib_port_immutable *immutable) { struct ib_port_attr attr; + struct mlx5_ib_dev *dev = to_mdev(ibdev); + enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num); int err; err = mlx5_ib_query_port(ibdev, port_num, &attr); @@ -3027,7 +3029,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; immutable->core_cap_flags = get_core_cap_flags(ibdev); - immutable->max_mad_size = IB_MGMT_MAD_SIZE; + if ((ll == IB_LINK_LAYER_INFINIBAND) || MLX5_CAP_GEN(dev->mdev, roce)) + immutable->max_mad_size = IB_MGMT_MAD_SIZE; return 0; } @@ -3089,9 +3092,11 @@ static int mlx5_enable_roce(struct mlx5_ib_dev *dev) return err; } - err = mlx5_nic_vport_enable_roce(dev->mdev); - if (err) - goto err_unregister_netdevice_notifier; + if (MLX5_CAP_GEN(dev->mdev, roce)) { + err = mlx5_nic_vport_enable_roce(dev->mdev); + if (err) + goto err_unregister_netdevice_notifier; + } err = mlx5_roce_lag_init(dev); if (err) @@ -3100,7 +3105,8 @@ static int mlx5_enable_roce(struct mlx5_ib_dev *dev) return 0; err_disable_roce: - mlx5_nic_vport_disable_roce(dev->mdev); + if (MLX5_CAP_GEN(dev->mdev, roce)) + mlx5_nic_vport_disable_roce(dev->mdev); err_unregister_netdevice_notifier: mlx5_remove_roce_notifier(dev); @@ -3110,7 +3116,8 @@ err_unregister_netdevice_notifier: static void mlx5_disable_roce(struct mlx5_ib_dev *dev) { mlx5_roce_lag_cleanup(dev); - mlx5_nic_vport_disable_roce(dev->mdev); + if (MLX5_CAP_GEN(dev->mdev, roce)) + mlx5_nic_vport_disable_roce(dev->mdev); } static void mlx5_ib_dealloc_q_port_counter(struct mlx5_ib_dev *dev, u8 port_num) @@ -3268,9 +3275,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) port_type_cap = MLX5_CAP_GEN(mdev, port_type); ll = mlx5_port_type_cap_to_rdma_ll(port_type_cap); - if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce)) - return NULL; - dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev)); if (!dev) return NULL; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D81466EFBA; Mon, 26 Jul 2021 16:13:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2F2nP9z3pL2; Mon, 26 Jul 2021 16:13:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 427BA19E49; Mon, 26 Jul 2021 16:13:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGD9HW005059; Mon, 26 Jul 2021 16:13:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGD9Qw005058; Mon, 26 Jul 2021 16:13:09 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:09 GMT Message-Id: <202107261613.16QGD9Qw005058@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6b49b46f2692 - stable/13 - mlx5en: Add more error checks in the transmit path. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6b49b46f2692fa7505b133276d1c878bb6fd5607 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:09 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6b49b46f2692fa7505b133276d1c878bb6fd5607 commit 6b49b46f2692fa7505b133276d1c878bb6fd5607 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5en: Add more error checks in the transmit path. - Upon error more completion events than requested may be generated, particularly when using the completion event factor feature. - Count number of event errors in the transmit path. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4f4739a77b0e69dae57fd1687926d6e48a698fe4) --- sys/dev/mlx5/device.h | 5 +++++ sys/dev/mlx5/mlx5_en/en.h | 1 + sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 26 ++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx5/device.h b/sys/dev/mlx5/device.h index 64d4ed87d58f..e59fb6771d83 100644 --- a/sys/dev/mlx5/device.h +++ b/sys/dev/mlx5/device.h @@ -692,6 +692,11 @@ struct mlx5_cqe64 { #define MLX5_CQE_TSTMP_PTP (1ULL << 63) +static inline u8 get_cqe_opcode(struct mlx5_cqe64 *cqe) +{ + return (cqe->op_own >> 4); +} + static inline bool get_cqe_lro_timestamp_valid(struct mlx5_cqe64 *cqe) { return (cqe->lro_tcppsh_abort_dupack >> 7) & 1; diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index e4b66bea8f60..b249a82d30ef 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -627,6 +627,7 @@ struct mlx5e_rq_stats { m(+1, u64, defragged, "defragged", "Transmitted packets") \ m(+1, u64, dropped, "dropped", "Transmitted packets") \ m(+1, u64, enobuf, "enobuf", "Transmitted packets") \ + m(+1, u64, cqe_err, "cqe_err", "Transmit CQE errors") \ m(+1, u64, nop, "nop", "Transmitted packets") #define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT)) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 0e8e5f46d032..e85522bdfad7 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -1037,6 +1037,9 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) while (budget > 0) { struct mlx5_cqe64 *cqe; struct mbuf *mb; + bool match; + u16 sqcc_this; + u16 delta; u16 x; u16 ci; @@ -1046,11 +1049,28 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) mlx5_cqwq_pop(&sq->cq.wq); + /* check if the completion event indicates an error */ + if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_REQ)) + sq->stats.cqe_err++; + + /* setup local variables */ + sqcc_this = be16toh(cqe->wqe_counter); + match = false; + /* update budget according to the event factor */ budget -= sq->cev_factor; - for (x = 0; x != sq->cev_factor; x++) { + for (x = 0;; x++) { + if (unlikely(match != false)) { + break; + } else if (unlikely(x == sq->cev_factor)) { + /* WQE counter match not found */ + sq->stats.cqe_err++; + break; + } ci = sqcc & sq->wq.sz_m1; + delta = sqcc_this - sqcc; + match = (delta < sq->mbuf[ci].num_wqebbs); mb = sq->mbuf[ci].mbuf; sq->mbuf[ci].mbuf = NULL; @@ -1060,10 +1080,8 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) } if (mb == NULL) { - if (sq->mbuf[ci].num_bytes == 0) { - /* NOP */ + if (unlikely(sq->mbuf[ci].num_bytes == 0)) sq->stats.nop++; - } } else { bus_dmamap_sync(sq->dma_tag, sq->mbuf[ci].dma_map, BUS_DMASYNC_POSTWRITE); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A560366F622; Mon, 26 Jul 2021 16:13:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2G3Wf3z3pBp; Mon, 26 Jul 2021 16:13:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57B3219E4A; Mon, 26 Jul 2021 16:13:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDAQ0005083; Mon, 26 Jul 2021 16:13:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDAwh005082; Mon, 26 Jul 2021 16:13:10 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:10 GMT Message-Id: <202107261613.16QGDAwh005082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: cae3be82c3cd - stable/13 - mlx5ib: Simplify mlx5_ib_cont_pages() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cae3be82c3cd16e73b94a7320314b7d402275e35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:10 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cae3be82c3cd16e73b94a7320314b7d402275e35 commit cae3be82c3cd16e73b94a7320314b7d402275e35 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:30 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5ib: Simplify mlx5_ib_cont_pages() The patch simplifies mlx5_ib_cont_pages and fixes the following issues in the original implementation: First issues is related to alignment of the PFNs. After the check base + p != PFN, the alignment of the PFN wasn't checked. So the PFN sequence 0, 1, 1, 2 would result in a page_shift of 13 even though the 3rd PFN is not 8KB aligned. This wasn't actually a bug because it was supported by all the existing mlx5 compatible device, but we don't want to require this support in all future devices. Another issue is because the inner loop didn't advance PFN so the test "if (base + p != pfn)" always failed for SGE with len > (1<page_size); - - /* With ODP we must always match OS page size. */ - if (umem->odp_data) { - *count = ib_umem_page_count(umem); - *shift = PAGE_SHIFT; - *ncont = *count; - if (order) - *order = ilog2(roundup_pow_of_two(*count)); - - return; - } - addr = addr >> page_shift; + addr = addr >> PAGE_SHIFT; tmp = (unsigned long)addr; m = find_first_bit(&tmp, BITS_PER_LONG); - skip = 1 << m; - mask = skip - 1; - i = 0; + for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { - len = sg_dma_len(sg) >> page_shift; - pfn = sg_dma_address(sg) >> page_shift; - for (k = 0; k < len; k++) { - if (!(i & mask)) { - tmp = (unsigned long)pfn; - m = min_t(unsigned long, m, find_first_bit(&tmp, BITS_PER_LONG)); - skip = 1 << m; - mask = skip - 1; - base = pfn; - p = 0; - } else { - if (base + p != pfn) { - tmp = (unsigned long)p; - m = find_first_bit(&tmp, BITS_PER_LONG); - skip = 1 << m; - mask = skip - 1; - base = pfn; - p = 0; - } - } - p++; - i++; + len = sg_dma_len(sg) >> PAGE_SHIFT; + pfn = sg_dma_address(sg) >> PAGE_SHIFT; + if (base + p != pfn) { + /* If either the offset or the new + * base are unaligned update m + */ + tmp = (unsigned long)(pfn | p); + if (!IS_ALIGNED(tmp, 1 << m)) + m = find_first_bit(&tmp, BITS_PER_LONG); + + base = pfn; + p = 0; } + + p += len; + i += len; } if (i) { @@ -111,7 +86,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, *ncont = 0; } - *shift = page_shift + m; + *shift = PAGE_SHIFT + m; *count = i; } From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CABB66F2DF; Mon, 26 Jul 2021 16:13:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2H6DyDz3pNX; Mon, 26 Jul 2021 16:13:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7255A1A489; Mon, 26 Jul 2021 16:13:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDB3g005107; Mon, 26 Jul 2021 16:13:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDB8E005106; Mon, 26 Jul 2021 16:13:11 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:11 GMT Message-Id: <202107261613.16QGDB8E005106@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: f1d4741b7600 - stable/13 - mlx5ib: Limit mkey page size to 2GB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f1d4741b76000caad899a7f81a7ae71c2c7b511c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:12 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f1d4741b76000caad899a7f81a7ae71c2c7b511c commit f1d4741b76000caad899a7f81a7ae71c2c7b511c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:31 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 mlx5ib: Limit mkey page size to 2GB The maximum page size in the mkey context is 2GB. Until today, we didn't enforce this requirement in the code, and therefore, if we got a page size larger than 2GB, we have passed zeros in the log_page_shift instead of the actual value and the registration failed. This patch limits the driver to use compound pages of 2GB for mkeys. Linux commit: 762f899ae7875554284af92b821be8c083227092 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 565cb4e8cc5efb4c493efe5cf2cb2ec36f69a413) --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 6 +++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c | 7 ++++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 2 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 0420b294de80..fcb1e584fcca 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -59,6 +59,8 @@ pr_warn("%s: WARN: %s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ #define MLX5_IB_DEFAULT_UIDX 0xffffff #define MLX5_USER_ASSIGNED_UIDX_MASK __mlx5_mask(qpc, user_index) +#define MLX5_MKEY_PAGE_SHIFT_MASK __mlx5_mask(mkc, log_page_size) + enum { MLX5_IB_MMAP_CMD_SHIFT = 8, MLX5_IB_MMAP_CMD_MASK = 0xff, @@ -909,7 +911,9 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *props); int mlx5_ib_init_fmr(struct mlx5_ib_dev *dev); void mlx5_ib_cleanup_fmr(struct mlx5_ib_dev *dev); -void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, +void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, + unsigned long max_page_shift, + int *count, int *shift, int *ncont, int *order); void __mlx5_ib_populate_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, int page_shift, size_t offset, size_t num_pages, diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c index 15c33fdee440..3c37df82199f 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c @@ -781,7 +781,7 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata, if (err) goto err_umem; - mlx5_ib_cont_pages(cq->buf.umem, ucmd.buf_addr, &npages, &page_shift, + mlx5_ib_cont_pages(cq->buf.umem, ucmd.buf_addr, 0, &npages, &page_shift, &ncont, NULL); mlx5_ib_dbg(dev, "addr 0x%llx, size %u, npages %d, page_shift %d, ncont %d\n", (long long)ucmd.buf_addr, entries * ucmd.cqe_size, npages, page_shift, ncont); @@ -1148,7 +1148,7 @@ static int resize_user(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, return err; } - mlx5_ib_cont_pages(umem, ucmd.buf_addr, &npages, page_shift, + mlx5_ib_cont_pages(umem, ucmd.buf_addr, 0, &npages, page_shift, npas, NULL); cq->resize_umem = umem; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c index 97d9d33603d6..b780fd2f72fd 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c @@ -32,12 +32,15 @@ /* @umem: umem object to scan * @addr: ib virtual address requested by the user + * @max_page_shift: high limit for page_shift - 0 means no limit * @count: number of PAGE_SIZE pages covered by umem * @shift: page shift for the compound pages found in the region * @ncont: number of compund pages * @order: log2 of the number of compound pages */ -void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, +void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, + unsigned long max_page_shift, + int *count, int *shift, int *ncont, int *order) { unsigned long tmp; @@ -51,6 +54,8 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, addr = addr >> PAGE_SHIFT; tmp = (unsigned long)addr; m = find_first_bit(&tmp, BITS_PER_LONG); + if (max_page_shift) + m = min_t(unsigned long, max_page_shift - PAGE_SHIFT, m); for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { len = sg_dma_len(sg) >> PAGE_SHIFT; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c index 5df7aed9dc1c..585e52d35d3b 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c @@ -637,7 +637,7 @@ static struct ib_umem *mr_umem_get(struct ib_pd *pd, u64 start, u64 length, return (void *)umem; } - mlx5_ib_cont_pages(umem, start, npages, page_shift, ncont, order); + mlx5_ib_cont_pages(umem, start, MLX5_MKEY_PAGE_SHIFT_MASK, npages, page_shift, ncont, order); if (!*npages) { mlx5_ib_warn(dev, "avoid zero region\n"); ib_umem_release(umem); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 94561d32acc1..bc17ee56c7d0 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -659,7 +659,7 @@ static int mlx5_ib_umem_get(struct mlx5_ib_dev *dev, return PTR_ERR(*umem); } - mlx5_ib_cont_pages(*umem, addr, npages, page_shift, ncont, NULL); + mlx5_ib_cont_pages(*umem, addr, 0, npages, page_shift, ncont, NULL); err = mlx5_ib_get_buf_offset(addr, *page_shift, offset); if (err) { @@ -712,7 +712,7 @@ static int create_user_rq(struct mlx5_ib_dev *dev, struct ib_pd *pd, return err; } - mlx5_ib_cont_pages(rwq->umem, ucmd->buf_addr, &npages, &page_shift, + mlx5_ib_cont_pages(rwq->umem, ucmd->buf_addr, 0, &npages, &page_shift, &ncont, NULL); err = mlx5_ib_get_buf_offset(ucmd->buf_addr, page_shift, &rwq->rq_page_offset); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c index 148b4c8f6d99..42e10f9a50de 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c @@ -113,7 +113,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq, return err; } - mlx5_ib_cont_pages(srq->umem, ucmd.buf_addr, &npages, + mlx5_ib_cont_pages(srq->umem, ucmd.buf_addr, 0, &npages, &page_shift, &ncont, NULL); err = mlx5_ib_get_buf_offset(ucmd.buf_addr, page_shift, &offset); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B81E66EF59; Mon, 26 Jul 2021 16:13:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2J6Rpjz3pFJ; Mon, 26 Jul 2021 16:13:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D78D1A22B; Mon, 26 Jul 2021 16:13:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDC0N005131; Mon, 26 Jul 2021 16:13:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDCuc005130; Mon, 26 Jul 2021 16:13:12 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:12 GMT Message-Id: <202107261613.16QGDCuc005130@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 4e16399f4507 - stable/13 - ipoib: Destroying a CQ should never fail. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e16399f450767642a875ef6660169e9fc6113d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:14 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4e16399f450767642a875ef6660169e9fc6113d1 commit 4e16399f450767642a875ef6660169e9fc6113d1 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:32 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:28 +0000 ipoib: Destroying a CQ should never fail. Remove not needed error handling when destroying a CQ. The function in question will later on be updated to return "void". Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit eafc89853835147bcbd019a974ebfa9d3a8b00a7) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index c459b3fb55a7..35fd7875b77d 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c @@ -254,11 +254,9 @@ void ipoib_transport_dev_cleanup(struct ipoib_dev_priv *priv) clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); } - if (ib_destroy_cq(priv->send_cq)) - ipoib_warn(priv, "ib_cq_destroy (send) failed\n"); + ib_destroy_cq(priv->send_cq); - if (ib_destroy_cq(priv->recv_cq)) - ipoib_warn(priv, "ib_cq_destroy (recv) failed\n"); + ib_destroy_cq(priv->recv_cq); ipoib_cm_dev_cleanup(priv); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6ECE066F464; Mon, 26 Jul 2021 16:13:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2M1c3Mz3pFL; Mon, 26 Jul 2021 16:13:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1CE51A22C; Mon, 26 Jul 2021 16:13:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDEWu005185; Mon, 26 Jul 2021 16:13:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDEG9005184; Mon, 26 Jul 2021 16:13:14 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:14 GMT Message-Id: <202107261613.16QGDEG9005184@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 349d037802fe - stable/13 - mlx5ib: Fix XRC QP support after introducing extended atomic. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 349d037802fe9fd64c2fc6233db81d121d28d080 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:16 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=349d037802fe9fd64c2fc6233db81d121d28d080 commit 349d037802fe9fd64c2fc6233db81d121d28d080 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 mlx5ib: Fix XRC QP support after introducing extended atomic. Extended atomics are supported with RC and XRC QP types, but Linux commit a60109dc9a95 added an unneeded check to to_mlx5_access_flags(). This broke XRC QPs. The following ib_atomic_bw invocation over XRC reproduces the issue: ib_atomic_bw -d mlx5_1 --connection=XRC --atomic_type=FETCH_AND_ADD It is safe to remove such checks because the QP type was already checked in ib_modify_qp_is_ok(), which was previously called from mlx5_ib_modify_qp(). Linux commit: 13f8d9c16693afb908ead3d2a758adbe6a79eccd Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit cf88b86e4954215eb447729042dab8dea722c044) --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 2 + sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 85 ++++++++++++++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index fcb1e584fcca..44a9aa307be7 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -207,6 +207,8 @@ struct mlx5_ib_flow_db { * creates the actual hardware QP. */ #define MLX5_IB_QPT_HW_GSI IB_QPT_RESERVED2 +#define MLX5_IB_QPT_DCI IB_QPT_RESERVED3 +#define MLX5_IB_QPT_DCT IB_QPT_RESERVED4 #define MLX5_IB_WR_UMR IB_WR_RESERVED1 /* Private QP creation flags to be passed in ib_qp_init_attr.create_flags. diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index bc17ee56c7d0..8f05b32a3261 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -1504,6 +1504,53 @@ err: return err; } +static int atomic_size_to_mode(int size_mask) +{ + /* driver does not support atomic_size > 256B + * and does not know how to translate bigger sizes + */ + int supported_size_mask = size_mask & 0x1ff; + int log_max_size; + + if (!supported_size_mask) + return -EOPNOTSUPP; + + log_max_size = __fls(supported_size_mask); + + if (log_max_size > 3) + return log_max_size; + + return MLX5_ATOMIC_MODE_8B; +} + +static int get_atomic_mode(struct mlx5_ib_dev *dev, + enum ib_qp_type qp_type) +{ + u8 atomic_operations = MLX5_CAP_ATOMIC(dev->mdev, atomic_operations); + u8 atomic = MLX5_CAP_GEN(dev->mdev, atomic); + int atomic_mode = -EOPNOTSUPP; + int atomic_size_mask; + + if (!atomic) + return -EOPNOTSUPP; + + if (qp_type == MLX5_IB_QPT_DCT) + atomic_size_mask = MLX5_CAP_ATOMIC(dev->mdev, atomic_size_dc); + else + atomic_size_mask = MLX5_CAP_ATOMIC(dev->mdev, atomic_size_qp); + + if ((atomic_operations & MLX5_ATOMIC_OPS_MASKED_CMP_SWAP) || + (atomic_operations & MLX5_ATOMIC_OPS_MASKED_FETCH_ADD)) + atomic_mode = atomic_size_to_mode(atomic_size_mask); + + if (atomic_mode <= 0 && + (atomic_operations & MLX5_ATOMIC_OPS_CMP_SWAP && + atomic_operations & MLX5_ATOMIC_OPS_FETCH_ADD)) + atomic_mode = MLX5_ATOMIC_MODE_IB_COMP; + + return atomic_mode; +} + static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata, struct mlx5_ib_qp *qp) @@ -2119,12 +2166,14 @@ int mlx5_ib_destroy_qp(struct ib_qp *qp) return 0; } -static __be32 to_mlx5_access_flags(struct mlx5_ib_qp *qp, const struct ib_qp_attr *attr, - int attr_mask) +static int to_mlx5_access_flags(struct mlx5_ib_qp *qp, + const struct ib_qp_attr *attr, + int attr_mask, __be32 *hw_access_flags_be) { - u32 hw_access_flags = 0; u8 dest_rd_atomic; - u32 access_flags; + u32 access_flags, hw_access_flags = 0; + + struct mlx5_ib_dev *dev = to_mdev(qp->ibqp.device); if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) dest_rd_atomic = attr->max_dest_rd_atomic; @@ -2141,12 +2190,23 @@ static __be32 to_mlx5_access_flags(struct mlx5_ib_qp *qp, const struct ib_qp_att if (access_flags & IB_ACCESS_REMOTE_READ) hw_access_flags |= MLX5_QP_BIT_RRE; - if (access_flags & IB_ACCESS_REMOTE_ATOMIC) - hw_access_flags |= (MLX5_QP_BIT_RAE | MLX5_ATOMIC_MODE_CX); + if (access_flags & IB_ACCESS_REMOTE_ATOMIC) { + int atomic_mode; + + atomic_mode = get_atomic_mode(dev, qp->ibqp.qp_type); + if (atomic_mode < 0) + return -EOPNOTSUPP; + + hw_access_flags |= MLX5_QP_BIT_RAE; + hw_access_flags |= atomic_mode << MLX5_ATOMIC_MODE_OFF; + } + if (access_flags & IB_ACCESS_REMOTE_WRITE) hw_access_flags |= MLX5_QP_BIT_RWE; - return cpu_to_be32(hw_access_flags); + *hw_access_flags_be = cpu_to_be32(hw_access_flags); + + return 0; } enum { @@ -2730,8 +2790,15 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, cpu_to_be32(fls(attr->max_dest_rd_atomic - 1) << 21); } - if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) - context->params2 |= to_mlx5_access_flags(qp, attr, attr_mask); + if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) { + __be32 access_flags; + + err = to_mlx5_access_flags(qp, attr, attr_mask, &access_flags); + if (err) + goto out; + + context->params2 |= access_flags; + } if (attr_mask & IB_QP_MIN_RNR_TIMER) context->rnr_nextrecvpsn |= cpu_to_be32(attr->min_rnr_timer << 24); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E73766F472; Mon, 26 Jul 2021 16:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2S2W8Bz3pCD; Mon, 26 Jul 2021 16:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75CDD1A446; Mon, 26 Jul 2021 16:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDJts005287; Mon, 26 Jul 2021 16:13:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDJE8005286; Mon, 26 Jul 2021 16:13:19 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:19 GMT Message-Id: <202107261613.16QGDJE8005286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 072eaae40ba7 - stable/13 - ibcore: Fix memory leak in cm_add/remove_one. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 072eaae40ba7b46101ec2cf4625e6e7e12debf0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:21 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=072eaae40ba7b46101ec2cf4625e6e7e12debf0a commit 072eaae40ba7b46101ec2cf4625e6e7e12debf0a Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:36 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Fix memory leak in cm_add/remove_one. In the process of moving the debug counters sysfs entries, the commit mentioned below eliminated the cm_infiniband sysfs directory. This sysfs directory was tied to the cm_port object allocated in procedure cm_add_one(). Before the commit below, this cm_port object was freed via a call to kobject_put(port->kobj) in procedure cm_remove_port_fs(). Since port no longer uses its kobj, kobject_put(port->kobj) was eliminated. This, however, meant that kfree was never called for the cm_port buffers. Fix this by adding explicit kfree(port) calls to functions cm_add_one() and cm_remove_one(). Note that the kfree call in the first chunk below, in the cm_add_one error flow, fixes an old, undetected memory leak. Linux commit: 94635c36f3854934a46d9e812e028d4721bbb0e6 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 8d04583de542dcd087b401f6b830b8e6ab43d696) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 6a809b18d301..5fb37e3245e8 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -4132,6 +4132,7 @@ error2: error1: port_modify.set_port_cap_mask = 0; port_modify.clr_port_cap_mask = IB_PORT_CM_SUP; + kfree(port); while (--i) { if (!rdma_cap_ib_cm(ib_device, i)) continue; @@ -4140,6 +4141,7 @@ error1: ib_modify_port(ib_device, port->port_num, 0, &port_modify); ib_unregister_mad_agent(port->mad_agent); cm_remove_port_fs(port); + kfree(port); } free: device_unregister(cm_dev->device); @@ -4194,6 +4196,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) spin_unlock_irq(&cm.state_lock); ib_unregister_mad_agent(cur_mad_agent); cm_remove_port_fs(port); + kfree(port); } device_unregister(cm_dev->device); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5302466F694; Mon, 26 Jul 2021 16:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2X45gcz3pYK; Mon, 26 Jul 2021 16:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FBD61A48A; Mon, 26 Jul 2021 16:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDNXI005384; Mon, 26 Jul 2021 16:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDNjU005383; Mon, 26 Jul 2021 16:13:23 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:23 GMT Message-Id: <202107261613.16QGDNjU005383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 645d0710fc48 - stable/13 - ibcore: Fix unable to change lifespan entry for hw_counters. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 645d0710fc48e255ea74ede8bd2c08aab2207965 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:25 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=645d0710fc48e255ea74ede8bd2c08aab2207965 commit 645d0710fc48e255ea74ede8bd2c08aab2207965 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:39 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Fix unable to change lifespan entry for hw_counters. This patch fixes the case where 'lifespan' entry of the hw_counters is not writable. Currently write callback is not exposed for for the hw_counters sysfs operation. Due to this, modifying lifespan value results into permission denied error in below example. echo 10 > /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan -bash: /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan: Permission denied This patch adds the hook to modify any attribute which implements store() operation. Linux commit: 79c4d80b43b8e43684894574a508a871f0c196bf Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit d7d833e20ba33f5b9f3052a534af7ecdd602f152) --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index d12b5803e722..55e7b5395b8e 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -114,8 +114,22 @@ static ssize_t port_attr_show(struct kobject *kobj, return port_attr->show(p, port_attr, buf); } +static ssize_t port_attr_store(struct kobject *kobj, + struct attribute *attr, + const char *buf, size_t count) +{ + struct port_attribute *port_attr = + container_of(attr, struct port_attribute, attr); + struct ib_port *p = container_of(kobj, struct ib_port, kobj); + + if (!port_attr->store) + return -EIO; + return port_attr->store(p, port_attr, buf, count); +} + static const struct sysfs_ops port_sysfs_ops = { - .show = port_attr_show + .show = port_attr_show, + .store = port_attr_store }; static ssize_t gid_attr_show(struct kobject *kobj, From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7864766F689; Mon, 26 Jul 2021 16:13:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2L0g00z3pLF; Mon, 26 Jul 2021 16:13:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFB9F1A291; Mon, 26 Jul 2021 16:13:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDDfO005161; Mon, 26 Jul 2021 16:13:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDDQc005160; Mon, 26 Jul 2021 16:13:13 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:13 GMT Message-Id: <202107261613.16QGDDQc005160@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6c80d908d671 - stable/13 - ibcore: Remove unused and erroneous msg sequence encoding. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6c80d908d671c327bc81551460a6aa21f0547c8e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:14 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6c80d908d671c327bc81551460a6aa21f0547c8e commit 6c80d908d671c327bc81551460a6aa21f0547c8e Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:33 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Remove unused and erroneous msg sequence encoding. In cm_form_tid(), a two bit message sequence number is OR'ed into bit 31-30 of the lower TID value. After Linux commit f06d26537559 ("IB/cm: Randomize starting comm ID"), the local_id is XOR'ed with a 32-bit random value. Hence, bit 31-30 in the lower TID now has an arbitrarily value and it makes no sense to OR in the message sequence number. Adding to that, the evolution in use of IDR routines in cm_alloc_id() has always had the possibility of returning a value with bit 30 set. In addition, said bits are never checked. Hence, remove the encoding and the corresponding enum. Linux commit: 87a37ce9e400e40daee537ff95343e3c94743c6d Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 315627b7191dd4fe30a9293609feaf7eeb62e478) --- sys/ofed/drivers/infiniband/core/cm_msgs.h | 7 ------- sys/ofed/drivers/infiniband/core/ib_cm.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/cm_msgs.h b/sys/ofed/drivers/infiniband/core/cm_msgs.h index 9b8ef9a93d5b..fa88aa711aa3 100644 --- a/sys/ofed/drivers/infiniband/core/cm_msgs.h +++ b/sys/ofed/drivers/infiniband/core/cm_msgs.h @@ -49,13 +49,6 @@ #define IB_CM_CLASS_VERSION 2 /* IB specification 1.2 */ -enum cm_msg_sequence { - CM_MSG_SEQUENCE_REQ, - CM_MSG_SEQUENCE_LAP, - CM_MSG_SEQUENCE_DREQ, - CM_MSG_SEQUENCE_SIDR -}; - struct cm_req_msg { struct ib_mad_hdr hdr; diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 95b442eb0dd1..5d0229f57260 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1130,14 +1130,12 @@ new_id: } EXPORT_SYMBOL(ib_cm_insert_listen); -static __be64 cm_form_tid(struct cm_id_private *cm_id_priv, - enum cm_msg_sequence msg_seq) +static __be64 cm_form_tid(struct cm_id_private *cm_id_priv) { u64 hi_tid, low_tid; hi_tid = ((u64) cm_id_priv->av.port->mad_agent->hi_tid) << 32; - low_tid = (u64) ((__force u32)cm_id_priv->id.local_id | - (msg_seq << 30)); + low_tid = (u64)cm_id_priv->id.local_id; return cpu_to_be64(hi_tid | low_tid); } @@ -1160,7 +1158,7 @@ static void cm_format_req(struct cm_req_msg *req_msg, struct ib_sa_path_rec *alt_path = param->alternate_path; cm_format_mad_hdr(&req_msg->hdr, CM_REQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_REQ)); + cm_form_tid(cm_id_priv)); req_msg->local_comm_id = cm_id_priv->id.local_id; req_msg->service_id = param->service_id; @@ -2171,7 +2169,7 @@ static void cm_format_dreq(struct cm_dreq_msg *dreq_msg, u8 private_data_len) { cm_format_mad_hdr(&dreq_msg->hdr, CM_DREQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_DREQ)); + cm_form_tid(cm_id_priv)); dreq_msg->local_comm_id = cm_id_priv->id.local_id; dreq_msg->remote_comm_id = cm_id_priv->id.remote_id; cm_dreq_set_remote_qpn(dreq_msg, cm_id_priv->remote_qpn); @@ -2775,7 +2773,7 @@ static void cm_format_lap(struct cm_lap_msg *lap_msg, u8 private_data_len) { cm_format_mad_hdr(&lap_msg->hdr, CM_LAP_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_LAP)); + cm_form_tid(cm_id_priv)); lap_msg->local_comm_id = cm_id_priv->id.local_id; lap_msg->remote_comm_id = cm_id_priv->id.remote_id; cm_lap_set_remote_qpn(lap_msg, cm_id_priv->remote_qpn); @@ -3110,7 +3108,7 @@ static void cm_format_sidr_req(struct cm_sidr_req_msg *sidr_req_msg, struct ib_cm_sidr_req_param *param) { cm_format_mad_hdr(&sidr_req_msg->hdr, CM_SIDR_REQ_ATTR_ID, - cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_SIDR)); + cm_form_tid(cm_id_priv)); sidr_req_msg->request_id = cm_id_priv->id.local_id; sidr_req_msg->pkey = param->path->pkey; sidr_req_msg->service_id = param->service_id; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEB4F66EFDF; Mon, 26 Jul 2021 16:13:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2Q469Rz3pSy; Mon, 26 Jul 2021 16:13:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5BEF01A312; Mon, 26 Jul 2021 16:13:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDIVN005257; Mon, 26 Jul 2021 16:13:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDIAp005256; Mon, 26 Jul 2021 16:13:18 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:18 GMT Message-Id: <202107261613.16QGDIAp005256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a306f3d4485d - stable/13 - ibcore: Block processing of alternate path handling in RoCE RX CM messages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a306f3d4485d2846ab1052da28475683e8e5c7a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:18 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a306f3d4485d2846ab1052da28475683e8e5c7a4 commit a306f3d4485d2846ab1052da28475683e8e5c7a4 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Block processing of alternate path handling in RoCE RX CM messages. Due to the below reasons, it is better to not support alternate path receive messages for RoCE in near term. 1. Alternate path for RoCE is not supported at rdmacm layer. 2. It is not supported in uverbs/core layer for RoCE. 3. Alternate path for IPv6 for link local address cannot resolve route determinstically without a valid incoming interface ID whose usecase make sense only with dual port mode. 4. init_av_from_path while processing LAP messages for IB and RoCE can lead to adding duplicate entry of AV into the port list, leads to list corruption. 5. rdma-core userspace a well known userspace implementation has removed support of libucm which use ucm.ko module, which is the only module that can trigger alternate path related messages. 6. ucm kernel module is requested to be removed from the IB core in the following patch, https://patchwork.kernel.org/patch/10268503/ . Linux commit: 97c45c2c28cd291e06778d9d36a0f60ee74726bc Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 0f2e5b432dcdd19955285169f1603473219ac130) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index a0bfa1cd41b4..6a809b18d301 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -2957,6 +2957,13 @@ static int cm_lap_handler(struct cm_work *work) struct ib_mad_send_buf *msg = NULL; int ret; + /* Currently Alternate path messages are not supported for + * RoCE link layer. + */ + if (rdma_protocol_roce(work->port->cm_dev->ib_device, + work->port->port_num)) + return -EINVAL; + /* todo: verify LAP request and send reject APR if invalid. */ lap_msg = (struct cm_lap_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(lap_msg->remote_comm_id, @@ -3102,6 +3109,13 @@ static int cm_apr_handler(struct cm_work *work) struct cm_apr_msg *apr_msg; int ret; + /* Currently Alternate path messages are not supported for + * RoCE link layer. + */ + if (rdma_protocol_roce(work->port->cm_dev->ib_device, + work->port->port_num)) + return -EINVAL; + apr_msg = (struct cm_apr_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(apr_msg->remote_comm_id, apr_msg->local_comm_id); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3329766F473; Mon, 26 Jul 2021 16:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2S5vQRz3pNt; Mon, 26 Jul 2021 16:13:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B50C1A22D; Mon, 26 Jul 2021 16:13:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDKvv005311; Mon, 26 Jul 2021 16:13:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDKAA005310; Mon, 26 Jul 2021 16:13:20 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:20 GMT Message-Id: <202107261613.16QGDKAA005310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c254f79d9ae7 - stable/13 - ibcore: Move debug counters to be under relevant IB device MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c254f79d9ae794f3e0353f2a9cb94acd288a82a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:21 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c254f79d9ae794f3e0353f2a9cb94acd288a82a2 commit c254f79d9ae794f3e0353f2a9cb94acd288a82a2 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:37 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Move debug counters to be under relevant IB device The sysfs layout is created by CM incorrectly presented RDMA devices with InfiniBand link layer. Layout of such devices represents device tree of connections. By moving CM statistics to be under relevant port of IB device, we will fix the following issues: * Symlink name - It used device name instead of specific identifier. * Target location - It was supposed to point to PCI-ID/infiniband_cm/ instead of PCI-ID/infiniband/ * Target name - It created extra device file under already existing device folder, e.g. mlx5_0/mlx5_0 * Crash during boot with RDMA persistent naming patches. sysfs: cannot create duplicate filename '/class/infiniband_cm/mlx5_0' CPU: 29 PID: 433 Comm: modprobe Not tainted 5.0.0-rc5+ #178 Call Trace: dump_stack+0xcc/0x180 sysfs_warn_dup.cold.3+0x17/0x2d sysfs_do_create_link_sd.isra.2+0xd0/0xf0 device_add+0x7cb/0x1450 device_create_groups_vargs+0x1ae/0x220 device_create+0x93/0xc0 cm_add_one+0x38f/0xf60 [ib_cm] add_client_context+0x167/0x210 [ib_core] enable_device_and_get+0x230/0x3f0 [ib_core] ib_register_device+0x823/0xbf0 [ib_core] __mlx5_ib_add+0x45/0x150 [mlx5_ib] mlx5_ib_add+0x1b3/0x5e0 [mlx5_ib] mlx5_add_device+0x130/0x3a0 [mlx5_core] mlx5_register_interface+0x1a9/0x270 [mlx5_core] do_one_initcall+0x14f/0x5de do_init_module+0x247/0x7c0 load_module+0x4c2f/0x60d0 entry_SYSCALL_64_after_hwframe+0x49/0xbe After this change: [leonro@server ~]$ ls -al /sys/class/infiniband/ibp0s12f0/ports/1/ drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_rx_duplicates drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_rx_msgs drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_tx_msgs drwxr-xr-x 2 root root 0 Mar 11 11:17 cm_tx_retries Linux commit: c87e65cfb97c7f325132a68288ed76ba7bdcd2c6 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit f48e85dfe2ece188eaf44ee6cb626de1f7ae65e9) --- sys/ofed/drivers/infiniband/core/core_priv.h | 5 +++ sys/ofed/drivers/infiniband/core/ib_cm.c | 46 +++++----------------------- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 45 +++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/core_priv.h b/sys/ofed/drivers/infiniband/core/core_priv.h index 62772fc2a6c5..7fa8d0cfe0bb 100644 --- a/sys/ofed/drivers/infiniband/core/core_priv.h +++ b/sys/ofed/drivers/infiniband/core/core_priv.h @@ -137,4 +137,9 @@ void ib_mad_cleanup(void); int ib_sa_init(void); void ib_sa_cleanup(void); +int ib_port_register_module_stat(struct ib_device *device, u8 port_num, + struct kobject *kobj, struct kobj_type *ktype, + const char *name); +void ib_port_unregister_module_stat(struct kobject *kobj); + #endif /* _CORE_PRIV_H */ diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 5fb37e3245e8..1f96a733b042 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "cm_msgs.h" +#include "core_priv.h" MODULE_AUTHOR("Sean Hefty"); MODULE_DESCRIPTION("InfiniBand CM"); @@ -227,7 +228,6 @@ struct cm_port { struct cm_device { struct list_head list; struct ib_device *ib_device; - struct device *device; u8 ack_delay; int going_down; struct cm_port *port[0]; @@ -3978,18 +3978,6 @@ static struct kobj_type cm_counter_obj_type = { .default_attrs = cm_counter_default_attrs }; -static void cm_release_port_obj(struct kobject *obj) -{ - struct cm_port *cm_port; - - cm_port = container_of(obj, struct cm_port, port_obj); - kfree(cm_port); -} - -static struct kobj_type cm_port_obj_type = { - .release = cm_release_port_obj -}; - static char *cm_devnode(struct device *dev, umode_t *mode) { if (mode) @@ -4008,19 +3996,12 @@ static int cm_create_port_fs(struct cm_port *port) { int i, ret; - ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, - &port->cm_dev->device->kobj, - "%d", port->port_num); - if (ret) { - kfree(port); - return ret; - } - for (i = 0; i < CM_COUNTER_GROUPS; i++) { - ret = kobject_init_and_add(&port->counter_group[i].obj, - &cm_counter_obj_type, - &port->port_obj, - "%s", counter_group_names[i]); + ret = ib_port_register_module_stat(port->cm_dev->ib_device, + port->port_num, + &port->counter_group[i].obj, + &cm_counter_obj_type, + counter_group_names[i]); if (ret) goto error; } @@ -4029,8 +4010,7 @@ static int cm_create_port_fs(struct cm_port *port) error: while (i--) - kobject_put(&port->counter_group[i].obj); - kobject_put(&port->port_obj); + ib_port_unregister_module_stat(&port->counter_group[i].obj); return ret; } @@ -4040,9 +4020,8 @@ static void cm_remove_port_fs(struct cm_port *port) int i; for (i = 0; i < CM_COUNTER_GROUPS; i++) - kobject_put(&port->counter_group[i].obj); + ib_port_unregister_module_stat(&port->counter_group[i].obj); - kobject_put(&port->port_obj); } static void cm_add_one(struct ib_device *ib_device) @@ -4069,13 +4048,6 @@ static void cm_add_one(struct ib_device *ib_device) cm_dev->ib_device = ib_device; cm_dev->ack_delay = ib_device->attrs.local_ca_ack_delay; cm_dev->going_down = 0; - cm_dev->device = device_create(&cm_class, &ib_device->dev, - MKDEV(0, 0), NULL, - "%s", ib_device->name); - if (IS_ERR(cm_dev->device)) { - kfree(cm_dev); - return; - } set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask); for (i = 1; i <= ib_device->phys_port_cnt; i++) { @@ -4144,7 +4116,6 @@ error1: kfree(port); } free: - device_unregister(cm_dev->device); kfree(cm_dev); } @@ -4199,7 +4170,6 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) kfree(port); } - device_unregister(cm_dev->device); kfree(cm_dev); } diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index fb9884a7ea08..d12b5803e722 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -1336,3 +1336,48 @@ void ib_device_unregister_sysfs(struct ib_device *device) device_unregister(&device->dev); } + +/** + * ib_port_register_module_stat - add module counters under relevant port + * of IB device. + * + * @device: IB device to add counters + * @port_num: valid port number + * @kobj: pointer to the kobject to initialize + * @ktype: pointer to the ktype for this kobject. + * @name: the name of the kobject + */ +int ib_port_register_module_stat(struct ib_device *device, u8 port_num, + struct kobject *kobj, struct kobj_type *ktype, + const char *name) +{ + struct kobject *p, *t; + int ret; + + list_for_each_entry_safe(p, t, &device->port_list, entry) { + struct ib_port *port = container_of(p, struct ib_port, kobj); + + if (port->port_num != port_num) + continue; + + ret = kobject_init_and_add(kobj, ktype, &port->kobj, "%s", + name); + if (ret) { + kobject_put(kobj); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL(ib_port_register_module_stat); + +/** + * ib_port_unregister_module_stat - release module counters + * @kobj: pointer to the kobject to release + */ +void ib_port_unregister_module_stat(struct kobject *kobj) +{ + kobject_put(kobj); +} +EXPORT_SYMBOL(ib_port_unregister_module_stat); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13E6D66EF6A; Mon, 26 Jul 2021 16:13:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2b08KGz3pbX; Mon, 26 Jul 2021 16:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56EE019E4B; Mon, 26 Jul 2021 16:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDQiD005438; Mon, 26 Jul 2021 16:13:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDQoV005437; Mon, 26 Jul 2021 16:13:26 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:26 GMT Message-Id: <202107261613.16QGDQoV005437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: e898f1af80f6 - stable/13 - ibcore: Do not expose unsupported counters. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e898f1af80f694e91707a1bb6725a7d197eb4359 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:28 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e898f1af80f694e91707a1bb6725a7d197eb4359 commit e898f1af80f694e91707a1bb6725a7d197eb4359 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:40 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Do not expose unsupported counters. If the provider driver (such as rdma_rxe) doesn't support PMA counters, avoid exposing its directory similar to optional hw_counters directory. If core fails to read the PMA counter, return an error so that user can retry later if needed. Linux commit: 0f6ef65d1c6ec8deb5d0f11f86631ec4cfe8f22e Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit ac4174e064f447ed3b19a8b395625b7d2b3739d1) --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index 64ef4c4aefdb..c393bb64a034 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -520,7 +520,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr, ret = get_perf_mad(p->ibdev, p->port_num, tab_attr->attr_id, &data, 40 + offset / 8, sizeof(data)); if (ret < 0) - return sprintf(buf, "N/A (no PMA)\n"); + return ret; switch (width) { case 4: @@ -1043,10 +1043,12 @@ static int add_port(struct ib_device *device, int port_num, goto err_put; } - p->pma_table = get_counter_table(device, port_num); - ret = sysfs_create_group(&p->kobj, p->pma_table); - if (ret) - goto err_put_gid_attrs; + if (device->process_mad) { + p->pma_table = get_counter_table(device, port_num); + ret = sysfs_create_group(&p->kobj, p->pma_table); + if (ret) + goto err_put_gid_attrs; + } p->gid_group.name = "gids"; p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); @@ -1158,7 +1160,8 @@ err_free_gid: p->gid_group.attrs = NULL; err_remove_pma: - sysfs_remove_group(&p->kobj, p->pma_table); + if (p->pma_table) + sysfs_remove_group(&p->kobj, p->pma_table); err_put_gid_attrs: kobject_put(&p->gid_attr_group->kobj); @@ -1270,7 +1273,9 @@ static void free_port_list_attributes(struct ib_device *device) kfree(port->hw_stats); free_hsag(&port->kobj, port->hw_stats_ag); } - sysfs_remove_group(p, port->pma_table); + + if (port->pma_table) + sysfs_remove_group(p, port->pma_table); sysfs_remove_group(p, &port->pkey_group); sysfs_remove_group(p, &port->gid_group); sysfs_remove_group(&port->gid_attr_group->kobj, From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E505466F4C1; Mon, 26 Jul 2021 16:13:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2c4zbcz3pf6; Mon, 26 Jul 2021 16:13:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F98E1A293; Mon, 26 Jul 2021 16:13:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDRgg005462; Mon, 26 Jul 2021 16:13:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDRli005461; Mon, 26 Jul 2021 16:13:27 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:27 GMT Message-Id: <202107261613.16QGDRli005461@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: f919e2521470 - stable/13 - mlx5core: Make sure error code is propagated on error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f919e2521470144bbe99602b516f9834ee00f636 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:31 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f919e2521470144bbe99602b516f9834ee00f636 commit f919e2521470144bbe99602b516f9834ee00f636 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 mlx5core: Make sure error code is propagated on error. If mlx5_init_once() fails, mlx5_load_one() should fail too, else the device instance remains attached causing problems at reboot. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit d8cbfa101cbe3a9ece41120af93884177aff728a) --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 37a55f65683c..755e8844a892 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1101,7 +1101,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, mlx5_start_health_poll(dev); - if (boot && mlx5_init_once(dev, priv)) { + if (boot && (err = mlx5_init_once(dev, priv))) { mlx5_core_err(dev, "sw objs init failed\n"); goto err_stop_poll; } From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCE9266F68E; Mon, 26 Jul 2021 16:13:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2P2jT2z3pC7; Mon, 26 Jul 2021 16:13:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36A3F1A292; Mon, 26 Jul 2021 16:13:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDHbE005233; Mon, 26 Jul 2021 16:13:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDHit005232; Mon, 26 Jul 2021 16:13:17 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:17 GMT Message-Id: <202107261613.16QGDHit005232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: b3f8942c1a5d - stable/13 - ibcore: Store and restore ah_attr during LAP msg processing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b3f8942c1a5de03ebed6ff5065e7e84d167f9523 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:17 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b3f8942c1a5de03ebed6ff5065e7e84d167f9523 commit b3f8942c1a5de03ebed6ff5065e7e84d167f9523 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Store and restore ah_attr during LAP msg processing. During CM LAP processing, ah_attr is reinitialized on receiving a LAP request. First likely during CM request processing. ah_attr might get zeroed out if LAP processing fails. Therefore, try to create a new ah_attr for the LAP message. If the initialization fails, continue with older ah_attr. If the initialization passes, consider the new ah_attr by overwriting the older one. Linux commit: 0e225dcb7681c0a8e52fb9dc68bd8ab973de4ca2 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit bf5075e41e6a29232a1c5aef07e69b9173494187) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index c0ee472c01a1..a0bfa1cd41b4 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -460,6 +460,32 @@ static void cm_set_private_data(struct cm_id_private *cm_id_priv, cm_id_priv->private_data_len = private_data_len; } +static int cm_init_av_for_lap(struct cm_port *port, struct ib_wc *wc, + struct ib_grh *grh, struct cm_av *av) +{ + struct ib_ah_attr new_ah_attr; + int ret; + + av->port = port; + av->pkey_index = wc->pkey_index; + + /* + * av->ah_attr might be initialized based on past wc during incoming + * connect request or while sending out connect request. So initialize + * a new ah_attr on stack. If initialization fails, old ah_attr is + * used for sending any responses. If initialization is successful, + * than new ah_attr is used by overwriting old one. + */ + ret = ib_init_ah_from_wc(port->cm_dev->ib_device, + port->port_num, wc, + grh, &new_ah_attr); + if (ret) + return ret; + + memcpy(&av->ah_attr, &new_ah_attr, sizeof(new_ah_attr)); + return 0; +} + static int cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, struct ib_grh *grh, struct cm_av *av) { @@ -3253,9 +3279,9 @@ static int cm_sidr_req_handler(struct cm_work *work) wc = work->mad_recv_wc->wc; cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid); cm_id_priv->av.dgid.global.interface_id = 0; - ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret = cm_init_av_for_lap(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); if (ret) goto out; cm_id_priv->id.remote_id = sidr_req_msg->request_id; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F24B66EF65; Mon, 26 Jul 2021 16:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2T73Dvz3pQs; Mon, 26 Jul 2021 16:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C36FB1A447; Mon, 26 Jul 2021 16:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDLHW005336; Mon, 26 Jul 2021 16:13:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDLhr005334; Mon, 26 Jul 2021 16:13:21 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:21 GMT Message-Id: <202107261613.16QGDLhr005334@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c629928b25cc - stable/13 - ibcore: Fix memory leak in cm_req_handler error flows. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c629928b25ccf55ebdf4cef20ae148daa1d8db67 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:22 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c629928b25ccf55ebdf4cef20ae148daa1d8db67 commit c629928b25ccf55ebdf4cef20ae148daa1d8db67 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:37 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Fix memory leak in cm_req_handler error flows. In the cm_req_handler() error flows, sometimes cm_id_priv->timewait_info isn't free'd. Linux commit: 8b00914654ef56ff5473f4fe1f1168254dbb8a17 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 2f05418748585dcbd5912f335040f652a8cc9703) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 1f96a733b042..7dea2620cb60 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1790,8 +1790,7 @@ static int cm_req_handler(struct cm_work *work) listen_cm_id_priv = cm_match_req(work, cm_id_priv); if (!listen_cm_id_priv) { ret = -EINVAL; - kfree(cm_id_priv->timewait_info); - goto destroy; + goto free_timeinfo; } cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler; @@ -1866,6 +1865,8 @@ static int cm_req_handler(struct cm_work *work) rejected: atomic_dec(&cm_id_priv->refcount); cm_deref_id(listen_cm_id_priv); +free_timeinfo: + kfree(cm_id_priv->timewait_info); destroy: ib_destroy_cm_id(cm_id); return ret; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C75C866F470; Mon, 26 Jul 2021 16:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2N4k7Hz3pLR; Mon, 26 Jul 2021 16:13:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1669E19EB8; Mon, 26 Jul 2021 16:13:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDFhS005209; Mon, 26 Jul 2021 16:13:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDFME005208; Mon, 26 Jul 2021 16:13:15 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:15 GMT Message-Id: <202107261613.16QGDFME005208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: bc73c139f027 - stable/13 - ibcore: Add rdma_reject_msg() helper function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bc73c139f027c01990a6132212117158a232bbcc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:20 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=bc73c139f027c01990a6132212117158a232bbcc commit bc73c139f027c01990a6132212117158a232bbcc Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:34 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Add rdma_reject_msg() helper function. rdma_reject_msg() returns a pointer to a string message associated with the transport reject reason codes. Linux commit: 77a5db13153906a7e00740b10b2730e53385c5a8 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit e25bcf8d775c61e9bb67246545d2ee6717f4ca89) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 48 ++++++++++++++++++++++++++++++ sys/ofed/drivers/infiniband/core/ib_cma.c | 14 +++++++++ sys/ofed/drivers/infiniband/core/ib_iwcm.c | 21 +++++++++++++ sys/ofed/include/rdma/ib_cm.h | 6 ++++ sys/ofed/include/rdma/iw_cm.h | 6 ++++ sys/ofed/include/rdma/rdma_cm.h | 8 +++++ 6 files changed, 103 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 5d0229f57260..c0ee472c01a1 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -65,6 +65,54 @@ MODULE_AUTHOR("Sean Hefty"); MODULE_DESCRIPTION("InfiniBand CM"); MODULE_LICENSE("Dual BSD/GPL"); +static const char * const ibcm_rej_reason_strs[] = { + [IB_CM_REJ_NO_QP] = "no QP", + [IB_CM_REJ_NO_EEC] = "no EEC", + [IB_CM_REJ_NO_RESOURCES] = "no resources", + [IB_CM_REJ_TIMEOUT] = "timeout", + [IB_CM_REJ_UNSUPPORTED] = "unsupported", + [IB_CM_REJ_INVALID_COMM_ID] = "invalid comm ID", + [IB_CM_REJ_INVALID_COMM_INSTANCE] = "invalid comm instance", + [IB_CM_REJ_INVALID_SERVICE_ID] = "invalid service ID", + [IB_CM_REJ_INVALID_TRANSPORT_TYPE] = "invalid transport type", + [IB_CM_REJ_STALE_CONN] = "stale conn", + [IB_CM_REJ_RDC_NOT_EXIST] = "RDC not exist", + [IB_CM_REJ_INVALID_GID] = "invalid GID", + [IB_CM_REJ_INVALID_LID] = "invalid LID", + [IB_CM_REJ_INVALID_SL] = "invalid SL", + [IB_CM_REJ_INVALID_TRAFFIC_CLASS] = "invalid traffic class", + [IB_CM_REJ_INVALID_HOP_LIMIT] = "invalid hop limit", + [IB_CM_REJ_INVALID_PACKET_RATE] = "invalid packet rate", + [IB_CM_REJ_INVALID_ALT_GID] = "invalid alt GID", + [IB_CM_REJ_INVALID_ALT_LID] = "invalid alt LID", + [IB_CM_REJ_INVALID_ALT_SL] = "invalid alt SL", + [IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS] = "invalid alt traffic class", + [IB_CM_REJ_INVALID_ALT_HOP_LIMIT] = "invalid alt hop limit", + [IB_CM_REJ_INVALID_ALT_PACKET_RATE] = "invalid alt packet rate", + [IB_CM_REJ_PORT_CM_REDIRECT] = "port CM redirect", + [IB_CM_REJ_PORT_REDIRECT] = "port redirect", + [IB_CM_REJ_INVALID_MTU] = "invalid MTU", + [IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES] = "insufficient resp resources", + [IB_CM_REJ_CONSUMER_DEFINED] = "consumer defined", + [IB_CM_REJ_INVALID_RNR_RETRY] = "invalid RNR retry", + [IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID] = "duplicate local comm ID", + [IB_CM_REJ_INVALID_CLASS_VERSION] = "invalid class version", + [IB_CM_REJ_INVALID_FLOW_LABEL] = "invalid flow label", + [IB_CM_REJ_INVALID_ALT_FLOW_LABEL] = "invalid alt flow label", +}; + +const char *__attribute_const__ ibcm_reject_msg(int reason) +{ + size_t index = reason; + + if (index < ARRAY_SIZE(ibcm_rej_reason_strs) && + ibcm_rej_reason_strs[index]) + return ibcm_rej_reason_strs[index]; + else + return "unrecognized reason"; +} +EXPORT_SYMBOL(ibcm_reject_msg); + static void cm_add_one(struct ib_device *device); static void cm_remove_one(struct ib_device *device, void *client_data); diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 829d668dbd05..2639c61b94a4 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -112,6 +112,20 @@ const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event) } EXPORT_SYMBOL(rdma_event_msg); +const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, + int reason) +{ + if (rdma_ib_or_roce(id->device, id->port_num)) + return ibcm_reject_msg(reason); + + if (rdma_protocol_iwarp(id->device, id->port_num)) + return iwcm_reject_msg(reason); + + WARN_ON_ONCE(1); + return "unrecognized transport"; +} +EXPORT_SYMBOL(rdma_reject_msg); + static int cma_check_linklocal(struct rdma_dev_addr *, struct sockaddr *); static void cma_add_one(struct ib_device *device); static void cma_remove_one(struct ib_device *device, void *client_data); diff --git a/sys/ofed/drivers/infiniband/core/ib_iwcm.c b/sys/ofed/drivers/infiniband/core/ib_iwcm.c index a2abfec40668..6ac7b06569de 100644 --- a/sys/ofed/drivers/infiniband/core/ib_iwcm.c +++ b/sys/ofed/drivers/infiniband/core/ib_iwcm.c @@ -63,6 +63,27 @@ MODULE_AUTHOR("Tom Tucker"); MODULE_DESCRIPTION("iWARP CM"); MODULE_LICENSE("Dual BSD/GPL"); +static const char * const iwcm_rej_reason_strs[] = { + [ECONNRESET] = "reset by remote host", + [ECONNREFUSED] = "refused by remote application", + [ETIMEDOUT] = "setup timeout", +}; + +const char *__attribute_const__ iwcm_reject_msg(int reason) +{ + size_t index; + + /* iWARP uses negative errnos */ + index = -reason; + + if (index < ARRAY_SIZE(iwcm_rej_reason_strs) && + iwcm_rej_reason_strs[index]) + return iwcm_rej_reason_strs[index]; + else + return "unrecognized reason"; +} +EXPORT_SYMBOL(iwcm_reject_msg); + static struct workqueue_struct *iwcm_wq; struct iwcm_work { struct work_struct work; diff --git a/sys/ofed/include/rdma/ib_cm.h b/sys/ofed/include/rdma/ib_cm.h index 8806494766f6..8333b73f1f41 100644 --- a/sys/ofed/include/rdma/ib_cm.h +++ b/sys/ofed/include/rdma/ib_cm.h @@ -622,4 +622,10 @@ struct ib_cm_sidr_rep_param { int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id, struct ib_cm_sidr_rep_param *param); +/** + * ibcm_reject_msg - return a pointer to a reject message string. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ ibcm_reject_msg(int reason); + #endif /* IB_CM_H */ diff --git a/sys/ofed/include/rdma/iw_cm.h b/sys/ofed/include/rdma/iw_cm.h index ddb12dfd9256..e9e118c9dea5 100644 --- a/sys/ofed/include/rdma/iw_cm.h +++ b/sys/ofed/include/rdma/iw_cm.h @@ -257,4 +257,10 @@ int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt); int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr, int *qp_attr_mask); +/** + * iwcm_reject_msg - return a pointer to a reject message string. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ iwcm_reject_msg(int reason); + #endif /* IW_CM_H */ diff --git a/sys/ofed/include/rdma/rdma_cm.h b/sys/ofed/include/rdma/rdma_cm.h index 09fa5c084e36..b5ed43426969 100644 --- a/sys/ofed/include/rdma/rdma_cm.h +++ b/sys/ofed/include/rdma/rdma_cm.h @@ -392,4 +392,12 @@ int rdma_set_afonly(struct rdma_cm_id *id, int afonly); */ __be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr); +/** + * rdma_reject_msg - return a pointer to a reject message string. + * @id: Communication identifier that received the REJECT event. + * @reason: Value returned in the REJECT event status field. + */ +const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, + int reason); + #endif /* RDMA_CM_H */ From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E41266F5FD; Mon, 26 Jul 2021 16:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2W5t5Qz3pYH; Mon, 26 Jul 2021 16:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7CDD1A313; Mon, 26 Jul 2021 16:13:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDMkG005360; Mon, 26 Jul 2021 16:13:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDM77005359; Mon, 26 Jul 2021 16:13:22 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:22 GMT Message-Id: <202107261613.16QGDM77005359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 06307dd6e0df - stable/13 - ibcore: Issue DREQ when receiving REQ/REP for stale QP. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 06307dd6e0df91a867a6a42bb4da121f89085b54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:24 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=06307dd6e0df91a867a6a42bb4da121f89085b54 commit 06307dd6e0df91a867a6a42bb4da121f89085b54 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:38 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:29 +0000 ibcore: Issue DREQ when receiving REQ/REP for stale QP. From "InfiBand Architecture Specifications Volume 1": A QP is said to have a stale connection when only one side has connection information. A stale connection may result if the remote CM had dropped the connection and sent a DREQ but the DREQ was never received by the local CM. Alternatively the remote CM may have lost all record of past connections because its node crashed and rebooted, while the local CM did not become aware of the remote node's reboot and therefore did not clean up stale connections. And: A local CM may receive a REQ/REP for a stale connection. It shall abort the connection issuing REJ to the REQ/REP. It shall then issue DREQ with "DREQ:remote QPN" set to the remote QPN from the REQ/REP. This patch solves a problem with reuse of QPN. Current codebase, that is IPoIB, relies on a REAP-mechanism to do cleanup of the structures in CM. A problem with this is the timeconstants governing this mechanism; they are up to 768 seconds and the interface may look inresponsive in that period. Issuing a DREQ (and receiving a DREP) does the necessary cleanup and the interface comes up. Linux commit: 9315bc9a133011fdb084f2626b86db3ebb64661f Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 12a913d207d287733da75784b3aa35f5e48d0cef) --- sys/ofed/drivers/infiniband/core/ib_cm.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 7dea2620cb60..376dcb420f5b 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -1679,6 +1679,7 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, struct cm_id_private *listen_cm_id_priv, *cur_cm_id_priv; struct cm_timewait_info *timewait_info; struct cm_req_msg *req_msg; + struct ib_cm_id *cm_id; req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; @@ -1700,10 +1701,18 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info); if (timewait_info) { cm_cleanup_timewait(cm_id_priv->timewait_info); + cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, + timewait_info->work.remote_id); + spin_unlock_irq(&cm.lock); cm_issue_rej(work->port, work->mad_recv_wc, IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, NULL, 0); + if (cur_cm_id_priv) { + cm_id = &cur_cm_id_priv->id; + ib_send_cm_dreq(cm_id, NULL, 0); + cm_deref_id(cur_cm_id_priv); + } return NULL; } @@ -2084,6 +2093,9 @@ static int cm_rep_handler(struct cm_work *work) struct cm_id_private *cm_id_priv; struct cm_rep_msg *rep_msg; int ret; + struct cm_id_private *cur_cm_id_priv; + struct ib_cm_id *cm_id; + struct cm_timewait_info *timewait_info; rep_msg = (struct cm_rep_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0); @@ -2118,16 +2130,26 @@ static int cm_rep_handler(struct cm_work *work) goto error; } /* Check for a stale connection. */ - if (cm_insert_remote_qpn(cm_id_priv->timewait_info)) { + timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info); + if (timewait_info) { rb_erase(&cm_id_priv->timewait_info->remote_id_node, &cm.remote_id_table); cm_id_priv->timewait_info->inserted_remote_id = 0; + cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, + timewait_info->work.remote_id); + spin_unlock(&cm.lock); spin_unlock_irq(&cm_id_priv->lock); cm_issue_rej(work->port, work->mad_recv_wc, IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP, NULL, 0); ret = -EINVAL; + if (cur_cm_id_priv) { + cm_id = &cur_cm_id_priv->id; + ib_send_cm_dreq(cm_id, NULL, 0); + cm_deref_id(cur_cm_id_priv); + } + goto error; } spin_unlock(&cm.lock); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E79D766F6A7; Mon, 26 Jul 2021 16:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2g36L6z3pbk; Mon, 26 Jul 2021 16:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7BE91A449; Mon, 26 Jul 2021 16:13:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDUft005538; Mon, 26 Jul 2021 16:13:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDUWA005537; Mon, 26 Jul 2021 16:13:30 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:30 GMT Message-Id: <202107261613.16QGDUWA005537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: dd7241e04d90 - stable/13 - ibcore: Use inline function to validate port MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dd7241e04d90407418089f749a68c4b1e391e65f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:32 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=dd7241e04d90407418089f749a68c4b1e391e65f commit dd7241e04d90407418089f749a68c4b1e391e65f Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:43 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Use inline function to validate port Linux commit: 24dc831b77eca9361cf835be59fa69ea0e471afc Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit e2ae502d28605db0ca2af6e6261513106fe2b57d) --- sys/ofed/drivers/infiniband/core/ib_cache.c | 22 +++++++++++----------- sys/ofed/drivers/infiniband/core/ib_cma.c | 6 ++---- sys/ofed/drivers/infiniband/core/ib_device.c | 4 ++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_cache.c b/sys/ofed/drivers/infiniband/core/ib_cache.c index 3680b97ad2bf..1f44841348fe 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cache.c +++ b/sys/ofed/drivers/infiniband/core/ib_cache.c @@ -518,8 +518,7 @@ int ib_find_cached_gid_by_port(struct ib_device *ib_dev, struct ib_gid_attr val = {.ndev = ndev, .gid_type = gid_type}; unsigned long flags; - if (port < rdma_start_port(ib_dev) || - port > rdma_end_port(ib_dev)) + if (!rdma_is_port_valid(ib_dev, port)) return -ENOENT; table = ports_table[port - rdma_start_port(ib_dev)]; @@ -579,9 +578,10 @@ static int ib_cache_gid_find_by_filter(struct ib_device *ib_dev, if (!ports_table) return -EOPNOTSUPP; - if (port < rdma_start_port(ib_dev) || - port > rdma_end_port(ib_dev) || - !rdma_protocol_roce(ib_dev, port)) + if (!rdma_is_port_valid(ib_dev, port)) + return -EINVAL; + + if (!rdma_protocol_roce(ib_dev, port)) return -EPROTONOSUPPORT; table = ports_table[port - rdma_start_port(ib_dev)]; @@ -885,7 +885,7 @@ int ib_get_cached_gid(struct ib_device *device, struct ib_gid_table **ports_table = device->cache.gid_cache; struct ib_gid_table *table = ports_table[port_num - rdma_start_port(device)]; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&table->rwlock, flags); @@ -934,7 +934,7 @@ int ib_get_cached_pkey(struct ib_device *device, unsigned long flags; int ret = 0; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -963,7 +963,7 @@ int ib_find_cached_pkey(struct ib_device *device, int ret = -ENOENT; int partial_ix = -1; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1003,7 +1003,7 @@ int ib_find_exact_cached_pkey(struct ib_device *device, int i; int ret = -ENOENT; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1032,7 +1032,7 @@ int ib_get_cached_lmc(struct ib_device *device, unsigned long flags; int ret = 0; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; read_lock_irqsave(&device->cache.lock, flags); @@ -1059,7 +1059,7 @@ static void ib_cache_update(struct ib_device *device, bool use_roce_gid_table = rdma_cap_roce_gid_table(device, port); - if (port < rdma_start_port(device) || port > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port)) return; table = ports_table[port - rdma_start_port(device)]; diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 2639c61b94a4..bad4b311e112 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -264,8 +264,7 @@ struct cma_device *cma_enum_devices_by_ibdev(cma_device_filter filter, int cma_get_default_gid_type(struct cma_device *cma_dev, unsigned int port) { - if (port < rdma_start_port(cma_dev->device) || - port > rdma_end_port(cma_dev->device)) + if (!rdma_is_port_valid(cma_dev->device, port)) return -EINVAL; return cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)]; @@ -277,8 +276,7 @@ int cma_set_default_gid_type(struct cma_device *cma_dev, { unsigned long supported_gids; - if (port < rdma_start_port(cma_dev->device) || - port > rdma_end_port(cma_dev->device)) + if (!rdma_is_port_valid(cma_dev->device, port)) return -EINVAL; supported_gids = roce_gid_type_mask_support(cma_dev->device, port); diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c index 8ce1127db639..dc0e6a5866d2 100644 --- a/sys/ofed/drivers/infiniband/core/ib_device.c +++ b/sys/ofed/drivers/infiniband/core/ib_device.c @@ -664,7 +664,7 @@ int ib_query_port(struct ib_device *device, union ib_gid gid; int err; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; memset(port_attr, 0, sizeof(*port_attr)); @@ -855,7 +855,7 @@ int ib_modify_port(struct ib_device *device, if (!device->modify_port) return -ENOSYS; - if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) + if (!rdma_is_port_valid(device, port_num)) return -EINVAL; return device->modify_port(device, port_num, port_modify_mask, From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 595D066F80C; Mon, 26 Jul 2021 16:13:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2j2Q37z3plL; Mon, 26 Jul 2021 16:13:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 184D919E4C; Mon, 26 Jul 2021 16:13:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDVGo005564; Mon, 26 Jul 2021 16:13:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDVHW005563; Mon, 26 Jul 2021 16:13:31 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:31 GMT Message-Id: <202107261613.16QGDVHW005563@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 7da85a0db999 - stable/13 - ibcore: Fail early if unsupported QP is provided. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7da85a0db999e7ff0b00bb41460b274fd9341a83 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:34 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7da85a0db999e7ff0b00bb41460b274fd9341a83 commit 7da85a0db999e7ff0b00bb41460b274fd9341a83 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Fail early if unsupported QP is provided. When requested QP type is not supported for a {device, port}, return the error right away before validating all parameters during mad agent registration time. Linux commit: 798bba01b44b0ddf8cd6e542635b37cc9a9b739c Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 507389a35a41f5f15592d2156d34039e3ee1c3e5) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 7bb6323a4c53..2f14535688aa 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -219,6 +219,10 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, unsigned long flags; u8 mgmt_class, vclass; + if ((qp_type == IB_QPT_SMI && !rdma_cap_ib_smi(device, port_num)) || + (qp_type == IB_QPT_GSI && !rdma_cap_ib_cm(device, port_num))) + return ERR_PTR(-EPROTONOSUPPORT); + /* Validate parameters */ qpn = get_spl_qp_index(qp_type); if (qpn == -1) { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C6F966F901; Mon, 26 Jul 2021 16:13:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2n1r2Gz3pbx; Mon, 26 Jul 2021 16:13:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6186119E4D; Mon, 26 Jul 2021 16:13:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDYVF005612; Mon, 26 Jul 2021 16:13:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDYn2005611; Mon, 26 Jul 2021 16:13:34 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:34 GMT Message-Id: <202107261613.16QGDYn2005611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: fe866f58903b - stable/13 - ibcore: Remove debug prints after allocation failure. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fe866f58903b2ff578f774f30c42953c402dfd70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:37 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=fe866f58903b2ff578f774f30c42953c402dfd70 commit fe866f58903b2ff578f774f30c42953c402dfd70 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:45 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Remove debug prints after allocation failure. The prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway. Linux commit: 2716243212241855cd9070883779f6e58967dec5 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 26646ba5bcdadbd513dc4dfccc772952732aea5c) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 40 ++++++------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index b9f45ff5e41d..5b1297fe4cd3 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -827,7 +827,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, local = kmalloc(sizeof *local, GFP_ATOMIC); if (!local) { ret = -ENOMEM; - dev_err(&device->dev, "No memory for ib_mad_local_private\n"); goto out; } local->mad_priv = NULL; @@ -835,7 +834,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, mad_priv = alloc_mad_private(mad_size, GFP_ATOMIC); if (!mad_priv) { ret = -ENOMEM; - dev_err(&device->dev, "No memory for local response MAD\n"); kfree(local); goto out; } @@ -958,9 +956,6 @@ static int alloc_send_rmpp_list(struct ib_mad_send_wr_private *send_wr, for (left = send_buf->data_len + pad; left > 0; left -= seg_size) { seg = kmalloc(sizeof (*seg) + seg_size, gfp_mask); if (!seg) { - dev_err(&send_buf->mad_agent->device->dev, - "alloc_send_rmpp_segs: RMPP mem alloc failed for len %zd, gfp %#x\n", - sizeof (*seg) + seg_size, gfp_mask); free_send_rmpp_list(send_wr); return -ENOMEM; } @@ -1373,12 +1368,7 @@ static int allocate_method_table(struct ib_mad_mgmt_method_table **method) { /* Allocate management method table */ *method = kzalloc(sizeof **method, GFP_ATOMIC); - if (!*method) { - pr_err("No memory for ib_mad_mgmt_method_table\n"); - return -ENOMEM; - } - - return 0; + return (*method) ? 0 : (-ENOMEM); } /* @@ -1469,8 +1459,6 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req, /* Allocate management class table for "new" class version */ *class = kzalloc(sizeof **class, GFP_ATOMIC); if (!*class) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_class_table\n"); ret = -ENOMEM; goto error1; } @@ -1535,22 +1523,16 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, if (!*vendor_table) { /* Allocate mgmt vendor class table for "new" class version */ vendor = kzalloc(sizeof *vendor, GFP_ATOMIC); - if (!vendor) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_vendor_class_table\n"); + if (!vendor) goto error1; - } *vendor_table = vendor; } if (!(*vendor_table)->vendor_class[vclass]) { /* Allocate table for this management vendor class */ vendor_class = kzalloc(sizeof *vendor_class, GFP_ATOMIC); - if (!vendor_class) { - dev_err(&agent_priv->agent.device->dev, - "No memory for ib_mad_mgmt_vendor_class\n"); + if (!vendor_class) goto error2; - } (*vendor_table)->vendor_class[vclass] = vendor_class; } @@ -1560,7 +1542,8 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, mad_reg_req->oui, 3)) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; - BUG_ON(!*method); + if (!*method) + goto error3; goto check_in_use; } } @@ -1570,7 +1553,6 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, vclass]->oui[i])) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; - BUG_ON(*method); /* Allocate method table for this OUI */ if ((ret = allocate_method_table(method))) goto error3; @@ -2249,11 +2231,8 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) mad_size = recv->mad_size; response = alloc_mad_private(mad_size, GFP_KERNEL); - if (!response) { - dev_err(&port_priv->device->dev, - "%s: no memory for response buffer\n", __func__); + if (!response) goto out; - } if (rdma_cap_ib_switch(port_priv->device)) port_num = wc->port_num; @@ -2880,8 +2859,6 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, mad_priv = alloc_mad_private(port_mad_size(qp_info->port_priv), GFP_ATOMIC); if (!mad_priv) { - dev_err(&qp_info->port_priv->device->dev, - "No memory for receive buffer\n"); ret = -ENOMEM; break; } @@ -2972,11 +2949,8 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) u16 pkey_index; attr = kmalloc(sizeof *attr, GFP_KERNEL); - if (!attr) { - dev_err(&port_priv->device->dev, - "Couldn't kmalloc ib_qp_attr\n"); + if (!attr) return -ENOMEM; - } ret = ib_find_pkey(port_priv->device, port_priv->port_num, IB_DEFAULT_PKEY_FULL, &pkey_index); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FD8A66F702; Mon, 26 Jul 2021 16:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2d688nz3pTZ; Mon, 26 Jul 2021 16:13:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3C6A1A22F; Mon, 26 Jul 2021 16:13:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDS0o005486; Mon, 26 Jul 2021 16:13:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDS5i005485; Mon, 26 Jul 2021 16:13:28 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:28 GMT Message-Id: <202107261613.16QGDS5i005485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6ee862127d3d - stable/13 - ibcore: Protect against concurrent access to hardware stats. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6ee862127d3d329575b72e95824c87518d65df7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:31 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6ee862127d3d329575b72e95824c87518d65df7c commit 6ee862127d3d329575b72e95824c87518d65df7c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Protect against concurrent access to hardware stats. Currently access to hardware stats buffer isn't protected, this can result in multiple writes and reads at the same time to the same memory location. This can lead to providing an incorrect value to the user. Add a mutex to protect against it. Linux commit: e945130b52bea65d15f9bdf54949d4cb7a88db7f Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 912e98cedee2590748a9893d3152b11694de3379) --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 34 ++++++++++++++++++++++++----- sys/ofed/include/rdma/ib_verbs.h | 4 ++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index c393bb64a034..806f4aba6c76 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -827,10 +827,15 @@ static ssize_t show_hw_stats(struct kobject *kobj, struct attribute *attr, dev = port->ibdev; stats = port->hw_stats; } + mutex_lock(&stats->lock); ret = update_hw_stats(dev, stats, hsa->port_num, hsa->index); if (ret) - return ret; - return print_hw_stat(stats, hsa->index, buf); + goto unlock; + ret = print_hw_stat(stats, hsa->index, buf); +unlock: + mutex_unlock(&stats->lock); + + return ret; } static ssize_t show_stats_lifespan(struct kobject *kobj, @@ -838,17 +843,25 @@ static ssize_t show_stats_lifespan(struct kobject *kobj, char *buf) { struct hw_stats_attribute *hsa; + struct rdma_hw_stats *stats; int msecs; hsa = container_of(attr, struct hw_stats_attribute, attr); if (!hsa->port_num) { struct ib_device *dev = container_of((struct device *)kobj, struct ib_device, dev); - msecs = jiffies_to_msecs(dev->hw_stats->lifespan); + + stats = dev->hw_stats; } else { struct ib_port *p = container_of(kobj, struct ib_port, kobj); - msecs = jiffies_to_msecs(p->hw_stats->lifespan); + + stats = p->hw_stats; } + + mutex_lock(&stats->lock); + msecs = jiffies_to_msecs(stats->lifespan); + mutex_unlock(&stats->lock); + return sprintf(buf, "%d\n", msecs); } @@ -857,6 +870,7 @@ static ssize_t set_stats_lifespan(struct kobject *kobj, const char *buf, size_t count) { struct hw_stats_attribute *hsa; + struct rdma_hw_stats *stats; int msecs; int jiffies; int ret; @@ -871,11 +885,18 @@ static ssize_t set_stats_lifespan(struct kobject *kobj, if (!hsa->port_num) { struct ib_device *dev = container_of((struct device *)kobj, struct ib_device, dev); - dev->hw_stats->lifespan = jiffies; + + stats = dev->hw_stats; } else { struct ib_port *p = container_of(kobj, struct ib_port, kobj); - p->hw_stats->lifespan = jiffies; + + stats = p->hw_stats; } + + mutex_lock(&stats->lock); + stats->lifespan = jiffies; + mutex_unlock(&stats->lock); + return count; } @@ -968,6 +989,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, sysfs_attr_init(hsag->attrs[i]); } + mutex_init(&stats->lock); /* treat an error here as non-fatal */ hsag->attrs[i] = alloc_hsa_lifespan("lifespan", port_num); if (hsag->attrs[i]) diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 2399a3a53120..b18aa2855166 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -438,6 +438,9 @@ enum ib_port_speed { /** * struct rdma_hw_stats + * @lock - Mutex to protect parallel write access to lifespan and values + * of counters, which are 64bits and not guaranteeed to be written + * atomicaly on 32bits systems. * @timestamp - Used by the core code to track when the last update was * @lifespan - Used by the core code to determine how old the counters * should be before being updated again. Stored in jiffies, defaults @@ -453,6 +456,7 @@ enum ib_port_speed { * filled in by the drivers get_stats routine */ struct rdma_hw_stats { + struct mutex lock; /* Protect lifespan and values[] */ unsigned long timestamp; unsigned long lifespan; const char * const *names; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAD9266EF7E; Mon, 26 Jul 2021 16:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2f5P06z3pfD; Mon, 26 Jul 2021 16:13:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C868B1A48B; Mon, 26 Jul 2021 16:13:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDTDd005510; Mon, 26 Jul 2021 16:13:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDTZw005509; Mon, 26 Jul 2021 16:13:29 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:29 GMT Message-Id: <202107261613.16QGDTZw005509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a4b27295c71e - stable/13 - ibcore: Validate port number in query_pkey verb. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a4b27295c71ea05b54f07b574018469a14ea68dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:31 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a4b27295c71ea05b54f07b574018469a14ea68dd commit a4b27295c71ea05b54f07b574018469a14ea68dd Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Validate port number in query_pkey verb. Before calling the driver's function let's make sure port is valid. Linux commit: 9af3f5cf9d64a056eca53bc643f6288ad28bbbb5 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 31525faed8b43c579767cf3ac211f41764b2a46c) --- sys/ofed/drivers/infiniband/core/ib_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c index 8c6a2d9f1a8a..8ce1127db639 100644 --- a/sys/ofed/drivers/infiniband/core/ib_device.c +++ b/sys/ofed/drivers/infiniband/core/ib_device.c @@ -809,6 +809,9 @@ void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev) int ib_query_pkey(struct ib_device *device, u8 port_num, u16 index, u16 *pkey) { + if (!rdma_is_port_valid(device, port_num)) + return -EINVAL; + return device->query_pkey(device, port_num, index, pkey); } EXPORT_SYMBOL(ib_query_pkey); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9A1E66F6D2; Mon, 26 Jul 2021 16:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2k0pSkz3pfL; Mon, 26 Jul 2021 16:13:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B50A1A44A; Mon, 26 Jul 2021 16:13:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDX4D005588; Mon, 26 Jul 2021 16:13:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDXr0005587; Mon, 26 Jul 2021 16:13:33 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:33 GMT Message-Id: <202107261613.16QGDXr0005587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 36f60545aac6 - stable/13 - ibcore: Fix use-after-free in IB mad completion handling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 36f60545aac67a3ee290bca78aa102c41f7d57c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:37 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=36f60545aac67a3ee290bca78aa102c41f7d57c7 commit 36f60545aac67a3ee290bca78aa102c41f7d57c7 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Fix use-after-free in IB mad completion handling. We encountered a use-after-free bug when unloading the driver: BUG: KASAN: use-after-free in ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] Read of size 4 at addr ffff8882ca5aa868 by task kworker/u13:2/23862 Workqueue: ib-comp-unb-wq ib_cq_poll_work [ib_core] Call Trace: dump_stack+0x9a/0xeb print_address_description+0xe3/0x2e0 ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] __kasan_report+0x15c/0x1df ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] kasan_report+0xe/0x20 ib_mad_post_receive_mads+0xddc/0xed0 [ib_core] find_mad_agent+0xa00/0xa00 [ib_core] qlist_free_all+0x51/0xb0 mlx4_ib_sqp_comp_worker+0x1970/0x1970 [mlx4_ib] quarantine_reduce+0x1fa/0x270 kasan_unpoison_shadow+0x30/0x40 ib_mad_recv_done+0xdf6/0x3000 [ib_core] _raw_spin_unlock_irqrestore+0x46/0x70 ib_mad_send_done+0x1810/0x1810 [ib_core] mlx4_ib_destroy_cq+0x2a0/0x2a0 [mlx4_ib] _raw_spin_unlock_irqrestore+0x46/0x70 debug_object_deactivate+0x2b9/0x4a0 __ib_process_cq+0xe2/0x1d0 [ib_core] ib_cq_poll_work+0x45/0xf0 [ib_core] process_one_work+0x90c/0x1860 pwq_dec_nr_in_flight+0x320/0x320 worker_thread+0x87/0xbb0 __kthread_parkme+0xb6/0x180 process_one_work+0x1860/0x1860 kthread+0x320/0x3e0 kthread_park+0x120/0x120 ret_from_fork+0x24/0x30 ... Freed by task 31682: save_stack+0x19/0x80 __kasan_slab_free+0x11d/0x160 kfree+0xf5/0x2f0 ib_mad_port_close+0x200/0x380 [ib_core] ib_mad_remove_device+0xf0/0x230 [ib_core] remove_client_context+0xa6/0xe0 [ib_core] disable_device+0x14e/0x260 [ib_core] __ib_unregister_device+0x79/0x150 [ib_core] ib_unregister_device+0x21/0x30 [ib_core] mlx4_ib_remove+0x162/0x690 [mlx4_ib] mlx4_remove_device+0x204/0x2c0 [mlx4_core] mlx4_unregister_interface+0x49/0x1d0 [mlx4_core] mlx4_ib_cleanup+0xc/0x1d [mlx4_ib] __x64_sys_delete_module+0x2d2/0x400 do_syscall_64+0x95/0x470 entry_SYSCALL_64_after_hwframe+0x49/0xbe The problem was that the MAD PD was deallocated before the MAD CQ. There was completion work pending for the CQ when the PD got deallocated. When the mad completion handling reached procedure ib_mad_post_receive_mads(), we got a use-after-free bug in the following line of code in that procedure: sg_list.lkey = qp_info->port_priv->pd->local_dma_lkey; (the pd pointer in the above line is no longer valid, because the pd has been deallocated). We fix this by allocating the PD before the CQ in procedure ib_mad_port_open(), and deallocating the PD after freeing the CQ in procedure ib_mad_port_close(). Since the CQ completion work queue is flushed during ib_free_cq(), no completions will be pending for that CQ when the PD is later deallocated. Note that freeing the CQ before deallocating the PD is the practice in the ULPs. Linux commit: 770b7d96cfff6a8bf6c9f261ba6f135dc9edf484 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 468a6b5055f0b6ea0bdb1ee8cbdf749204cb3b25) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 2f14535688aa..b9f45ff5e41d 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -3146,10 +3146,8 @@ static int ib_mad_port_open(struct ib_device *device, /* Create new device info */ port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL); - if (!port_priv) { - dev_err(&device->dev, "No memory for ib_mad_port_private\n"); + if (!port_priv) return -ENOMEM; - } port_priv->device = device; port_priv->port_num = port_num; @@ -3163,18 +3161,18 @@ static int ib_mad_port_open(struct ib_device *device, if (has_smi) cq_size *= 2; + port_priv->pd = ib_alloc_pd(device, 0); + if (IS_ERR(port_priv->pd)) { + dev_err(&device->dev, "Couldn't create ib_mad PD\n"); + ret = PTR_ERR(port_priv->pd); + goto error3; + } + port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0, IB_POLL_WORKQUEUE); if (IS_ERR(port_priv->cq)) { dev_err(&device->dev, "Couldn't create ib_mad CQ\n"); ret = PTR_ERR(port_priv->cq); - goto error3; - } - - port_priv->pd = ib_alloc_pd(device, 0); - if (IS_ERR(port_priv->pd)) { - dev_err(&device->dev, "Couldn't create ib_mad PD\n"); - ret = PTR_ERR(port_priv->pd); goto error4; } @@ -3217,11 +3215,11 @@ error8: error7: destroy_mad_qp(&port_priv->qp_info[0]); error6: - ib_dealloc_pd(port_priv->pd); -error4: ib_free_cq(port_priv->cq); cleanup_recv_queue(&port_priv->qp_info[1]); cleanup_recv_queue(&port_priv->qp_info[0]); +error4: + ib_dealloc_pd(port_priv->pd); error3: kfree(port_priv); @@ -3251,8 +3249,8 @@ static int ib_mad_port_close(struct ib_device *device, int port_num) destroy_workqueue(port_priv->wq); destroy_mad_qp(&port_priv->qp_info[1]); destroy_mad_qp(&port_priv->qp_info[0]); - ib_dealloc_pd(port_priv->pd); ib_free_cq(port_priv->cq); + ib_dealloc_pd(port_priv->pd); cleanup_recv_queue(&port_priv->qp_info[1]); cleanup_recv_queue(&port_priv->qp_info[0]); /* XXX: Handle deallocation of MAD registration tables */ From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31AE366F4BF; Mon, 26 Jul 2021 16:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2Y6ZfRz3pR6; Mon, 26 Jul 2021 16:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3287D1A448; Mon, 26 Jul 2021 16:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDPWS005412; Mon, 26 Jul 2021 16:13:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDPpc005411; Mon, 26 Jul 2021 16:13:25 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:25 GMT Message-Id: <202107261613.16QGDPpc005411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2cbd28890432 - stable/13 - ibcore: Introduce ib_port_phys_state enum. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2cbd28890432f2b47a7cb3a99724294e83e619c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:26 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2cbd28890432f2b47a7cb3a99724294e83e619c9 commit 2cbd28890432f2b47a7cb3a99724294e83e619c9 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:39 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:30 +0000 ibcore: Introduce ib_port_phys_state enum. In order to improve readability, add ib_port_phys_state enum to replace the use of magic numbers. Linux commit: 72a7720fca37fec0daf295923f17ac5d88a613e1 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4238b4a7a2cfe44e95f3553ff4a3f6f813fb81f5) --- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 3 ++- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 4 ++-- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 30 +++++++++++++++++++---------- sys/ofed/include/rdma/ib_verbs.h | 10 ++++++++++ 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index 62956607974b..ef23f182bc28 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -684,7 +684,8 @@ out: static u8 state_to_phys_state(enum ib_port_state state) { - return state == IB_PORT_ACTIVE ? 5 : 3; + return state == IB_PORT_ACTIVE ? + IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED; } static int eth_link_query_port(struct ib_device *ibdev, u8 port, diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index b97d40ca8b99..d614ec048f60 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -319,7 +319,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg); props->pkey_tbl_len = 1; props->state = IB_PORT_DOWN; - props->phys_state = 3; + props->phys_state = IB_PORT_PHYS_STATE_DISABLED; mlx5_query_nic_vport_qkey_viol_cntr(dev->mdev, &qkey_viol_cntr); props->qkey_viol_cntr = qkey_viol_cntr; @@ -331,7 +331,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, if (ndev->if_drv_flags & IFF_DRV_RUNNING && ndev->if_link_state == LINK_STATE_UP) { props->state = IB_PORT_ACTIVE; - props->phys_state = 5; + props->phys_state = IB_PORT_PHYS_STATE_LINK_UP; } ndev_ib_mtu = iboe_get_mtu(ndev->if_mtu); diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index 55e7b5395b8e..64ef4c4aefdb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -293,6 +293,24 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, ib_width_enum_to_int(attr.active_width), speed); } +static const char *phys_state_to_str(enum ib_port_phys_state phys_state) +{ + static const char * phys_state_str[] = { + "", + "Sleep", + "Polling", + "Disabled", + "PortConfigurationTraining", + "LinkUp", + "LinkErrorRecovery", + "Phy Test", + }; + + if (phys_state < ARRAY_SIZE(phys_state_str)) + return phys_state_str[phys_state]; + return ""; +} + static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, char *buf) { @@ -304,16 +322,8 @@ static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, if (ret) return ret; - switch (attr.phys_state) { - case 1: return sprintf(buf, "1: Sleep\n"); - case 2: return sprintf(buf, "2: Polling\n"); - case 3: return sprintf(buf, "3: Disabled\n"); - case 4: return sprintf(buf, "4: PortConfigurationTraining\n"); - case 5: return sprintf(buf, "5: LinkUp\n"); - case 6: return sprintf(buf, "6: LinkErrorRecovery\n"); - case 7: return sprintf(buf, "7: Phy Test\n"); - default: return sprintf(buf, "%d: \n", attr.phys_state); - } + return sprintf(buf, "%d: %s\n", attr.phys_state, + phys_state_to_str(attr.phys_state)); } static ssize_t link_layer_show(struct ib_port *p, struct port_attribute *unused, diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 2450682ffa66..2399a3a53120 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -396,6 +396,16 @@ enum ib_port_cap_flags { IB_PORT_IP_BASED_GIDS = 1 << 26, }; +enum ib_port_phys_state { + IB_PORT_PHYS_STATE_SLEEP = 1, + IB_PORT_PHYS_STATE_POLLING = 2, + IB_PORT_PHYS_STATE_DISABLED = 3, + IB_PORT_PHYS_STATE_PORT_CONFIGURATION_TRAINING = 4, + IB_PORT_PHYS_STATE_LINK_UP = 5, + IB_PORT_PHYS_STATE_LINK_ERROR_RECOVERY = 6, + IB_PORT_PHYS_STATE_PHY_TEST = 7, +}; + enum ib_port_width { IB_WIDTH_1X = 1, IB_WIDTH_2X = 16, From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E06066F7A1; Mon, 26 Jul 2021 16:13:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2n576zz3pj4; Mon, 26 Jul 2021 16:13:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D4A019E4E; Mon, 26 Jul 2021 16:13:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDZEO005636; Mon, 26 Jul 2021 16:13:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDZTF005635; Mon, 26 Jul 2021 16:13:35 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:35 GMT Message-Id: <202107261613.16QGDZTF005635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 7449dd9a127d - stable/13 - ibcore: Do not overreact to SM LID change event. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7449dd9a127dc3ec75c3445713ab2d8103537d02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:38 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7449dd9a127dc3ec75c3445713ab2d8103537d02 commit 7449dd9a127dc3ec75c3445713ab2d8103537d02 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Do not overreact to SM LID change event. When IPoIB receives an SM LID change event, it reacts by flushing its path record cache and rejoining multicast groups. This is the same behavior it performs when it receives a reregistration event. This behavior is unnecessary as an SM may have database backup or synchronization mechanisms which permit the SM location or LID to change without loss of multicast membership and without impact to path records. Both opensm and the OPA FM issue reregistration events if a new SM is started (or restarted with a new config) or an SM event occurs which results in loss of multicast membership records by the SM (such as opensm failover) or the SM encounters new nodes with Active ports (such as after joining 2 fabrics by connecting switches via ISLs). Hence this event can be depended on as the trigger for IPoIB cache and multicast flushing. It appears that some drivers, such as qib, and hfi1 issue the IB_EVENT_SM_CHANGE but other drivers such as mlx4 and mlx5 do not. Empirical testing on Mellanox EDR using ibv_asyncwatch has confirmed that Mellanox EDR HCAs do not generate SM change events and that opensm does generate reregistration. An SM LID change event is generated by the mentioned drivers to reflect that sm_lid and/or sm_sl in the local port info has changed. The intent of this event is to permit applications and ULPs which have a local copy of this information (or an address handle using it) to update their information. The intent is that the reregistration event (caused by the SM via a bit in Set(PortInfo)) be used to inform nodes that they need to rejoin multicast groups, resubscribe for notices and potentially update path records. When an SM migrates or fails over, a SM LID change event can occur. In response IPoIB discards path records and multicast membership and loses connectivity until these records are restored via SA requests. In very large fabrics, it may take minutes for the SM to be ready and for the SA responses to be supplied. This can result in undesirable and unnecessary IPoIB connectivity impacts. It also can result in an unnecessary storm of SA queries from all nodes in a cluster potentially followed by yet another storm if the SM issues the reregistration request. The fact the Mellanox HCAs do not even generate this event, is further evidence that on modern IB fabrics there will be no ill side effects from the proposed changes below to reduce the reaction by 3 kernel components to this event. So these changes should be benign for Mellanox IB fabrics and will benefit OPA fabrics while also making ib_core and ULP behavor "correct" as intended by the IBTA spec and kernel RDMA event APIs. Address these issues by removing IB_EVENT_SM_CHANGE handling from ipoib. IPoIB does not locally store sm_lid nor sm_sl, so it does not need to do anything on SM LID change. IPoIB makes use of other ib_core components to issue SA requests for it and those components correctly track SM LID and SM LID changes. Also in ib_core multicast handling, remove the test for IB_EVENT_SM_CHANGE. This code is moving all multicast groups to the error state, which will trigger rejoins. This code is used by IPoIB as well as the connection manager and other clients of multicast groups. This kernel module centralizes group membership status and joins since a node can only join a given group once but multiple ULPs or applications may want to join the same group. It makes use of the sa_query.c component in ib_core, which correctly trackes SM LID and SL. This component does not track SM LID nor SL itself and hence need not react to their changes. Similarly in the ib_core cache code remove the handling for the IB_EVENT_SM_CHANGE. In this function. The ib_cache_update function which is ultimately called is updating local copies of the pkey table, gid table and lmc. It does not update nor retain sm_lid nor sm_sl. As such it does not need to be called on an SM LID change. It technically also does not need to be called on a reregistration. The LID_CHANGE, PKEY_CHANGE, GID_CHANGE and port state change events (PORT_ERR, PORT_ACTICE) should be sufficient triggers. It is worth noting that the alternative of simply having the hfi1 and qib drivers not generate the SM LID change event was explored. While this would duplicate what Mellanox drivers do now, it is not the correct behavior and removes the ability for an SM to migrate without requiring reregistration. Since both opensm and OPA SM have mechanisms to backup or synchronize registration information, it is desirable to let them perform SM migrations (with LID or SL changes) without requiring reregistration when they deem it appropriate. Linux commit: ba7d8117f3cca8eb70d579fde3f9ec8cd6a28f39 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit df1df0c742ec22de6ee7656a91ea8773c05f3b81) --- sys/ofed/drivers/infiniband/core/ib_multicast.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_multicast.c b/sys/ofed/drivers/infiniband/core/ib_multicast.c index d81767bcd3a1..3784a3e5e290 100644 --- a/sys/ofed/drivers/infiniband/core/ib_multicast.c +++ b/sys/ofed/drivers/infiniband/core/ib_multicast.c @@ -800,7 +800,6 @@ static void mcast_event_handler(struct ib_event_handler *handler, switch (event->event) { case IB_EVENT_PORT_ERR: case IB_EVENT_LID_CHANGE: - case IB_EVENT_SM_CHANGE: case IB_EVENT_CLIENT_REREGISTER: mcast_groups_event(&dev->port[index], MCAST_GROUP_ERROR); break; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:14:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBA9A66F9BC; Mon, 26 Jul 2021 16:14:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3N1qRlz3pgs; Mon, 26 Jul 2021 16:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15B431A298; Mon, 26 Jul 2021 16:14:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGE4tE006291; Mon, 26 Jul 2021 16:14:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE4tI006290; Mon, 26 Jul 2021 16:14:04 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:04 GMT Message-Id: <202107261614.16QGE4tI006290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 5f23486df92d - stable/13 - ipoib: Fix for accessing uninitialized pointers and freed memory during attach and detach. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5f23486df92d476a42d3cc25da7afe35fb6e8269 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:14:10 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5f23486df92d476a42d3cc25da7afe35fb6e8269 commit 5f23486df92d476a42d3cc25da7afe35fb6e8269 Author: Hans Petter Selasky AuthorDate: 2021-07-12 13:01:19 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 ipoib: Fix for accessing uninitialized pointers and freed memory during attach and detach. Call infiniband_ifdetach() early to stop ifioctl(9) calls from user-space during device removal. Also make sure that ifioctl(9) calls are blocked from executing until the device is fully initialized. Ideally we would delay the infiniband_ifattach() call, but because part of the initialization is to update the link level address, that is not possible without more significant changes. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit cd2c05d323d272163d04dd94caabe018ca2d4dc5) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c | 34 +++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index b0f69842ac02..0982af9fb904 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -278,7 +278,13 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data) int error = 0; /* check if detaching */ - if (priv == NULL || priv->gone != 0) + if (priv == NULL) + return (ENXIO); + /* wait for device to become ready, if any */ + while (priv->gone == 2) + pause("W", 1); + /* check for device gone */ + if (priv->gone != 0) return (ENXIO); switch (command) { @@ -822,7 +828,7 @@ out: } static void -ipoib_detach(struct ipoib_dev_priv *priv) +ipoib_ifdetach(struct ipoib_dev_priv *priv) { struct ifnet *dev; @@ -830,6 +836,16 @@ ipoib_detach(struct ipoib_dev_priv *priv) if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { priv->gone = 1; infiniband_ifdetach(dev); + } +} + +static void +ipoib_detach(struct ipoib_dev_priv *priv) +{ + struct ifnet *dev; + + dev = priv->dev; + if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { if_free(dev); free_unr(ipoib_unrhdr, priv->unit); } else @@ -845,6 +861,7 @@ ipoib_dev_cleanup(struct ipoib_dev_priv *priv) /* Delete any child interfaces first */ list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) { + ipoib_ifdetach(cpriv); ipoib_dev_cleanup(cpriv); ipoib_detach(cpriv); } @@ -897,6 +914,7 @@ ipoib_intf_alloc(const char *name) return NULL; } dev->if_softc = priv; + priv->gone = 2; /* initializing */ priv->unit = alloc_unr(ipoib_unrhdr); if (priv->unit == -1) { if_free(dev); @@ -906,7 +924,7 @@ ipoib_intf_alloc(const char *name) if_initname(dev, name, priv->unit); dev->if_flags = IFF_BROADCAST | IFF_MULTICAST; - infiniband_ifattach(dev, NULL, priv->broadcastaddr); + infiniband_ifattach(priv->dev, NULL, priv->broadcastaddr); dev->if_init = ipoib_init; dev->if_ioctl = ipoib_ioctl; @@ -915,7 +933,7 @@ ipoib_intf_alloc(const char *name) dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2; priv->dev = dev; - if_link_state_change(dev, LINK_STATE_DOWN); + if_link_state_change(priv->dev, LINK_STATE_DOWN); return dev->if_softc; } @@ -1000,7 +1018,7 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port) hca->name, port, result); goto device_init_failed; } - memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof (union ib_gid)); + memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof(union ib_gid)); result = ipoib_dev_init(priv, hca, port); if (result < 0) { @@ -1022,12 +1040,15 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port) } if_printf(priv->dev, "Attached to %s port %d\n", hca->name, port); + priv->gone = 0; /* ready */ + return priv->dev; event_failed: ipoib_dev_cleanup(priv); device_init_failed: + ipoib_ifdetach(priv); ipoib_detach(priv); alloc_mem_failed: @@ -1088,12 +1109,11 @@ ipoib_remove_one(struct ib_device *device, void *client_data) if (rdma_port_get_link_layer(device, priv->port) != IB_LINK_LAYER_INFINIBAND) continue; + ipoib_ifdetach(priv); ipoib_stop(priv); ib_unregister_event_handler(&priv->event_handler); - /* dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP); */ - flush_workqueue(ipoib_workqueue); ipoib_dev_cleanup(priv); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE4F966F898; Mon, 26 Jul 2021 16:13:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2r66q8z3pVD; Mon, 26 Jul 2021 16:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3D5D19EB9; Mon, 26 Jul 2021 16:13:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDcFR005714; Mon, 26 Jul 2021 16:13:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDcBC005713; Mon, 26 Jul 2021 16:13:38 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:38 GMT Message-Id: <202107261613.16QGDcBC005713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: d857bf203733 - stable/13 - ibcore: Don't allocate method table, if already present. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d857bf20373325346168e71ff39cb84d692b51e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:42 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d857bf20373325346168e71ff39cb84d692b51e7 commit d857bf20373325346168e71ff39cb84d692b51e7 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:48 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Don't allocate method table, if already present. This commit aligns the code in question with upstream Linux. Linux commit: 2468b82d69e3a53d024f28d79ba0fdb8bf43dfbf Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 721b795b721b349db5e6198f8681d5992447c775) --- sys/ofed/drivers/infiniband/core/ib_mad.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_mad.c b/sys/ofed/drivers/infiniband/core/ib_mad.c index 5b1297fe4cd3..82a3f19d92bb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_mad.c @@ -1554,8 +1554,11 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; /* Allocate method table for this OUI */ - if ((ret = allocate_method_table(method))) - goto error3; + if (!*method) { + ret = allocate_method_table(method); + if (ret) + goto error3; + } memcpy((*vendor_table)->vendor_class[vclass]->oui[i], mad_reg_req->oui, 3); goto check_in_use; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7883066F65D; Mon, 26 Jul 2021 16:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2p4ylCz3pV4; Mon, 26 Jul 2021 16:13:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD4001A230; Mon, 26 Jul 2021 16:13:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDb2u005690; Mon, 26 Jul 2021 16:13:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDbXu005689; Mon, 26 Jul 2021 16:13:37 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:37 GMT Message-Id: <202107261613.16QGDbXu005689@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a0d74ac3f370 - stable/13 - ibcore: Fix a use-after-free in ucma_resolve_ip(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a0d74ac3f3700fa384076d46f6a3fe4f82d1e0ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:39 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a0d74ac3f3700fa384076d46f6a3fe4f82d1e0ad commit a0d74ac3f3700fa384076d46f6a3fe4f82d1e0ad Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:47 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Fix a use-after-free in ucma_resolve_ip(). There is a race condition between ucma_close() and ucma_resolve_ip(): CPU0 CPU1 ucma_resolve_ip(): ucma_close(): ctx = ucma_get_ctx(file, cmd.id); list_for_each_entry_safe(ctx, tmp, &file->ctx_list, list) { mutex_lock(&mut); idr_remove(&ctx_idr, ctx->id); mutex_unlock(&mut); ... mutex_lock(&mut); if (!ctx->closing) { mutex_unlock(&mut); rdma_destroy_id(ctx->cm_id); ... ucma_free_ctx(ctx); } ret = rdma_resolve_addr(); ucma_put_ctx(ctx); Before idr_remove(), ucma_get_ctx() could still find the ctx and after rdma_destroy_id(), rdma_resolve_addr() may still access id_priv pointer. Also, ucma_put_ctx() may use ctx after ucma_free_ctx() too. ucma_close() should call ucma_put_ctx() too which tests the refcnt and waits for the last one releasing it. The similar pattern is already used by ucma_destroy_id(). Linux commit: 5fe23f262e0548ca7f19fb79f89059a60d087d22 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit c6ccb08686f3b92c12778b4b903431b2ce71ec2c) --- sys/ofed/drivers/infiniband/core/ib_ucma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_ucma.c b/sys/ofed/drivers/infiniband/core/ib_ucma.c index 19e4a17836ee..878e4d348234 100644 --- a/sys/ofed/drivers/infiniband/core/ib_ucma.c +++ b/sys/ofed/drivers/infiniband/core/ib_ucma.c @@ -1705,6 +1705,8 @@ static int ucma_close(struct inode *inode, struct file *filp) mutex_lock(&mut); if (!ctx->closing) { mutex_unlock(&mut); + ucma_put_ctx(ctx); + wait_for_completion(&ctx->comp); /* rdma_destroy_id ensures that no event handlers are * inflight for that id before releasing it. */ From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F02066F65C; Mon, 26 Jul 2021 16:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2p2q4wz3pX0; Mon, 26 Jul 2021 16:13:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EE111A44B; Mon, 26 Jul 2021 16:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDaMs005664; Mon, 26 Jul 2021 16:13:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDa5Y005663; Mon, 26 Jul 2021 16:13:36 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:36 GMT Message-Id: <202107261613.16QGDa5Y005663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1753641a8b93 - stable/13 - ibcore: Define option to set ack timeout. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1753641a8b93c625f65b4c5333b66db365eefe77 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:39 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1753641a8b93c625f65b4c5333b66db365eefe77 commit 1753641a8b93c625f65b4c5333b66db365eefe77 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:47 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Define option to set ack timeout. Define new option in 'rdma_set_option' to override calculated QP timeout when requested to provide QP attributes to modify a QP. At the same time, pack tos_set to be bitfield. Linux commit: 2c1619edef61a03cb516efaa81750784c3071d10 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 20fea7ac64683b064ffe4cefa750e46ba20de4f9) --- sys/ofed/drivers/infiniband/core/ib_cma.c | 34 ++++++++++++++++++++++++++++++ sys/ofed/drivers/infiniband/core/ib_ucma.c | 7 ++++++ sys/ofed/include/rdma/rdma_cm.h | 1 + sys/ofed/include/uapi/rdma/rdma_user_cm.h | 4 ++++ 4 files changed, 46 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index bad4b311e112..586524ac88bb 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -336,8 +336,10 @@ struct rdma_id_private { u32 options; u8 srq; u8 tos; + u8 timeout_set:1; u8 reuseaddr; u8 afonly; + u8 timeout; enum ib_gid_type gid_type; }; @@ -775,6 +777,7 @@ struct rdma_cm_id *rdma_create_id(struct vnet *net, id_priv->id.event_handler = event_handler; id_priv->id.ps = ps; id_priv->id.qp_type = qp_type; + id_priv->timeout_set = false; spin_lock_init(&id_priv->lock); mutex_init(&id_priv->qp_mutex); init_completion(&id_priv->comp); @@ -1021,6 +1024,9 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, } else ret = -ENOSYS; + if ((*qp_attr_mask & IB_QP_TIMEOUT) && id_priv->timeout_set) + qp_attr->timeout = id_priv->timeout; + return ret; } EXPORT_SYMBOL(rdma_init_qp_attr); @@ -2495,6 +2501,34 @@ void rdma_set_service_type(struct rdma_cm_id *id, int tos) } EXPORT_SYMBOL(rdma_set_service_type); +/** + * rdma_set_ack_timeout() - Set the ack timeout of QP associated + * with a connection identifier. + * @id: Communication identifier to associated with service type. + * @timeout: Ack timeout to set a QP, expressed as 4.096 * 2^(timeout) usec. + * + * This function should be called before rdma_connect() on active side, + * and on passive side before rdma_accept(). It is applicable to primary + * path only. The timeout will affect the local side of the QP, it is not + * negotiated with remote side and zero disables the timer. + * + * Return: 0 for success + */ +int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout) +{ + struct rdma_id_private *id_priv; + + if (id->qp_type != IB_QPT_RC) + return -EINVAL; + + id_priv = container_of(id, struct rdma_id_private, id); + id_priv->timeout = timeout; + id_priv->timeout_set = true; + + return 0; +} +EXPORT_SYMBOL(rdma_set_ack_timeout); + static void cma_query_handler(int status, struct ib_sa_path_rec *path_rec, void *context) { diff --git a/sys/ofed/drivers/infiniband/core/ib_ucma.c b/sys/ofed/drivers/infiniband/core/ib_ucma.c index 5ea2845c0fe5..19e4a17836ee 100644 --- a/sys/ofed/drivers/infiniband/core/ib_ucma.c +++ b/sys/ofed/drivers/infiniband/core/ib_ucma.c @@ -1204,6 +1204,13 @@ static int ucma_set_option_id(struct ucma_context *ctx, int optname, } ret = rdma_set_afonly(ctx->cm_id, *((int *) optval) ? 1 : 0); break; + case RDMA_OPTION_ID_ACK_TIMEOUT: + if (optlen != sizeof(u8)) { + ret = -EINVAL; + break; + } + ret = rdma_set_ack_timeout(ctx->cm_id, *((u8 *)optval)); + break; default: ret = -ENOSYS; } diff --git a/sys/ofed/include/rdma/rdma_cm.h b/sys/ofed/include/rdma/rdma_cm.h index b5ed43426969..8b9b38601325 100644 --- a/sys/ofed/include/rdma/rdma_cm.h +++ b/sys/ofed/include/rdma/rdma_cm.h @@ -385,6 +385,7 @@ int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse); */ int rdma_set_afonly(struct rdma_cm_id *id, int afonly); +int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout); /** * rdma_get_service_id - Return the IB service ID for a specified address. * @id: Communication identifier associated with the address. diff --git a/sys/ofed/include/uapi/rdma/rdma_user_cm.h b/sys/ofed/include/uapi/rdma/rdma_user_cm.h index 7c6ade294835..d93bc9abfe90 100644 --- a/sys/ofed/include/uapi/rdma/rdma_user_cm.h +++ b/sys/ofed/include/uapi/rdma/rdma_user_cm.h @@ -296,6 +296,10 @@ enum { RDMA_OPTION_ID_TOS = 0, RDMA_OPTION_ID_REUSEADDR = 1, RDMA_OPTION_ID_AFONLY = 2, + RDMA_OPTION_ID_ACK_TIMEOUT = 3 +}; + +enum { RDMA_OPTION_IB_PATH = 1 }; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C35666F6E2; Mon, 26 Jul 2021 16:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2s56cXz3plq; Mon, 26 Jul 2021 16:13:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 128F21A48C; Mon, 26 Jul 2021 16:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDd4B005738; Mon, 26 Jul 2021 16:13:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDdk5005737; Mon, 26 Jul 2021 16:13:39 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:39 GMT Message-Id: <202107261613.16QGDdk5005737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: d76e6346afbc - stable/13 - ibcore: Add new IB rates. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d76e6346afbc24260c2bbf4ad847ac03188facd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:43 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d76e6346afbc24260c2bbf4ad847ac03188facd4 commit d76e6346afbc24260c2bbf4ad847ac03188facd4 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Add new IB rates. Add the new rates that were added to Infiniband spec as part of HDR and 2x support. Linux commit: a5a5d1993696419e7d5357fc3128e53d219d382e Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 3d2fb36a9ce72053e8865852caad30044dbd1059) --- sys/ofed/drivers/infiniband/core/ib_verbs.c | 48 +++++++++++++++++------------ 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index b397a65fdd9d..9e06d079af31 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -127,20 +127,28 @@ EXPORT_SYMBOL(ib_wc_status_msg); __attribute_const__ int ib_rate_to_mult(enum ib_rate rate) { switch (rate) { - case IB_RATE_2_5_GBPS: return 1; - case IB_RATE_5_GBPS: return 2; - case IB_RATE_10_GBPS: return 4; - case IB_RATE_20_GBPS: return 8; - case IB_RATE_30_GBPS: return 12; - case IB_RATE_40_GBPS: return 16; - case IB_RATE_60_GBPS: return 24; - case IB_RATE_80_GBPS: return 32; - case IB_RATE_120_GBPS: return 48; + case IB_RATE_2_5_GBPS: return 1; + case IB_RATE_5_GBPS: return 2; + case IB_RATE_10_GBPS: return 4; + case IB_RATE_20_GBPS: return 8; + case IB_RATE_30_GBPS: return 12; + case IB_RATE_40_GBPS: return 16; + case IB_RATE_60_GBPS: return 24; + case IB_RATE_80_GBPS: return 32; + case IB_RATE_120_GBPS: return 48; + case IB_RATE_14_GBPS: return 6; + case IB_RATE_56_GBPS: return 22; + case IB_RATE_112_GBPS: return 45; + case IB_RATE_168_GBPS: return 67; + case IB_RATE_25_GBPS: return 10; + case IB_RATE_100_GBPS: return 40; + case IB_RATE_200_GBPS: return 80; + case IB_RATE_300_GBPS: return 120; 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; + default: return -1; } } EXPORT_SYMBOL(ib_rate_to_mult); @@ -148,15 +156,15 @@ EXPORT_SYMBOL(ib_rate_to_mult); __attribute_const__ enum ib_rate mult_to_ib_rate(int mult) { switch (mult) { - case 1: return IB_RATE_2_5_GBPS; - case 2: return IB_RATE_5_GBPS; - case 4: return IB_RATE_10_GBPS; - case 8: return IB_RATE_20_GBPS; - case 12: return IB_RATE_30_GBPS; - case 16: return IB_RATE_40_GBPS; - case 24: return IB_RATE_60_GBPS; - case 32: return IB_RATE_80_GBPS; - case 48: return IB_RATE_120_GBPS; + case 1: return IB_RATE_2_5_GBPS; + case 2: return IB_RATE_5_GBPS; + case 4: return IB_RATE_10_GBPS; + case 8: return IB_RATE_20_GBPS; + case 12: return IB_RATE_30_GBPS; + case 16: return IB_RATE_40_GBPS; + 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; @@ -169,7 +177,7 @@ __attribute_const__ enum ib_rate mult_to_ib_rate(int mult) 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; + default: return IB_RATE_PORT_CURRENT; } } EXPORT_SYMBOL(mult_to_ib_rate); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 831C866F72D; Mon, 26 Jul 2021 16:13:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2y73lfz3pZG; Mon, 26 Jul 2021 16:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B362E1A231; Mon, 26 Jul 2021 16:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDjeB005865; Mon, 26 Jul 2021 16:13:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDjnb005864; Mon, 26 Jul 2021 16:13:45 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:45 GMT Message-Id: <202107261613.16QGDjnb005864@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a7a80f17715c - stable/13 - mlx5: Add new timestamp mode bits. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a7a80f17715c7b71c9de66f127fb4b3e6b4b267a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:49 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a7a80f17715c7b71c9de66f127fb4b3e6b4b267a commit a7a80f17715c7b71c9de66f127fb4b3e6b4b267a Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:52 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5: Add new timestamp mode bits. These fields declare which timestamp mode is supported by the device per RQ/SQ/QP. In addition add the ts_format field to the select the mode for RQ/SQ/QP. Linux commit: a6a217dddcd544f6b75f0e2a60b6e84c1d494b7e Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 915fc66cb59faa543b852083233729c270d5aa3b) --- sys/dev/mlx5/mlx5_ifc.h | 56 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 494180630500..ce8074fba3f1 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -914,13 +914,19 @@ enum { MLX5_ROCE_CAP_L3_TYPE_IPV6 = 0x4, }; +enum { + MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_QP_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + struct mlx5_ifc_roce_cap_bits { u8 roce_apm[0x1]; u8 rts2rts_primary_eth_prio[0x1]; u8 roce_rx_allow_untagged[0x1]; u8 rts2rts_src_addr_index_for_vlan_valid_vlan_id[0x1]; - - u8 reserved_0[0x1c]; + u8 reserved_at_4[0x1a]; + u8 qp_ts_format[0x2]; u8 reserved_1[0x60]; @@ -1037,6 +1043,18 @@ enum { MLX5_CMD_HCA_CAP_CMDIF_CHECKSUM_ENABLED = 0x3, }; +enum { + MLX5_SQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_SQ_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_SQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + +enum { + MLX5_RQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING = 0x0, + MLX5_RQ_TIMESTAMP_FORMAT_CAP_REAL_TIME = 0x1, + MLX5_RQ_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME = 0x2, +}; + struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_0[0x80]; @@ -1274,7 +1292,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 general_obj_types[0x40]; - u8 reserved_at_440[0x8]; + u8 sq_ts_format[0x2]; + u8 rq_ts_format[0x2]; + u8 reserved_at_444[0x4]; u8 create_qp_start_hint[0x18]; u8 reserved_at_460[0x3]; @@ -1961,6 +1981,12 @@ enum { MLX5_QPC_CS_RES_UP_TO_64B = 0x2, }; +enum { + MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_QPC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_qpc_bits { u8 state[0x4]; u8 lag_tx_port_affinity[0x4]; @@ -1987,7 +2013,9 @@ struct mlx5_ifc_qpc_bits { u8 log_rq_stride[0x3]; u8 no_sq[0x1]; u8 log_sq_size[0x4]; - u8 reserved_7[0x6]; + u8 reserved_at_55[0x3]; + u8 ts_format[0x2]; + u8 reserved_at_5a[0x1]; u8 rlky[0x1]; u8 ulp_stateless_offload_mode[0x4]; @@ -2376,6 +2404,12 @@ enum { MLX5_SQC_STATE_ERR = 0x3, }; +enum { + MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_SQC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_sqc_bits { u8 rlkey[0x1]; u8 cd_master[0x1]; @@ -2386,7 +2420,9 @@ struct mlx5_ifc_sqc_bits { u8 state[0x4]; u8 reg_umr[0x1]; u8 allow_swp[0x1]; - u8 reserved_0[0x12]; + u8 reserved_at_e[0xc]; + u8 ts_format[0x2]; + u8 reserved_at_1c[0x4]; u8 reserved_1[0x8]; u8 user_index[0x18]; @@ -2492,6 +2528,12 @@ enum { MLX5_RQC_DROPLESS_MODE_ENABLE = 0x1, }; +enum { + MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING = 0x0, + MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT = 0x1, + MLX5_RQC_TIMESTAMP_FORMAT_REAL_TIME = 0x2, +}; + struct mlx5_ifc_rqc_bits { u8 rlkey[0x1]; u8 delay_drop_en[0x1]; @@ -2501,7 +2543,9 @@ struct mlx5_ifc_rqc_bits { u8 state[0x4]; u8 reserved_1[0x1]; u8 flush_in_error_en[0x1]; - u8 reserved_2[0x12]; + u8 reserved_at_e[0xc]; + u8 ts_format[0x2]; + u8 reserved_at_1c[0x4]; u8 reserved_3[0x8]; u8 user_index[0x18]; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D6FA66F66E; Mon, 26 Jul 2021 16:13:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ326ycgz3pXm; Mon, 26 Jul 2021 16:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3107C1A233; Mon, 26 Jul 2021 16:13:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDn7S005943; Mon, 26 Jul 2021 16:13:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDnvk005942; Mon, 26 Jul 2021 16:13:49 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:49 GMT Message-Id: <202107261613.16QGDnvk005942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: f52bc34a0635 - stable/13 - Fix LINT kernel build issues after c3987b8ea793c11f61fecb14ef93195a23e3522c . MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f52bc34a0635c813080075f1d5383e03992e0ba4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:53 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f52bc34a0635c813080075f1d5383e03992e0ba4 commit f52bc34a0635c813080075f1d5383e03992e0ba4 Author: Hans Petter Selasky AuthorDate: 2021-07-12 15:47:15 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 Fix LINT kernel build issues after c3987b8ea793c11f61fecb14ef93195a23e3522c . Fixes the IPOIB_CM and SDP kernel options. Reported by: lwhsu @ Sponsored by: NVIDIA Networking (cherry picked from commit 693ddf4dc4b9c1ffbe6373e186e1b121e3635f53) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 8 ++++---- sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c | 2 +- sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index b61ebfd1495a..1e386a04d6d9 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -92,7 +92,7 @@ static void ipoib_cm_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_cm_r static int ipoib_cm_post_receive_srq(struct ipoib_dev_priv *priv, int id) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct ipoib_rx_buf *rx_req; struct mbuf *m; int ret; @@ -124,7 +124,7 @@ static int ipoib_cm_post_receive_nonsrq(struct ipoib_dev_priv *priv, struct ib_sge *sge, int id) { struct ipoib_rx_buf *rx_req; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct mbuf *m; int ret; int i; @@ -172,7 +172,7 @@ static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv *priv) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ipoib_cm_rx *p; /* We only reserved 1 extra slot in CQ for drain WRs, so @@ -600,7 +600,7 @@ static inline int post_send(struct ipoib_dev_priv *priv, struct ipoib_cm_tx_buf *tx_req, unsigned int wr_id) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mbuf *mb = tx_req->mb; u64 *mapping = tx_req->mapping; struct mbuf *m; diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c index bb56e1c4d7d1..e20602a8d87c 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c @@ -103,7 +103,7 @@ sdp_post_recv(struct sdp_sock *ssk) struct ib_recv_wr rx_wr = { NULL }; struct ib_sge ibsge[SDP_MAX_RECV_SGES]; struct ib_sge *sge = ibsge; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; struct mbuf *mb, *m; struct sdp_bsdh *h; int id = ring_head(ssk->rx_ring); diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c index 0d35759e4b71..64f42ed8d569 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c @@ -69,7 +69,7 @@ sdp_post_send(struct sdp_sock *ssk, struct mbuf *mb) struct sdp_bsdh *h; unsigned long mseq; struct ib_device *dev; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_sge ibsge[SDP_MAX_SEND_SGES]; struct ib_sge *sge; struct ib_send_wr tx_wr = { NULL }; @@ -390,7 +390,8 @@ void sdp_post_keepalive(struct sdp_sock *ssk) { int rc; - struct ib_send_wr wr, *bad_wr; + struct ib_send_wr wr; + const struct ib_send_wr *bad_wr; sdp_dbg(ssk->socket, "%s\n", __func__); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78DCC66F6F1; Mon, 26 Jul 2021 16:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2v51Zgz3pfk; Mon, 26 Jul 2021 16:13:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D3321A48D; Mon, 26 Jul 2021 16:13:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDfg3005762; Mon, 26 Jul 2021 16:13:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDfAb005761; Mon, 26 Jul 2021 16:13:41 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:41 GMT Message-Id: <202107261613.16QGDfAb005761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 4c033941d0b9 - stable/13 - ibcore: Support rate limit for packet pacing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4c033941d0b9ddb78ab7cb9a0e8124f96df605f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:44 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4c033941d0b9ddb78ab7cb9a0e8124f96df605f7 commit 4c033941d0b9ddb78ab7cb9a0e8124f96df605f7 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Support rate limit for packet pacing Add new member rate_limit to ib_qp_attr which holds the packet pacing rate in kbps, 0 means unlimited. IB_QP_RATE_LIMIT is added to ib_attr_mask and could be used by RAW QPs when changing QP state from RTR to RTS, RTS to RTS. Linux commit: 528e5a1bd3f0e9b760cb3a1062fce7513712a15d Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 0c13880cccd75655c878ce31e767bce04b1d6e85) --- sys/ofed/drivers/infiniband/core/ib_verbs.c | 2 ++ sys/ofed/include/rdma/ib_verbs.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index 9e06d079af31..aabb416ddc21 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -1016,6 +1016,7 @@ static const struct { IB_QP_QKEY), [IB_QPT_GSI] = (IB_QP_CUR_STATE | IB_QP_QKEY), + [IB_QPT_RAW_PACKET] = IB_QP_RATE_LIMIT, } } }, @@ -1049,6 +1050,7 @@ static const struct { IB_QP_QKEY), [IB_QPT_GSI] = (IB_QP_CUR_STATE | IB_QP_QKEY), + [IB_QPT_RAW_PACKET] = IB_QP_RATE_LIMIT, } }, [IB_QPS_SQD] = { diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index b18aa2855166..cdbf2f5ce260 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -1132,6 +1132,7 @@ enum ib_qp_attr_mask { IB_QP_RESERVED2 = (1<<22), IB_QP_RESERVED3 = (1<<23), IB_QP_RESERVED4 = (1<<24), + IB_QP_RATE_LIMIT = (1<<25), }; enum ib_qp_state { @@ -1182,6 +1183,7 @@ struct ib_qp_attr { u8 rnr_retry; u8 alt_port_num; u8 alt_timeout; + u32 rate_limit; }; enum ib_wr_opcode { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E93E166F7B3; Mon, 26 Jul 2021 16:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3230LRz3pmM; Mon, 26 Jul 2021 16:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03EA31A232; Mon, 26 Jul 2021 16:13:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDljo005913; Mon, 26 Jul 2021 16:13:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDlGx005912; Mon, 26 Jul 2021 16:13:47 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:47 GMT Message-Id: <202107261613.16QGDlGx005912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 47f7e8e4231f - stable/13 - ibcore: Declare ib_post_send() and ib_post_recv() arguments const MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 47f7e8e4231f9e2dcf8e6d180ec1a7353c8f94a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:51 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=47f7e8e4231f9e2dcf8e6d180ec1a7353c8f94a6 commit 47f7e8e4231f9e2dcf8e6d180ec1a7353c8f94a6 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:54 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 ibcore: Declare ib_post_send() and ib_post_recv() arguments const Since neither ib_post_send() nor ib_post_recv() modify the data structure their second argument points at, declare that argument const. This change makes it necessary to declare the 'bad_wr' argument const too and also to modify all ULPs that call ib_post_send(), ib_post_recv() or ib_post_srq_recv(). This patch does not change any functionality but makes it possible for the compiler to verify whether the ib_post_(send|recv|srq_recv) really do not modify the posted work request. Linux commit: f696bf6d64b195b83ca1bdb7cd33c999c9dcf514 7bb1fafc2f163ad03a2007295bb2f57cfdbfb630 d34ac5cd3a73aacd11009c4fc3ba15d7ea62c411 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit c3987b8ea793c11f61fecb14ef93195a23e3522c) --- sys/contrib/rdma/krping/krping.c | 42 +++++++------- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 8 +-- sys/dev/cxgbe/iw_cxgbe/qp.c | 28 +++++----- sys/dev/iser/iser_memory.c | 3 +- sys/dev/iser/iser_verbs.c | 13 +++-- sys/dev/mlx4/mlx4_ib/mlx4_ib.h | 12 ++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c | 7 ++- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 28 +++++----- sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c | 4 +- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 22 ++++---- sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c | 8 +-- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 43 +++++++-------- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 70 +++++++++++++----------- sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c | 4 +- sys/dev/mthca/mthca_dev.h | 24 ++++---- sys/dev/mthca/mthca_qp.c | 24 ++++---- sys/dev/mthca/mthca_srq.c | 8 +-- sys/dev/qlnx/qlnxr/qlnxr_cm.c | 12 ++-- sys/dev/qlnx/qlnxr/qlnxr_cm.h | 8 +-- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 34 ++++++------ sys/dev/qlnx/qlnxr/qlnxr_verbs.h | 12 ++-- sys/ofed/drivers/infiniband/core/ib_mad.c | 9 +-- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 9 ++- sys/ofed/drivers/infiniband/core/ib_verbs.c | 5 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 4 +- sys/ofed/include/rdma/ib_verbs.h | 34 ++++++------ 26 files changed, 245 insertions(+), 230 deletions(-) diff --git a/sys/contrib/rdma/krping/krping.c b/sys/contrib/rdma/krping/krping.c index 75c874411bb3..da0a03af42cd 100644 --- a/sys/contrib/rdma/krping/krping.c +++ b/sys/contrib/rdma/krping/krping.c @@ -358,7 +358,7 @@ static void krping_cq_event_handler(struct ib_cq *cq, void *ctx) { struct krping_cb *cb = ctx; struct ib_wc wc; - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; BUG_ON(cb->cq != cq); @@ -705,7 +705,7 @@ err1: static u32 krping_rdma_rkey(struct krping_cb *cb, u64 buf, int post_inv) { u32 rkey; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ret; struct scatterlist sg = {0}; @@ -772,7 +772,8 @@ static void krping_format_send(struct krping_cb *cb, u64 buf) static void krping_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr, inv; + const struct ib_send_wr *bad_wr; + struct ib_send_wr inv; int ret; while (1) { @@ -913,7 +914,7 @@ static void rlat_test(struct krping_cb *cb) struct timeval start_tv, stop_tv; int ret; struct ib_wc wc; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ne; scnt = 0; @@ -1054,7 +1055,7 @@ static void wlat_test(struct krping_cb *cb) } if (scnt < iters) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; *buf = (char)scnt+1; if (scnt < cycle_iters) @@ -1187,7 +1188,7 @@ static void bw_test(struct krping_cb *cb) while (scnt < iters || ccnt < iters) { while (scnt < iters && scnt - ccnt < cb->txdepth) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; if (scnt < cycle_iters) post_cycles_start[scnt] = get_cycles(); @@ -1263,7 +1264,7 @@ done: static void krping_rlat_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1296,7 +1297,7 @@ static void krping_rlat_test_server(struct krping_cb *cb) static void krping_wlat_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1330,7 +1331,7 @@ static void krping_wlat_test_server(struct krping_cb *cb) static void krping_bw_test_server(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1434,7 +1435,7 @@ static int krping_bind_server(struct krping_cb *cb) static void krping_run_server(struct krping_cb *cb) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; ret = krping_bind_server(cb); @@ -1485,7 +1486,7 @@ err0: static void krping_test_client(struct krping_cb *cb) { int ping, start, cc, i, ret; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; unsigned char c; start = 65; @@ -1558,7 +1559,7 @@ static void krping_test_client(struct krping_cb *cb) static void krping_rlat_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1600,7 +1601,7 @@ static void krping_rlat_test_client(struct krping_cb *cb) suseconds_t usec; unsigned long long elapsed; struct ib_wc wc; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; int ne; cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; @@ -1648,7 +1649,7 @@ static void krping_rlat_test_client(struct krping_cb *cb) static void krping_wlat_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1687,7 +1688,7 @@ static void krping_wlat_test_client(struct krping_cb *cb) static void krping_bw_test_client(struct krping_cb *cb) { - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct ib_wc wc; int ret; @@ -1729,8 +1730,10 @@ static void krping_bw_test_client(struct krping_cb *cb) */ static void flush_qp(struct krping_cb *cb) { - struct ib_send_wr wr = { 0 }, *bad; - struct ib_recv_wr recv_wr = { 0 }, *recv_bad; + struct ib_send_wr wr = { 0 }; + const struct ib_send_wr *bad; + struct ib_recv_wr recv_wr = { 0 }; + const struct ib_recv_wr *recv_bad; struct ib_wc wc; int ret; int flushed = 0; @@ -1773,7 +1776,8 @@ static void flush_qp(struct krping_cb *cb) static void krping_fr_test(struct krping_cb *cb) { - struct ib_send_wr inv, *bad; + struct ib_send_wr inv; + const struct ib_send_wr *bad; struct ib_reg_wr fr; struct ib_wc wc; u8 key = 0; @@ -1922,7 +1926,7 @@ static int krping_bind_client(struct krping_cb *cb) static void krping_run_client(struct krping_cb *cb) { - struct ib_recv_wr *bad_wr; + const struct ib_recv_wr *bad_wr; int ret; /* set type of service, if any */ diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index aa94a40add1e..8314800c4e7b 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -920,10 +920,10 @@ void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx); int c4iw_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc); -int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param); int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog); int c4iw_destroy_listen(struct iw_cm_id *cm_id); diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index f999254a748c..eb314a6034c8 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -335,7 +335,7 @@ free_sq_qid: } static int build_immd(struct t4_sq *sq, struct fw_ri_immd *immdp, - struct ib_send_wr *wr, int max, u32 *plenp) + const struct ib_send_wr *wr, int max, u32 *plenp) { u8 *dstp, *srcp; u32 plen = 0; @@ -405,7 +405,7 @@ static int build_isgl(__be64 *queue_start, __be64 *queue_end, } static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, - struct ib_send_wr *wr, u8 *len16) + const struct ib_send_wr *wr, u8 *len16) { u32 plen; int size; @@ -472,7 +472,7 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, } static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, - struct ib_send_wr *wr, u8 *len16) + const struct ib_send_wr *wr, u8 *len16) { u32 plen; int size; @@ -514,7 +514,7 @@ static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, return 0; } -static int build_rdma_read(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16) +static int build_rdma_read(union t4_wr *wqe, const struct ib_send_wr *wr, u8 *len16) { if (wr->num_sge > 1) return -EINVAL; @@ -545,7 +545,7 @@ static int build_rdma_read(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16) } static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe, - struct ib_recv_wr *wr, u8 *len16) + const struct ib_recv_wr *wr, u8 *len16) { int ret; @@ -559,7 +559,7 @@ static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe, return 0; } -static int build_inv_stag(union t4_wr *wqe, struct ib_send_wr *wr, +static int build_inv_stag(union t4_wr *wqe, const struct ib_send_wr *wr, u8 *len16) { wqe->inv.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey); @@ -609,7 +609,7 @@ void c4iw_qp_rem_ref(struct ib_qp *qp) kref_put(&to_c4iw_qp(qp)->kref, queue_qp_free); } -static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) +static void complete_sq_drain_wr(struct c4iw_qp *qhp, const struct ib_send_wr *wr) { struct t4_cqe cqe = {}; struct c4iw_cq *schp; @@ -639,7 +639,7 @@ static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) spin_unlock_irqrestore(&schp->comp_handler_lock, flag); } -static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) +static void complete_rq_drain_wr(struct c4iw_qp *qhp, const struct ib_recv_wr *wr) { struct t4_cqe cqe = {}; struct c4iw_cq *rchp; @@ -670,7 +670,7 @@ static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) } static int build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr, - struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16) + const struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16) { __be64 *p = (__be64 *)fr->pbl; @@ -705,7 +705,7 @@ static int build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr, } static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, - struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16, + const struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16, bool dsgl_supported) { struct fw_ri_immd *imdp; @@ -772,8 +772,8 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, return 0; } -int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { int err = 0; u8 len16 = 0; @@ -912,8 +912,8 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, return err; } -int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { int err = 0; struct c4iw_qp *qhp; diff --git a/sys/dev/iser/iser_memory.c b/sys/dev/iser/iser_memory.c index ca3b557866b1..9cf48248741c 100644 --- a/sys/dev/iser/iser_memory.c +++ b/sys/dev/iser/iser_memory.c @@ -159,7 +159,8 @@ iser_fast_reg_mr(struct icl_iser_pdu *iser_pdu, struct ib_mr *mr = rsc->mr; struct ib_reg_wr fastreg_wr; struct ib_send_wr inv_wr; - struct ib_send_wr *bad_wr, *wr = NULL; + const struct ib_send_wr *bad_wr; + struct ib_send_wr *wr = NULL; int ret, n; /* if there a single dma entry, dma mr suffices */ diff --git a/sys/dev/iser/iser_verbs.c b/sys/dev/iser/iser_verbs.c index c9d42da2657b..c613764bd952 100644 --- a/sys/dev/iser/iser_verbs.c +++ b/sys/dev/iser/iser_verbs.c @@ -614,8 +614,8 @@ int iser_conn_terminate(struct iser_conn *iser_conn) { struct ib_conn *ib_conn = &iser_conn->ib_conn; - struct ib_send_wr *bad_send_wr; - struct ib_recv_wr *bad_recv_wr; + const struct ib_send_wr *bad_send_wr; + const struct ib_recv_wr *bad_recv_wr; int err = 0; /* terminate the iser conn only if the conn state is UP */ @@ -860,7 +860,8 @@ iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) int iser_post_recvl(struct iser_conn *iser_conn) { - struct ib_recv_wr rx_wr, *rx_wr_failed; + const struct ib_recv_wr *rx_wr_failed; + struct ib_recv_wr rx_wr; struct ib_conn *ib_conn = &iser_conn->ib_conn; struct ib_sge sge; int ib_ret; @@ -887,7 +888,8 @@ iser_post_recvl(struct iser_conn *iser_conn) int iser_post_recvm(struct iser_conn *iser_conn, int count) { - struct ib_recv_wr *rx_wr, *rx_wr_failed; + const struct ib_recv_wr *rx_wr_failed; + struct ib_recv_wr *rx_wr; int i, ib_ret; struct ib_conn *ib_conn = &iser_conn->ib_conn; unsigned int my_rx_head = iser_conn->rx_desc_head; @@ -925,7 +927,8 @@ int iser_post_send(struct ib_conn *ib_conn, struct iser_tx_desc *tx_desc, bool signal) { int ib_ret; - struct ib_send_wr send_wr, *send_wr_failed; + const struct ib_send_wr *send_wr_failed; + struct ib_send_wr send_wr; ib_dma_sync_single_for_device(ib_conn->device->ib_device, tx_desc->dma_addr, ISER_HEADERS_LEN, diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h index 100a06b75af7..544ed1913419 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib.h +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib.h @@ -760,8 +760,8 @@ int mlx4_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, int mlx4_ib_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr); int mlx4_ib_destroy_srq(struct ib_srq *srq); void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index); -int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, @@ -771,10 +771,10 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata); int mlx4_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); -int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx4_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx4_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int mad_ifc_flags, int port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c index 183ccecd2171..455b85f27942 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c @@ -485,7 +485,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, { struct ib_sge list; struct ib_ud_wr wr; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mlx4_ib_demux_pv_ctx *tun_ctx; struct mlx4_ib_demux_pv_qp *tun_qp; struct mlx4_rcv_tunnel_mad *tun_mad; @@ -1275,7 +1275,8 @@ static int mlx4_ib_post_pv_qp_buf(struct mlx4_ib_demux_pv_ctx *ctx, int index) { struct ib_sge sg_list; - struct ib_recv_wr recv_wr, *bad_recv_wr; + struct ib_recv_wr recv_wr; + const struct ib_recv_wr *bad_recv_wr; int size; size = (tun_qp->qp->qp_type == IB_QPT_UD) ? @@ -1326,7 +1327,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, { struct ib_sge list; struct ib_ud_wr wr; - struct ib_send_wr *bad_wr; + const struct ib_send_wr *bad_wr; struct mlx4_ib_demux_pv_ctx *sqp_ctx; struct mlx4_ib_demux_pv_qp *sqp; struct mlx4_mad_snd_buf *sqp_mad; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index 280ab6359dd1..9eebbd6bb978 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -2287,7 +2287,7 @@ static int vf_get_qp0_qkey(struct mlx4_dev *dev, int qpn, u32 *qkey) } static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp, - struct ib_ud_wr *wr, + const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct mlx4_ib_dev *mdev = to_mdev(sqp->qp.ibqp.device); @@ -2416,7 +2416,7 @@ static u8 sl_to_vl(struct mlx4_ib_dev *dev, u8 sl, int port_num) } #define MLX4_ROCEV2_QP1_SPORT 0xC000 -static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr, +static int build_mlx_header(struct mlx4_ib_sqp *sqp, const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct ib_device *ib_dev = sqp->qp.ibqp.device; @@ -2707,7 +2707,7 @@ static __be32 convert_access(int acc) } static void set_reg_seg(struct mlx4_wqe_fmr_seg *fseg, - struct ib_reg_wr *wr) + const struct ib_reg_wr *wr) { struct mlx4_ib_mr *mr = to_mmr(wr->mr); @@ -2737,7 +2737,7 @@ static __always_inline void set_raddr_seg(struct mlx4_wqe_raddr_seg *rseg, } static void set_atomic_seg(struct mlx4_wqe_atomic_seg *aseg, - struct ib_atomic_wr *wr) + const struct ib_atomic_wr *wr) { if (wr->wr.opcode == IB_WR_ATOMIC_CMP_AND_SWP) { aseg->swap_add = cpu_to_be64(wr->swap); @@ -2753,7 +2753,7 @@ static void set_atomic_seg(struct mlx4_wqe_atomic_seg *aseg, } static void set_masked_atomic_seg(struct mlx4_wqe_masked_atomic_seg *aseg, - struct ib_atomic_wr *wr) + const struct ib_atomic_wr *wr) { aseg->swap_add = cpu_to_be64(wr->swap); aseg->swap_add_mask = cpu_to_be64(wr->swap_mask); @@ -2762,7 +2762,7 @@ static void set_masked_atomic_seg(struct mlx4_wqe_masked_atomic_seg *aseg, } static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg, - struct ib_ud_wr *wr) + const struct ib_ud_wr *wr) { memcpy(dseg->av, &to_mah(wr->ah)->av, sizeof (struct mlx4_av)); dseg->dqpn = cpu_to_be32(wr->remote_qpn); @@ -2773,7 +2773,7 @@ static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg, static void set_tunnel_datagram_seg(struct mlx4_ib_dev *dev, struct mlx4_wqe_datagram_seg *dseg, - struct ib_ud_wr *wr, + const struct ib_ud_wr *wr, enum mlx4_ib_qp_type qpt) { union mlx4_ext_av *av = &to_mah(wr->ah)->av; @@ -2795,7 +2795,7 @@ static void set_tunnel_datagram_seg(struct mlx4_ib_dev *dev, dseg->qkey = cpu_to_be32(IB_QP_SET_QKEY); } -static void build_tunnel_header(struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) +static void build_tunnel_header(const struct ib_ud_wr *wr, void *wqe, unsigned *mlx_seg_len) { struct mlx4_wqe_inline_seg *inl = wqe; struct mlx4_ib_tunnel_header hdr; @@ -2878,7 +2878,7 @@ static void __set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ib_sge *sg) dseg->addr = cpu_to_be64(sg->addr); } -static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_ud_wr *wr, +static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, const struct ib_ud_wr *wr, struct mlx4_ib_qp *qp, unsigned *lso_seg_len, __be32 *lso_hdr_sz, __be32 *blh) { @@ -2898,7 +2898,7 @@ static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_ud_wr *wr, return 0; } -static __be32 send_ieth(struct ib_send_wr *wr) +static __be32 send_ieth(const struct ib_send_wr *wr) { switch (wr->opcode) { case IB_WR_SEND_WITH_IMM: @@ -2920,8 +2920,8 @@ static void add_zero_len_inline(void *wqe) inl->byte_count = cpu_to_be32(1U << 31); } -int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int mlx4_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { struct mlx4_ib_qp *qp = to_mqp(ibqp); void *wqe; @@ -3255,8 +3255,8 @@ out: return err; } -int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx4_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx4_ib_qp *qp = to_mqp(ibqp); struct mlx4_wqe_data_seg *scat; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c index a2e55db37125..a040b673dae9 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c @@ -311,8 +311,8 @@ void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index) spin_unlock(&srq->lock); } -int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx4_ib_srq *srq = to_msrq(ibsrq); struct mlx4_wqe_srq_next_seg *next; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 44a9aa307be7..695b1ab14948 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -449,7 +449,7 @@ struct mlx5_umr_wr { u32 mkey; }; -static inline struct mlx5_umr_wr *umr_wr(struct ib_send_wr *wr) +static inline const struct mlx5_umr_wr *umr_wr(const struct ib_send_wr *wr) { return container_of(wr, struct mlx5_umr_wr, wr); } @@ -837,8 +837,8 @@ int mlx5_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); int mlx5_ib_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr); int mlx5_ib_destroy_srq(struct ib_srq *srq); -int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata); @@ -847,10 +847,10 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); int mlx5_ib_destroy_qp(struct ib_qp *qp); -int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx5_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx5_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); void *mlx5_get_send_wqe(struct mlx5_ib_qp *qp, int n); int mlx5_ib_read_user_wqe(struct mlx5_ib_qp *qp, int send, int wqe_index, void *buffer, u32 length, @@ -994,10 +994,10 @@ int mlx5_ib_gsi_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr, int mlx5_ib_gsi_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); -int mlx5_ib_gsi_post_send(struct ib_qp *qp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr); -int mlx5_ib_gsi_post_recv(struct ib_qp *qp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr); +int mlx5_ib_gsi_post_send(struct ib_qp *qp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr); +int mlx5_ib_gsi_post_recv(struct ib_qp *qp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr); void mlx5_ib_gsi_pkey_change(struct mlx5_ib_gsi_qp *gsi); int mlx5_ib_generate_wc(struct ib_cq *ibcq, struct ib_wc *wc); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c index 6c0417851665..dc90b1348378 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c @@ -472,8 +472,8 @@ static struct ib_qp *get_tx_qp(struct mlx5_ib_gsi_qp *gsi, struct ib_ud_wr *wr) return gsi->tx_qps[qp_index]; } -int mlx5_ib_gsi_post_send(struct ib_qp *qp, struct ib_send_wr *wr, - struct ib_send_wr **bad_wr) +int mlx5_ib_gsi_post_send(struct ib_qp *qp, const struct ib_send_wr *wr, + const struct ib_send_wr **bad_wr) { struct mlx5_ib_gsi_qp *gsi = gsi_qp(qp); struct ib_qp *tx_qp; @@ -517,8 +517,8 @@ err: return ret; } -int mlx5_ib_gsi_post_recv(struct ib_qp *qp, struct ib_recv_wr *wr, - struct ib_recv_wr **bad_wr) +int mlx5_ib_gsi_post_recv(struct ib_qp *qp, const struct ib_recv_wr *wr, + const struct ib_recv_wr **bad_wr) { struct mlx5_ib_gsi_qp *gsi = gsi_qp(qp); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c index 585e52d35d3b..145ec55d6757 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c @@ -573,41 +573,38 @@ static int dma_map_mr_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, return 0; } -static void prep_umr_wqe_common(struct ib_pd *pd, struct ib_send_wr *wr, +static void prep_umr_wqe_common(struct ib_pd *pd, struct mlx5_umr_wr *umrwr, struct ib_sge *sg, u64 dma, int n, u32 key, int page_shift) { struct mlx5_ib_dev *dev = to_mdev(pd->device); - struct mlx5_umr_wr *umrwr = umr_wr(wr); sg->addr = dma; sg->length = ALIGN(sizeof(u64) * n, 64); sg->lkey = dev->umrc.pd->local_dma_lkey; - wr->next = NULL; - wr->sg_list = sg; + umrwr->wr.next = NULL; + umrwr->wr.sg_list = sg; if (n) - wr->num_sge = 1; + umrwr->wr.num_sge = 1; else - wr->num_sge = 0; + umrwr->wr.num_sge = 0; - wr->opcode = MLX5_IB_WR_UMR; + umrwr->wr.opcode = MLX5_IB_WR_UMR; umrwr->npages = n; umrwr->page_shift = page_shift; umrwr->mkey = key; } -static void prep_umr_reg_wqe(struct ib_pd *pd, struct ib_send_wr *wr, +static void prep_umr_reg_wqe(struct ib_pd *pd, struct mlx5_umr_wr *umrwr, struct ib_sge *sg, u64 dma, int n, u32 key, int page_shift, u64 virt_addr, u64 len, int access_flags) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + prep_umr_wqe_common(pd, umrwr, sg, dma, n, key, page_shift); - prep_umr_wqe_common(pd, wr, sg, dma, n, key, page_shift); - - wr->send_flags = 0; + umrwr->wr.send_flags = 0; umrwr->target.virt_addr = virt_addr; umrwr->length = len; @@ -616,12 +613,10 @@ static void prep_umr_reg_wqe(struct ib_pd *pd, struct ib_send_wr *wr, } static void prep_umr_unreg_wqe(struct mlx5_ib_dev *dev, - struct ib_send_wr *wr, u32 key) + struct mlx5_umr_wr *umrwr, u32 key) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); - - wr->send_flags = MLX5_IB_SEND_UMR_UNREG | MLX5_IB_SEND_UMR_FAIL_IF_FREE; - wr->opcode = MLX5_IB_WR_UMR; + umrwr->wr.send_flags = MLX5_IB_SEND_UMR_UNREG | MLX5_IB_SEND_UMR_FAIL_IF_FREE; + umrwr->wr.opcode = MLX5_IB_WR_UMR; umrwr->mkey = key; } @@ -675,7 +670,7 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, struct umr_common *umrc = &dev->umrc; struct mlx5_ib_umr_context umr_context; struct mlx5_umr_wr umrwr = {}; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_ib_mr *mr; struct ib_sge sg; int size; @@ -707,7 +702,7 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, mlx5_ib_init_umr_context(&umr_context); umrwr.wr.wr_cqe = &umr_context.cqe; - prep_umr_reg_wqe(pd, &umrwr.wr, &sg, dma, npages, mr->mmkey.key, + prep_umr_reg_wqe(pd, &umrwr, &sg, dma, npages, mr->mmkey.key, page_shift, virt_addr, len, access_flags); down(&umrc->sem); @@ -756,7 +751,7 @@ int mlx5_ib_update_mtt(struct mlx5_ib_mr *mr, u64 start_page_index, int npages, int size; __be64 *pas; dma_addr_t dma; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_umr_wr wr; struct ib_sge sg; int err = 0; @@ -1026,7 +1021,7 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) struct umr_common *umrc = &dev->umrc; struct mlx5_ib_umr_context umr_context; struct mlx5_umr_wr umrwr = {}; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; int err; if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) @@ -1035,7 +1030,7 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) mlx5_ib_init_umr_context(&umr_context); umrwr.wr.wr_cqe = &umr_context.cqe; - prep_umr_unreg_wqe(dev, &umrwr.wr, mr->mmkey.key); + prep_umr_unreg_wqe(dev, &umrwr, mr->mmkey.key); down(&umrc->sem); err = ib_post_send(umrc->qp, &umrwr.wr, &bad); @@ -1065,7 +1060,7 @@ static int rereg_umr(struct ib_pd *pd, struct mlx5_ib_mr *mr, u64 virt_addr, struct mlx5_ib_dev *dev = to_mdev(pd->device); struct device *ddev = dev->ib_dev.dma_device; struct mlx5_ib_umr_context umr_context; - struct ib_send_wr *bad; + const struct ib_send_wr *bad; struct mlx5_umr_wr umrwr = {}; struct ib_sge sg; struct umr_common *umrc = &dev->umrc; @@ -1090,7 +1085,7 @@ static int rereg_umr(struct ib_pd *pd, struct mlx5_ib_mr *mr, u64 virt_addr, umrwr.wr.send_flags |= MLX5_IB_SEND_UMR_UPDATE_TRANSLATION; } - prep_umr_wqe_common(pd, &umrwr.wr, &sg, dma, npages, mr->mmkey.key, + prep_umr_wqe_common(pd, &umrwr, &sg, dma, npages, mr->mmkey.key, page_shift); if (flags & IB_MR_REREG_PD) { diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index ec47b3e07b87..90c6d69e30c2 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -3028,7 +3028,7 @@ static __always_inline void set_raddr_seg(struct mlx5_wqe_raddr_seg *rseg, } static void *set_eth_seg(struct mlx5_wqe_eth_seg *eseg, - struct ib_send_wr *wr, void *qend, + const struct ib_send_wr *wr, void *qend, struct mlx5_ib_qp *qp, int *size) { void *seg = eseg; @@ -3081,7 +3081,7 @@ static void *set_eth_seg(struct mlx5_wqe_eth_seg *eseg, } static void set_datagram_seg(struct mlx5_wqe_datagram_seg *dseg, - struct ib_send_wr *wr) + const struct ib_send_wr *wr) { memcpy(&dseg->av, &to_mah(ud_wr(wr)->ah)->av, sizeof(struct mlx5_av)); dseg->av.dqp_dct = cpu_to_be32(ud_wr(wr)->remote_qpn | MLX5_EXTENDED_UD_AV); @@ -3240,9 +3240,9 @@ static __be64 get_umr_update_pd_mask(void) } static void set_reg_umr_segment(struct mlx5_wqe_umr_ctrl_seg *umr, - struct ib_send_wr *wr) + const struct ib_send_wr *wr) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + const struct mlx5_umr_wr *umrwr = umr_wr(wr); memset(umr, 0, sizeof(*umr)); @@ -3311,9 +3311,9 @@ static void set_linv_mkey_seg(struct mlx5_mkey_seg *seg) seg->status = MLX5_MKEY_STATUS_FREE; } -static void set_reg_mkey_segment(struct mlx5_mkey_seg *seg, struct ib_send_wr *wr) +static void set_reg_mkey_segment(struct mlx5_mkey_seg *seg, const struct ib_send_wr *wr) { - struct mlx5_umr_wr *umrwr = umr_wr(wr); + const struct mlx5_umr_wr *umrwr = umr_wr(wr); memset(seg, 0, sizeof(*seg)); if (wr->send_flags & MLX5_IB_SEND_UMR_UNREG) { @@ -3344,7 +3344,7 @@ static void set_reg_data_seg(struct mlx5_wqe_data_seg *dseg, dseg->lkey = cpu_to_be32(pd->ibpd.local_dma_lkey); } -static __be32 send_ieth(struct ib_send_wr *wr) +static __be32 send_ieth(const struct ib_send_wr *wr) { switch (wr->opcode) { case IB_WR_SEND_WITH_IMM: @@ -3376,7 +3376,7 @@ static u8 wq_sig(void *wqe) return calc_sig(wqe, (*((u8 *)wqe + 8) & 0x3f) << 4); } -static int set_data_inl_seg(struct mlx5_ib_qp *qp, struct ib_send_wr *wr, +static int set_data_inl_seg(struct mlx5_ib_qp *qp, const struct ib_send_wr *wr, void *wqe, int *sz) { struct mlx5_wqe_inline_seg *seg; @@ -3522,7 +3522,7 @@ static int mlx5_set_bsf(struct ib_mr *sig_mr, return 0; } -static int set_sig_data_segment(struct ib_sig_handover_wr *wr, +static int set_sig_data_segment(const struct ib_sig_handover_wr *wr, struct mlx5_ib_qp *qp, void **seg, int *size) { struct ib_sig_attrs *sig_attrs = wr->sig_attrs; @@ -3624,7 +3624,7 @@ static int set_sig_data_segment(struct ib_sig_handover_wr *wr, } static void set_sig_mkey_segment(struct mlx5_mkey_seg *seg, - struct ib_sig_handover_wr *wr, u32 nelements, + const struct ib_sig_handover_wr *wr, u32 nelements, u32 length, u32 pdn) { struct ib_mr *sig_mr = wr->sig_mr; @@ -3655,10 +3655,10 @@ static void set_sig_umr_segment(struct mlx5_wqe_umr_ctrl_seg *umr, } -static int set_sig_umr_wr(struct ib_send_wr *send_wr, struct mlx5_ib_qp *qp, +static int set_sig_umr_wr(const struct ib_send_wr *send_wr, struct mlx5_ib_qp *qp, void **seg, int *size) { - struct ib_sig_handover_wr *wr = sig_handover_wr(send_wr); + const struct ib_sig_handover_wr *wr = sig_handover_wr(send_wr); struct mlx5_ib_mr *sig_mr = to_mmr(wr->sig_mr); u32 pdn = get_pd(qp)->pdn; u32 klm_oct_size; @@ -3732,7 +3732,7 @@ static int set_psv_wr(struct ib_sig_domain *domain, } static int set_reg_wr(struct mlx5_ib_qp *qp, - struct ib_reg_wr *wr, + const struct ib_reg_wr *wr, void **seg, int *size) { struct mlx5_ib_mr *mr = to_mmr(wr->mr); @@ -3797,7 +3797,7 @@ static void dump_wqe(struct mlx5_ib_qp *qp, int idx, int size_16) } } -static u8 get_fence(u8 fence, struct ib_send_wr *wr) +static u8 get_fence(u8 fence, const struct ib_send_wr *wr) { if (unlikely(wr->opcode == IB_WR_LOCAL_INV && wr->send_flags & IB_SEND_FENCE)) @@ -3815,10 +3815,10 @@ static u8 get_fence(u8 fence, struct ib_send_wr *wr) return 0; } -static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, - struct mlx5_wqe_ctrl_seg **ctrl, - struct ib_send_wr *wr, unsigned *idx, - int *size, int nreq) +static int __begin_wqe(struct mlx5_ib_qp *qp, void **seg, + struct mlx5_wqe_ctrl_seg **ctrl, + const struct ib_send_wr *wr, unsigned *idx, + int *size, int nreq, bool send_signaled, bool solicited) { if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq))) return -ENOMEM; @@ -3829,10 +3829,8 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, *(uint32_t *)(*seg + 8) = 0; (*ctrl)->imm = send_ieth(wr); (*ctrl)->fm_ce_se = qp->sq_signal_bits | - (wr->send_flags & IB_SEND_SIGNALED ? - MLX5_WQE_CTRL_CQ_UPDATE : 0) | - (wr->send_flags & IB_SEND_SOLICITED ? - MLX5_WQE_CTRL_SOLICITED : 0); + (send_signaled ? MLX5_WQE_CTRL_CQ_UPDATE : 0) | + (solicited ? MLX5_WQE_CTRL_SOLICITED : 0); *seg += sizeof(**ctrl); *size = sizeof(**ctrl) / 16; @@ -3840,6 +3838,16 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, return 0; } +static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, + struct mlx5_wqe_ctrl_seg **ctrl, + const struct ib_send_wr *wr, unsigned *idx, + int *size, int nreq) +{ + return __begin_wqe(qp, seg, ctrl, wr, idx, size, nreq, + wr->send_flags & IB_SEND_SIGNALED, + wr->send_flags & IB_SEND_SOLICITED); +} + static void finish_wqe(struct mlx5_ib_qp *qp, *** 655 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:14:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5801C66F951; Mon, 26 Jul 2021 16:14:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3P6TyTz3pxD; Mon, 26 Jul 2021 16:14:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51B1419E4F; Mon, 26 Jul 2021 16:14:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGE6wB006321; Mon, 26 Jul 2021 16:14:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE69n006320; Mon, 26 Jul 2021 16:14:06 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:06 GMT Message-Id: <202107261614.16QGE69n006320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 9661887500f8 - stable/13 - Fix mismerge in OFED update MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9661887500f8231706ae87b47941af678ad48164 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:14:11 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9661887500f8231706ae87b47941af678ad48164 commit 9661887500f8231706ae87b47941af678ad48164 Author: Hans Petter Selasky AuthorDate: 2021-07-26 16:12:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:12:35 +0000 Fix mismerge in OFED update When OFED was upgraded to Linux v4.9, a bunch of Linux-specific netlink changes were dropped. Unfortunately, there was a mismerge in this process and as a result ib_sa_cancel_query() would fail to cancel an outstanding MAD. This was causing rdma_destroy_id() to hang indefinitely waiting for the MAD to complete and release the final reference. Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D28421 Reviewed by: hselasky, kib (cherry picked from commit 8a06ca2f734c726799688d65a7dad67284275438) --- sys/ofed/drivers/infiniband/core/ib_sa_query.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_sa_query.c b/sys/ofed/drivers/infiniband/core/ib_sa_query.c index ce9c7f8a8998..b423d78d0407 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sa_query.c +++ b/sys/ofed/drivers/infiniband/core/ib_sa_query.c @@ -622,6 +622,8 @@ void ib_sa_cancel_query(int id, struct ib_sa_query *query) agent = query->port->agent; mad_buf = query->mad_buf; spin_unlock_irqrestore(&idr_lock, flags); + + ib_cancel_mad(agent, mad_buf); } EXPORT_SYMBOL(ib_sa_cancel_query); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD60766F91B; Mon, 26 Jul 2021 16:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2x3ztpz3pnc; Mon, 26 Jul 2021 16:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 891E51A48F; Mon, 26 Jul 2021 16:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDijR005841; Mon, 26 Jul 2021 16:13:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDixw005840; Mon, 26 Jul 2021 16:13:44 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:44 GMT Message-Id: <202107261613.16QGDixw005840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: ee9aeb312c4c - stable/13 - ibcore: Implement ib_uverbs_get_ucontext_file(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ee9aeb312c4c5fd58e4ae15567c87d9b04990f89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:48 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ee9aeb312c4c5fd58e4ae15567c87d9b04990f89 commit ee9aeb312c4c5fd58e4ae15567c87d9b04990f89 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Implement ib_uverbs_get_ucontext_file(). Expose ib_ucontext from a given ib_uverbs_file. Drivers that use the ioctl(9) API may have the ib_uverbs_file and need a way to get the related ib_ucontext from it, this is enabled by this patch. Downstream patches from this series will use it. Linux commit: 7dc08dcfc8c86cb4457e383734ff6844ddaff876 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 79b817084ca891e465fe1a868ef1d9f1a3f33a69) --- sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 24 +++++++++++++++++++++++ sys/ofed/include/rdma/ib_verbs.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index dff566e71f99..38016681b819 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -146,6 +146,30 @@ static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file, static void ib_uverbs_add_one(struct ib_device *device); static void ib_uverbs_remove_one(struct ib_device *device, void *client_data); +/* + * Must be called with the ufile->device->disassociate_srcu held, and the lock + * must be held until use of the ucontext is finished. + */ +struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile) +{ + /* + * We do not hold the hw_destroy_rwsem lock for this flow, instead + * srcu is used. It does not matter if someone races this with + * get_context, we get NULL or valid ucontext. + */ + struct ib_ucontext *ucontext = READ_ONCE(ufile->ucontext); + + if (!srcu_dereference(ufile->device->ib_dev, + &ufile->device->disassociate_srcu)) + return ERR_PTR(-EIO); + + if (!ucontext) + return ERR_PTR(-EINVAL); + + return ucontext; +} +EXPORT_SYMBOL(ib_uverbs_get_ucontext_file); + int uverbs_dealloc_mw(struct ib_mw *mw) { struct ib_pd *pd = mw->pd; diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 353181a8d790..da17bc9f8250 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -67,6 +67,7 @@ struct ifla_vf_info; struct ifla_vf_stats; +struct ib_uverbs_file; extern struct workqueue_struct *ib_wq; extern struct workqueue_struct *ib_comp_wq; @@ -3390,6 +3391,8 @@ void ib_drain_rq(struct ib_qp *qp); void ib_drain_sq(struct ib_qp *qp); void ib_drain_qp(struct ib_qp *qp); +struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile); + int ib_resolve_eth_dmac(struct ib_device *device, struct ib_ah_attr *ah_attr); #endif /* IB_VERBS_H */ From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77A6466F6F6; Mon, 26 Jul 2021 16:13:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2z1JN8z3pcb; Mon, 26 Jul 2021 16:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2CF71A44D; Mon, 26 Jul 2021 16:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDk0V005889; Mon, 26 Jul 2021 16:13:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDkSO005888; Mon, 26 Jul 2021 16:13:46 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:46 GMT Message-Id: <202107261613.16QGDkSO005888@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: b383248ef6dc - stable/13 - mlx5: Set default timestamp format for mlx5en(4) and mlx5ib. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b383248ef6dce0019856de495840b810dad18cb1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:48 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b383248ef6dce0019856de495840b810dad18cb1 commit b383248ef6dce0019856de495840b810dad18cb1 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:53 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5: Set default timestamp format for mlx5en(4) and mlx5ib. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4fb0a74e081772fc6fc2a43222ee072fd089bf5f) --- sys/dev/mlx5/driver.h | 21 +++++++++++++++++++++ sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 7 ++++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 14 +++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index 5d4f58d7e1fd..c36380505fbb 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -1202,4 +1202,25 @@ static inline bool mlx5_rl_is_supported(struct mlx5_core_dev *dev) void mlx5_disable_interrupts(struct mlx5_core_dev *); void mlx5_poll_interrupts(struct mlx5_core_dev *); +static inline int mlx5_get_qp_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_ROCE(dev, qp_ts_format) ? + MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT; +} + +static inline int mlx5_get_rq_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_GEN(dev, rq_ts_format) ? + MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT; +} + +static inline int mlx5_get_sq_default_ts(struct mlx5_core_dev *dev) +{ + return !MLX5_CAP_GEN(dev, sq_ts_format) ? + MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING : + MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT; +} + #endif /* MLX5_DRIVER_H */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 57da44e68de3..fc9ffc01a0df 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1350,12 +1350,12 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) struct mlx5e_channel *c = rq->channel; struct mlx5e_priv *priv = c->priv; struct mlx5_core_dev *mdev = priv->mdev; - void *in; void *rqc; void *wq; int inlen; int err; + u8 ts_format; inlen = MLX5_ST_SZ_BYTES(create_rq_in) + sizeof(u64) * rq->wq_ctrl.buf.npages; @@ -1363,6 +1363,7 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) if (in == NULL) return (-ENOMEM); + ts_format = mlx5_get_rq_default_ts(mdev); rqc = MLX5_ADDR_OF(create_rq_in, in, ctx); wq = MLX5_ADDR_OF(rqc, rqc, wq); @@ -1370,6 +1371,7 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) MLX5_SET(rqc, rqc, cqn, c->rq.cq.mcq.cqn); MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); + MLX5_SET(rqc, rqc, ts_format, ts_format); MLX5_SET(rqc, rqc, flush_in_error_en, 1); if (priv->counter_set_id >= 0) MLX5_SET(rqc, rqc, counter_set_id, priv->counter_set_id); @@ -1673,6 +1675,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, void *wq; int inlen; int err; + u8 ts_format; inlen = MLX5_ST_SZ_BYTES(create_sq_in) + sizeof(u64) * sq->wq_ctrl.buf.npages; @@ -1680,6 +1683,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, if (in == NULL) return (-ENOMEM); + ts_format = mlx5_get_sq_default_ts(sq->priv->mdev); sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); wq = MLX5_ADDR_OF(sqc, sqc, wq); @@ -1688,6 +1692,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, tis_num_0, tis_num); MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn); MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); + MLX5_SET(sqc, sqc, ts_format, ts_format); MLX5_SET(sqc, sqc, tis_lst_sz, 1); MLX5_SET(sqc, sqc, flush_in_error_en, 1); MLX5_SET(sqc, sqc, allow_swp, 1); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 54a091548faf..ec47b3e07b87 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2020, Mellanox Technologies. All rights reserved. + * Copyright (c) 2013-2021, Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -962,6 +962,7 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, qpc = MLX5_ADDR_OF(create_qp_in, *in, qpc); MLX5_SET(qpc, qpc, uar_page, uar_index); + MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev)); MLX5_SET(qpc, qpc, log_page_size, qp->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT); /* Set "fast registration enabled" for all kernel QPs */ @@ -1075,6 +1076,9 @@ static int create_raw_packet_qp_sq(struct mlx5_ib_dev *dev, int npages; int ncont = 0; u32 offset = 0; + u8 ts_format; + + ts_format = mlx5_get_sq_default_ts(dev->mdev); err = mlx5_ib_umem_get(dev, pd, ubuffer->buf_addr, ubuffer->buf_size, &sq->ubuffer.umem, &npages, &page_shift, @@ -1092,6 +1096,7 @@ static int create_raw_packet_qp_sq(struct mlx5_ib_dev *dev, sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); MLX5_SET(sqc, sqc, flush_in_error_en, 1); MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST); + MLX5_SET(sqc, sqc, ts_format, ts_format); MLX5_SET(sqc, sqc, user_index, MLX5_GET(qpc, qpc, user_index)); MLX5_SET(sqc, sqc, cqn, MLX5_GET(qpc, qpc, cqn_snd)); MLX5_SET(sqc, sqc, tis_lst_sz, 1); @@ -1161,6 +1166,9 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev, int inlen; int err; u32 rq_pas_size = get_rq_pas_size(qpc); + u8 ts_format; + + ts_format = mlx5_get_rq_default_ts(dev->mdev); inlen = MLX5_ST_SZ_BYTES(create_rq_in) + rq_pas_size; in = mlx5_vzalloc(inlen); @@ -1171,6 +1179,7 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev, MLX5_SET(rqc, rqc, vlan_strip_disable, 1); MLX5_SET(rqc, rqc, mem_rq_type, MLX5_RQC_RQ_TYPE_MEMORY_RQ_INLINE); MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); + MLX5_SET(rqc, rqc, ts_format, ts_format); MLX5_SET(rqc, rqc, flush_in_error_en, 1); MLX5_SET(rqc, rqc, user_index, MLX5_GET(qpc, qpc, user_index)); MLX5_SET(rqc, rqc, cqn, MLX5_GET(qpc, qpc, cqn_rcv)); @@ -1754,6 +1763,9 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, MLX5_SET(qpc, qpc, log_rq_size, ilog2(qp->rq.wqe_cnt)); } + if (init_attr->qp_type != IB_QPT_RAW_PACKET) + MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev)); + MLX5_SET(qpc, qpc, rq_type, get_rx_type(qp, init_attr)); if (qp->sq.wqe_cnt) From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDDB466F857; Mon, 26 Jul 2021 16:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3B4ZXtz3ptc; Mon, 26 Jul 2021 16:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDC741A23A; Mon, 26 Jul 2021 16:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDtgd006093; Mon, 26 Jul 2021 16:13:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDtpv006092; Mon, 26 Jul 2021 16:13:55 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:55 GMT Message-Id: <202107261613.16QGDtpv006092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: cd08d4c53775 - stable/13 - mlx4ib and mlx5ib: Set slid to zero in Ethernet completion struct MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cd08d4c53775bb470044aa6001dc1647200d44e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:59 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cd08d4c53775bb470044aa6001dc1647200d44e0 commit cd08d4c53775bb470044aa6001dc1647200d44e0 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx4ib and mlx5ib: Set slid to zero in Ethernet completion struct IB spec says that a lid should be ignored when link layer is Ethernet, for example when building or parsing a CM request message (CA17-34). However, since ib_lid_be16() and ib_lid_cpu16() validates the slid, not only when link layer is IB, we set the slid to zero to prevent false warnings in the kernel log. Linux commit: 65389322b28f81cc137b60a41044c2d958a7b950 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 30416d4e827341be32c3e415f16c73f252a68d85) --- sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c | 4 +++- sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c index d9f3a719e030..215c428e7af7 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c @@ -593,6 +593,7 @@ static void use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct wc->dlid_path_bits = 0; if (is_eth) { + wc->slid = 0; wc->vlan_id = be16_to_cpu(hdr->tun.sl_vid); memcpy(&(wc->smac[0]), (char *)&hdr->tun.mac_31_0, 4); memcpy(&(wc->smac[4]), (char *)&hdr->tun.slid_mac_47_32, 2); @@ -841,7 +842,6 @@ repoll: } } - wc->slid = be16_to_cpu(cqe->rlid); g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); wc->src_qp = g_mlpath_rqpn & 0xffffff; wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; @@ -850,6 +850,7 @@ repoll: wc->wc_flags |= mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum) ? IB_WC_IP_CSUM_OK : 0; if (is_eth) { + wc->slid = 0; wc->sl = be16_to_cpu(cqe->sl_vid) >> 13; if (be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_CVLAN_PRESENT_MASK) { @@ -861,6 +862,7 @@ repoll: memcpy(wc->smac, cqe->smac, ETH_ALEN); wc->wc_flags |= (IB_WC_WITH_VLAN | IB_WC_WITH_SMAC); } else { + wc->slid = be16_to_cpu(cqe->rlid); wc->sl = be16_to_cpu(cqe->sl_vid) >> 12; wc->vlan_id = 0xffff; } diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c index 3c37df82199f..495aabb01bfe 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c @@ -219,7 +219,6 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, wc->ex.invalidate_rkey = be32_to_cpu(cqe->imm_inval_pkey); break; } - wc->slid = be16_to_cpu(cqe->slid); wc->src_qp = be32_to_cpu(cqe->flags_rqpn) & 0xffffff; wc->dlid_path_bits = cqe->ml_path; g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3; @@ -234,10 +233,12 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, } if (ll != IB_LINK_LAYER_ETHERNET) { + wc->slid = be16_to_cpu(cqe->slid); wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf; return; } + wc->slid = 0; vlan_present = cqe_has_vlan(cqe); roce_packet_type = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0x3; if (vlan_present) { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 393E966F6F2; Mon, 26 Jul 2021 16:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2w6d4Hz3pfq; Mon, 26 Jul 2021 16:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 507D31A44C; Mon, 26 Jul 2021 16:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDgSJ005786; Mon, 26 Jul 2021 16:13:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDgOl005785; Mon, 26 Jul 2021 16:13:42 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:42 GMT Message-Id: <202107261613.16QGDgOl005785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1c1c0acb3113 - stable/13 - ibcore: Simplify ib_modify_qp_is_ok(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1c1c0acb31137bc4e229215243eba8c8654b96cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:46 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1c1c0acb31137bc4e229215243eba8c8654b96cf commit 1c1c0acb31137bc4e229215243eba8c8654b96cf Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:50 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Simplify ib_modify_qp_is_ok(). All callers to ib_modify_qp_is_ok() provides enum ib_qp_state makes the checks of out-of-scope redundant. Let's remove them together with updating function signature to return boolean result. While at it remove unused "ll" parameter from ib_modify_qp_is_ok(). Linux commit: 19b1f54099b6ee334acbfbcfbdffd1d1f057216d d31131bba5a1630304c55ea775c48cc84912ab59 Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit d92a9e5604d7302c349f77c0fde160256aec56ed) --- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 10 +--------- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 8 +------- sys/dev/mthca/mthca_qp.c | 3 +-- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 18 ------------------ sys/ofed/drivers/infiniband/core/ib_verbs.c | 19 +++++++------------ sys/ofed/include/rdma/ib_verbs.h | 6 ++---- 6 files changed, 12 insertions(+), 52 deletions(-) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c index 3b81797b46b0..280ab6359dd1 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c @@ -2163,21 +2163,13 @@ static int _mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, struct mlx4_ib_qp *qp = to_mqp(ibqp); enum ib_qp_state cur_state, new_state; int err = -EINVAL; - int ll; mutex_lock(&qp->mutex); cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (cur_state == new_state && cur_state == IB_QPS_RESET) { - ll = IB_LINK_LAYER_UNSPECIFIED; - } else { - int port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; - ll = rdma_port_get_link_layer(&dev->ib_dev, port); - } - if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, - attr_mask, ll)) { + attr_mask)) { pr_debug("qpn 0x%x: invalid attribute mask specified " "for transition %d to %d. qp_type %d," " attr_mask 0x%x\n", diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c index 8f05b32a3261..54a091548faf 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c @@ -2922,7 +2922,6 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, enum ib_qp_state cur_state, new_state; int err = -EINVAL; int port; - enum rdma_link_layer ll = IB_LINK_LAYER_UNSPECIFIED; if (ibqp->rwq_ind_tbl) return -ENOSYS; @@ -2938,13 +2937,8 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (!(cur_state == new_state && cur_state == IB_QPS_RESET)) { - port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; - ll = dev->ib_dev.get_link_layer(&dev->ib_dev, port); - } - if (qp_type != MLX5_IB_QPT_REG_UMR && - !ib_modify_qp_is_ok(cur_state, new_state, qp_type, attr_mask, ll)) { + !ib_modify_qp_is_ok(cur_state, new_state, qp_type, attr_mask)) { mlx5_ib_dbg(dev, "invalid QP state transition from %d to %d, qp_type %d, attr_mask 0x%x\n", cur_state, new_state, ibqp->qp_type, attr_mask); goto out; diff --git a/sys/dev/mthca/mthca_qp.c b/sys/dev/mthca/mthca_qp.c index 33d61d29bbe5..b726450ba4aa 100644 --- a/sys/dev/mthca/mthca_qp.c +++ b/sys/dev/mthca/mthca_qp.c @@ -860,8 +860,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask, - IB_LINK_LAYER_UNSPECIFIED)) { + if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) { mthca_dbg(dev, "Bad QP transition (transport %d) " "%d->%d with attr 0x%08x\n", qp->transport, cur_state, new_state, diff --git a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c index 9c0087c1b76d..861db52044f8 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c @@ -3543,22 +3543,6 @@ qlnxr_modify_qp(struct ib_qp *ibqp, new_qp_state = old_qp_state; if (QLNX_IS_ROCE(dev)) { -#if __FreeBSD_version >= 1100000 - if (!ib_modify_qp_is_ok(old_qp_state, - new_qp_state, - ibqp->qp_type, - attr_mask, - IB_LINK_LAYER_ETHERNET)) { - QL_DPRINT12(ha, - "invalid attribute mask=0x%x" - " specified for qpn=0x%x of type=0x%x \n" - " old_qp_state=0x%x, new_qp_state=0x%x\n", - attr_mask, qp->qp_id, ibqp->qp_type, - old_qp_state, new_qp_state); - rc = -EINVAL; - goto err; - } -#else if (!ib_modify_qp_is_ok(old_qp_state, new_qp_state, ibqp->qp_type, @@ -3572,8 +3556,6 @@ qlnxr_modify_qp(struct ib_qp *ibqp, rc = -EINVAL; goto err; } - -#endif /* #if __FreeBSD_version >= 1100000 */ } /* translate the masks... */ if (attr_mask & IB_QP_STATE) { diff --git a/sys/ofed/drivers/infiniband/core/ib_verbs.c b/sys/ofed/drivers/infiniband/core/ib_verbs.c index aabb416ddc21..32be78f118b5 100644 --- a/sys/ofed/drivers/infiniband/core/ib_verbs.c +++ b/sys/ofed/drivers/infiniband/core/ib_verbs.c @@ -1169,34 +1169,29 @@ static const struct { } }; -int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, - enum ib_qp_type type, enum ib_qp_attr_mask mask, - enum rdma_link_layer ll) +bool ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, + enum ib_qp_type type, enum ib_qp_attr_mask mask) { enum ib_qp_attr_mask req_param, opt_param; - if (cur_state < 0 || cur_state > IB_QPS_ERR || - next_state < 0 || next_state > IB_QPS_ERR) - return 0; - if (mask & IB_QP_CUR_STATE && cur_state != IB_QPS_RTR && cur_state != IB_QPS_RTS && cur_state != IB_QPS_SQD && cur_state != IB_QPS_SQE) - return 0; + return false; if (!qp_state_table[cur_state][next_state].valid) - return 0; + return false; req_param = qp_state_table[cur_state][next_state].req_param[type]; opt_param = qp_state_table[cur_state][next_state].opt_param[type]; if ((mask & req_param) != req_param) - return 0; + return false; if (mask & ~(req_param | opt_param | IB_QP_STATE)) - return 0; + return false; - return 1; + return true; } EXPORT_SYMBOL(ib_modify_qp_is_ok); diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index cdbf2f5ce260..353181a8d790 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -2220,7 +2220,6 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, * @next_state: Next QP state * @type: QP type * @mask: Mask of supplied QP attributes - * @ll : link layer of port * * This function is a helper function that a low-level driver's * modify_qp method can use to validate the consumer's input. It @@ -2228,9 +2227,8 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, * transition from cur_state to next_state is allowed by the IB spec, * and that the attribute mask supplied is allowed for the transition. */ -int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, - enum ib_qp_type type, enum ib_qp_attr_mask mask, - enum rdma_link_layer ll); +bool ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state, + enum ib_qp_type type, enum ib_qp_attr_mask mask); int ib_register_event_handler (struct ib_event_handler *event_handler); int ib_unregister_event_handler(struct ib_event_handler *event_handler); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C39BD66F91C; Mon, 26 Jul 2021 16:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ2y29JMz3pZB; Mon, 26 Jul 2021 16:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D4611A48E; Mon, 26 Jul 2021 16:13:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDhum005817; Mon, 26 Jul 2021 16:13:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDhch005816; Mon, 26 Jul 2021 16:13:43 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:43 GMT Message-Id: <202107261613.16QGDhch005816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 11f42801533c - stable/13 - ibcore: Clean up INIT_UDATA() and INIT_UDATA_BUF_OR_NULL() macro usage. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 11f42801533ca9fd8cd261634fa050d679de79c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:48 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=11f42801533ca9fd8cd261634fa050d679de79c9 commit 11f42801533ca9fd8cd261634fa050d679de79c9 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:31 +0000 ibcore: Clean up INIT_UDATA() and INIT_UDATA_BUF_OR_NULL() macro usage. We get a harmless warning about the fact that we use the result of a multiplication as a condition in INIT_UDATA_BUF_OR_NULL(): uverbs_main.c: In function 'ib_uverbs_write': error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] This avoids the problem by using an inline function in place of the macro. After changing INIT_UDATA_BUF_OR_NULL() to an inline function, do the same change to INIT_UDATA() for consistency. Using an inline function gives us better type safety here among other issues with macros. I'm using u64_to_user_ptr() to convert the user pointer to simplify the logic rather than adding lots of new type casts. Linux commit: 12f727721eee61b3d19dedb95cb893b2baa9fe41 40a203396cc1c239f2e71c47c66ed03097123d2c Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 05f4691919d6d0219795a1ca8ad84dd82d87b1cf) --- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 63 ++++++++++++----------- sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 7 +-- sys/ofed/drivers/infiniband/core/uverbs.h | 37 +++++++------ 3 files changed, 57 insertions(+), 50 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c index 46edd7b28580..dcc73dc5848e 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c @@ -339,8 +339,8 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, goto err; } - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); ucontext = ib_dev->alloc_ucontext(ib_dev, &udata); @@ -560,8 +560,8 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); uobj = kmalloc(sizeof *uobj, GFP_KERNEL); @@ -768,8 +768,8 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); mutex_lock(&file->device->xrcd_tree_mutex); @@ -978,8 +978,8 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); if ((cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK)) @@ -1085,8 +1085,8 @@ ssize_t ib_uverbs_rereg_mr(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long) cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); if (cmd.flags & ~IB_MR_REREG_SUPPORTED || !cmd.flags) @@ -1225,8 +1225,8 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file, goto err_free; } - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof(resp)); @@ -1494,10 +1494,11 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, sizeof(cmd), sizeof(resp)); + ib_uverbs_init_udata(&ucore, buf, + u64_to_user_ptr(cmd.response), sizeof(cmd), sizeof(resp)); - INIT_UDATA(&uhw, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&uhw, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); memset(&cmd_ex, 0, sizeof(cmd_ex)); @@ -1579,8 +1580,8 @@ ssize_t ib_uverbs_resize_cq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); @@ -2050,10 +2051,10 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; - INIT_UDATA(&ucore, buf, (unsigned long)cmd.response, sizeof(cmd), - resp_size); - INIT_UDATA(&uhw, buf + sizeof(cmd), - (unsigned long)cmd.response + resp_size, + ib_uverbs_init_udata(&ucore, buf, + u64_to_user_ptr(cmd.response), sizeof(cmd), resp_size); + ib_uverbs_init_udata(&uhw, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + resp_size), in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr), out_len - resp_size); @@ -2150,8 +2151,8 @@ ssize_t ib_uverbs_open_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd, out_len - sizeof resp); obj = kmalloc(sizeof *obj, GFP_KERNEL); @@ -2354,7 +2355,7 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, out_len); attr = kmalloc(sizeof *attr, GFP_KERNEL); @@ -2919,8 +2920,8 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file, if (!rdma_is_port_valid(ib_dev, cmd.attr.port_num)) return -EINVAL; - INIT_UDATA(&udata, buf + sizeof(cmd), - (unsigned long)cmd.response + sizeof(resp), + ib_uverbs_init_udata(&udata, buf + sizeof(cmd), + u64_to_user_ptr(cmd.response + sizeof(resp)), in_len - sizeof(cmd), out_len - sizeof(resp)); uobj = kmalloc(sizeof *uobj, GFP_KERNEL); @@ -4045,8 +4046,8 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, xcmd.max_sge = cmd.max_sge; xcmd.srq_limit = cmd.srq_limit; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof resp); @@ -4072,8 +4073,8 @@ ssize_t ib_uverbs_create_xsrq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, - (unsigned long) cmd.response + sizeof resp, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, + u64_to_user_ptr(cmd.response + sizeof resp), in_len - sizeof cmd - sizeof(struct ib_uverbs_cmd_hdr), out_len - sizeof resp); @@ -4098,7 +4099,7 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, + ib_uverbs_init_udata(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd, out_len); srq = idr_read_srq(cmd.srq_handle, file->ucontext); diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index e1b560774fbc..dff566e71f99 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -868,12 +868,13 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, } } - INIT_UDATA_BUF_OR_NULL(&ucore, buf, (unsigned long) ex_hdr.response, + ib_uverbs_init_udata_buf_or_null(&ucore, buf, + u64_to_user_ptr(ex_hdr.response), hdr.in_words * 8, hdr.out_words * 8); - INIT_UDATA_BUF_OR_NULL(&uhw, + ib_uverbs_init_udata_buf_or_null(&uhw, buf + ucore.inlen, - (unsigned long) ex_hdr.response + ucore.outlen, + u64_to_user_ptr(ex_hdr.response + ucore.outlen), ex_hdr.provider_in_words * 8, ex_hdr.provider_out_words * 8); diff --git a/sys/ofed/drivers/infiniband/core/uverbs.h b/sys/ofed/drivers/infiniband/core/uverbs.h index 0db0d47cc691..9f2a519fa259 100644 --- a/sys/ofed/drivers/infiniband/core/uverbs.h +++ b/sys/ofed/drivers/infiniband/core/uverbs.h @@ -54,23 +54,28 @@ #include #include -#define INIT_UDATA(udata, ibuf, obuf, ilen, olen) \ - do { \ - (udata)->inbuf = (const void __user *) (ibuf); \ - (udata)->outbuf = (void __user *) (obuf); \ - (udata)->inlen = (ilen); \ - (udata)->outlen = (olen); \ - } while (0) +static inline void +ib_uverbs_init_udata(struct ib_udata *udata, + const void __user *ibuf, + void __user *obuf, + size_t ilen, size_t olen) +{ + udata->inbuf = ibuf; + udata->outbuf = obuf; + udata->inlen = ilen; + udata->outlen = olen; +} -#define INIT_UDATA_BUF_OR_NULL(udata, ibuf, obuf, ilen, olen) \ - do { \ - (udata)->inbuf = ((ilen) != 0) ? \ - (const void __user *) (ibuf) : NULL; \ - (udata)->outbuf = ((olen) != 0) ? \ - (void __user *) (obuf) : NULL; \ - (udata)->inlen = (ilen); \ - (udata)->outlen = (olen); \ - } while (0) +static inline void +ib_uverbs_init_udata_buf_or_null(struct ib_udata *udata, + const void __user *ibuf, + void __user *obuf, + size_t ilen, size_t olen) +{ + ib_uverbs_init_udata(udata, + ilen ? ibuf : NULL, olen ? obuf : NULL, + ilen, olen); +} /* * Our lifetime rules for these structs are the following: From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:14:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 289DD66F85E; Mon, 26 Jul 2021 16:14:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3G3R62z3pkH; Mon, 26 Jul 2021 16:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51ABE1A295; Mon, 26 Jul 2021 16:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDx1n006165; Mon, 26 Jul 2021 16:13:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDxP3006164; Mon, 26 Jul 2021 16:13:59 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:59 GMT Message-Id: <202107261613.16QGDxP3006164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 9fe9a92ab68f - stable/13 - ibcore: Add some functions and definitions for selecting and querying retryable ucontext cleanup. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9fe9a92ab68fc3f8aa0b6a45f46e2385cc10887f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:14:03 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9fe9a92ab68fc3f8aa0b6a45f46e2385cc10887f commit 9fe9a92ab68fc3f8aa0b6a45f46e2385cc10887f Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:00 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 ibcore: Add some functions and definitions for selecting and querying retryable ucontext cleanup. Linux commit: 1c77483e4c50339b0306572167ccbff6b55d051b Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit f60da09dbb152d7c8ee1719197d98149a8b0c017) --- sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c | 1 + sys/ofed/include/rdma/ib_verbs.h | 56 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c index ab6e27d40d33..df3f8657755c 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c @@ -365,6 +365,7 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file, ucontext->tgid = get_pid(task_pid_group_leader(current)); rcu_read_unlock(); ucontext->closing = 0; + ucontext->cleanup_retryable = false; #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING ucontext->umem_tree = RB_ROOT; diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h index 45a25dc06c45..723db4a659cf 100644 --- a/sys/ofed/include/rdma/ib_verbs.h +++ b/sys/ofed/include/rdma/ib_verbs.h @@ -1364,6 +1364,20 @@ struct ib_fmr_attr { struct ib_umem; +enum rdma_remove_reason { + /* + * Userspace requested uobject deletion or initial try + * to remove uobject via cleanup. Call could fail + */ + RDMA_REMOVE_DESTROY, + /* Context deletion. This call should delete the actual object itself */ + RDMA_REMOVE_CLOSE, + /* Driver is being hot-unplugged. This call should delete the actual object itself */ + RDMA_REMOVE_DRIVER_REMOVE, + /* uobj is being cleaned-up before being committed */ + RDMA_REMOVE_ABORT, +}; + struct ib_ucontext { struct ib_device *device; struct list_head pd_list; @@ -1379,6 +1393,8 @@ struct ib_ucontext { struct list_head rwq_ind_tbl_list; int closing; + bool cleanup_retryable; + pid_t tgid; #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING struct rb_root umem_tree; @@ -2213,6 +2229,46 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, return ret; } +/** + * ib_is_destroy_retryable - Check whether the uobject destruction + * is retryable. + * @ret: The initial destruction return code + * @why: remove reason + * @uobj: The uobject that is destroyed + * + * This function is a helper function that IB layer and low-level drivers + * can use to consider whether the destruction of the given uobject is + * retry-able. + * It checks the original return code, if it wasn't success the destruction + * is retryable according to the ucontext state (i.e. cleanup_retryable) and + * the remove reason. (i.e. why). + * Must be called with the object locked for destroy. + */ +static inline bool ib_is_destroy_retryable(int ret, enum rdma_remove_reason why, + struct ib_uobject *uobj) +{ + return ret && (why == RDMA_REMOVE_DESTROY || + uobj->context->cleanup_retryable); +} + +/** + * ib_destroy_usecnt - Called during destruction to check the usecnt + * @usecnt: The usecnt atomic + * @why: remove reason + * @uobj: The uobject that is destroyed + * + * Non-zero usecnts will block destruction unless destruction was triggered by + * a ucontext cleanup. + */ +static inline int ib_destroy_usecnt(atomic_t *usecnt, + enum rdma_remove_reason why, + struct ib_uobject *uobj) +{ + if (atomic_read(usecnt) && ib_is_destroy_retryable(-EBUSY, why, uobj)) + return -EBUSY; + return 0; +} + /** * ib_modify_qp_is_ok - Check that the supplied attribute mask * contains all required attributes and no attributes not allowed for From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B797366F7D0; Mon, 26 Jul 2021 16:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ366rb5z3pd1; Mon, 26 Jul 2021 16:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F87B1A294; Mon, 26 Jul 2021 16:13:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDqig006015; Mon, 26 Jul 2021 16:13:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDqCZ006014; Mon, 26 Jul 2021 16:13:52 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:52 GMT Message-Id: <202107261613.16QGDqCZ006014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 763d239db250 - stable/13 - mlx5ib: Implement support for enabling and disabling RoCE ECN. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 763d239db2503ba39bbb9bbe43ae193a423e656c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:56 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=763d239db2503ba39bbb9bbe43ae193a423e656c commit 763d239db2503ba39bbb9bbe43ae193a423e656c Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:56 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5ib: Implement support for enabling and disabling RoCE ECN. RoCE is short for Remote direct memory access over Converged Ethernet. ECN is short for Explicit Congestion Notification. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 8abf5ac0e6ddaeddf49cf39193bbe0c3ebf7209b) --- sys/dev/mlx5/cmd.h | 4 ++ sys/dev/mlx5/mlx5_core/mlx5_cmd.c | 23 ++++++++++ sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 39 +++++++++++++++++ sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c | 84 +++++++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+) diff --git a/sys/dev/mlx5/cmd.h b/sys/dev/mlx5/cmd.h index 674a8ab44acd..babcaac58ee3 100644 --- a/sys/dev/mlx5/cmd.h +++ b/sys/dev/mlx5/cmd.h @@ -50,4 +50,8 @@ int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point, void *out, int out_size); int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *mdev, void *in, int in_size); +int mlx5_cmd_query_cong_status(struct mlx5_core_dev *dev, int cong_point, + int prio, void *out, int out_size); +int mlx5_cmd_modify_cong_status(struct mlx5_core_dev *mdev, + void *in, int in_size); #endif /* MLX5_CMD_H */ diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c index c6cc3fee8c43..c4e8b32ffcd5 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c @@ -1668,3 +1668,26 @@ int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *dev, return mlx5_cmd_exec(dev, in, in_size, out, sizeof(out)); } EXPORT_SYMBOL(mlx5_cmd_modify_cong_params); + +int mlx5_cmd_query_cong_status(struct mlx5_core_dev *dev, int cong_point, + int prio, void *out, int out_size) +{ + u32 in[MLX5_ST_SZ_DW(query_cong_status_in)] = { }; + + MLX5_SET(query_cong_status_in, in, opcode, + MLX5_CMD_OP_QUERY_CONG_STATUS); + MLX5_SET(query_cong_status_in, in, priority, prio); + MLX5_SET(query_cong_status_in, in, cong_protocol, cong_point); + + return mlx5_cmd_exec(dev, in, sizeof(in), out, out_size); +} +EXPORT_SYMBOL(mlx5_cmd_query_cong_status); + +int mlx5_cmd_modify_cong_status(struct mlx5_core_dev *dev, + void *in, int in_size) +{ + u32 out[MLX5_ST_SZ_DW(modify_cong_status_out)] = { }; + + return mlx5_cmd_exec(dev, in, in_size, out, sizeof(out)); +} +EXPORT_SYMBOL(mlx5_cmd_modify_cong_status); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 0ac5368ca3b2..49f6e87868ff 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -678,6 +678,44 @@ struct mlx5_roce { #define MLX5_IB_CONG_STATS_NUM (0 MLX5_IB_CONG_STATS(MLX5_IB_STATS_COUNT)) +#define MLX5_IB_CONG_STATUS(m) \ + /* ECN RP */ \ + m(+1, u64, rp_0_enable, "rp_0_enable", "Enable reaction point, priority 0", MLX5_IB_RROCE_ECN_RP, 0, enable) \ + m(+1, u64, rp_1_enable, "rp_1_enable", "Enable reaction point, priority 1", MLX5_IB_RROCE_ECN_RP, 1, enable) \ + m(+1, u64, rp_2_enable, "rp_2_enable", "Enable reaction point, priority 2", MLX5_IB_RROCE_ECN_RP, 2, enable) \ + m(+1, u64, rp_3_enable, "rp_3_enable", "Enable reaction point, priority 3", MLX5_IB_RROCE_ECN_RP, 3, enable) \ + m(+1, u64, rp_4_enable, "rp_4_enable", "Enable reaction point, priority 4", MLX5_IB_RROCE_ECN_RP, 4, enable) \ + m(+1, u64, rp_5_enable, "rp_5_enable", "Enable reaction point, priority 5", MLX5_IB_RROCE_ECN_RP, 5, enable) \ + m(+1, u64, rp_6_enable, "rp_6_enable", "Enable reaction point, priority 6", MLX5_IB_RROCE_ECN_RP, 6, enable) \ + m(+1, u64, rp_7_enable, "rp_7_enable", "Enable reaction point, priority 7", MLX5_IB_RROCE_ECN_RP, 7, enable) \ + m(+1, u64, rp_8_enable, "rp_8_enable", "Enable reaction point, priority 8", MLX5_IB_RROCE_ECN_RP, 8, enable) \ + m(+1, u64, rp_9_enable, "rp_9_enable", "Enable reaction point, priority 9", MLX5_IB_RROCE_ECN_RP, 9, enable) \ + m(+1, u64, rp_10_enable, "rp_10_enable", "Enable reaction point, priority 10", MLX5_IB_RROCE_ECN_RP, 10, enable) \ + m(+1, u64, rp_11_enable, "rp_11_enable", "Enable reaction point, priority 11", MLX5_IB_RROCE_ECN_RP, 11, enable) \ + m(+1, u64, rp_12_enable, "rp_12_enable", "Enable reaction point, priority 12", MLX5_IB_RROCE_ECN_RP, 12, enable) \ + m(+1, u64, rp_13_enable, "rp_13_enable", "Enable reaction point, priority 13", MLX5_IB_RROCE_ECN_RP, 13, enable) \ + m(+1, u64, rp_14_enable, "rp_14_enable", "Enable reaction point, priority 14", MLX5_IB_RROCE_ECN_RP, 14, enable) \ + m(+1, u64, rp_15_enable, "rp_15_enable", "Enable reaction point, priority 15", MLX5_IB_RROCE_ECN_RP, 15, enable) \ + /* ECN NP */ \ + m(+1, u64, np_0_enable, "np_0_enable", "Enable notification point, priority 0", MLX5_IB_RROCE_ECN_NP, 0, enable) \ + m(+1, u64, np_1_enable, "np_1_enable", "Enable notification point, priority 1", MLX5_IB_RROCE_ECN_NP, 1, enable) \ + m(+1, u64, np_2_enable, "np_2_enable", "Enable notification point, priority 2", MLX5_IB_RROCE_ECN_NP, 2, enable) \ + m(+1, u64, np_3_enable, "np_3_enable", "Enable notification point, priority 3", MLX5_IB_RROCE_ECN_NP, 3, enable) \ + m(+1, u64, np_4_enable, "np_4_enable", "Enable notification point, priority 4", MLX5_IB_RROCE_ECN_NP, 4, enable) \ + m(+1, u64, np_5_enable, "np_5_enable", "Enable notification point, priority 5", MLX5_IB_RROCE_ECN_NP, 5, enable) \ + m(+1, u64, np_6_enable, "np_6_enable", "Enable notification point, priority 6", MLX5_IB_RROCE_ECN_NP, 6, enable) \ + m(+1, u64, np_7_enable, "np_7_enable", "Enable notification point, priority 7", MLX5_IB_RROCE_ECN_NP, 7, enable) \ + m(+1, u64, np_8_enable, "np_8_enable", "Enable notification point, priority 8", MLX5_IB_RROCE_ECN_NP, 8, enable) \ + m(+1, u64, np_9_enable, "np_9_enable", "Enable notification point, priority 9", MLX5_IB_RROCE_ECN_NP, 9, enable) \ + m(+1, u64, np_10_enable, "np_10_enable", "Enable notification point, priority 10", MLX5_IB_RROCE_ECN_NP, 10, enable) \ + m(+1, u64, np_11_enable, "np_11_enable", "Enable notification point, priority 11", MLX5_IB_RROCE_ECN_NP, 11, enable) \ + m(+1, u64, np_12_enable, "np_12_enable", "Enable notification point, priority 12", MLX5_IB_RROCE_ECN_NP, 12, enable) \ + m(+1, u64, np_13_enable, "np_13_enable", "Enable notification point, priority 13", MLX5_IB_RROCE_ECN_NP, 13, enable) \ + m(+1, u64, np_14_enable, "np_14_enable", "Enable notification point, priority 14", MLX5_IB_RROCE_ECN_NP, 14, enable) \ + m(+1, u64, np_15_enable, "np_15_enable", "Enable notification point, priority 15", MLX5_IB_RROCE_ECN_NP, 15, enable) \ + +#define MLX5_IB_CONG_STATUS_NUM (0 MLX5_IB_CONG_STATUS(MLX5_IB_STATS_COUNT)) + struct mlx5_ib_congestion { struct sysctl_ctx_list ctx; struct sx lock; @@ -687,6 +725,7 @@ struct mlx5_ib_congestion { struct { MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_VAR) MLX5_IB_CONG_STATS(MLX5_IB_STATS_VAR) + MLX5_IB_CONG_STATUS(MLX5_IB_STATS_VAR) }; }; }; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c index 0fc6694bde82..85ba77362cca 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c @@ -33,6 +33,10 @@ static const char *mlx5_ib_cong_params_desc[] = { MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_DESC) }; +static const char *mlx5_ib_cong_status_desc[] = { + MLX5_IB_CONG_STATUS(MLX5_IB_STATS_DESC) +}; + static const char *mlx5_ib_cong_stats_desc[] = { MLX5_IB_CONG_STATS(MLX5_IB_STATS_DESC) }; @@ -346,6 +350,72 @@ done: return (error); } +static int +mlx5_ib_get_all_cc_status(struct mlx5_ib_dev *dev) +{ + const int outlen = MLX5_ST_SZ_BYTES(query_cong_status_out); + uint32_t out[MLX5_ST_SZ_DW(query_cong_status_out)] = {}; + int error; + +#define MLX5_IB_CONG_STATUS_READ(a,b,c,d,e,node,prio,field) do { \ + error = mlx5_cmd_query_cong_status(dev->mdev, node, prio, out, outlen); \ + if (error) \ + goto done; \ + dev->congestion.c = MLX5_GET(query_cong_status_out, out, field); \ +} while (0); + + MLX5_IB_CONG_STATUS(MLX5_IB_CONG_STATUS_READ); +done: + return (error); +} + +static int +mlx5_ib_cong_status_handler(SYSCTL_HANDLER_ARGS) +{ + const int inlen = MLX5_ST_SZ_BYTES(modify_cong_status_in); + uint32_t in[MLX5_ST_SZ_DW(modify_cong_status_in)] = {}; + struct mlx5_ib_dev *dev = arg1; + u64 value; + int error; + + CONG_LOCK(dev); + value = dev->congestion.arg[arg2]; + if (req != NULL) { + error = sysctl_handle_64(oidp, &value, 0, req); + /* convert value into a boolean */ + value = value ? 1 : 0; + if (error || req->newptr == NULL || + value == dev->congestion.arg[arg2]) + goto done; + + /* assign new binary value */ + dev->congestion.arg[arg2] = value; + } else { + error = 0; + } + if (!MLX5_CAP_GEN(dev->mdev, cc_modify_allowed)) + error = EPERM; + else switch (arg2) { +#define MLX5_IB_CONG_STATUS_WRITE(a,b,c,d,e,node,prio,field) \ + case MLX5_IB_INDEX(c): \ + MLX5_SET(modify_cong_status_in, in, opcode, \ + MLX5_CMD_OP_MODIFY_CONG_STATUS); \ + MLX5_SET(modify_cong_status_in, in, priority, prio); \ + MLX5_SET(modify_cong_status_in, in, cong_protocol, node); \ + MLX5_SET(modify_cong_status_in, in, field, value); \ + error = -mlx5_cmd_modify_cong_status(dev->mdev, in, inlen); \ + break; + MLX5_IB_CONG_STATUS(MLX5_IB_CONG_STATUS_WRITE) + default: + error = EINVAL; + break; + } +done: + CONG_UNLOCK(dev); + + return (error); +} + #define MLX5_GET_UNALIGNED_64(t,p,f) \ (((u64)MLX5_GET(t,p,f##_high) << 32) | MLX5_GET(t,p,f##_low)) @@ -422,6 +492,10 @@ mlx5_ib_init_congestion(struct mlx5_ib_dev *dev) if (err) return (err); + err = mlx5_ib_get_all_cc_status(dev); + if (err) + return (err); + parent = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(dev->ib_dev.dev.kobj.oidp), OID_AUTO, "cong", CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "Congestion control"); @@ -445,6 +519,16 @@ mlx5_ib_init_congestion(struct mlx5_ib_dev *dev) mlx5_ib_cong_params_desc[2 * x + 1]); } + for (x = 0; x != MLX5_IB_CONG_STATUS_NUM; x++) { + SYSCTL_ADD_PROC(ctx, + SYSCTL_CHILDREN(node), OID_AUTO, + mlx5_ib_cong_status_desc[2 * x], + CTLTYPE_U64 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + dev, x + MLX5_IB_CONG_PARAMS_NUM + MLX5_IB_CONG_STATS_NUM, + &mlx5_ib_cong_status_handler, "QU", + mlx5_ib_cong_status_desc[2 * x + 1]); + } + node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(parent), OID_AUTO, "stats", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Statistics"); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FAA966F987; Mon, 26 Jul 2021 16:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ395JJyz3pZp; Mon, 26 Jul 2021 16:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B90311A238; Mon, 26 Jul 2021 16:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDsB5006069; Mon, 26 Jul 2021 16:13:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDsIY006068; Mon, 26 Jul 2021 16:13:54 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:54 GMT Message-Id: <202107261613.16QGDsIY006068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1554e2673b3b - stable/13 - mlx5en: Configure relaxed PCI read and write ordering for ethernet. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1554e2673b3b79f467fb8cdfcbbee3c73c090147 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:58 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1554e2673b3b79f467fb8cdfcbbee3c73c090147 commit 1554e2673b3b79f467fb8cdfcbbee3c73c090147 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:57 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5en: Configure relaxed PCI read and write ordering for ethernet. This may improve performance in some configurations. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit de2437f19950f6758159abbde93200468d1327fa) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 14 +++++++++++++- sys/dev/mlx5/mlx5_ifc.h | 12 ++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 97438de3bc2a..02417f5f931c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3707,6 +3707,18 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, return (0); } +static void +mlx5e_mkey_set_relaxed_ordering(struct mlx5_core_dev *mdev, void *mkc) +{ + bool ro_pci_enable = + pci_get_relaxed_ordering_enabled(mdev->pdev->dev.bsddev); + bool ro_write = MLX5_CAP_GEN(mdev, relaxed_ordering_write); + bool ro_read = MLX5_CAP_GEN(mdev, relaxed_ordering_read); + + MLX5_SET(mkc, mkc, relaxed_ordering_read, ro_pci_enable && ro_read); + MLX5_SET(mkc, mkc, relaxed_ordering_write, ro_pci_enable && ro_write); +} + static int mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn, struct mlx5_core_mr *mkey) @@ -3729,7 +3741,7 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn, MLX5_SET(mkc, mkc, umr_en, 1); /* used by HW TLS */ MLX5_SET(mkc, mkc, lw, 1); MLX5_SET(mkc, mkc, lr, 1); - + mlx5e_mkey_set_relaxed_ordering(mdev, mkc); MLX5_SET(mkc, mkc, pd, pdn); MLX5_SET(mkc, mkc, length64, 1); MLX5_SET(mkc, mkc, qpn, 0xffffff); diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index ce8074fba3f1..d44927236f74 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -1069,12 +1069,14 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_4[0x8]; u8 log_max_cq_sz[0x8]; - u8 reserved_5[0xb]; + u8 relaxed_ordering_write_umr[0x1]; + u8 relaxed_ordering_read_umr[0x1]; + u8 reserved_5[0x9]; u8 log_max_cq[0x5]; u8 log_max_eq_sz[0x8]; - u8 relaxed_ordering_write[1]; - u8 reserved_6[0x1]; + u8 relaxed_ordering_write[0x1]; + u8 relaxed_ordering_read[0x1]; u8 log_max_mkey[0x6]; u8 reserved_7[0xb]; u8 fast_teardown[0x1]; @@ -2685,7 +2687,9 @@ struct mlx5_ifc_mkc_bits { u8 translations_octword_size[0x20]; - u8 reserved_7[0x1b]; + u8 reserved_at_1c0[0x19]; + u8 relaxed_ordering_read[0x1]; + u8 reserved_at_1d9[0x1]; u8 log_page_size[0x5]; u8 reserved_8[0x20]; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9705266F98C; Mon, 26 Jul 2021 16:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3B6qLZz3pd9; Mon, 26 Jul 2021 16:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C5111A44E; Mon, 26 Jul 2021 16:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDus7006117; Mon, 26 Jul 2021 16:13:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDuNY006116; Mon, 26 Jul 2021 16:13:56 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:56 GMT Message-Id: <202107261613.16QGDuNY006116@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 0ebff67cab8b - stable/13 - mlx5en: Wait for all TLS connections to terminate when unloading driver. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ebff67cab8b78e73f7a166fcabad3244edf812f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:59 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0ebff67cab8b78e73f7a166fcabad3244edf812f commit 0ebff67cab8b78e73f7a166fcabad3244edf812f Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5en: Wait for all TLS connections to terminate when unloading driver. The driver expects all TLS tags to be returned to the driver before it can free the UMA zone where the TLS tags reside. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 3a934ba7a30831dda104e9faad9412f9743c9bae) --- sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c | 2 +- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c index 3e63b9e660f1..1a92e5aa222a 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c @@ -288,7 +288,7 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp, priv = ifp->if_softc; - if (priv->tls.init == 0) + if (priv->gone != 0 || priv->tls.init == 0) return (EOPNOTSUPP); /* allocate new tag from zone, if any */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 02417f5f931c..d9860c24114b 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -4715,6 +4715,16 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) pause("W", hz); } #endif + +#ifdef KERN_TLS + /* wait for all TLS tags to get freed */ + while (priv->tls.init != 0 && + uma_zone_get_cur(priv->tls.zone) != 0) { + mlx5_en_err(priv->ifp, + "Waiting for all TLS connections to terminate\n"); + pause("W", hz); + } +#endif /* wait for all unlimited send tags to complete */ mlx5e_priv_wait_for_completion(priv, mdev->priv.eq_table.num_comp_vectors); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:14:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5396C66F86D; Mon, 26 Jul 2021 16:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3L4khGz3px7; Mon, 26 Jul 2021 16:14:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5A961A297; Mon, 26 Jul 2021 16:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGE2UO006243; Mon, 26 Jul 2021 16:14:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE2oB006242; Mon, 26 Jul 2021 16:14:02 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:02 GMT Message-Id: <202107261614.16QGE2oB006242@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2b4db9bbc23b - stable/13 - mlx5: Fix for uninitialized "uid" field. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b4db9bbc23b1a3030ba44d5fb174f6e031be39d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:14:09 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2b4db9bbc23b1a3030ba44d5fb174f6e031be39d commit 2b4db9bbc23b1a3030ba44d5fb174f6e031be39d Author: Hans Petter Selasky AuthorDate: 2021-06-21 13:41:11 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5: Fix for uninitialized "uid" field. Make sure the "uid" field gets properly set when destroying DCT and QP objects by making a copy of the field when creating such objects. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit cbf6911e10d7ed4e772affdd03cb4d439669acbd) --- sys/dev/mlx5/driver.h | 1 + sys/dev/mlx5/mlx5_core/mlx5_qp.c | 90 +++++++++++++++++++++++++++++----------- sys/dev/mlx5/mlx5_ifc.h | 34 +++++++-------- sys/dev/mlx5/qp.h | 1 + 4 files changed, 84 insertions(+), 42 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index c36380505fbb..d21a4aa075c0 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -805,6 +805,7 @@ struct mlx5_core_dct { struct completion drained; struct mlx5_rsc_debug *dbg; int pid; + u16 uid; }; enum { diff --git a/sys/dev/mlx5/mlx5_core/mlx5_qp.c b/sys/dev/mlx5/mlx5_core/mlx5_qp.c index c5fb95cc2d2b..441c005b9920 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_qp.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_qp.c @@ -133,6 +133,7 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev, if (err) return err; + qp->uid = MLX5_GET(create_qp_in, in, uid); qp->qpn = MLX5_GET(create_qp_out, out, qpn); mlx5_core_dbg(dev, "qpn = 0x%x\n", qp->qpn); @@ -145,8 +146,9 @@ int mlx5_core_create_qp(struct mlx5_core_dev *dev, return 0; err_cmd: - MLX5_SET(destroy_qp_in, in, opcode, MLX5_CMD_OP_DESTROY_QP); - MLX5_SET(destroy_qp_in, in, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, din, opcode, MLX5_CMD_OP_DESTROY_QP); + MLX5_SET(destroy_qp_in, din, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, din, uid, qp->uid); mlx5_cmd_exec(dev, din, sizeof(din), dout, sizeof(dout)); return err; } @@ -164,6 +166,7 @@ int mlx5_core_destroy_qp(struct mlx5_core_dev *dev, MLX5_SET(destroy_qp_in, in, opcode, MLX5_CMD_OP_DESTROY_QP); MLX5_SET(destroy_qp_in, in, qpn, qp->qpn); + MLX5_SET(destroy_qp_in, in, uid, qp->uid); err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); if (err) return err; @@ -203,33 +206,40 @@ static void mbox_free(struct mbox_info *mbox) static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn, u32 opt_param_mask, void *qpc, - struct mbox_info *mbox) + struct mbox_info *mbox, u16 uid) { mbox->out = NULL; mbox->in = NULL; - #define MBOX_ALLOC(mbox, typ) \ - mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out)) +#define MBOX_ALLOC(mbox, typ) \ + mbox_alloc(mbox, MLX5_ST_SZ_BYTES(typ##_in), MLX5_ST_SZ_BYTES(typ##_out)) - #define MOD_QP_IN_SET(typ, in, _opcode, _qpn) \ - MLX5_SET(typ##_in, in, opcode, _opcode); \ - MLX5_SET(typ##_in, in, qpn, _qpn) - #define MOD_QP_IN_SET_QPC(typ, in, _opcode, _qpn, _opt_p, _qpc) \ - MOD_QP_IN_SET(typ, in, _opcode, _qpn); \ - MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \ - memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, MLX5_ST_SZ_BYTES(qpc)) +#define MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid) \ + do { \ + MLX5_SET(typ##_in, in, opcode, _opcode); \ + MLX5_SET(typ##_in, in, qpn, _qpn); \ + MLX5_SET(typ##_in, in, uid, _uid); \ + } while (0) + +#define MOD_QP_IN_SET_QPC(typ, in, _opcode, _qpn, _opt_p, _qpc, _uid) \ + do { \ + MOD_QP_IN_SET(typ, in, _opcode, _qpn, _uid); \ + MLX5_SET(typ##_in, in, opt_param_mask, _opt_p); \ + memcpy(MLX5_ADDR_OF(typ##_in, in, qpc), _qpc, \ + MLX5_ST_SZ_BYTES(qpc)); \ + } while (0) switch (opcode) { /* 2RST & 2ERR */ case MLX5_CMD_OP_2RST_QP: if (MBOX_ALLOC(mbox, qp_2rst)) return -ENOMEM; - MOD_QP_IN_SET(qp_2rst, mbox->in, opcode, qpn); + MOD_QP_IN_SET(qp_2rst, mbox->in, opcode, qpn, uid); break; case MLX5_CMD_OP_2ERR_QP: if (MBOX_ALLOC(mbox, qp_2err)) return -ENOMEM; - MOD_QP_IN_SET(qp_2err, mbox->in, opcode, qpn); + MOD_QP_IN_SET(qp_2err, mbox->in, opcode, qpn, uid); break; /* MODIFY with QPC */ @@ -237,37 +247,37 @@ static int modify_qp_mbox_alloc(struct mlx5_core_dev *dev, u16 opcode, int qpn, if (MBOX_ALLOC(mbox, rst2init_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rst2init_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_INIT2RTR_QP: if (MBOX_ALLOC(mbox, init2rtr_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(init2rtr_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_RTR2RTS_QP: if (MBOX_ALLOC(mbox, rtr2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rtr2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_RTS2RTS_QP: if (MBOX_ALLOC(mbox, rts2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(rts2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_SQERR2RTS_QP: if (MBOX_ALLOC(mbox, sqerr2rts_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(sqerr2rts_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; case MLX5_CMD_OP_INIT2INIT_QP: if (MBOX_ALLOC(mbox, init2init_qp)) return -ENOMEM; MOD_QP_IN_SET_QPC(init2init_qp, mbox->in, opcode, qpn, - opt_param_mask, qpc); + opt_param_mask, qpc, uid); break; default: mlx5_core_err(dev, "Unknown transition for modify QP: OP(0x%x) QPN(0x%x)\n", @@ -287,7 +297,7 @@ int mlx5_core_qp_modify(struct mlx5_core_dev *dev, u16 opcode, int err; err = modify_qp_mbox_alloc(dev, opcode, qp->qpn, - opt_param_mask, qpc, &mbox); + opt_param_mask, qpc, &mbox, qp->uid); if (err) return err; @@ -367,6 +377,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, } dct->dctn = MLX5_GET(create_dct_out, out, dctn); + dct->uid = MLX5_GET(create_dct_in, in, uid); dct->common.res = MLX5_RES_DCT; spin_lock_irq(&table->lock); @@ -386,6 +397,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev, err_cmd: MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT); MLX5_SET(destroy_dct_in, din, dctn, dct->dctn); + MLX5_SET(destroy_dct_in, din, uid, dct->uid); mlx5_cmd_exec(dev, &din, sizeof(din), dout, sizeof(dout)); return err; @@ -400,6 +412,7 @@ static int mlx5_core_drain_dct(struct mlx5_core_dev *dev, MLX5_SET(drain_dct_in, in, opcode, MLX5_CMD_OP_DRAIN_DCT); MLX5_SET(drain_dct_in, in, dctn, dct->dctn); + MLX5_SET(drain_dct_in, in, uid, dct->uid); return mlx5_cmd_exec(dev, (void *)&in, sizeof(in), (void *)&out, sizeof(out)); } @@ -437,6 +450,7 @@ free_dct: MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT); MLX5_SET(destroy_dct_in, in, dctn, dct->dctn); + MLX5_SET(destroy_dct_in, in, uid, dct->uid); return mlx5_cmd_exec(dev, (void *)&in, sizeof(in), (void *)&out, sizeof(out)); @@ -469,6 +483,17 @@ int mlx5_core_arm_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct) } EXPORT_SYMBOL_GPL(mlx5_core_arm_dct); +static void destroy_rq_tracked(struct mlx5_core_dev *dev, u32 rqn, u16 uid) +{ + u32 in[MLX5_ST_SZ_DW(destroy_rq_in)] = {}; + u32 out[MLX5_ST_SZ_DW(destroy_rq_out)] = {}; + + MLX5_SET(destroy_rq_in, in, opcode, MLX5_CMD_OP_DESTROY_RQ); + MLX5_SET(destroy_rq_in, in, rqn, rqn); + MLX5_SET(destroy_rq_in, in, uid, uid); + mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); +} + int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, struct mlx5_core_qp *rq) { @@ -478,9 +503,11 @@ int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, if (err) return err; + rq->uid = MLX5_GET(create_rq_in, in, uid); + err = create_qprqsq_common(dev, rq, MLX5_RES_RQ); if (err) - mlx5_core_destroy_rq(dev, rq->qpn); + destroy_rq_tracked(dev, rq->qpn, rq->uid); return err; } @@ -490,10 +517,21 @@ void mlx5_core_destroy_rq_tracked(struct mlx5_core_dev *dev, struct mlx5_core_qp *rq) { destroy_qprqsq_common(dev, rq, MLX5_RES_RQ); - mlx5_core_destroy_rq(dev, rq->qpn); + destroy_rq_tracked(dev, rq->qpn, rq->uid); } EXPORT_SYMBOL(mlx5_core_destroy_rq_tracked); +static void destroy_sq_tracked(struct mlx5_core_dev *dev, u32 sqn, u16 uid) +{ + u32 in[MLX5_ST_SZ_DW(destroy_sq_in)] = {}; + u32 out[MLX5_ST_SZ_DW(destroy_sq_out)] = {}; + + MLX5_SET(destroy_sq_in, in, opcode, MLX5_CMD_OP_DESTROY_SQ); + MLX5_SET(destroy_sq_in, in, sqn, sqn); + MLX5_SET(destroy_sq_in, in, uid, uid); + mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); +} + int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, struct mlx5_core_qp *sq) { @@ -503,9 +541,11 @@ int mlx5_core_create_sq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen, if (err) return err; + sq->uid = MLX5_GET(create_sq_in, in, uid); + err = create_qprqsq_common(dev, sq, MLX5_RES_SQ); if (err) - mlx5_core_destroy_sq(dev, sq->qpn); + destroy_sq_tracked(dev, sq->qpn, sq->uid); return err; } @@ -515,6 +555,6 @@ void mlx5_core_destroy_sq_tracked(struct mlx5_core_dev *dev, struct mlx5_core_qp *sq) { destroy_qprqsq_common(dev, sq, MLX5_RES_SQ); - mlx5_core_destroy_sq(dev, sq->qpn); + destroy_sq_tracked(dev, sq->qpn, sq->uid); } EXPORT_SYMBOL(mlx5_core_destroy_sq_tracked); diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index d44927236f74..865548ed1981 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -3492,7 +3492,7 @@ struct mlx5_ifc_sqerr2rts_qp_out_bits { struct mlx5_ifc_sqerr2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3877,7 +3877,7 @@ struct mlx5_ifc_rts2rts_qp_out_bits { struct mlx5_ifc_rts2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3907,7 +3907,7 @@ struct mlx5_ifc_rtr2rts_qp_out_bits { struct mlx5_ifc_rtr2rts_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -3937,7 +3937,7 @@ struct mlx5_ifc_rst2init_qp_out_bits { struct mlx5_ifc_rst2init_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5255,7 +5255,7 @@ struct mlx5_ifc_qp_2rst_out_bits { struct mlx5_ifc_qp_2rst_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5277,7 +5277,7 @@ struct mlx5_ifc_qp_2err_out_bits { struct mlx5_ifc_qp_2err_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -5971,7 +5971,7 @@ struct mlx5_ifc_init2rtr_qp_out_bits { struct mlx5_ifc_init2rtr_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6001,7 +6001,7 @@ struct mlx5_ifc_init2init_qp_out_bits { struct mlx5_ifc_init2init_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6118,7 +6118,7 @@ struct mlx5_ifc_drain_dct_out_bits { struct mlx5_ifc_drain_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6274,7 +6274,7 @@ struct mlx5_ifc_destroy_sq_out_bits { struct mlx5_ifc_destroy_sq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6346,7 +6346,7 @@ struct mlx5_ifc_destroy_rq_out_bits { struct mlx5_ifc_destroy_rq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6390,7 +6390,7 @@ struct mlx5_ifc_destroy_qp_out_bits { struct mlx5_ifc_destroy_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -6587,7 +6587,7 @@ struct mlx5_ifc_destroy_dct_out_bits { struct mlx5_ifc_destroy_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7050,7 +7050,7 @@ struct mlx5_ifc_create_sq_out_bits { struct mlx5_ifc_create_sq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7132,7 +7132,7 @@ struct mlx5_ifc_create_rq_out_bits { struct mlx5_ifc_create_rq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7180,7 +7180,7 @@ struct mlx5_ifc_create_qp_out_bits { struct mlx5_ifc_create_qp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -7452,7 +7452,7 @@ struct mlx5_ifc_create_dct_out_bits { struct mlx5_ifc_create_dct_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; diff --git a/sys/dev/mlx5/qp.h b/sys/dev/mlx5/qp.h index aada3401f7e7..bf9fef73667d 100644 --- a/sys/dev/mlx5/qp.h +++ b/sys/dev/mlx5/qp.h @@ -466,6 +466,7 @@ struct mlx5_core_qp { int qpn; struct mlx5_rsc_debug *dbg; int pid; + u16 uid; }; struct mlx5_qp_path { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:14:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B087966F94E; Mon, 26 Jul 2021 16:14:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3N0SRxz3ppk; Mon, 26 Jul 2021 16:14:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8FE919EBA; Mon, 26 Jul 2021 16:14:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGE3DH006267; Mon, 26 Jul 2021 16:14:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE3vo006266; Mon, 26 Jul 2021 16:14:03 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:03 GMT Message-Id: <202107261614.16QGE3vo006266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 5b803f682001 - stable/13 - mlx5: Numa domain improvements. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5b803f68200198ee3c014d34f3bd8e1eec172a69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:14:09 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5b803f68200198ee3c014d34f3bd8e1eec172a69 commit 5b803f68200198ee3c014d34f3bd8e1eec172a69 Author: Hans Petter Selasky AuthorDate: 2021-06-21 13:42:20 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5: Numa domain improvements. Properly allocate all mlx5en(4) structures from correct numa domain. While at it cleanup unused numa domain integers deriving from the Linux version of mlx5en(4). Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 7c3eff94bda8bb746bfa7a5edc81b014e2dc97f6) --- sys/dev/mlx5/driver.h | 10 ++++++---- sys/dev/mlx5/mlx5_core/mlx5_alloc.c | 13 +++---------- sys/dev/mlx5/mlx5_core/mlx5_main.c | 16 +++++++++------- sys/dev/mlx5/mlx5_core/mlx5_wq.c | 21 +++++++++------------ sys/dev/mlx5/mlx5_core/wq.h | 2 -- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 28 ++++++++++++---------------- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 10 ++++------ 7 files changed, 43 insertions(+), 57 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index d21a4aa075c0..614a308e8e2f 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -985,8 +985,6 @@ 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) int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, struct mlx5_buf *buf); void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf); @@ -1072,10 +1070,14 @@ void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev); int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev); void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev); int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db); -int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, - int node); void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db); +static inline struct domainset * +mlx5_dev_domainset(struct mlx5_core_dev *mdev) +{ + return (linux_get_vm_domain_set(mdev->priv.numa_node)); +} + const char *mlx5_command_str(int command); int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev); diff --git a/sys/dev/mlx5/mlx5_core/mlx5_alloc.c b/sys/dev/mlx5/mlx5_core/mlx5_alloc.c index 1dabbd9f586f..99e39b80a4ec 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_alloc.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_alloc.c @@ -147,8 +147,7 @@ void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf) } EXPORT_SYMBOL_GPL(mlx5_buf_free); -static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev, - int node) +static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struct mlx5_core_dev *dev) { struct mlx5_db_pgdir *pgdir; @@ -199,7 +198,7 @@ static int mlx5_alloc_db_from_pgdir(struct mlx5_db_pgdir *pgdir, return 0; } -int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node) +int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) { struct mlx5_db_pgdir *pgdir; int ret = 0; @@ -210,7 +209,7 @@ int mlx5_db_alloc_node(struct mlx5_core_dev *dev, struct mlx5_db *db, int node) if (!mlx5_alloc_db_from_pgdir(pgdir, db)) goto out; - pgdir = mlx5_alloc_db_pgdir(dev, node); + pgdir = mlx5_alloc_db_pgdir(dev); if (!pgdir) { ret = -ENOMEM; goto out; @@ -226,12 +225,6 @@ out: return ret; } -EXPORT_SYMBOL_GPL(mlx5_db_alloc_node); - -int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db) -{ - return mlx5_db_alloc_node(dev, db, dev->priv.numa_node); -} EXPORT_SYMBOL_GPL(mlx5_db_alloc); void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 755e8844a892..7527af524456 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -82,8 +82,6 @@ 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); static LIST_HEAD(dev_list); static DEFINE_MUTEX(intf_mutex); @@ -653,7 +651,7 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) ncomp_vec = table->num_comp_vectors; nent = MLX5_COMP_EQ_SIZE; for (i = 0; i < ncomp_vec; i++) { - eq = kzalloc(sizeof(*eq), GFP_KERNEL); + eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, dev->priv.numa_node); err = mlx5_create_map_eq(dev, eq, i + MLX5_EQ_VEC_COMP_BASE, nent, 0); @@ -715,7 +713,7 @@ static void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv) struct mlx5_device_context *dev_ctx; struct mlx5_core_dev *dev = container_of(priv, struct mlx5_core_dev, priv); - dev_ctx = kzalloc(sizeof(*dev_ctx), GFP_KERNEL); + dev_ctx = kzalloc_node(sizeof(*dev_ctx), GFP_KERNEL, priv->numa_node); if (!dev_ctx) return; @@ -869,8 +867,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) INIT_LIST_HEAD(&priv->pgdir_list); spin_lock_init(&priv->mkey_lock); - priv->numa_node = NUMA_NO_NODE; - err = mlx5_pci_enable_device(dev); if (err) { mlx5_core_err(dev, "Cannot enable PCI device, aborting\n"); @@ -1314,14 +1310,20 @@ static int init_one(struct pci_dev *pdev, int num_vfs, sriov_pos; #endif int i,err; + int numa_node; struct sysctl_oid *pme_sysctl_node; struct sysctl_oid *pme_err_sysctl_node; struct sysctl_oid *cap_sysctl_node; struct sysctl_oid *current_cap_sysctl_node; struct sysctl_oid *max_cap_sysctl_node; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + numa_node = dev_to_node(&pdev->dev); + + dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, numa_node); + priv = &dev->priv; + priv->numa_node = numa_node; + if (id) priv->pci_dev_data = id->driver_data; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_wq.c b/sys/dev/mlx5/mlx5_core/mlx5_wq.c index 6cbb7c0000ae..131ed9bfce2a 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_wq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_wq.c @@ -69,15 +69,14 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_stride = MLX5_GET(wq, wqc, log_wq_stride); wq->sz_m1 = (1 << MLX5_GET(wq, wqc, log_wq_sz)) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_wq_cyc_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_wq_cyc_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; @@ -107,15 +106,14 @@ int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_sz = MLX5_GET(cqc, cqc, log_cq_size); wq->sz_m1 = (1 << wq->log_sz) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_cqwq_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_cqwq_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; @@ -146,15 +144,14 @@ int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, wq->log_stride = MLX5_GET(wq, wqc, log_wq_stride); wq->sz_m1 = (1 << MLX5_GET(wq, wqc, log_wq_sz)) - 1; - err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); + err = mlx5_db_alloc(mdev, &wq_ctrl->db); if (err) { mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); return err; } - err = mlx5_buf_alloc_node(mdev, mlx5_wq_ll_get_byte_size(wq), - max_direct, &wq_ctrl->buf, - param->buf_numa_node); + err = mlx5_buf_alloc(mdev, mlx5_wq_ll_get_byte_size(wq), + max_direct, &wq_ctrl->buf); if (err) { mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); goto err_db_free; diff --git a/sys/dev/mlx5/mlx5_core/wq.h b/sys/dev/mlx5/mlx5_core/wq.h index 13f26b0dd9a1..f513e4d7f6b4 100644 --- a/sys/dev/mlx5/mlx5_core/wq.h +++ b/sys/dev/mlx5/mlx5_core/wq.h @@ -32,8 +32,6 @@ struct mlx5_wq_param { int linear; - int buf_numa_node; - int db_numa_node; }; struct mlx5_wq_ctrl { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 9345798006f2..170fb03be968 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1261,7 +1261,8 @@ mlx5e_create_rq(struct mlx5e_channel *c, if (err) goto err_rq_wq_destroy; - rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); + rq->mbuf = malloc_domainset(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, + mlx5_dev_domainset(mdev), M_WAITOK | M_ZERO); for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); int j; @@ -1525,7 +1526,8 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq) int err; int x; - sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); + sq->mbuf = malloc_domainset(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, + mlx5_dev_domainset(sq->priv->mdev), M_WAITOK | M_ZERO); /* Create DMA descriptor MAPs */ for (x = 0; x != wq_sz; x++) { @@ -1619,6 +1621,11 @@ mlx5e_create_sq(struct mlx5e_channel *c, &sq->dma_tag))) goto done; + sq->mkey_be = cpu_to_be32(priv->mr.key); + sq->ifp = priv->ifp; + sq->priv = priv; + sq->tc = tc; + err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -1630,11 +1637,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, if (err) goto err_sq_wq_destroy; - sq->mkey_be = cpu_to_be32(priv->mr.key); - sq->ifp = priv->ifp; - sq->priv = priv; - sq->tc = tc; - mlx5e_update_sq_inline(sq); snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc); @@ -1927,9 +1929,6 @@ mlx5e_create_cq(struct mlx5e_priv *priv, int err; u32 i; - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; - err = mlx5_vector2eqn(mdev, eq_ix, &eqn_not_used, &irqn); if (err) return (err); @@ -2292,8 +2291,6 @@ mlx5e_build_rq_param(struct mlx5e_priv *priv, MLX5_SET(wq, wq, log_wq_sz, priv->params.log_rq_size); MLX5_SET(wq, wq, pd, priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -2308,8 +2305,6 @@ mlx5e_build_sq_param(struct mlx5e_priv *priv, MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB)); MLX5_SET(wq, wq, pd, priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -4430,13 +4425,14 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n"); return (NULL); } + /* * Try to allocate the priv and make room for worst-case * number of channel structures: */ - priv = malloc(sizeof(*priv) + + priv = malloc_domainset(sizeof(*priv) + (sizeof(priv->channel[0]) * mdev->priv.eq_table.num_comp_vectors), - M_MLX5EN, M_WAITOK | M_ZERO); + M_MLX5EN, mlx5_dev_domainset(mdev), M_WAITOK | M_ZERO); ifp = priv->ifp = if_alloc_dev(IFT_ETHER, mdev->pdev->dev.bsddev); if (ifp == NULL) { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index bd66b8ecd725..fa7b812fbdf1 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -51,8 +51,6 @@ mlx5e_rl_build_sq_param(struct mlx5e_rl_priv_data *rl, MLX5_SET(wq, wq, log_wq_stride, ilog2(MLX5_SEND_WQE_BB)); MLX5_SET(wq, wq, pd, rl->priv->pdn); - param->wq.buf_numa_node = 0; - param->wq.db_numa_node = 0; param->wq.linear = 1; } @@ -116,6 +114,10 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, &sq->dma_tag))) goto done; + sq->mkey_be = cpu_to_be32(priv->mr.key); + sq->ifp = priv->ifp; + sq->priv = priv; + err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -127,10 +129,6 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, if (err) goto err_sq_wq_destroy; - sq->mkey_be = cpu_to_be32(priv->mr.key); - sq->ifp = priv->ifp; - sq->priv = priv; - mlx5e_update_sq_inline(sq); return (0); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:14:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E220666F93D; Mon, 26 Jul 2021 16:14:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3L1Hybz3ptw; Mon, 26 Jul 2021 16:14:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DD6D1A23C; Mon, 26 Jul 2021 16:14:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGE1fZ006219; Mon, 26 Jul 2021 16:14:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE1nD006218; Mon, 26 Jul 2021 16:14:01 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:01 GMT Message-Id: <202107261614.16QGE1nD006218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 191a0e65a016 - stable/13 - mlx4: Map core_clock page to user space only when allowed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 191a0e65a016a973b586a8d8a4927872e05d0167 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:14:07 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=191a0e65a016a973b586a8d8a4927872e05d0167 commit 191a0e65a016a973b586a8d8a4927872e05d0167 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx4: Map core_clock page to user space only when allowed Currently when we map the hca_core_clock page to the user space, there are vulnerable registers, one of which is semaphore, on this page as well. If user read the wrong offset, it can modify the above semaphore and hang the device. Hence, mapping the hca_core_clock page to the user space only when user required it specifically. After this patch, mlx4 core_clock won't be mapped to user space by default. Oppose to current state, where mlx4 core_clock is always mapped to user space. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit c8301cbb0fa25d03c1b6b2d056497d5a1580a8b4) --- sys/dev/mlx4/device.h | 1 + sys/dev/mlx4/mlx4_core/fw.h | 1 + sys/dev/mlx4/mlx4_core/mlx4_fw.c | 3 +++ sys/dev/mlx4/mlx4_core/mlx4_main.c | 6 ++++++ sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 5 +---- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx4/device.h b/sys/dev/mlx4/device.h index 0af8fce5e634..ce934838253f 100644 --- a/sys/dev/mlx4/device.h +++ b/sys/dev/mlx4/device.h @@ -624,6 +624,7 @@ struct mlx4_caps { u32 dmfs_high_rate_qpn_range; u32 vf_caps; struct mlx4_rate_limit_caps rl_caps; + bool map_clock_to_user; }; struct mlx4_buf_list { diff --git a/sys/dev/mlx4/mlx4_core/fw.h b/sys/dev/mlx4/mlx4_core/fw.h index c4c4883b4d06..48ba434e6078 100644 --- a/sys/dev/mlx4/mlx4_core/fw.h +++ b/sys/dev/mlx4/mlx4_core/fw.h @@ -129,6 +129,7 @@ struct mlx4_dev_cap { u32 dmfs_high_rate_qpn_range; struct mlx4_rate_limit_caps rl_caps; struct mlx4_port_cap port_cap[MLX4_MAX_PORTS + 1]; + bool map_clock_to_user; }; struct mlx4_func_cap { diff --git a/sys/dev/mlx4/mlx4_core/mlx4_fw.c b/sys/dev/mlx4/mlx4_core/mlx4_fw.c index 0ac45e1297b9..68aa7e76c79d 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_fw.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_fw.c @@ -820,6 +820,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) #define QUERY_DEV_CAP_MAD_DEMUX_OFFSET 0xb0 #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_BASE_OFFSET 0xa8 #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_RANGE_OFFSET 0xac +#define QUERY_DEV_CAP_MAP_CLOCK_TO_USER 0xc1 #define QUERY_DEV_CAP_QP_RATE_LIMIT_NUM_OFFSET 0xcc #define QUERY_DEV_CAP_QP_RATE_LIMIT_MAX_OFFSET 0xd0 #define QUERY_DEV_CAP_QP_RATE_LIMIT_MIN_OFFSET 0xd2 @@ -838,6 +839,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) if (mlx4_is_mfunc(dev)) disable_unsupported_roce_caps(outbox); + MLX4_GET(field, outbox, QUERY_DEV_CAP_MAP_CLOCK_TO_USER); + dev_cap->map_clock_to_user = field & 0x80; MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_QP_OFFSET); dev_cap->reserved_qps = 1 << (field & 0xf); MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_OFFSET); diff --git a/sys/dev/mlx4/mlx4_core/mlx4_main.c b/sys/dev/mlx4/mlx4_core/mlx4_main.c index 48cc2fc7d3f6..ca63d1d12ba6 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_main.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_main.c @@ -386,6 +386,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) } } + dev->caps.map_clock_to_user = dev_cap->map_clock_to_user; dev->caps.uar_page_size = PAGE_SIZE; dev->caps.num_uars = dev_cap->uar_size / PAGE_SIZE; dev->caps.local_ca_ack_delay = dev_cap->local_ca_ack_delay; @@ -1872,6 +1873,11 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev, if (mlx4_is_slave(dev)) return -ENOTSUPP; + if (!dev->caps.map_clock_to_user) { + mlx4_dbg(dev, "Map clock to user is not supported.\n"); + return -EOPNOTSUPP; + } + if (!params) return -EINVAL; diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index ef23f182bc28..e992400820c0 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -560,12 +560,9 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL; props->timestamp_mask = 0xFFFFFFFFFFFFULL; - if (!mlx4_is_slave(dev->dev)) - err = mlx4_get_internal_clock_params(dev->dev, &clock_params); - if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) { resp.response_length += sizeof(resp.hca_core_clock_offset); - if (!err && !mlx4_is_slave(dev->dev)) { + if (!mlx4_get_internal_clock_params(dev->dev, &clock_params)) { resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP; resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE; } From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 030B266F73A; Mon, 26 Jul 2021 16:13:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ351FDdz3pcv; Mon, 26 Jul 2021 16:13:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 642811A235; Mon, 26 Jul 2021 16:13:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDpTJ005991; Mon, 26 Jul 2021 16:13:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDp2I005990; Mon, 26 Jul 2021 16:13:51 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:51 GMT Message-Id: <202107261613.16QGDp2I005990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 526c54f54b50 - stable/13 - mlx5ib: Extend parameter macros so that more arguments may be added. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 526c54f54b5073b896bc65538336f4aa163d3f7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:54 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=526c54f54b5073b896bc65538336f4aa163d3f7e commit 526c54f54b5073b896bc65538336f4aa163d3f7e Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:55 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5ib: Extend parameter macros so that more arguments may be added. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 42f719d611413f3bf9c7914e008fe22c916e1ac5) --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 62 +++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index 695b1ab14948..0ac5368ca3b2 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2020, 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 @@ -637,44 +637,44 @@ struct mlx5_roce { atomic_t next_port; }; -#define MLX5_IB_STATS_COUNT(a,b,c,d) a -#define MLX5_IB_STATS_VAR(a,b,c,d) b; -#define MLX5_IB_STATS_DESC(a,b,c,d) c, d, +#define MLX5_IB_STATS_COUNT(a,...) a +#define MLX5_IB_STATS_VAR(a,b,c,...) b c; +#define MLX5_IB_STATS_DESC(a,b,c,d,e,...) d, e, #define MLX5_IB_CONG_PARAMS(m) \ /* ECN RP */ \ - m(+1, u64 rp_clamp_tgt_rate, "rp_clamp_tgt_rate", "If set, whenever a CNP is processed, the target rate is updated to be the current rate") \ - m(+1, u64 rp_clamp_tgt_rate_ati, "rp_clamp_tgt_rate_ati", "If set, when receiving a CNP, the target rate should be updated if the transission rate was increased due to the timer, and not only due to the byte counter") \ - m(+1, u64 rp_time_reset, "rp_time_reset", "Time in microseconds between rate increases if no CNPs are received") \ - m(+1, u64 rp_byte_reset, "rp_byte_reset", "Transmitted data in bytes between rate increases if no CNP's are received. A value of zero means disabled.") \ - m(+1, u64 rp_threshold, "rp_threshold", "The number of times rpByteStage or rpTimeStage can count before the RP rate control state machine advances states") \ - m(+1, u64 rp_ai_rate, "rp_ai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the active increase state") \ - m(+1, u64 rp_hai_rate, "rp_hai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the hyper increase state") \ - m(+1, u64 rp_min_dec_fac, "rp_min_dec_fac", "The minimum factor by which the current transmit rate can be changed when processing a CNP. Value is given as a percentage, [1 .. 100]") \ - m(+1, u64 rp_min_rate, "rp_min_rate", "The minimum value, in Mbps per second, for rate to limit") \ - m(+1, u64 rp_rate_to_set_on_first_cnp, "rp_rate_to_set_on_first_cnp", "The rate that is set for the flow when a rate limiter is allocated to it upon first CNP received, in Mbps. A value of zero means use full port speed") \ - m(+1, u64 rp_dce_tcp_g, "rp_dce_tcp_g", "Used to update the congestion estimator, alpha, once every dce_tcp_rtt once every dce_tcp_rtt microseconds") \ - m(+1, u64 rp_dce_tcp_rtt, "rp_dce_tcp_rtt", "The time between updates of the aolpha value, in microseconds") \ - m(+1, u64 rp_rate_reduce_monitor_period, "rp_rate_reduce_monitor_period", "The minimum time between two consecutive rate reductions for a single flow") \ - m(+1, u64 rp_initial_alpha_value, "rp_initial_alpha_value", "The initial value of alpha to use when receiving the first CNP for a flow") \ - m(+1, u64 rp_gd, "rp_gd", "If a CNP is received, the flow rate is reduced at the beginning of the next rate_reduce_monitor_period interval") \ + m(+1, u64, rp_clamp_tgt_rate, "rp_clamp_tgt_rate", "If set, whenever a CNP is processed, the target rate is updated to be the current rate") \ + m(+1, u64, rp_clamp_tgt_rate_ati, "rp_clamp_tgt_rate_ati", "If set, when receiving a CNP, the target rate should be updated if the transission rate was increased due to the timer, and not only due to the byte counter") \ + m(+1, u64, rp_time_reset, "rp_time_reset", "Time in microseconds between rate increases if no CNPs are received") \ + m(+1, u64, rp_byte_reset, "rp_byte_reset", "Transmitted data in bytes between rate increases if no CNP's are received. A value of zero means disabled.") \ + m(+1, u64, rp_threshold, "rp_threshold", "The number of times rpByteStage or rpTimeStage can count before the RP rate control state machine advances states") \ + m(+1, u64, rp_ai_rate, "rp_ai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the active increase state") \ + m(+1, u64, rp_hai_rate, "rp_hai_rate", "The rate, in Mbits per second, used to increase rpTargetRate in the hyper increase state") \ + m(+1, u64, rp_min_dec_fac, "rp_min_dec_fac", "The minimum factor by which the current transmit rate can be changed when processing a CNP. Value is given as a percentage, [1 .. 100]") \ + m(+1, u64, rp_min_rate, "rp_min_rate", "The minimum value, in Mbps per second, for rate to limit") \ + m(+1, u64, rp_rate_to_set_on_first_cnp, "rp_rate_to_set_on_first_cnp", "The rate that is set for the flow when a rate limiter is allocated to it upon first CNP received, in Mbps. A value of zero means use full port speed") \ + m(+1, u64, rp_dce_tcp_g, "rp_dce_tcp_g", "Used to update the congestion estimator, alpha, once every dce_tcp_rtt once every dce_tcp_rtt microseconds") \ + m(+1, u64, rp_dce_tcp_rtt, "rp_dce_tcp_rtt", "The time between updates of the aolpha value, in microseconds") \ + m(+1, u64, rp_rate_reduce_monitor_period, "rp_rate_reduce_monitor_period", "The minimum time between two consecutive rate reductions for a single flow") \ + m(+1, u64, rp_initial_alpha_value, "rp_initial_alpha_value", "The initial value of alpha to use when receiving the first CNP for a flow") \ + m(+1, u64, rp_gd, "rp_gd", "If a CNP is received, the flow rate is reduced at the beginning of the next rate_reduce_monitor_period interval") \ /* ECN NP */ \ - m(+1, u64 np_cnp_dscp, "np_cnp_dscp", "The DiffServ Code Point of the generated CNP for this port") \ - m(+1, u64 np_cnp_prio_mode, "np_cnp_prio_mode", "The 802.1p priority value of the generated CNP for this port") \ - m(+1, u64 np_cnp_prio, "np_cnp_prio", "The 802.1p priority value of the generated CNP for this port") + m(+1, u64, np_cnp_dscp, "np_cnp_dscp", "The DiffServ Code Point of the generated CNP for this port") \ + m(+1, u64, np_cnp_prio_mode, "np_cnp_prio_mode", "The 802.1p priority value of the generated CNP for this port") \ + m(+1, u64, np_cnp_prio, "np_cnp_prio", "The 802.1p priority value of the generated CNP for this port") #define MLX5_IB_CONG_PARAMS_NUM (0 MLX5_IB_CONG_PARAMS(MLX5_IB_STATS_COUNT)) #define MLX5_IB_CONG_STATS(m) \ - m(+1, u64 syndrome, "syndrome", "Syndrome number") \ - m(+1, u64 rp_cur_flows, "rp_cur_flows", "Number of flows limited") \ - m(+1, u64 sum_flows, "sum_flows", "Sum of the number of flows limited over time") \ - m(+1, u64 rp_cnp_ignored, "rp_cnp_ignored", "Number of CNPs and CNMs ignored") \ - m(+1, u64 rp_cnp_handled, "rp_cnp_handled", "Number of CNPs and CNMs successfully handled") \ - m(+1, u64 time_stamp, "time_stamp", "Time stamp in microseconds") \ - m(+1, u64 accumulators_period, "accumulators_period", "The value of X variable for accumulating counters") \ - m(+1, u64 np_ecn_marked_roce_packets, "np_ecn_marked_roce_packets", "Number of ECN marked packets seen") \ - m(+1, u64 np_cnp_sent, "np_cnp_sent", "Number of CNPs sent") + m(+1, u64, syndrome, "syndrome", "Syndrome number") \ + m(+1, u64, rp_cur_flows, "rp_cur_flows", "Number of flows limited") \ + m(+1, u64, sum_flows, "sum_flows", "Sum of the number of flows limited over time") \ + m(+1, u64, rp_cnp_ignored, "rp_cnp_ignored", "Number of CNPs and CNMs ignored") \ + m(+1, u64, rp_cnp_handled, "rp_cnp_handled", "Number of CNPs and CNMs successfully handled") \ + m(+1, u64, time_stamp, "time_stamp", "Time stamp in microseconds") \ + m(+1, u64, accumulators_period, "accumulators_period", "The value of X variable for accumulating counters") \ + m(+1, u64, np_ecn_marked_roce_packets, "np_ecn_marked_roce_packets", "Number of ECN marked packets seen") \ + m(+1, u64, np_cnp_sent, "np_cnp_sent", "Number of CNPs sent") #define MLX5_IB_CONG_STATS_NUM (0 MLX5_IB_CONG_STATS(MLX5_IB_STATS_COUNT)) From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 750A666F736; Mon, 26 Jul 2021 16:13:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ326w3Qz3pjl; Mon, 26 Jul 2021 16:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3501F1A490; Mon, 26 Jul 2021 16:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDoJJ005967; Mon, 26 Jul 2021 16:13:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDoVL005966; Mon, 26 Jul 2021 16:13:50 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:50 GMT Message-Id: <202107261613.16QGDoVL005966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 75b63f08d2e8 - stable/13 - mlx5core: Don't query the PCI config space for offline during a firmware command. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 75b63f08d2e849c8639f0990f1e1794136b7050d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:53 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=75b63f08d2e849c8639f0990f1e1794136b7050d commit 75b63f08d2e849c8639f0990f1e1794136b7050d Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:54 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5core: Don't query the PCI config space for offline during a firmware command. Querying the PCI config space for offline for every firmware command blocks the PCI bus and affects performance. Especially for packet pacing and TLS when objects are frequently created and destroyed. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit e787b5acb1bdf97fc04ec3ebebb7a8dd40d85199) --- sys/dev/mlx5/mlx5_core/mlx5_cmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c index 0bc5f92e3b02..c6cc3fee8c43 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cmd.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cmd.c @@ -1287,8 +1287,7 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, u8 status = 0; u32 drv_synd; - if (pci_channel_offline(dev->pdev) || - dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { u16 opcode = MLX5_GET(mbox_in, in, opcode); err = mlx5_internal_err_ret_value(dev, opcode, &drv_synd, &status); MLX5_SET(mbox_out, out, status, status); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:14:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C492166F99A; Mon, 26 Jul 2021 16:14:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3J0spvz3pgj; Mon, 26 Jul 2021 16:14:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 643F31A491; Mon, 26 Jul 2021 16:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGE0CR006195; Mon, 26 Jul 2021 16:14:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGE0f9006194; Mon, 26 Jul 2021 16:14:00 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:14:00 GMT Message-Id: <202107261614.16QGE0f9006194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: fdab56d1f605 - stable/13 - mlx5en: Allow binding channels to CPUs when RSS is not enabled. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fdab56d1f6054f33ffab0b4498ea114acbb475ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:14:06 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=fdab56d1f6054f33ffab0b4498ea114acbb475ac commit fdab56d1f6054f33ffab0b4498ea114acbb475ac Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:02:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5en: Allow binding channels to CPUs when RSS is not enabled. Submitted by: Netflix Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit c8d16d1e084dc14191491e95ce226d3ce8b39275) --- sys/dev/mlx5/mlx5_en/en.h | 6 ++++-- sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c | 13 ++++++++++++- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index c84e2af237b2..8556a4364ddd 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -710,7 +710,9 @@ struct mlx5e_params { 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, uc_local_lb, "uc_local_lb", "0: Local unicast loopback enabled 1: Disabled") \ + m(+1, s64, irq_cpu_base, "irq_cpu_base", "-1: Don't bind IRQ 0..NCPU-1: select this base CPU when binding IRQs") \ + m(+1, s64, irq_cpu_stride, "irq_cpu_stride", "0..NCPU-1: Distance between IRQ vectors when binding them") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c index 4070fe4331a1..f7228989ee04 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2021 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1250,6 +1250,15 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) } break; + case MLX5_PARAM_OFFSET(irq_cpu_base): + case MLX5_PARAM_OFFSET(irq_cpu_stride): + if (was_opened) { + /* network interface must toggled */ + mlx5e_close_locked(priv->ifp); + mlx5e_open_locked(priv->ifp); + } + break; + default: break; } @@ -1413,6 +1422,8 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) int i; /* set some defaults */ + priv->params_ethtool.irq_cpu_base = -1; /* disabled */ + priv->params_ethtool.irq_cpu_stride = 1; priv->params_ethtool.tx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE; priv->params_ethtool.rx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE; priv->params_ethtool.tx_queue_size = 1 << priv->params.log_sq_size; diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index b67f382522e7..9345798006f2 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2446,6 +2446,30 @@ mlx5e_open_channels(struct mlx5e_priv *priv) err = mlx5e_open_channel(priv, cparam, &priv->channel[i]); if (err) goto err_close_channels; + + /* Bind interrupt vectors, if any. */ + if (priv->params_ethtool.irq_cpu_base > -1) { + cpuset_t cpuset; + int cpu; + int irq; + int eqn; + int nirq; + + err = mlx5_vector2eqn(priv->mdev, i, + &eqn, &nirq); + + /* error here is non-fatal */ + if (err != 0) + continue; + + irq = priv->mdev->priv.msix_arr[nirq].vector; + cpu = (unsigned)(priv->params_ethtool.irq_cpu_base + + i * priv->params_ethtool.irq_cpu_stride) % (unsigned)mp_ncpus; + + CPU_ZERO(&cpuset); + CPU_SET(cpu, &cpuset); + intr_setaffinity(irq, CPU_WHICH_INTRHANDLER, &cpuset); + } } for (j = 0; j < priv->params.num_channels; j++) { From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:13:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8963966F672; Mon, 26 Jul 2021 16:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3856Szz3pgN; Mon, 26 Jul 2021 16:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A35761A237; Mon, 26 Jul 2021 16:13:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDraZ006039; Mon, 26 Jul 2021 16:13:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDrLB006038; Mon, 26 Jul 2021 16:13:53 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:53 GMT Message-Id: <202107261613.16QGDrLB006038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c41403c5cae2 - stable/13 - mlx5en: Check for pci_channel_offline() when draining sendqueue. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c41403c5cae251f0a531c3d3491a1401368c5cfd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:13:57 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c41403c5cae251f0a531c3d3491a1401368c5cfd commit c41403c5cae251f0a531c3d3491a1401368c5cfd Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:56 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:32 +0000 mlx5en: Check for pci_channel_offline() when draining sendqueue. This speeds up detach in hypervisor environments. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4692d9808e61958675d91ec595b5732c8d1fa700) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index fc9ffc01a0df..97438de3bc2a 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1875,7 +1875,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) mtx_lock(&sq->lock); while (sq->cc != sq->pc && (sq->priv->media_status_last & IFM_ACTIVE) != 0 && - mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR && + pci_channel_offline(mdev->pdev) == 0) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq, NULL); @@ -1893,7 +1894,8 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* wait till SQ is empty */ mtx_lock(&sq->lock); while (sq->cc != sq->pc && - mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mdev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR && + pci_channel_offline(mdev->pdev) == 0) { mtx_unlock(&sq->lock); msleep(1); sq->cq.mcq.comp(&sq->cq.mcq, NULL); From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 16:14:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E8A366F8B4; Mon, 26 Jul 2021 16:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYQ3C46V3z3pgY; Mon, 26 Jul 2021 16:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 240911A44F; Mon, 26 Jul 2021 16:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QGDwvM006141; Mon, 26 Jul 2021 16:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QGDwsK006140; Mon, 26 Jul 2021 16:13:58 GMT (envelope-from git) Date: Mon, 26 Jul 2021 16:13:58 GMT Message-Id: <202107261613.16QGDwsK006140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 857966b357ee - stable/13 - mlx5en: Allocate per-channel doorbells. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 857966b357eed16c5e79fd1a40cb389980373100 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 16:14:01 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=857966b357eed16c5e79fd1a40cb389980373100 commit 857966b357eed16c5e79fd1a40cb389980373100 Author: Hans Petter Selasky AuthorDate: 2021-06-16 13:01:59 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-26 16:04:33 +0000 mlx5en: Allocate per-channel doorbells. To avoid congestion on the same PCI memory register space when traffic consists mostly of small packets. Reviewed by: kib Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 9dfa21486e1db730305abd63df449bcc1e76127b) --- sys/dev/mlx5/mlx5_en/en.h | 6 ++-- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 61 ++++++++++++++++++++++++------------- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 5 +-- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index b249a82d30ef..c84e2af237b2 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -870,6 +870,7 @@ mlx5e_sq_queue_level(struct mlx5e_sq *sq) struct mlx5e_channel { struct mlx5e_rq rq; struct m_snd_tag tag; + struct mlx5_sq_bfreg bfreg; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; struct mlx5e_priv *priv; struct completion completion; @@ -1073,8 +1074,6 @@ struct mlx5e_priv { struct mlx5e_dcbx dcbx; bool sw_is_port_buf_owner; - struct mlx5_sq_bfreg bfreg; - struct pfil_head *pfil; struct mlx5e_channel channel[]; }; @@ -1201,7 +1200,8 @@ int mlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *, void mlx5e_close_cq(struct mlx5e_cq *); void mlx5e_free_sq_db(struct mlx5e_sq *); int mlx5e_alloc_sq_db(struct mlx5e_sq *); -int mlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, int tis_num); +int mlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, + const struct mlx5_sq_bfreg *, int tis_num); int mlx5e_modify_sq(struct mlx5e_sq *, int curr_state, int next_state); void mlx5e_disable_sq(struct mlx5e_sq *); void mlx5e_drain_sq(struct mlx5e_sq *); diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index d9860c24114b..b67f382522e7 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1619,8 +1619,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, &sq->dma_tag))) goto done; - sq->uar_map = priv->bfreg.map; - err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -1668,7 +1666,7 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq) int mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, - int tis_num) + const struct mlx5_sq_bfreg *bfreg, int tis_num) { void *in; void *sqc; @@ -1683,6 +1681,8 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, if (in == NULL) return (-ENOMEM); + sq->uar_map = bfreg->map; + ts_format = mlx5_get_sq_default_ts(sq->priv->mdev); sqc = MLX5_ADDR_OF(create_sq_in, in, ctx); wq = MLX5_ADDR_OF(sqc, sqc, wq); @@ -1698,7 +1698,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param, MLX5_SET(sqc, sqc, allow_swp, 1); MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC); - MLX5_SET(wq, wq, uar_page, sq->priv->bfreg.index); + MLX5_SET(wq, wq, uar_page, bfreg->index); MLX5_SET(wq, wq, log_wq_pg_sz, sq->wq_ctrl.buf.page_shift - PAGE_SHIFT); MLX5_SET64(wq, wq, dbr_addr, sq->wq_ctrl.db.dma); @@ -1764,7 +1764,7 @@ mlx5e_open_sq(struct mlx5e_channel *c, if (err) return (err); - err = mlx5e_enable_sq(sq, param, c->priv->tisn[tc]); + err = mlx5e_enable_sq(sq, param, &c->bfreg, c->priv->tisn[tc]); if (err) goto err_destroy_sq; @@ -3763,10 +3763,12 @@ static const char *mlx5e_pport_stats_desc[] = { MLX5E_PPORT_STATS(MLX5E_STATS_DESC) }; -static void -mlx5e_priv_static_init(struct mlx5e_priv *priv, const uint32_t channels) +static int +mlx5e_priv_static_init(struct mlx5e_priv *priv, struct mlx5_core_dev *mdev, + const uint32_t channels) { uint32_t x; + int err; mtx_init(&priv->async_events_mtx, "mlx5async", MTX_NETWORK_LOCK, MTX_DEF); sx_init(&priv->state_lock, "mlx5state"); @@ -3774,13 +3776,34 @@ mlx5e_priv_static_init(struct mlx5e_priv *priv, const uint32_t channels) MLX5_INIT_DOORBELL_LOCK(&priv->doorbell_lock); for (x = 0; x != channels; x++) mlx5e_chan_static_init(priv, &priv->channel[x], x); + + for (x = 0; x != channels; x++) { + err = mlx5_alloc_bfreg(mdev, &priv->channel[x].bfreg, false, false); + if (err) + goto err_alloc_bfreg; + } + return (0); + +err_alloc_bfreg: + while (x--) + mlx5_free_bfreg(mdev, &priv->channel[x].bfreg); + + for (x = 0; x != channels; x++) + mlx5e_chan_static_destroy(&priv->channel[x]); + callout_drain(&priv->watchdog); + mtx_destroy(&priv->async_events_mtx); + sx_destroy(&priv->state_lock); + return (err); } static void -mlx5e_priv_static_destroy(struct mlx5e_priv *priv, const uint32_t channels) +mlx5e_priv_static_destroy(struct mlx5e_priv *priv, struct mlx5_core_dev *mdev, + const uint32_t channels) { uint32_t x; + for (x = 0; x != channels; x++) + mlx5_free_bfreg(mdev, &priv->channel[x].bfreg); for (x = 0; x != channels; x++) mlx5e_chan_static_destroy(&priv->channel[x]); callout_drain(&priv->watchdog); @@ -4397,7 +4420,10 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_free_priv; } /* setup all static fields */ - mlx5e_priv_static_init(priv, mdev->priv.eq_table.num_comp_vectors); + if (mlx5e_priv_static_init(priv, mdev, mdev->priv.eq_table.num_comp_vectors)) { + mlx5_core_err(mdev, "mlx5e_priv_static_init() failed\n"); + goto err_free_ifp; + } ifp->if_softc = priv; if_initname(ifp, "mce", device_get_unit(mdev->pdev->dev.bsddev)); @@ -4508,11 +4534,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_en_err(ifp, "mlx5e_create_mkey failed, %d\n", err); goto err_dealloc_transport_domain; } - err = mlx5_alloc_bfreg(mdev, &priv->bfreg, false, false); - if (err) { - mlx5_en_err(ifp, "alloc bfreg failed, %d\n", err); - goto err_create_mkey; - } mlx5_query_nic_vport_mac_address(priv->mdev, 0, dev_addr); /* check if we should generate a random MAC address */ @@ -4525,7 +4546,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) err = mlx5e_rl_init(priv); if (err) { mlx5_en_err(ifp, "mlx5e_rl_init failed, %d\n", err); - goto err_alloc_bfreg; + goto err_create_mkey; } err = mlx5e_tls_init(priv); @@ -4664,9 +4685,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) err_rl_init: mlx5e_rl_cleanup(priv); -err_alloc_bfreg: - mlx5_free_bfreg(mdev, &priv->bfreg); - err_create_mkey: mlx5_core_destroy_mkey(priv->mdev, &priv->mr); @@ -4683,7 +4701,9 @@ err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); if (priv->sysctl_debug) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); - mlx5e_priv_static_destroy(priv, mdev->priv.eq_table.num_comp_vectors); + mlx5e_priv_static_destroy(priv, mdev, mdev->priv.eq_table.num_comp_vectors); + +err_free_ifp: if_free(ifp); err_free_priv: @@ -4767,13 +4787,12 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); sysctl_ctx_free(&priv->sysctl_ctx); - mlx5_free_bfreg(priv->mdev, &priv->bfreg); mlx5_core_destroy_mkey(priv->mdev, &priv->mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn); mlx5_core_dealloc_pd(priv->mdev, priv->pdn); mlx5e_disable_async_events(priv); flush_workqueue(priv->wq); - mlx5e_priv_static_destroy(priv, mdev->priv.eq_table.num_comp_vectors); + mlx5e_priv_static_destroy(priv, mdev, mdev->priv.eq_table.num_comp_vectors); if_free(ifp); free(priv, M_MLX5EN); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index 33b93b1b5ced..bd66b8ecd725 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -116,9 +116,6 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, &sq->dma_tag))) goto done; - /* use shared UAR */ - sq->uar_map = priv->bfreg.map; - err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, &sq->wq, &sq->wq_ctrl); if (err) @@ -165,7 +162,7 @@ mlx5e_rl_open_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, if (err) return (err); - err = mlx5e_enable_sq(sq, param, priv->rl.tisn); + err = mlx5e_enable_sq(sq, param, &priv->channel[ix].bfreg, priv->rl.tisn); if (err) goto err_destroy_sq; From owner-dev-commits-src-branches@freebsd.org Mon Jul 26 22:02:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00169675D03; Mon, 26 Jul 2021 22:02:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYYn15Pl0z4vT4; Mon, 26 Jul 2021 22:02:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0C781E9FC; Mon, 26 Jul 2021 22:02:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16QM2DLP074152; Mon, 26 Jul 2021 22:02:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QM2DT0074151; Mon, 26 Jul 2021 22:02:13 GMT (envelope-from git) Date: Mon, 26 Jul 2021 22:02:13 GMT Message-Id: <202107262202.16QM2DT0074151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 6e405dd9e48d - stable/13 - cxgbe(4): Remove some dead code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6e405dd9e48db9d088d6832efe8630c098bc4ce2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 22:02:14 -0000 The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=6e405dd9e48db9d088d6832efe8630c098bc4ce2 commit 6e405dd9e48db9d088d6832efe8630c098bc4ce2 Author: Navdeep Parhar AuthorDate: 2021-05-19 06:16:03 +0000 Commit: Navdeep Parhar CommitDate: 2021-07-26 17:49:25 +0000 cxgbe(4): Remove some dead code. (cherry picked from commit 3965469eaa33aca03837baf5f88a55fa89f3f987) --- sys/dev/cxgbe/adapter.h | 10 ---------- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 2 -- 2 files changed, 12 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 7bdad292c752..7f6e1ceb1550 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -68,16 +68,6 @@ MALLOC_DECLARE(M_CXGBE); #define CXGBE_UNIMPLEMENTED(s) \ panic("%s (%s, line %d) not implemented yet.", s, __FILE__, __LINE__) -#if defined(__i386__) || defined(__amd64__) -static __inline void -prefetch(void *x) -{ - __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); -} -#else -#define prefetch(x) __builtin_prefetch(x) -#endif - #ifndef SYSCTL_ADD_UQUAD #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #define sysctl_handle_64 sysctl_handle_quad diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index 8314800c4e7b..1a717d6352c8 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -56,8 +56,6 @@ #include #include -#undef prefetch - #include "common/common.h" #include "common/t4_msg.h" #include "common/t4_regs.h" From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 01:49:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F028665429D; Tue, 27 Jul 2021 01:49:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYfqL4lqJz4vjd; Tue, 27 Jul 2021 01:49:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81A1421F91; Tue, 27 Jul 2021 01:49:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16R1nYUl067332; Tue, 27 Jul 2021 01:49:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1nY1j067331; Tue, 27 Jul 2021 01:49:34 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:34 GMT Message-Id: <202107270149.16R1nY1j067331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b88a1996e218 - stable/13 - fifo: Explicitly initialize generation numbers when opening MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b88a1996e2185b462f63108e96dd6f4226e8c7f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 01:49:35 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b88a1996e2185b462f63108e96dd6f4226e8c7f6 commit b88a1996e2185b462f63108e96dd6f4226e8c7f6 Author: Mark Johnston AuthorDate: 2021-07-13 21:45:49 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:46:45 +0000 fifo: Explicitly initialize generation numbers when opening The fi_rgen and fi_wgen fields are generation numbers used when sleeping waiting for the other end of the fifo to be opened. The fields were not explicitly initialized after allocation, but this was harmless. To avoid false positives from KMSAN, though, ensure that they get initialized to zero. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit b9ca419a21d109948bf0fcea5c59725f1fe0cd7b) --- sys/fs/fifofs/fifo_vnops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 33c2c8ab2951..d2a51de84fba 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -154,9 +154,9 @@ fifo_open(ap) error = pipe_named_ctor(&fpipe, td); if (error != 0) return (error); - fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK); + fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK | M_ZERO); fip->fi_pipe = fpipe; - fpipe->pipe_wgen = fip->fi_readers = fip->fi_writers = 0; + fpipe->pipe_wgen = 0; KASSERT(vp->v_fifoinfo == NULL, ("fifo_open: v_fifoinfo race")); vp->v_fifoinfo = fip; } From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 01:49:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A425E654298; Tue, 27 Jul 2021 01:49:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYfqK46qyz4vXG; Tue, 27 Jul 2021 01:49:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DB8C21D2C; Tue, 27 Jul 2021 01:49:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16R1nXEp067308; Tue, 27 Jul 2021 01:49:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1nXvb067307; Tue, 27 Jul 2021 01:49:33 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:33 GMT Message-Id: <202107270149.16R1nXvb067307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 978804184224 - stable/13 - uart: Fix an out-of-bounds read in ns8250_bus_probe() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 97880418422475bc35c2485074ac77912f202305 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 01:49:33 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=97880418422475bc35c2485074ac77912f202305 commit 97880418422475bc35c2485074ac77912f202305 Author: Mark Johnston AuthorDate: 2021-07-13 21:49:39 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:46:34 +0000 uart: Fix an out-of-bounds read in ns8250_bus_probe() The problem is that ns8250_bus_probe() accesses a field from the ns8250_softc, which embeds the generic UART softc, but the ns8250_softc hasn't yet been allocated because we're still probing. This is a regression from commit 0aefb0a63c50. This fixed a problem where one of the upper four IER bits, which are usually reserved, needs to be set in order to get RX interrupts before the RX FIFO is full. At the same time, we avoid clearing those reserved bits (see commit 58957d87173, though other UART drivers I looked at do not bother with this). So, copy what ns8250_init() does to disable interrupts, since we don't know what the "right" mask is at this point. Reported by: syzbot+f256beefd0df9eb796e7@syzkaller.appspotmail.com Reviewed by: imp Sponsored by: The FreeBSD Foundation (cherry picked from commit 4a9a41650c909706bc0b9a3f29817c11b262b0a0) --- sys/dev/uart/uart_dev_ns8250.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 45b4d315c3d5..2b2f75cf5336 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -791,13 +791,11 @@ ns8250_bus_param(struct uart_softc *sc, int baudrate, int databits, int ns8250_bus_probe(struct uart_softc *sc) { - struct ns8250_softc *ns8250; struct uart_bas *bas; int count, delay, error, limit; uint8_t lsr, mcr, ier; uint8_t val; - ns8250 = (struct ns8250_softc *)sc; bas = &sc->sc_bas; error = ns8250_probe(bas); @@ -892,7 +890,8 @@ ns8250_bus_probe(struct uart_softc *sc) --limit) DELAY(delay); if (limit == 0) { - ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask; + /* See the comment in ns8250_init(). */ + ier = uart_getreg(bas, REG_IER) & 0xe0; uart_setreg(bas, REG_IER, ier); uart_setreg(bas, REG_MCR, mcr); val = 0; From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 01:49:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05AD2654053; Tue, 27 Jul 2021 01:49:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYfqN0w0Nz4vXN; Tue, 27 Jul 2021 01:49:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A50D621B53; Tue, 27 Jul 2021 01:49:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16R1nZ1F067356; Tue, 27 Jul 2021 01:49:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1nZkj067355; Tue, 27 Jul 2021 01:49:35 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:35 GMT Message-Id: <202107270149.16R1nZkj067355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a938bfca7a1a - stable/13 - graid3: Zero the metadata block before writing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a938bfca7a1ab2238c956e6098e78154da47ee2c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 01:49:37 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a938bfca7a1ab2238c956e6098e78154da47ee2c commit a938bfca7a1ab2238c956e6098e78154da47ee2c Author: Mark Johnston AuthorDate: 2021-07-13 21:46:02 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:47:12 +0000 graid3: Zero the metadata block before writing Ensure that string buffers and pad bytes are zero-filled before writing graid3 metadata. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 39552dff7bb5463a74e5195d65a3252c583d9414) --- sys/geom/raid3/g_raid3.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 5fe67c00068d..159eff990892 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -743,6 +743,7 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) struct g_raid3_softc *sc; struct g_provider *pp; + bzero(md, sizeof(*md)); sc = disk->d_softc; strlcpy(md->md_magic, G_RAID3_MAGIC, sizeof(md->md_magic)); md->md_version = G_RAID3_VERSION; @@ -756,9 +757,7 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) md->md_no = disk->d_no; md->md_syncid = disk->d_sync.ds_syncid; md->md_dflags = (disk->d_flags & G_RAID3_DISK_FLAG_MASK); - if (disk->d_state != G_RAID3_DISK_STATE_SYNCHRONIZING) - md->md_sync_offset = 0; - else { + if (disk->d_state == G_RAID3_DISK_STATE_SYNCHRONIZING) { md->md_sync_offset = disk->d_sync.ds_offset_done / (sc->sc_ndisks - 1); } @@ -768,12 +767,8 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) pp = NULL; if ((disk->d_flags & G_RAID3_DISK_FLAG_HARDCODED) != 0 && pp != NULL) strlcpy(md->md_provider, pp->name, sizeof(md->md_provider)); - else - bzero(md->md_provider, sizeof(md->md_provider)); if (pp != NULL) md->md_provsize = pp->mediasize; - else - md->md_provsize = 0; } void From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 01:49:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3AD1A654310; Tue, 27 Jul 2021 01:49:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYfqP0mZPz4vjm; Tue, 27 Jul 2021 01:49:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB04821ECF; Tue, 27 Jul 2021 01:49:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16R1naPY067385; Tue, 27 Jul 2021 01:49:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1na8S067384; Tue, 27 Jul 2021 01:49:36 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:36 GMT Message-Id: <202107270149.16R1na8S067384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f065d0bb299b - stable/13 - blist: Correct the node count computed in blist_create() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f065d0bb299bcedf1adc003397d340f88688ff75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 01:49:37 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f065d0bb299bcedf1adc003397d340f88688ff75 commit f065d0bb299bcedf1adc003397d340f88688ff75 Author: Mark Johnston AuthorDate: 2021-07-13 21:47:27 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:47:20 +0000 blist: Correct the node count computed in blist_create() Commit bb4a27f927a1 added the ability to allocate a span of blocks crossing a meta node boundary. To ensure that blst_next_leaf_alloc() does not walk past the end of the tree, an extra all-zero meta node needs to be present at the end of the allocation, and blst_next_leaf_alloc() is implemented such that the presence of this node terminates the search. blist_create() computes the number of nodes required. It had two problems: 1. When the size of the blist is a power of BLIST_RADIX, we would unnecessarily allocate an extra level in the tree. 2. When the size of the blist is a multiple of BLIST_RADIX, we would fail to allocate a terminator node. In this case, blst_next_leaf_alloc() could scan beyond the bounds of the allocation. This was found using KASAN. Modify blist_create() to handle these cases correctly. Reported by: pho Reviewed by: dougm (cherry picked from commit 2783335caeae964bd8a1aa15726b523876613e45) --- sys/kern/subr_blist.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c index 27b226fd8a18..ba13fb4efd80 100644 --- a/sys/kern/subr_blist.c +++ b/sys/kern/subr_blist.c @@ -244,8 +244,16 @@ blist_create(daddr_t blocks, int flags) * Calculate the radix and node count used for scanning. */ nodes = 1; - for (radix = 1; radix <= blocks / BLIST_RADIX; radix *= BLIST_RADIX) - nodes += 1 + (blocks - 1) / radix / BLIST_RADIX; + for (radix = 1; (blocks - 1) / BLIST_RADIX / radix > 0; + radix *= BLIST_RADIX) + nodes += 1 + (blocks - 1) / BLIST_RADIX / radix; + + /* + * Include a sentinel node to ensure that cross-leaf scans stay within + * the bounds of the allocation. + */ + if (blocks % BLIST_RADIX == 0) + nodes++; bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags | M_ZERO); From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 01:49:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4852065405B; Tue, 27 Jul 2021 01:49:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYfqQ291Kz4vlR; Tue, 27 Jul 2021 01:49:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB1CE21B54; Tue, 27 Jul 2021 01:49:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16R1nbrt067411; Tue, 27 Jul 2021 01:49:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R1nbIb067410; Tue, 27 Jul 2021 01:49:37 GMT (envelope-from git) Date: Tue, 27 Jul 2021 01:49:37 GMT Message-Id: <202107270149.16R1nbIb067410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 82b475c654ab - stable/13 - gmirror: Zero the metadata block before writing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 82b475c654abfaa9c28bb1e2e73dfbd15d3f45f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 01:49:39 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=82b475c654abfaa9c28bb1e2e73dfbd15d3f45f4 commit 82b475c654abfaa9c28bb1e2e73dfbd15d3f45f4 Author: Mark Johnston AuthorDate: 2021-07-13 21:45:57 +0000 Commit: Mark Johnston CommitDate: 2021-07-27 01:47:45 +0000 gmirror: Zero the metadata block before writing The mirror metadata fields contain string buffers and pad bytes, neither were being zeroed before metadata was written to disk. Also, the metadata structure is smaller than the sector size, and in one case gmirror was failing to zero-fill the full buffer before writing. Fix these problems by pre-zeroing the metadata structure and the sector buffer. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 7f053a44aef75eab395ce15a1c8a1399a2f89cad) --- sys/geom/mirror/g_mirror.c | 9 +-------- sys/geom/mirror/g_mirror_ctl.c | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 51836b7eabb8..c0641d15673e 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -749,6 +749,7 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, struct g_mirror_metadata *md) { + bzero(md, sizeof(*md)); strlcpy(md->md_magic, G_MIRROR_MAGIC, sizeof(md->md_magic)); md->md_version = G_MIRROR_VERSION; strlcpy(md->md_name, sc->sc_name, sizeof(md->md_name)); @@ -760,14 +761,8 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, md->md_mediasize = sc->sc_mediasize; md->md_sectorsize = sc->sc_sectorsize; md->md_mflags = (sc->sc_flags & G_MIRROR_DEVICE_FLAG_MASK); - bzero(md->md_provider, sizeof(md->md_provider)); if (disk == NULL) { md->md_did = arc4random(); - md->md_priority = 0; - md->md_syncid = 0; - md->md_dflags = 0; - md->md_sync_offset = 0; - md->md_provsize = 0; } else { md->md_did = disk->d_id; md->md_priority = disk->d_priority; @@ -775,8 +770,6 @@ g_mirror_fill_metadata(struct g_mirror_softc *sc, struct g_mirror_disk *disk, md->md_dflags = (disk->d_flags & G_MIRROR_DISK_FLAG_MASK); if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) md->md_sync_offset = disk->d_sync.ds_offset_done; - else - md->md_sync_offset = 0; if ((disk->d_flags & G_MIRROR_DISK_FLAG_HARDCODED) != 0) { strlcpy(md->md_provider, disk->d_consumer->provider->name, diff --git a/sys/geom/mirror/g_mirror_ctl.c b/sys/geom/mirror/g_mirror_ctl.c index 254841b6c04a..355504a6f90f 100644 --- a/sys/geom/mirror/g_mirror_ctl.c +++ b/sys/geom/mirror/g_mirror_ctl.c @@ -747,7 +747,7 @@ again: bzero(md.md_provider, sizeof(md.md_provider)); } md.md_provsize = pp->mediasize; - sector = g_malloc(pp->sectorsize, M_WAITOK); + sector = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); mirror_metadata_encode(&md, sector); error = g_write_data(disks[i].consumer, pp->mediasize - pp->sectorsize, sector, pp->sectorsize); From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 02:38:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2653865700E; Tue, 27 Jul 2021 02:38:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYgw20J8zz3Nmj; Tue, 27 Jul 2021 02:38:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5CAE22995; Tue, 27 Jul 2021 02:38:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16R2cfLP034154; Tue, 27 Jul 2021 02:38:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R2cfFS034153; Tue, 27 Jul 2021 02:38:41 GMT (envelope-from git) Date: Tue, 27 Jul 2021 02:38:41 GMT Message-Id: <202107270238.16R2cfFS034153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 320e5d7d398c - stable/13 - Revert "loader: support.4th resets the read buffer incorrectly" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 320e5d7d398c9b66e73560e7789e39709d31ce7d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 02:38:42 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=320e5d7d398c9b66e73560e7789e39709d31ce7d commit 320e5d7d398c9b66e73560e7789e39709d31ce7d Author: Warner Losh AuthorDate: 2021-07-26 22:40:41 +0000 Commit: Warner Losh CommitDate: 2021-07-27 02:37:40 +0000 Revert "loader: support.4th resets the read buffer incorrectly" This reverts commit 9c1c02093b90ae49745a174eb26ea85dd1990eec. It seems to have broken all old nextboot.conf files causing hangs on boot. PR: 239315 (cherry picked from commit 4783fb730fa1cfdbe5c905bb23ac74f681e2df6b) --- stand/forth/support.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index ec04b7e9e322..d87cf16a16dd 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -485,7 +485,7 @@ variable fd get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading - 0 read_buffer .len ! + 0 to read_buffer_ptr ; : read_line From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 02:45:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4947865721E; Tue, 27 Jul 2021 02:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYh3S13l2z3QJp; Tue, 27 Jul 2021 02:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0300B22749; Tue, 27 Jul 2021 02:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16R2j78b046881; Tue, 27 Jul 2021 02:45:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16R2j7Up046880; Tue, 27 Jul 2021 02:45:07 GMT (envelope-from git) Date: Tue, 27 Jul 2021 02:45:07 GMT Message-Id: <202107270245.16R2j7Up046880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: ac56cd3ba627 - stable/12 - Revert "loader: support.4th resets the read buffer incorrectly" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ac56cd3ba627b403da2c52ae6cecb5b4143be6c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 02:45:08 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ac56cd3ba627b403da2c52ae6cecb5b4143be6c7 commit ac56cd3ba627b403da2c52ae6cecb5b4143be6c7 Author: Warner Losh AuthorDate: 2021-07-26 22:40:41 +0000 Commit: Warner Losh CommitDate: 2021-07-27 02:38:58 +0000 Revert "loader: support.4th resets the read buffer incorrectly" This reverts commit 9c1c02093b90ae49745a174eb26ea85dd1990eec. It seems to have broken all old nextboot.conf files causing hangs on boot. PR: 239315 Sponsored by: Netflix (cherry picked from commit 4783fb730fa1cfdbe5c905bb23ac74f681e2df6b) --- stand/forth/support.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index ed5e6a6da9ee..64c71e12ec26 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -410,7 +410,7 @@ variable fd get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading - 0 read_buffer .len ! + 0 to read_buffer_ptr ; : read_line From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F96B65DB3E; Tue, 27 Jul 2021 11:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4N02s3z3s1C; Tue, 27 Jul 2021 11:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDB8D1DF3; Tue, 27 Jul 2021 11:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkhpe067561; Tue, 27 Jul 2021 11:46:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkh6e067560; Tue, 27 Jul 2021 11:46:43 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:43 GMT Message-Id: <202107271146.16RBkh6e067560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 0df576d98e15 - stable/13 - pf: factor out pf_synproxy() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0df576d98e15bbafa73522a099bf0f34990496b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:44 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0df576d98e15bbafa73522a099bf0f34990496b4 commit 0df576d98e15bbafa73522a099bf0f34990496b4 Author: Kristof Provost AuthorDate: 2021-06-10 13:49:09 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:42:13 +0000 pf: factor out pf_synproxy() MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31137 (cherry picked from commit ee9c3d38039eb29966e1f0b8f617bc564c078289) --- sys/netpfil/pf/pf.c | 85 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index c47a0098550d..a08f38f3a286 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4455,45 +4455,13 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, - struct mbuf *m, int off, void *h, struct pf_pdesc *pd, - u_short *reason) +pf_synproxy(struct pf_pdesc *pd, struct pf_kstate **state, u_short *reason) { - struct pf_state_key_cmp key; + struct pf_state_key *sk = (*state)->key[pd->didx]; struct tcphdr *th = &pd->hdr.tcp; - int copyback = 0; - struct pf_state_peer *src, *dst; - struct pf_state_key *sk; - - bzero(&key, sizeof(key)); - key.af = pd->af; - key.proto = IPPROTO_TCP; - if (direction == PF_IN) { /* wire side, straight */ - PF_ACPY(&key.addr[0], pd->src, key.af); - PF_ACPY(&key.addr[1], pd->dst, key.af); - key.port[0] = th->th_sport; - key.port[1] = th->th_dport; - } else { /* stack side, reverse */ - PF_ACPY(&key.addr[1], pd->src, key.af); - PF_ACPY(&key.addr[0], pd->dst, key.af); - key.port[1] = th->th_sport; - key.port[0] = th->th_dport; - } - - STATE_LOOKUP(kif, &key, direction, *state, pd); - - if (direction == (*state)->direction) { - src = &(*state)->src; - dst = &(*state)->dst; - } else { - src = &(*state)->dst; - dst = &(*state)->src; - } - - sk = (*state)->key[pd->didx]; if ((*state)->src.state == PF_TCPS_PROXY_SRC) { - if (direction != (*state)->direction) { + if (pd->dir != (*state)->direction) { REASON_SET(reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } @@ -4521,7 +4489,7 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, (*state)->src.state = PF_TCPS_PROXY_DST; } if ((*state)->src.state == PF_TCPS_PROXY_DST) { - if (direction == (*state)->direction) { + if (pd->dir == (*state)->direction) { if (((th->th_flags & (TH_SYN|TH_ACK)) != TH_ACK) || (ntohl(th->th_ack) != (*state)->src.seqhi + 1) || (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) { @@ -4572,6 +4540,51 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, } } + return (PF_PASS); +} + +static int +pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, + struct mbuf *m, int off, void *h, struct pf_pdesc *pd, + u_short *reason) +{ + struct pf_state_key_cmp key; + struct tcphdr *th = &pd->hdr.tcp; + int copyback = 0; + int action; + struct pf_state_peer *src, *dst; + struct pf_state_key *sk; + + bzero(&key, sizeof(key)); + key.af = pd->af; + key.proto = IPPROTO_TCP; + if (direction == PF_IN) { /* wire side, straight */ + PF_ACPY(&key.addr[0], pd->src, key.af); + PF_ACPY(&key.addr[1], pd->dst, key.af); + key.port[0] = th->th_sport; + key.port[1] = th->th_dport; + } else { /* stack side, reverse */ + PF_ACPY(&key.addr[1], pd->src, key.af); + PF_ACPY(&key.addr[0], pd->dst, key.af); + key.port[1] = th->th_sport; + key.port[0] = th->th_dport; + } + + STATE_LOOKUP(kif, &key, direction, *state, pd); + + if (direction == (*state)->direction) { + src = &(*state)->src; + dst = &(*state)->dst; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + } + + sk = (*state)->key[pd->didx]; + + if ((action = pf_synproxy(pd, state, reason)) != PF_PASS) + return (action); + if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) && dst->state >= TCPS_FIN_WAIT_2 && src->state >= TCPS_FIN_WAIT_2) { From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AB9265DAC8; Tue, 27 Jul 2021 11:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4N330Bz3sHM; Tue, 27 Jul 2021 11:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50A351DF4; Tue, 27 Jul 2021 11:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkipG067667; Tue, 27 Jul 2021 11:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkibo067666; Tue, 27 Jul 2021 11:46:44 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:44 GMT Message-Id: <202107271146.16RBkibo067666@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 57eda4b922b0 - stable/12 - pf: factor out pf_synproxy() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 57eda4b922b0d29c5971dbcb6b09b966b064cc3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:44 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=57eda4b922b0d29c5971dbcb6b09b966b064cc3f commit 57eda4b922b0d29c5971dbcb6b09b966b064cc3f Author: Kristof Provost AuthorDate: 2021-06-10 13:49:09 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:42:40 +0000 pf: factor out pf_synproxy() MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31137 (cherry picked from commit ee9c3d38039eb29966e1f0b8f617bc564c078289) --- sys/netpfil/pf/pf.c | 85 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index b313decc3806..8d0da5c6f209 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4459,45 +4459,13 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, - struct mbuf *m, int off, void *h, struct pf_pdesc *pd, - u_short *reason) +pf_synproxy(struct pf_pdesc *pd, struct pf_kstate **state, u_short *reason) { - struct pf_state_key_cmp key; + struct pf_state_key *sk = (*state)->key[pd->didx]; struct tcphdr *th = &pd->hdr.tcp; - int copyback = 0; - struct pf_state_peer *src, *dst; - struct pf_state_key *sk; - - bzero(&key, sizeof(key)); - key.af = pd->af; - key.proto = IPPROTO_TCP; - if (direction == PF_IN) { /* wire side, straight */ - PF_ACPY(&key.addr[0], pd->src, key.af); - PF_ACPY(&key.addr[1], pd->dst, key.af); - key.port[0] = th->th_sport; - key.port[1] = th->th_dport; - } else { /* stack side, reverse */ - PF_ACPY(&key.addr[1], pd->src, key.af); - PF_ACPY(&key.addr[0], pd->dst, key.af); - key.port[1] = th->th_sport; - key.port[0] = th->th_dport; - } - - STATE_LOOKUP(kif, &key, direction, *state, pd); - - if (direction == (*state)->direction) { - src = &(*state)->src; - dst = &(*state)->dst; - } else { - src = &(*state)->dst; - dst = &(*state)->src; - } - - sk = (*state)->key[pd->didx]; if ((*state)->src.state == PF_TCPS_PROXY_SRC) { - if (direction != (*state)->direction) { + if (pd->dir != (*state)->direction) { REASON_SET(reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } @@ -4525,7 +4493,7 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, (*state)->src.state = PF_TCPS_PROXY_DST; } if ((*state)->src.state == PF_TCPS_PROXY_DST) { - if (direction == (*state)->direction) { + if (pd->dir == (*state)->direction) { if (((th->th_flags & (TH_SYN|TH_ACK)) != TH_ACK) || (ntohl(th->th_ack) != (*state)->src.seqhi + 1) || (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) { @@ -4576,6 +4544,51 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, } } + return (PF_PASS); +} + +static int +pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, + struct mbuf *m, int off, void *h, struct pf_pdesc *pd, + u_short *reason) +{ + struct pf_state_key_cmp key; + struct tcphdr *th = &pd->hdr.tcp; + int copyback = 0; + int action; + struct pf_state_peer *src, *dst; + struct pf_state_key *sk; + + bzero(&key, sizeof(key)); + key.af = pd->af; + key.proto = IPPROTO_TCP; + if (direction == PF_IN) { /* wire side, straight */ + PF_ACPY(&key.addr[0], pd->src, key.af); + PF_ACPY(&key.addr[1], pd->dst, key.af); + key.port[0] = th->th_sport; + key.port[1] = th->th_dport; + } else { /* stack side, reverse */ + PF_ACPY(&key.addr[1], pd->src, key.af); + PF_ACPY(&key.addr[0], pd->dst, key.af); + key.port[1] = th->th_sport; + key.port[0] = th->th_dport; + } + + STATE_LOOKUP(kif, &key, direction, *state, pd); + + if (direction == (*state)->direction) { + src = &(*state)->src; + dst = &(*state)->dst; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + } + + sk = (*state)->key[pd->didx]; + + if ((action = pf_synproxy(pd, state, reason)) != PF_PASS) + return (action); + if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) && dst->state >= TCPS_FIN_WAIT_2 && src->state >= TCPS_FIN_WAIT_2) { From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6108265E108; Tue, 27 Jul 2021 11:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4P0syxz3s1F; Tue, 27 Jul 2021 11:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06408211F; Tue, 27 Jul 2021 11:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkinT067691; Tue, 27 Jul 2021 11:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkiQF067690; Tue, 27 Jul 2021 11:46:44 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:44 GMT Message-Id: <202107271146.16RBkiQF067690@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c3d03672e119 - stable/13 - pf: syncookie support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c3d03672e119df47a43014a212d65983ae2cf230 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:45 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c3d03672e119df47a43014a212d65983ae2cf230 commit c3d03672e119df47a43014a212d65983ae2cf230 Author: Kristof Provost AuthorDate: 2021-05-20 09:54:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:42:25 +0000 pf: syncookie support Import OpenBSD's syncookie support for pf. This feature help pf resist TCP SYN floods by only creating states once the remote host completes the TCP handshake rather than when the initial SYN packet is received. This is accomplished by using the initial sequence numbers to encode a cookie (hence the name) in the SYN+ACK response and verifying this on receipt of the client ACK. Reviewed by: kbowling Obtained from: OpenBSD MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31138 (cherry picked from commit 8e1864ed07121b479b95d7e3a5931a9e0ffd4713) --- sys/modules/pf/Makefile | 2 +- sys/net/pfvar.h | 34 ++++ sys/netinet/tcp.h | 2 + sys/netpfil/pf/pf.c | 129 +++++++++++---- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ioctl.c | 3 +- sys/netpfil/pf/pf_mtag.h | 1 + sys/netpfil/pf/pf_syncookies.c | 350 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 492 insertions(+), 32 deletions(-) diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile index 7293b30cda9d..d361ea0802fb 100644 --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -4,7 +4,7 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ - pf_ruleset.c pf_nv.c in4_cksum.c \ + pf_ruleset.c pf_nv.c pf_syncookies.c in4_cksum.c \ bus_if.h device_if.h \ opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 73f3168aa31f..50634f39a549 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1132,6 +1132,12 @@ struct pf_pdesc { counter_u64_add(V_pf_status.counters[x], 1); \ } while (0) +enum pf_syncookies_mode { + PF_SYNCOOKIES_NEVER = 0, + PF_SYNCOOKIES_ALWAYS = 1, + PF_SYNCOOKIES_MODE_MAX = PF_SYNCOOKIES_ALWAYS +}; + struct pf_kstatus { counter_u64_t counters[PFRES_MAX]; /* reason for passing/dropping */ counter_u64_t lcounters[LCNT_MAX]; /* limit counters */ @@ -1146,6 +1152,8 @@ struct pf_kstatus { char ifname[IFNAMSIZ]; uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; bool keep_counters; + enum pf_syncookies_mode syncookies_mode; + bool syncookies_active; }; struct pf_divert { @@ -1486,6 +1494,8 @@ struct pfioc_iface { #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) #define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) #define DIOCGETSTATESV2 _IOWR('D', 93, struct pfioc_states_v2) +#define DIOCGETSYNCOOKIES _IOWR('D', 94, struct pfioc_nv) +#define DIOCSETSYNCOOKIES _IOWR('D', 95, struct pfioc_nv) struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; @@ -1816,6 +1826,30 @@ int pf_addr_cmp(struct pf_addr *, struct pf_addr *, sa_family_t); void pf_qid2qname(u_int32_t, char *); +u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, sa_family_t); +u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); +struct mbuf *pf_build_tcp(const struct pf_krule *, sa_family_t, + const struct pf_addr *, const struct pf_addr *, + u_int16_t, u_int16_t, u_int32_t, u_int32_t, + u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, + u_int16_t); +void pf_send_tcp(const struct pf_krule *, sa_family_t, + const struct pf_addr *, const struct pf_addr *, + u_int16_t, u_int16_t, u_int32_t, u_int32_t, + u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, + u_int16_t); + +void pf_syncookies_init(void); +int pf_syncookies_setmode(u_int8_t); +int pf_get_syncookies(struct pfioc_nv *); +int pf_set_syncookies(struct pfioc_nv *); +int pf_synflood_check(struct pf_pdesc *); +void pf_syncookie_send(struct mbuf *m, int off, + struct pf_pdesc *); +u_int8_t pf_syncookie_validate(struct pf_pdesc *); +struct mbuf * pf_syncookie_recreate_syn(uint8_t, int, + struct pf_pdesc *); + VNET_DECLARE(struct pf_kstatus, pf_status); #define V_pf_status VNET(pf_status) diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 7273cb5104ea..4f062b31a051 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -105,6 +105,8 @@ struct tcphdr { #define TCPOPT_FAST_OPEN 34 #define TCPOLEN_FAST_OPEN_EMPTY 2 +#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */ + /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ #define TCP_MAX_SACK 4 /* MAX # SACKs sent in any segment */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a08f38f3a286..4005e453cfb7 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -243,11 +243,6 @@ static void pf_change_icmp(struct pf_addr *, u_int16_t *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int8_t, sa_family_t); -static void pf_send_tcp(const struct pf_krule *, sa_family_t, - const struct pf_addr *, const struct pf_addr *, - u_int16_t, u_int16_t, u_int32_t, u_int32_t, - u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, - u_int16_t); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); static void pf_detach_state(struct pf_kstate *); @@ -289,10 +284,6 @@ static int pf_test_state_icmp(struct pf_kstate **, int, void *, struct pf_pdesc *, u_short *); static int pf_test_state_other(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); -static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, - sa_family_t); -static u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, - sa_family_t); static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, @@ -2460,14 +2451,13 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd, return (copyback); } -static void -pf_send_tcp(const struct pf_krule *r, sa_family_t af, +struct mbuf * +pf_build_tcp(const struct pf_krule *r, sa_family_t af, const struct pf_addr *saddr, const struct pf_addr *daddr, u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, u_int16_t rtag) { - struct pf_send_entry *pfse; struct mbuf *m; int len, tlen; #ifdef INET @@ -2503,22 +2493,16 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, panic("%s: unsupported af %d", __func__, af); } - /* Allocate outgoing queue entry, mbuf and mbuf tag. */ - pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT); - if (pfse == NULL) - return; m = m_gethdr(M_NOWAIT, MT_DATA); - if (m == NULL) { - free(pfse, M_PFTEMP); - return; - } + if (m == NULL) + return (NULL); + #ifdef MAC mac_netinet_firewall_send(m); #endif if ((pf_mtag = pf_get_mtag(m)) == NULL) { - free(pfse, M_PFTEMP); m_freem(m); - return; + return (NULL); } if (tag) m->m_flags |= M_SKIP_FIREWALL; @@ -2599,8 +2583,6 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; - - pfse->pfse_type = PFSE_IP; break; #endif /* INET */ #ifdef INET6 @@ -2611,11 +2593,48 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, h6->ip6_vfc |= IPV6_VERSION; h6->ip6_hlim = IPV6_DEFHLIM; + break; +#endif /* INET6 */ + } + + return (m); +} + +void +pf_send_tcp(const struct pf_krule *r, sa_family_t af, + const struct pf_addr *saddr, const struct pf_addr *daddr, + u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, + u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, + u_int16_t rtag) +{ + struct pf_send_entry *pfse; + struct mbuf *m; + + m = pf_build_tcp(r, af, saddr, daddr, sport, dport, seq, ack, flags, + win, mss, ttl, tag, rtag); + if (m == NULL) + return; + + /* Allocate outgoing queue entry, mbuf and mbuf tag. */ + pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT); + if (pfse == NULL) { + m_freem(m); + return; + } + switch (af) { +#ifdef INET + case AF_INET: + pfse->pfse_type = PFSE_IP; + break; +#endif /* INET */ +#ifdef INET6 + case AF_INET6: pfse->pfse_type = PFSE_IP6; break; #endif /* INET6 */ } + pfse->pfse_m = m; pf_send(pfse); } @@ -3190,7 +3209,7 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) return (1); } -static u_int8_t +u_int8_t pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { int hlen; @@ -3230,7 +3249,7 @@ pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) return (wscale); } -static u_int16_t +u_int16_t pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { int hlen; @@ -6047,6 +6066,18 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * goto done; } pd.p_len = pd.tot_len - off - (pd.hdr.tcp.th_off << 2); + + pd.sport = &pd.hdr.tcp.th_sport; + pd.dport = &pd.hdr.tcp.th_dport; + + /* Respond to SYN with a syncookie. */ + if ((pd.hdr.tcp.th_flags & (TH_SYN|TH_ACK|TH_RST)) == TH_SYN && + pd.dir == PF_IN && pf_synflood_check(&pd)) { + pf_syncookie_send(m, off, &pd); + action = PF_DROP; + break; + } + if ((pd.hdr.tcp.th_flags & TH_ACK) && pd.p_len == 0) pqid = 1; action = pf_normalize_tcp(dir, kif, m, 0, off, h, &pd); @@ -6060,9 +6091,49 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * r = s->rule.ptr; a = s->anchor.ptr; log = s->log; - } else if (s == NULL) - action = pf_test_rule(&r, &s, dir, kif, m, off, &pd, - &a, &ruleset, inp); + } else if (s == NULL) { + /* Validate remote SYN|ACK, re-create original SYN if + * valid. */ + if ((pd.hdr.tcp.th_flags & (TH_SYN|TH_ACK|TH_RST)) == + TH_ACK && pf_syncookie_validate(&pd) && + pd.dir == PF_IN) { + struct mbuf *msyn; + + msyn = pf_syncookie_recreate_syn(h->ip_ttl, + off,&pd); + if (msyn == NULL) { + action = PF_DROP; + break; + } + + action = pf_test(dir, pflags, ifp, &msyn, inp); + m_freem(msyn); + + if (action == PF_PASS) { + action = pf_test_state_tcp(&s, dir, + kif, m, off, h, &pd, &reason); + if (action != PF_PASS || s == NULL) { + action = PF_DROP; + break; + } + + s->src.seqhi = ntohl(pd.hdr.tcp.th_ack) + - 1; + s->src.seqlo = ntohl(pd.hdr.tcp.th_seq) + - 1; + s->src.state = PF_TCPS_PROXY_DST; + + action = pf_synproxy(&pd, &s, &reason); + if (action != PF_PASS) + break; + } + break; + } + else { + action = pf_test_rule(&r, &s, dir, kif, m, off, + &pd, &a, &ruleset, inp); + } + } break; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 011d69a746dd..869e8e32eb5c 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -159,7 +159,8 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_MAX 7 /* total+1 */ +#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ +#define LCNT_MAX 8 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c9105bf22385..d5b33a48a57c 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -285,6 +285,7 @@ pfattach_vnet(void) pfr_initialize(); pfi_initialize_vnet(); pf_normalize_init(); + pf_syncookies_init(); V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT; V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT; @@ -5525,7 +5526,7 @@ pf_load(void) { int error; - rm_init(&pf_rules_lock, "pf rulesets"); + rm_init_flags(&pf_rules_lock, "pf rulesets", RM_RECURSE); sx_init(&pf_ioctl_lock, "pf ioctl"); sx_init(&pf_end_lock, "pf end thread"); diff --git a/sys/netpfil/pf/pf_mtag.h b/sys/netpfil/pf/pf_mtag.h index ad28ab7a7c30..2135c9e69dbd 100644 --- a/sys/netpfil/pf/pf_mtag.h +++ b/sys/netpfil/pf/pf_mtag.h @@ -43,6 +43,7 @@ #define PF_FASTFWD_OURS_PRESENT 0x10 #define PF_REASSEMBLED 0x20 #define PF_DUPLICATED 0x40 +#define PF_TAG_SYNCOOKIE_RECREATED 0x80 struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c new file mode 100644 index 000000000000..0071bab0d7d5 --- /dev/null +++ b/sys/netpfil/pf/pf_syncookies.c @@ -0,0 +1,350 @@ +/* $OpenBSD: pf_syncookies.c,v 1.7 2018/09/10 15:54:28 henning Exp $ */ + +/* Copyright (c) 2016,2017 Henning Brauer + * Copyright (c) 2016 Alexandr Nedvedicky + * + * syncookie parts based on FreeBSD sys/netinet/tcp_syncache.c + * + * Copyright (c) 2001 McAfee, Inc. + * Copyright (c) 2006,2013 Andre Oppermann, Internet Business Solutions AG + * All rights reserved. + * + * This software was developed for the FreeBSD Project by Jonathan Lemon + * and McAfee Research, the Security Research Division of McAfee, Inc. under + * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the + * DARPA CHATS research program. [2001 McAfee, Inc.] + * + * 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 THE 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 THE 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. + */ + +/* + * when we're under synflood, we use syncookies to prevent state table + * exhaustion. Trigger for the synflood mode is the number of half-open + * connections in the state table. + * We leave synflood mode when the number of half-open states - including + * in-flight syncookies - drops far enough again + */ + +/* + * syncookie enabled Initial Sequence Number: + * 24 bit MAC + * 3 bit WSCALE index + * 3 bit MSS index + * 1 bit SACK permitted + * 1 bit odd/even secret + * + * References: + * RFC4987 TCP SYN Flooding Attacks and Common Mitigations + * http://cr.yp.to/syncookies.html (overview) + * http://cr.yp.to/syncookies/archive (details) + */ + +//#include "pflog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x + +union pf_syncookie { + uint8_t cookie; + struct { + uint8_t oddeven:1, + sack_ok:1, + wscale_idx:3, + mss_idx:3; + } flags; +}; + +#define PF_SYNCOOKIE_SECRET_SIZE SIPHASH_KEY_LENGTH +#define PF_SYNCOOKIE_SECRET_LIFETIME 15 /* seconds */ + +/* Protected by PF_RULES_xLOCK. */ +struct pf_syncookie_status { + struct callout keytimeout; + uint8_t oddeven; + uint8_t key[2][SIPHASH_KEY_LENGTH]; +}; +VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); +#define V_pf_syncookie_status VNET(pf_syncookie_status) + +void pf_syncookie_rotate(void *); +void pf_syncookie_newkey(void); +uint32_t pf_syncookie_mac(struct pf_pdesc *, union pf_syncookie, + uint32_t); +uint32_t pf_syncookie_generate(struct mbuf *m, int off, struct pf_pdesc *, + uint16_t); + +void +pf_syncookies_init(void) +{ + callout_init(&V_pf_syncookie_status.keytimeout, 1); + PF_RULES_WLOCK(); + pf_syncookies_setmode(PF_SYNCOOKIES_NEVER); + PF_RULES_WUNLOCK(); +} + +int +pf_syncookies_setmode(u_int8_t mode) +{ + if (mode > PF_SYNCOOKIES_MODE_MAX) + return (EINVAL); + + if (V_pf_status.syncookies_mode == mode) + return (0); + + V_pf_status.syncookies_mode = mode; + if (V_pf_status.syncookies_mode == PF_SYNCOOKIES_ALWAYS) { + pf_syncookie_newkey(); + V_pf_status.syncookies_active = true; + } + return (0); +} + +int +pf_synflood_check(struct pf_pdesc *pd) +{ + MPASS(pd->proto == IPPROTO_TCP); + PF_RULES_RASSERT(); + + if (pd->pf_mtag && (pd->pf_mtag->tag & PF_TAG_SYNCOOKIE_RECREATED)) + return (0); + + return (V_pf_status.syncookies_mode); +} + +void +pf_syncookie_send(struct mbuf *m, int off, struct pf_pdesc *pd) +{ + uint16_t mss; + uint32_t iss; + + mss = max(V_tcp_mssdflt, pf_get_mss(m, off, pd->hdr.tcp.th_off, pd->af)); + iss = pf_syncookie_generate(m, off, pd, mss); + pf_send_tcp(NULL, pd->af, pd->dst, pd->src, *pd->dport, *pd->sport, + iss, ntohl(pd->hdr.tcp.th_seq) + 1, TH_SYN|TH_ACK, 0, mss, + 0, 1, 0); +} + +uint8_t +pf_syncookie_validate(struct pf_pdesc *pd) +{ + uint32_t hash, ack, seq; + union pf_syncookie cookie; + + MPASS(pd->proto == IPPROTO_TCP); + PF_RULES_RASSERT(); + + seq = ntohl(pd->hdr.tcp.th_seq) - 1; + ack = ntohl(pd->hdr.tcp.th_ack) - 1; + cookie.cookie = (ack & 0xff) ^ (ack >> 24); + + hash = pf_syncookie_mac(pd, cookie, seq); + if ((ack & ~0xff) != (hash & ~0xff)) + return (0); + + counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); + return (1); +} + +/* + * all following functions private + */ +void +pf_syncookie_rotate(void *arg) +{ + CURVNET_SET((struct vnet *)arg); + + /* do we want to disable syncookies? */ + if (V_pf_status.syncookies_active) { + V_pf_status.syncookies_active = false; + DPFPRINTF(PF_DEBUG_MISC, ("syncookies disabled")); + } + + /* nothing in flight any more? delete keys and return */ + if (!V_pf_status.syncookies_active) { + memset(V_pf_syncookie_status.key[0], 0, + PF_SYNCOOKIE_SECRET_SIZE); + memset(V_pf_syncookie_status.key[1], 0, + PF_SYNCOOKIE_SECRET_SIZE); + CURVNET_RESTORE(); + return; + } + + /* new key, including timeout */ + pf_syncookie_newkey(); + + CURVNET_RESTORE(); + printf("KP: %s() return\n", __func__); +} + +void +pf_syncookie_newkey(void) +{ + PF_RULES_WASSERT(); + + V_pf_syncookie_status.oddeven = (V_pf_syncookie_status.oddeven + 1) & 0x1; + arc4random_buf(V_pf_syncookie_status.key[V_pf_syncookie_status.oddeven], + PF_SYNCOOKIE_SECRET_SIZE); + callout_reset(&V_pf_syncookie_status.keytimeout, + PF_SYNCOOKIE_SECRET_LIFETIME, pf_syncookie_rotate, curvnet); +} + +/* + * Distribution and probability of certain MSS values. Those in between are + * rounded down to the next lower one. + * [An Analysis of TCP Maximum Segment Sizes, S. Alcock and R. Nelson, 2011] + * .2% .3% 5% 7% 7% 20% 15% 45% + */ +static int pf_syncookie_msstab[] = + { 216, 536, 1200, 1360, 1400, 1440, 1452, 1460 }; + +/* + * Distribution and probability of certain WSCALE values. + * The absence of the WSCALE option is encoded with index zero. + * [WSCALE values histograms, Allman, 2012] + * X 10 10 35 5 6 14 10% by host + * X 11 4 5 5 18 49 3% by connections + */ +static int pf_syncookie_wstab[] = { 0, 0, 1, 2, 4, 6, 7, 8 }; + +uint32_t +pf_syncookie_mac(struct pf_pdesc *pd, union pf_syncookie cookie, uint32_t seq) +{ + SIPHASH_CTX ctx; + uint32_t siphash[2]; + + PF_RULES_RASSERT(); + MPASS(pd->proto == IPPROTO_TCP); + + SipHash24_Init(&ctx); + SipHash_SetKey(&ctx, V_pf_syncookie_status.key[cookie.flags.oddeven]); + + switch (pd->af) { + case AF_INET: + SipHash_Update(&ctx, pd->src, sizeof(pd->src->v4)); + SipHash_Update(&ctx, pd->dst, sizeof(pd->dst->v4)); + break; + case AF_INET6: + SipHash_Update(&ctx, pd->src, sizeof(pd->src->v6)); + SipHash_Update(&ctx, pd->dst, sizeof(pd->dst->v6)); + break; + default: + panic("unknown address family"); + } + + SipHash_Update(&ctx, pd->sport, sizeof(*pd->sport)); + SipHash_Update(&ctx, pd->dport, sizeof(*pd->dport)); + SipHash_Update(&ctx, &seq, sizeof(seq)); + SipHash_Update(&ctx, &cookie, sizeof(cookie)); + SipHash_Final((uint8_t *)&siphash, &ctx); + + return (siphash[0] ^ siphash[1]); +} + +uint32_t +pf_syncookie_generate(struct mbuf *m, int off, struct pf_pdesc *pd, + uint16_t mss) +{ + uint8_t i, wscale; + uint32_t iss, hash; + union pf_syncookie cookie; + + PF_RULES_RASSERT(); + + cookie.cookie = 0; + + /* map MSS */ + for (i = nitems(pf_syncookie_msstab) - 1; + pf_syncookie_msstab[i] > mss && i > 0; i--) + /* nada */; + cookie.flags.mss_idx = i; + + /* map WSCALE */ + wscale = pf_get_wscale(m, off, pd->hdr.tcp.th_off, pd->af); + for (i = nitems(pf_syncookie_wstab) - 1; + pf_syncookie_wstab[i] > wscale && i > 0; i--) + /* nada */; + cookie.flags.wscale_idx = i; + cookie.flags.sack_ok = 0; /* XXX */ + + cookie.flags.oddeven = V_pf_syncookie_status.oddeven; + hash = pf_syncookie_mac(pd, cookie, ntohl(pd->hdr.tcp.th_seq)); + + /* + * Put the flags into the hash and XOR them to get better ISS number + * variance. This doesn't enhance the cryptographic strength and is + * done to prevent the 8 cookie bits from showing up directly on the + * wire. + */ + iss = hash & ~0xff; + iss |= cookie.cookie ^ (hash >> 24); + + return (iss); +} + +struct mbuf * +pf_syncookie_recreate_syn(uint8_t ttl, int off, struct pf_pdesc *pd) +{ + uint8_t wscale; + uint16_t mss; + uint32_t ack, seq; + union pf_syncookie cookie; + + seq = ntohl(pd->hdr.tcp.th_seq) - 1; + ack = ntohl(pd->hdr.tcp.th_ack) - 1; + cookie.cookie = (ack & 0xff) ^ (ack >> 24); + + if (cookie.flags.mss_idx >= nitems(pf_syncookie_msstab) || + cookie.flags.wscale_idx >= nitems(pf_syncookie_wstab)) + return (NULL); + + mss = pf_syncookie_msstab[cookie.flags.mss_idx]; + wscale = pf_syncookie_wstab[cookie.flags.wscale_idx]; + + return (pf_build_tcp(NULL, pd->af, pd->src, pd->dst, *pd->sport, + *pd->dport, seq, 0, TH_SYN, wscale, mss, ttl, 0, + PF_TAG_SYNCOOKIE_RECREATED)); +} From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EED8265DF12; Tue, 27 Jul 2021 11:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4P56Y2z3sHR; Tue, 27 Jul 2021 11:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7439E1ADA; Tue, 27 Jul 2021 11:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkjST067717; Tue, 27 Jul 2021 11:46:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkj3X067716; Tue, 27 Jul 2021 11:46:45 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:45 GMT Message-Id: <202107271146.16RBkj3X067716@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ba7edb52211a - stable/12 - pf: syncookie support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ba7edb52211a5fcf19ca41dbd5feea1147e03df3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:46 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ba7edb52211a5fcf19ca41dbd5feea1147e03df3 commit ba7edb52211a5fcf19ca41dbd5feea1147e03df3 Author: Kristof Provost AuthorDate: 2021-05-20 09:54:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:23 +0000 pf: syncookie support Import OpenBSD's syncookie support for pf. This feature help pf resist TCP SYN floods by only creating states once the remote host completes the TCP handshake rather than when the initial SYN packet is received. This is accomplished by using the initial sequence numbers to encode a cookie (hence the name) in the SYN+ACK response and verifying this on receipt of the client ACK. Reviewed by: kbowling Obtained from: OpenBSD MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31138 (cherry picked from commit 8e1864ed07121b479b95d7e3a5931a9e0ffd4713) --- sys/modules/pf/Makefile | 2 +- sys/net/pfvar.h | 34 ++++ sys/netinet/tcp.h | 2 + sys/netpfil/pf/pf.c | 129 +++++++++++---- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ioctl.c | 3 +- sys/netpfil/pf/pf_mtag.h | 1 + sys/netpfil/pf/pf_syncookies.c | 350 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 492 insertions(+), 32 deletions(-) diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile index 7293b30cda9d..d361ea0802fb 100644 --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -4,7 +4,7 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ - pf_ruleset.c pf_nv.c in4_cksum.c \ + pf_ruleset.c pf_nv.c pf_syncookies.c in4_cksum.c \ bus_if.h device_if.h \ opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index dceebe1caf77..3a74709fecf5 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1132,6 +1132,12 @@ struct pf_pdesc { counter_u64_add(V_pf_status.counters[x], 1); \ } while (0) +enum pf_syncookies_mode { + PF_SYNCOOKIES_NEVER = 0, + PF_SYNCOOKIES_ALWAYS = 1, + PF_SYNCOOKIES_MODE_MAX = PF_SYNCOOKIES_ALWAYS +}; + struct pf_kstatus { counter_u64_t counters[PFRES_MAX]; /* reason for passing/dropping */ counter_u64_t lcounters[LCNT_MAX]; /* limit counters */ @@ -1146,6 +1152,8 @@ struct pf_kstatus { char ifname[IFNAMSIZ]; uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; bool keep_counters; + enum pf_syncookies_mode syncookies_mode; + bool syncookies_active; }; struct pf_divert { @@ -1487,6 +1495,8 @@ struct pfioc_iface { #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) #define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) #define DIOCGETSTATESV2 _IOWR('D', 93, struct pfioc_states_v2) +#define DIOCGETSYNCOOKIES _IOWR('D', 94, struct pfioc_nv) +#define DIOCSETSYNCOOKIES _IOWR('D', 95, struct pfioc_nv) struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; @@ -1817,6 +1827,30 @@ int pf_addr_cmp(struct pf_addr *, struct pf_addr *, sa_family_t); void pf_qid2qname(u_int32_t, char *); +u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, sa_family_t); +u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); +struct mbuf *pf_build_tcp(const struct pf_krule *, sa_family_t, + const struct pf_addr *, const struct pf_addr *, + u_int16_t, u_int16_t, u_int32_t, u_int32_t, + u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, + u_int16_t); +void pf_send_tcp(const struct pf_krule *, sa_family_t, + const struct pf_addr *, const struct pf_addr *, + u_int16_t, u_int16_t, u_int32_t, u_int32_t, + u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, + u_int16_t); + +void pf_syncookies_init(void); +int pf_syncookies_setmode(u_int8_t); +int pf_get_syncookies(struct pfioc_nv *); +int pf_set_syncookies(struct pfioc_nv *); +int pf_synflood_check(struct pf_pdesc *); +void pf_syncookie_send(struct mbuf *m, int off, + struct pf_pdesc *); +u_int8_t pf_syncookie_validate(struct pf_pdesc *); +struct mbuf * pf_syncookie_recreate_syn(uint8_t, int, + struct pf_pdesc *); + VNET_DECLARE(struct pf_kstatus, pf_status); #define V_pf_status VNET(pf_status) diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 3f5767d5a472..21922eb4df2e 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -105,6 +105,8 @@ struct tcphdr { #define TCPOPT_FAST_OPEN 34 #define TCPOLEN_FAST_OPEN_EMPTY 2 +#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */ + /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ #define TCP_MAX_SACK 4 /* MAX # SACKs sent in any segment */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 8d0da5c6f209..4127d526f33c 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -244,11 +244,6 @@ static void pf_change_icmp(struct pf_addr *, u_int16_t *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int8_t, sa_family_t); -static void pf_send_tcp(const struct pf_krule *, sa_family_t, - const struct pf_addr *, const struct pf_addr *, - u_int16_t, u_int16_t, u_int32_t, u_int32_t, - u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, - u_int16_t); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); static void pf_detach_state(struct pf_kstate *); @@ -290,10 +285,6 @@ static int pf_test_state_icmp(struct pf_kstate **, int, void *, struct pf_pdesc *, u_short *); static int pf_test_state_other(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); -static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, - sa_family_t); -static u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, - sa_family_t); static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, @@ -2461,14 +2452,13 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd, return (copyback); } -static void -pf_send_tcp(const struct pf_krule *r, sa_family_t af, +struct mbuf * +pf_build_tcp(const struct pf_krule *r, sa_family_t af, const struct pf_addr *saddr, const struct pf_addr *daddr, u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, u_int16_t rtag) { - struct pf_send_entry *pfse; struct mbuf *m; int len, tlen; #ifdef INET @@ -2504,22 +2494,16 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, panic("%s: unsupported af %d", __func__, af); } - /* Allocate outgoing queue entry, mbuf and mbuf tag. */ - pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT); - if (pfse == NULL) - return; m = m_gethdr(M_NOWAIT, MT_DATA); - if (m == NULL) { - free(pfse, M_PFTEMP); - return; - } + if (m == NULL) + return (NULL); + #ifdef MAC mac_netinet_firewall_send(m); #endif if ((pf_mtag = pf_get_mtag(m)) == NULL) { - free(pfse, M_PFTEMP); m_freem(m); - return; + return (NULL); } if (tag) m->m_flags |= M_SKIP_FIREWALL; @@ -2600,8 +2584,6 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; - - pfse->pfse_type = PFSE_IP; break; #endif /* INET */ #ifdef INET6 @@ -2612,11 +2594,48 @@ pf_send_tcp(const struct pf_krule *r, sa_family_t af, h6->ip6_vfc |= IPV6_VERSION; h6->ip6_hlim = IPV6_DEFHLIM; + break; +#endif /* INET6 */ + } + + return (m); +} + +void +pf_send_tcp(const struct pf_krule *r, sa_family_t af, + const struct pf_addr *saddr, const struct pf_addr *daddr, + u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, + u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, + u_int16_t rtag) +{ + struct pf_send_entry *pfse; + struct mbuf *m; + + m = pf_build_tcp(r, af, saddr, daddr, sport, dport, seq, ack, flags, + win, mss, ttl, tag, rtag); + if (m == NULL) + return; + + /* Allocate outgoing queue entry, mbuf and mbuf tag. */ + pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT); + if (pfse == NULL) { + m_freem(m); + return; + } + switch (af) { +#ifdef INET + case AF_INET: + pfse->pfse_type = PFSE_IP; + break; +#endif /* INET */ +#ifdef INET6 + case AF_INET6: pfse->pfse_type = PFSE_IP6; break; #endif /* INET6 */ } + pfse->pfse_m = m; pf_send(pfse); } @@ -3192,7 +3211,7 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) return (1); } -static u_int8_t +u_int8_t pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { int hlen; @@ -3232,7 +3251,7 @@ pf_get_wscale(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) return (wscale); } -static u_int16_t +u_int16_t pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af) { int hlen; @@ -6132,6 +6151,18 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * goto done; } pd.p_len = pd.tot_len - off - (pd.hdr.tcp.th_off << 2); + + pd.sport = &pd.hdr.tcp.th_sport; + pd.dport = &pd.hdr.tcp.th_dport; + + /* Respond to SYN with a syncookie. */ + if ((pd.hdr.tcp.th_flags & (TH_SYN|TH_ACK|TH_RST)) == TH_SYN && + pd.dir == PF_IN && pf_synflood_check(&pd)) { + pf_syncookie_send(m, off, &pd); + action = PF_DROP; + break; + } + if ((pd.hdr.tcp.th_flags & TH_ACK) && pd.p_len == 0) pqid = 1; action = pf_normalize_tcp(dir, kif, m, 0, off, h, &pd); @@ -6145,9 +6176,49 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * r = s->rule.ptr; a = s->anchor.ptr; log = s->log; - } else if (s == NULL) - action = pf_test_rule(&r, &s, dir, kif, m, off, &pd, - &a, &ruleset, inp); + } else if (s == NULL) { + /* Validate remote SYN|ACK, re-create original SYN if + * valid. */ + if ((pd.hdr.tcp.th_flags & (TH_SYN|TH_ACK|TH_RST)) == + TH_ACK && pf_syncookie_validate(&pd) && + pd.dir == PF_IN) { + struct mbuf *msyn; + + msyn = pf_syncookie_recreate_syn(h->ip_ttl, + off,&pd); + if (msyn == NULL) { + action = PF_DROP; + break; + } + + action = pf_test(dir, pflags, ifp, &msyn, inp); + m_freem(msyn); + + if (action == PF_PASS) { + action = pf_test_state_tcp(&s, dir, + kif, m, off, h, &pd, &reason); + if (action != PF_PASS || s == NULL) { + action = PF_DROP; + break; + } + + s->src.seqhi = ntohl(pd.hdr.tcp.th_ack) + - 1; + s->src.seqlo = ntohl(pd.hdr.tcp.th_seq) + - 1; + s->src.state = PF_TCPS_PROXY_DST; + + action = pf_synproxy(&pd, &s, &reason); + if (action != PF_PASS) + break; + } + break; + } + else { + action = pf_test_rule(&r, &s, dir, kif, m, off, + &pd, &a, &ruleset, inp); + } + } break; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 011d69a746dd..869e8e32eb5c 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -159,7 +159,8 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_MAX 7 /* total+1 */ +#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ +#define LCNT_MAX 8 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 74f347ac1fa6..70cc4ff83d7b 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -285,6 +285,7 @@ pfattach_vnet(void) pfr_initialize(); pfi_initialize_vnet(); pf_normalize_init(); + pf_syncookies_init(); V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT; V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT; @@ -5575,7 +5576,7 @@ pf_load(void) { int error; - rm_init(&pf_rules_lock, "pf rulesets"); + rm_init_flags(&pf_rules_lock, "pf rulesets", RM_RECURSE); sx_init(&pf_ioctl_lock, "pf ioctl"); sx_init(&pf_end_lock, "pf end thread"); diff --git a/sys/netpfil/pf/pf_mtag.h b/sys/netpfil/pf/pf_mtag.h index 67c79350e8eb..b1402e1ac77f 100644 --- a/sys/netpfil/pf/pf_mtag.h +++ b/sys/netpfil/pf/pf_mtag.h @@ -42,6 +42,7 @@ #define PF_PACKET_LOOPED 0x08 #define PF_FASTFWD_OURS_PRESENT 0x10 #define PF_REASSEMBLED 0x20 +#define PF_TAG_SYNCOOKIE_RECREATED 0x80 struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c new file mode 100644 index 000000000000..ee936b6662fa --- /dev/null +++ b/sys/netpfil/pf/pf_syncookies.c @@ -0,0 +1,350 @@ +/* $OpenBSD: pf_syncookies.c,v 1.7 2018/09/10 15:54:28 henning Exp $ */ + +/* Copyright (c) 2016,2017 Henning Brauer + * Copyright (c) 2016 Alexandr Nedvedicky + * + * syncookie parts based on FreeBSD sys/netinet/tcp_syncache.c + * + * Copyright (c) 2001 McAfee, Inc. + * Copyright (c) 2006,2013 Andre Oppermann, Internet Business Solutions AG + * All rights reserved. + * + * This software was developed for the FreeBSD Project by Jonathan Lemon + * and McAfee Research, the Security Research Division of McAfee, Inc. under + * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the + * DARPA CHATS research program. [2001 McAfee, Inc.] + * + * 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 THE 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 THE 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. + */ + +/* + * when we're under synflood, we use syncookies to prevent state table + * exhaustion. Trigger for the synflood mode is the number of half-open + * connections in the state table. + * We leave synflood mode when the number of half-open states - including + * in-flight syncookies - drops far enough again + */ + +/* + * syncookie enabled Initial Sequence Number: + * 24 bit MAC + * 3 bit WSCALE index + * 3 bit MSS index + * 1 bit SACK permitted + * 1 bit odd/even secret + * + * References: + * RFC4987 TCP SYN Flooding Attacks and Common Mitigations + * http://cr.yp.to/syncookies.html (overview) + * http://cr.yp.to/syncookies/archive (details) + */ + +//#include "pflog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x + +union pf_syncookie { + uint8_t cookie; + struct { + uint8_t oddeven:1, + sack_ok:1, + wscale_idx:3, + mss_idx:3; + } flags; +}; + +#define PF_SYNCOOKIE_SECRET_SIZE SIPHASH_KEY_LENGTH +#define PF_SYNCOOKIE_SECRET_LIFETIME 15 /* seconds */ + +/* Protected by PF_RULES_xLOCK. */ +struct pf_syncookie_status { + struct callout keytimeout; + uint8_t oddeven; + uint8_t key[2][SIPHASH_KEY_LENGTH]; +}; +VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); +#define V_pf_syncookie_status VNET(pf_syncookie_status) + +void pf_syncookie_rotate(void *); +void pf_syncookie_newkey(void); +uint32_t pf_syncookie_mac(struct pf_pdesc *, union pf_syncookie, + uint32_t); +uint32_t pf_syncookie_generate(struct mbuf *m, int off, struct pf_pdesc *, + uint16_t); + +void +pf_syncookies_init(void) +{ + callout_init(&V_pf_syncookie_status.keytimeout, 1); + PF_RULES_WLOCK(); + pf_syncookies_setmode(PF_SYNCOOKIES_NEVER); + PF_RULES_WUNLOCK(); +} + +int +pf_syncookies_setmode(u_int8_t mode) +{ + if (mode > PF_SYNCOOKIES_MODE_MAX) + return (EINVAL); + + if (V_pf_status.syncookies_mode == mode) + return (0); + + V_pf_status.syncookies_mode = mode; + if (V_pf_status.syncookies_mode == PF_SYNCOOKIES_ALWAYS) { + pf_syncookie_newkey(); + V_pf_status.syncookies_active = true; + } + return (0); +} + +int +pf_synflood_check(struct pf_pdesc *pd) +{ + MPASS(pd->proto == IPPROTO_TCP); + PF_RULES_RASSERT(); + + if (pd->pf_mtag && (pd->pf_mtag->tag & PF_TAG_SYNCOOKIE_RECREATED)) + return (0); + + return (V_pf_status.syncookies_mode); +} + +void +pf_syncookie_send(struct mbuf *m, int off, struct pf_pdesc *pd) +{ + uint16_t mss; + uint32_t iss; + + mss = max(V_tcp_mssdflt, pf_get_mss(m, off, pd->hdr.tcp.th_off, pd->af)); + iss = pf_syncookie_generate(m, off, pd, mss); + pf_send_tcp(NULL, pd->af, pd->dst, pd->src, *pd->dport, *pd->sport, + iss, ntohl(pd->hdr.tcp.th_seq) + 1, TH_SYN|TH_ACK, 0, mss, + 0, 1, 0); +} + +uint8_t +pf_syncookie_validate(struct pf_pdesc *pd) +{ + uint32_t hash, ack, seq; + union pf_syncookie cookie; + + MPASS(pd->proto == IPPROTO_TCP); + PF_RULES_RASSERT(); + + seq = ntohl(pd->hdr.tcp.th_seq) - 1; + ack = ntohl(pd->hdr.tcp.th_ack) - 1; + cookie.cookie = (ack & 0xff) ^ (ack >> 24); + + hash = pf_syncookie_mac(pd, cookie, seq); + if ((ack & ~0xff) != (hash & ~0xff)) + return (0); + + counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); + return (1); +} + +/* + * all following functions private + */ +void +pf_syncookie_rotate(void *arg) +{ + CURVNET_SET((struct vnet *)arg); + + /* do we want to disable syncookies? */ + if (V_pf_status.syncookies_active) { + V_pf_status.syncookies_active = false; + DPFPRINTF(PF_DEBUG_MISC, ("syncookies disabled")); + } + + /* nothing in flight any more? delete keys and return */ + if (!V_pf_status.syncookies_active) { + memset(V_pf_syncookie_status.key[0], 0, + PF_SYNCOOKIE_SECRET_SIZE); + memset(V_pf_syncookie_status.key[1], 0, + PF_SYNCOOKIE_SECRET_SIZE); + CURVNET_RESTORE(); + return; + } + + /* new key, including timeout */ + pf_syncookie_newkey(); + + CURVNET_RESTORE(); + printf("KP: %s() return\n", __func__); +} + +void +pf_syncookie_newkey(void) +{ + PF_RULES_WASSERT(); + + V_pf_syncookie_status.oddeven = (V_pf_syncookie_status.oddeven + 1) & 0x1; + arc4random_buf(V_pf_syncookie_status.key[V_pf_syncookie_status.oddeven], + PF_SYNCOOKIE_SECRET_SIZE); + callout_reset(&V_pf_syncookie_status.keytimeout, + PF_SYNCOOKIE_SECRET_LIFETIME, pf_syncookie_rotate, curvnet); +} + +/* + * Distribution and probability of certain MSS values. Those in between are + * rounded down to the next lower one. + * [An Analysis of TCP Maximum Segment Sizes, S. Alcock and R. Nelson, 2011] + * .2% .3% 5% 7% 7% 20% 15% 45% + */ +static int pf_syncookie_msstab[] = + { 216, 536, 1200, 1360, 1400, 1440, 1452, 1460 }; + +/* + * Distribution and probability of certain WSCALE values. + * The absence of the WSCALE option is encoded with index zero. + * [WSCALE values histograms, Allman, 2012] + * X 10 10 35 5 6 14 10% by host + * X 11 4 5 5 18 49 3% by connections + */ +static int pf_syncookie_wstab[] = { 0, 0, 1, 2, 4, 6, 7, 8 }; + +uint32_t +pf_syncookie_mac(struct pf_pdesc *pd, union pf_syncookie cookie, uint32_t seq) +{ + SIPHASH_CTX ctx; + uint32_t siphash[2]; + + PF_RULES_RASSERT(); + MPASS(pd->proto == IPPROTO_TCP); + + SipHash24_Init(&ctx); + SipHash_SetKey(&ctx, V_pf_syncookie_status.key[cookie.flags.oddeven]); + + switch (pd->af) { + case AF_INET: + SipHash_Update(&ctx, pd->src, sizeof(pd->src->v4)); + SipHash_Update(&ctx, pd->dst, sizeof(pd->dst->v4)); + break; + case AF_INET6: + SipHash_Update(&ctx, pd->src, sizeof(pd->src->v6)); + SipHash_Update(&ctx, pd->dst, sizeof(pd->dst->v6)); + break; + default: + panic("unknown address family"); + } + + SipHash_Update(&ctx, pd->sport, sizeof(*pd->sport)); + SipHash_Update(&ctx, pd->dport, sizeof(*pd->dport)); + SipHash_Update(&ctx, &seq, sizeof(seq)); + SipHash_Update(&ctx, &cookie, sizeof(cookie)); + SipHash_Final((uint8_t *)&siphash, &ctx); + + return (siphash[0] ^ siphash[1]); +} + +uint32_t +pf_syncookie_generate(struct mbuf *m, int off, struct pf_pdesc *pd, + uint16_t mss) +{ + uint8_t i, wscale; + uint32_t iss, hash; + union pf_syncookie cookie; + + PF_RULES_RASSERT(); + + cookie.cookie = 0; + + /* map MSS */ + for (i = nitems(pf_syncookie_msstab) - 1; + pf_syncookie_msstab[i] > mss && i > 0; i--) + /* nada */; + cookie.flags.mss_idx = i; + + /* map WSCALE */ + wscale = pf_get_wscale(m, off, pd->hdr.tcp.th_off, pd->af); + for (i = nitems(pf_syncookie_wstab) - 1; + pf_syncookie_wstab[i] > wscale && i > 0; i--) + /* nada */; + cookie.flags.wscale_idx = i; + cookie.flags.sack_ok = 0; /* XXX */ + + cookie.flags.oddeven = V_pf_syncookie_status.oddeven; + hash = pf_syncookie_mac(pd, cookie, ntohl(pd->hdr.tcp.th_seq)); + + /* + * Put the flags into the hash and XOR them to get better ISS number + * variance. This doesn't enhance the cryptographic strength and is + * done to prevent the 8 cookie bits from showing up directly on the + * wire. + */ + iss = hash & ~0xff; + iss |= cookie.cookie ^ (hash >> 24); + + return (iss); +} + +struct mbuf * +pf_syncookie_recreate_syn(uint8_t ttl, int off, struct pf_pdesc *pd) +{ + uint8_t wscale; + uint16_t mss; + uint32_t ack, seq; + union pf_syncookie cookie; + + seq = ntohl(pd->hdr.tcp.th_seq) - 1; + ack = ntohl(pd->hdr.tcp.th_ack) - 1; + cookie.cookie = (ack & 0xff) ^ (ack >> 24); + + if (cookie.flags.mss_idx >= nitems(pf_syncookie_msstab) || + cookie.flags.wscale_idx >= nitems(pf_syncookie_wstab)) + return (NULL); + + mss = pf_syncookie_msstab[cookie.flags.mss_idx]; + wscale = pf_syncookie_wstab[cookie.flags.wscale_idx]; + + return (pf_build_tcp(NULL, pd->af, pd->src, pd->dst, *pd->sport, + *pd->dport, seq, 0, TH_SYN, wscale, mss, ttl, 0, + PF_TAG_SYNCOOKIE_RECREATED)); +} From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E75E165D9E1; Tue, 27 Jul 2021 11:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4R65gPz3s5t; Tue, 27 Jul 2021 11:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0C631ADB; Tue, 27 Jul 2021 11:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBklmJ067813; Tue, 27 Jul 2021 11:46:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkliO067812; Tue, 27 Jul 2021 11:46:47 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:47 GMT Message-Id: <202107271146.16RBkliO067812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a1d93f870a22 - stable/12 - pfctl: syncookie configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a1d93f870a22e368f01d43b1ae8acb5cdae0462d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:48 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a1d93f870a22e368f01d43b1ae8acb5cdae0462d commit a1d93f870a22e368f01d43b1ae8acb5cdae0462d Author: Kristof Provost AuthorDate: 2021-05-26 11:41:34 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:25 +0000 pfctl: syncookie configuration pfctl and libpfctl code required to enable/disable the syncookie feature. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31140 (cherry picked from commit c69121c473d75abab55f9ade8e8138ac09c0942c) --- lib/libpfctl/libpfctl.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 11 +++++++++ sbin/pfctl/parse.y | 20 +++++++++++++++-- sbin/pfctl/pfctl.c | 30 +++++++++++++++++++++++-- sbin/pfctl/pfctl_parser.c | 7 +++++- sbin/pfctl/pfctl_parser.h | 3 ++- 6 files changed, 122 insertions(+), 6 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 6421a2c752a8..ced130820d7d 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -816,3 +816,60 @@ pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed) { return (_pfctl_clear_states(dev, kill, killed, DIOCKILLSTATESNV)); } + +int +pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + int ret; + + nvl = nvlist_create(0); + + nvlist_add_bool(nvl, "enabled", s->mode != PFCTL_SYNCOOKIES_NEVER); + nvlist_add_bool(nvl, "adaptive", false); /* XXX TODO */ + + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + nvlist_destroy(nvl); + nvl = NULL; + + ret = ioctl(dev, DIOCSETSYNCOOKIES, &nv); + + free(nv.data); + return (ret); +} + +int +pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + bool enabled, adaptive; + + bzero(s, sizeof(*s)); + + nv.data = malloc(128); + nv.len = nv.size = 128; + + if (ioctl(dev, DIOCGETSYNCOOKIES, &nv)) { + free(nv.data); + return (errno); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + free(nv.data); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + enabled = nvlist_get_bool(nvl, "enabled"); + adaptive = nvlist_get_bool(nvl, "adaptive"); + + s->mode = enabled ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + + nvlist_destroy(nvl); + + return (0); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 62866e17f904..d57241dd59fd 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -244,6 +244,15 @@ struct pfctl_states { size_t count; }; +enum pfctl_syncookies_mode { + PFCTL_SYNCOOKIES_NEVER, + PFCTL_SYNCOOKIES_ALWAYS +}; + +struct pfctl_syncookies { + enum pfctl_syncookies_mode mode; +}; + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); @@ -260,5 +269,7 @@ int pfctl_clear_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); int pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); +int pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s); +int pfctl_get_syncookies(int dev, struct pfctl_syncookies *s); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 1083666e00ce..2655a7939503 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -464,7 +464,7 @@ int parseport(char *, struct range *r, int); %token REASSEMBLE FRAGDROP FRAGCROP ANCHOR NATANCHOR RDRANCHOR BINATANCHOR %token SET OPTIMIZATION TIMEOUT LIMIT LOGINTERFACE BLOCKPOLICY FAILPOLICY %token RANDOMID REQUIREORDER SYNPROXY FINGERPRINTS NOSYNC DEBUG SKIP HOSTID -%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS +%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS SYNCOOKIES %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY MAPEPORTSET %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET INTERVAL @@ -480,7 +480,7 @@ int parseport(char *, struct range *r, int); %type number icmptype icmp6type uid gid %type tos not yesno %type probability -%type no dir af fragcache optimizer +%type no dir af fragcache optimizer syncookie_val %type sourcetrack flush unaryop statelock %type action nataction natpasslog scrubaction %type flags flag blockspec prio @@ -725,6 +725,21 @@ option : SET OPTIMIZATION STRING { | SET KEEPCOUNTERS { pf->keep_counters = true; } + | SET SYNCOOKIES syncookie_val { + pf->syncookies = $3; + } + ; + +syncookie_val : STRING { + if (!strcmp($1, "never")) + $$ = PFCTL_SYNCOOKIES_NEVER; + else if (!strcmp($1, "always")) + $$ = PFCTL_SYNCOOKIES_ALWAYS; + else { + yyerror("illegal value for syncookies"); + YYERROR; + } + } ; stringall : STRING { $$ = $1; } @@ -5663,6 +5678,7 @@ lookup(char *s) { "state-policy", STATEPOLICY}, { "static-port", STATICPORT}, { "sticky-address", STICKYADDRESS}, + { "syncookies", SYNCOOKIES}, { "synproxy", SYNPROXY}, { "table", TABLE}, { "tag", TAG}, diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 14b7f3a01657..6c689edf7c43 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -93,6 +93,7 @@ int pfctl_load_timeout(struct pfctl *, unsigned int, unsigned int); int pfctl_load_debug(struct pfctl *, unsigned int); int pfctl_load_logif(struct pfctl *, char *); int pfctl_load_hostid(struct pfctl *, u_int32_t); +int pfctl_load_syncookies(struct pfctl *, u_int8_t); int pfctl_get_pool(int, struct pfctl_pool *, u_int32_t, u_int32_t, int, char *); void pfctl_print_rule_counters(struct pfctl_rule *, int); @@ -1307,15 +1308,20 @@ pfctl_show_states(int dev, const char *iface, int opts) int pfctl_show_status(int dev, int opts) { - struct pf_status status; + struct pf_status status; + struct pfctl_syncookies cookies; if (ioctl(dev, DIOCGETSTATUS, &status)) { warn("DIOCGETSTATUS"); return (-1); } + if (pfctl_get_syncookies(dev, &cookies)) { + warn("DIOCGETSYNCOOKIES"); + return (-1); + } if (opts & PF_OPT_SHOWALL) pfctl_print_title("INFO:"); - print_status(&status, opts); + print_status(&status, &cookies, opts); return (0); } @@ -1861,6 +1867,10 @@ pfctl_load_options(struct pfctl *pf) if (pfctl_set_keepcounters(pf->dev, pf->keep_counters)) error = 1; + /* load syncookies settings */ + if (pfctl_load_syncookies(pf, pf->syncookies)) + error = 1; + return (error); } @@ -2047,6 +2057,22 @@ pfctl_load_hostid(struct pfctl *pf, u_int32_t hostid) return (0); } +int +pfctl_load_syncookies(struct pfctl *pf, u_int8_t val) +{ + struct pfctl_syncookies cookies; + + bzero(&cookies, sizeof(cookies)); + + cookies.mode = val ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + + if (pfctl_set_syncookies(dev, &cookies)) { + warnx("DIOCSETSYNCOOKIES"); + return (1); + } + return (0); +} + int pfctl_set_debug(struct pfctl *pf, char *d) { diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index c38411a145e7..7020a0f6a811 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -497,7 +497,7 @@ const char * const pf_fcounters[FCNT_MAX+1] = FCNT_NAMES; const char * const pf_scounters[FCNT_MAX+1] = FCNT_NAMES; void -print_status(struct pf_status *s, int opts) +print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) { char statline[80], *running; time_t runtime; @@ -627,6 +627,11 @@ print_status(struct pf_status *s, int opts) else printf("%14s\n", ""); } + + printf("Syncookies\n"); + printf(" %-25s %s\n", "mode", + cookies->mode == PFCTL_SYNCOOKIES_NEVER ? + "never" : "always"); } } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 5353900b380a..0c64238ecefa 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -100,6 +100,7 @@ struct pfctl { u_int32_t hostid; char *ifname; bool keep_counters; + u_int8_t syncookies; u_int8_t timeout_set[PFTM_MAX]; u_int8_t limit_set[PF_LIMIT_MAX]; @@ -278,7 +279,7 @@ void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, sa_family_t, int); void print_src_node(struct pf_src_node *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); -void print_status(struct pf_status *, int); +void print_status(struct pf_status *, struct pfctl_syncookies *, int); void print_running(struct pf_status *); int eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *, From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1CC965DED9; Tue, 27 Jul 2021 11:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4R4bYhz3s30; Tue, 27 Jul 2021 11:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 492D21BC1; Tue, 27 Jul 2021 11:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBklMh067789; Tue, 27 Jul 2021 11:46:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBklR9067788; Tue, 27 Jul 2021 11:46:47 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:47 GMT Message-Id: <202107271146.16RBklR9067788@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 720b82f8216d - stable/13 - pfctl: syncookie configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 720b82f8216d7c1f6a06993923e63df86f294069 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:47 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=720b82f8216d7c1f6a06993923e63df86f294069 commit 720b82f8216d7c1f6a06993923e63df86f294069 Author: Kristof Provost AuthorDate: 2021-05-26 11:41:34 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:43:52 +0000 pfctl: syncookie configuration pfctl and libpfctl code required to enable/disable the syncookie feature. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31140 (cherry picked from commit c69121c473d75abab55f9ade8e8138ac09c0942c) --- lib/libpfctl/libpfctl.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 11 +++++++++ sbin/pfctl/parse.y | 20 +++++++++++++++-- sbin/pfctl/pfctl.c | 30 +++++++++++++++++++++++-- sbin/pfctl/pfctl_parser.c | 7 +++++- sbin/pfctl/pfctl_parser.h | 3 ++- 6 files changed, 122 insertions(+), 6 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 6421a2c752a8..ced130820d7d 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -816,3 +816,60 @@ pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed) { return (_pfctl_clear_states(dev, kill, killed, DIOCKILLSTATESNV)); } + +int +pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + int ret; + + nvl = nvlist_create(0); + + nvlist_add_bool(nvl, "enabled", s->mode != PFCTL_SYNCOOKIES_NEVER); + nvlist_add_bool(nvl, "adaptive", false); /* XXX TODO */ + + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + nvlist_destroy(nvl); + nvl = NULL; + + ret = ioctl(dev, DIOCSETSYNCOOKIES, &nv); + + free(nv.data); + return (ret); +} + +int +pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + bool enabled, adaptive; + + bzero(s, sizeof(*s)); + + nv.data = malloc(128); + nv.len = nv.size = 128; + + if (ioctl(dev, DIOCGETSYNCOOKIES, &nv)) { + free(nv.data); + return (errno); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + free(nv.data); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + enabled = nvlist_get_bool(nvl, "enabled"); + adaptive = nvlist_get_bool(nvl, "adaptive"); + + s->mode = enabled ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + + nvlist_destroy(nvl); + + return (0); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 62866e17f904..d57241dd59fd 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -244,6 +244,15 @@ struct pfctl_states { size_t count; }; +enum pfctl_syncookies_mode { + PFCTL_SYNCOOKIES_NEVER, + PFCTL_SYNCOOKIES_ALWAYS +}; + +struct pfctl_syncookies { + enum pfctl_syncookies_mode mode; +}; + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); @@ -260,5 +269,7 @@ int pfctl_clear_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); int pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed); +int pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s); +int pfctl_get_syncookies(int dev, struct pfctl_syncookies *s); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index acd90e280b53..19fb87323060 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -464,7 +464,7 @@ int parseport(char *, struct range *r, int); %token REASSEMBLE FRAGDROP FRAGCROP ANCHOR NATANCHOR RDRANCHOR BINATANCHOR %token SET OPTIMIZATION TIMEOUT LIMIT LOGINTERFACE BLOCKPOLICY FAILPOLICY %token RANDOMID REQUIREORDER SYNPROXY FINGERPRINTS NOSYNC DEBUG SKIP HOSTID -%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS +%token ANTISPOOF FOR INCLUDE KEEPCOUNTERS SYNCOOKIES %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY MAPEPORTSET %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET INTERVAL @@ -480,7 +480,7 @@ int parseport(char *, struct range *r, int); %type number icmptype icmp6type uid gid %type tos not yesno %type probability -%type no dir af fragcache optimizer +%type no dir af fragcache optimizer syncookie_val %type sourcetrack flush unaryop statelock %type action nataction natpasslog scrubaction %type flags flag blockspec prio @@ -725,6 +725,21 @@ option : SET OPTIMIZATION STRING { | SET KEEPCOUNTERS { pf->keep_counters = true; } + | SET SYNCOOKIES syncookie_val { + pf->syncookies = $3; + } + ; + +syncookie_val : STRING { + if (!strcmp($1, "never")) + $$ = PFCTL_SYNCOOKIES_NEVER; + else if (!strcmp($1, "always")) + $$ = PFCTL_SYNCOOKIES_ALWAYS; + else { + yyerror("illegal value for syncookies"); + YYERROR; + } + } ; stringall : STRING { $$ = $1; } @@ -5671,6 +5686,7 @@ lookup(char *s) { "state-policy", STATEPOLICY}, { "static-port", STATICPORT}, { "sticky-address", STICKYADDRESS}, + { "syncookies", SYNCOOKIES}, { "synproxy", SYNPROXY}, { "table", TABLE}, { "tag", TAG}, diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 14b7f3a01657..6c689edf7c43 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -93,6 +93,7 @@ int pfctl_load_timeout(struct pfctl *, unsigned int, unsigned int); int pfctl_load_debug(struct pfctl *, unsigned int); int pfctl_load_logif(struct pfctl *, char *); int pfctl_load_hostid(struct pfctl *, u_int32_t); +int pfctl_load_syncookies(struct pfctl *, u_int8_t); int pfctl_get_pool(int, struct pfctl_pool *, u_int32_t, u_int32_t, int, char *); void pfctl_print_rule_counters(struct pfctl_rule *, int); @@ -1307,15 +1308,20 @@ pfctl_show_states(int dev, const char *iface, int opts) int pfctl_show_status(int dev, int opts) { - struct pf_status status; + struct pf_status status; + struct pfctl_syncookies cookies; if (ioctl(dev, DIOCGETSTATUS, &status)) { warn("DIOCGETSTATUS"); return (-1); } + if (pfctl_get_syncookies(dev, &cookies)) { + warn("DIOCGETSYNCOOKIES"); + return (-1); + } if (opts & PF_OPT_SHOWALL) pfctl_print_title("INFO:"); - print_status(&status, opts); + print_status(&status, &cookies, opts); return (0); } @@ -1861,6 +1867,10 @@ pfctl_load_options(struct pfctl *pf) if (pfctl_set_keepcounters(pf->dev, pf->keep_counters)) error = 1; + /* load syncookies settings */ + if (pfctl_load_syncookies(pf, pf->syncookies)) + error = 1; + return (error); } @@ -2047,6 +2057,22 @@ pfctl_load_hostid(struct pfctl *pf, u_int32_t hostid) return (0); } +int +pfctl_load_syncookies(struct pfctl *pf, u_int8_t val) +{ + struct pfctl_syncookies cookies; + + bzero(&cookies, sizeof(cookies)); + + cookies.mode = val ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + + if (pfctl_set_syncookies(dev, &cookies)) { + warnx("DIOCSETSYNCOOKIES"); + return (1); + } + return (0); +} + int pfctl_set_debug(struct pfctl *pf, char *d) { diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index b4a1cde967bd..e3efd20d3822 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -497,7 +497,7 @@ const char * const pf_fcounters[FCNT_MAX+1] = FCNT_NAMES; const char * const pf_scounters[FCNT_MAX+1] = FCNT_NAMES; void -print_status(struct pf_status *s, int opts) +print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) { char statline[80], *running; time_t runtime; @@ -627,6 +627,11 @@ print_status(struct pf_status *s, int opts) else printf("%14s\n", ""); } + + printf("Syncookies\n"); + printf(" %-25s %s\n", "mode", + cookies->mode == PFCTL_SYNCOOKIES_NEVER ? + "never" : "always"); } } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 5353900b380a..0c64238ecefa 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -100,6 +100,7 @@ struct pfctl { u_int32_t hostid; char *ifname; bool keep_counters; + u_int8_t syncookies; u_int8_t timeout_set[PFTM_MAX]; u_int8_t limit_set[PF_LIMIT_MAX]; @@ -278,7 +279,7 @@ void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, sa_family_t, int); void print_src_node(struct pf_src_node *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); -void print_status(struct pf_status *, int); +void print_status(struct pf_status *, struct pfctl_syncookies *, int); void print_running(struct pf_status *); int eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *, From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BBFF65E0AF; Tue, 27 Jul 2021 11:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4T0hHGz3rx9; Tue, 27 Jul 2021 11:46:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 724271E6C; Tue, 27 Jul 2021 11:46:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkmVJ067844; Tue, 27 Jul 2021 11:46:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkmoV067843; Tue, 27 Jul 2021 11:46:48 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:48 GMT Message-Id: <202107271146.16RBkmoV067843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 1156a429ebb1 - stable/13 - pf tests: Forwarding syncookie test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1156a429ebb13e18d41bbd7e18f612001733b493 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1156a429ebb13e18d41bbd7e18f612001733b493 commit 1156a429ebb13e18d41bbd7e18f612001733b493 Author: Kristof Provost AuthorDate: 2021-06-02 16:16:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:43:58 +0000 pf tests: Forwarding syncookie test Test syncookies on a forwarding host. That is, in a setup where the machine (or vnet) running pf is not the same as the machine (or vnet) running the server it's protecting. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31141 (cherry picked from commit 3be9301a7e4fbd630cbde1bd3e1b59ac726e21af) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/syncookie.sh | 84 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index e5139b4262e1..cfa5f5c7c912 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -25,6 +25,7 @@ ATF_TESTS_SH+= anchor \ set_skip \ set_tos \ src_track \ + syncookie \ synproxy \ table \ tos diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh new file mode 100644 index 000000000000..7bd045249be6 --- /dev/null +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -0,0 +1,84 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Modirum MDPay +# +# 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 THE 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 THE 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. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "forward" "cleanup" +forward_head() +{ + atf_set descr 'Syncookies for forwarded hosts' + atf_set require.user root +} + +forward_body() +{ + pft_init + + epair_in=$(vnet_mkepair) + epair_out=$(vnet_mkepair) + + vnet_mkjail fwd ${epair_in}b ${epair_out}a + vnet_mkjail srv ${epair_out}b + + jexec fwd ifconfig ${epair_in}b 192.0.2.1/24 up + jexec fwd ifconfig ${epair_out}a 198.51.100.1/24 up + jexec fwd sysctl net.inet.ip.forwarding=1 + + jexec srv ifconfig ${epair_out}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + jexec srv /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/echo_inetd.conf + + ifconfig ${epair_in}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + jexec fwd pfctl -e + pft_set_rules fwd \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + reply=$(echo foo | nc -N -w 5 198.51.100.2 7) + if [ "${reply}" != "foo" ]; + then + atf_fail "Failed to connect to syncookie protected echo daemon" + fi +} + +forward_cleanup() +{ + rm -f inetd-alcatraz.pid + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "forward" +} From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 685A165E0A9; Tue, 27 Jul 2021 11:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4Q67cPz3s85; Tue, 27 Jul 2021 11:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DD421F7F; Tue, 27 Jul 2021 11:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkkdc067765; Tue, 27 Jul 2021 11:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkkYF067764; Tue, 27 Jul 2021 11:46:46 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:46 GMT Message-Id: <202107271146.16RBkkYF067764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4c36e9454374 - stable/12 - pf: syncookie ioctl interface MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4c36e9454374fa200572ce4be5fb2570892c5634 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:47 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4c36e9454374fa200572ce4be5fb2570892c5634 commit 4c36e9454374fa200572ce4be5fb2570892c5634 Author: Kristof Provost AuthorDate: 2021-05-26 08:18:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:24 +0000 pf: syncookie ioctl interface Kernel side implementation to allow switching between on and off modes, and allow this configuration to be retrieved. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31139 (cherry picked from commit 231e83d3422ff58fe94de8375a9532a1726056ed) --- sys/net/pfvar.h | 2 +- sys/netpfil/pf/pf_ioctl.c | 18 +++++++++ sys/netpfil/pf/pf_syncookies.c | 84 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 3a74709fecf5..d072eedd3621 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1573,6 +1573,7 @@ struct pf_idhash { struct mtx lock; }; +extern u_long pf_ioctl_maxcount; extern u_long pf_hashmask; extern u_long pf_srchashmask; #define PF_HASHSIZ (131072) @@ -1841,7 +1842,6 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); -int pf_syncookies_setmode(u_int8_t); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 70cc4ff83d7b..dde2aecc8ef5 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -276,6 +276,14 @@ pflog_packet_t *pflog_packet_ptr = NULL; extern u_long pf_ioctl_maxcount; +#define ERROUT_FUNCTION(target, x) \ + do { \ + error = (x); \ + SDT_PROBE3(pf, ioctl, function, error, __func__, error, \ + __LINE__); \ + goto target; \ + } while (0) + static void pfattach_vnet(void) { @@ -2138,6 +2146,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCOSFPGET: case DIOCGETSRCNODES: case DIOCCLRSRCNODES: + case DIOCGETSYNCOOKIES: case DIOCIGETIFACES: case DIOCGIFSPEEDV0: case DIOCGIFSPEEDV1: @@ -2185,6 +2194,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCRTSTADDRS: case DIOCOSFPGET: case DIOCGETSRCNODES: + case DIOCGETSYNCOOKIES: case DIOCIGETIFACES: case DIOCGIFSPEEDV1: case DIOCGIFSPEEDV0: @@ -4602,6 +4612,14 @@ DIOCCHANGEADDR_error: error = pf_keepcounters((struct pfioc_nv *)addr); break; + case DIOCGETSYNCOOKIES: + error = pf_get_syncookies((struct pfioc_nv *)addr); + break; + + case DIOCSETSYNCOOKIES: + error = pf_set_syncookies((struct pfioc_nv *)addr); + break; + case DIOCSETHOSTID: { u_int32_t *hostid = (u_int32_t *)addr; diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index ee936b6662fa..c05aed605e06 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -110,6 +110,7 @@ struct pf_syncookie_status { VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); #define V_pf_syncookie_status VNET(pf_syncookie_status) +static int pf_syncookies_setmode(u_int8_t); void pf_syncookie_rotate(void *); void pf_syncookie_newkey(void); uint32_t pf_syncookie_mac(struct pf_pdesc *, union pf_syncookie, @@ -127,6 +128,89 @@ pf_syncookies_init(void) } int +pf_get_syncookies(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (ENOMEM); + + nvlist_add_bool(nvl, "enabled", + V_pf_status.syncookies_mode != PF_SYNCOOKIES_NEVER); + nvlist_add_bool(nvl, "adaptive", false); + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) { + nvlist_destroy(nvl); + return (ENOMEM); + } + if (nv->size == 0) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (0); + } else if (nv->size < nv->len) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (ENOSPC); + } + + return (copyout(nvlpacked, nv->data, nv->len)); +} + +int +pf_set_syncookies(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + int error; + bool enabled, adaptive; + + if (nv->len > pf_ioctl_maxcount) + return (ENOMEM); + + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + return (ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) { + free(nvlpacked, M_TEMP); + return (error); + } + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) { + free(nvlpacked, M_TEMP); + return (EBADMSG); + } + + if (! nvlist_exists_bool(nvl, "enabled") + || ! nvlist_exists_bool(nvl, "adaptive")) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (EBADMSG); + } + + enabled = nvlist_get_bool(nvl, "enabled"); + adaptive = nvlist_get_bool(nvl, "adaptive"); + + if (adaptive) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (ENOTSUP); + } + + PF_RULES_WLOCK(); + error = pf_syncookies_setmode(enabled ? + PF_SYNCOOKIES_ALWAYS : PF_SYNCOOKIES_NEVER); + PF_RULES_WUNLOCK(); + + return (error); +} + +static int pf_syncookies_setmode(u_int8_t mode) { if (mode > PF_SYNCOOKIES_MODE_MAX) From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C8EF65DF13; Tue, 27 Jul 2021 11:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4Q2Q8yz3s1K; Tue, 27 Jul 2021 11:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B21A1E6B; Tue, 27 Jul 2021 11:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkkXC067741; Tue, 27 Jul 2021 11:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkkrS067740; Tue, 27 Jul 2021 11:46:46 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:46 GMT Message-Id: <202107271146.16RBkkrS067740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2987a3643be7 - stable/13 - pf: syncookie ioctl interface MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2987a3643be7d143c1ff22be3a7e4f485a7acc1f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:46 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2987a3643be7d143c1ff22be3a7e4f485a7acc1f commit 2987a3643be7d143c1ff22be3a7e4f485a7acc1f Author: Kristof Provost AuthorDate: 2021-05-26 08:18:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:42:52 +0000 pf: syncookie ioctl interface Kernel side implementation to allow switching between on and off modes, and allow this configuration to be retrieved. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31139 (cherry picked from commit 231e83d3422ff58fe94de8375a9532a1726056ed) --- sys/net/pfvar.h | 2 +- sys/netpfil/pf/pf_ioctl.c | 18 +++++++++ sys/netpfil/pf/pf_syncookies.c | 84 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 50634f39a549..b4a788436147 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1572,6 +1572,7 @@ struct pf_idhash { struct mtx lock; }; +extern u_long pf_ioctl_maxcount; extern u_long pf_hashmask; extern u_long pf_srchashmask; #define PF_HASHSIZ (131072) @@ -1840,7 +1841,6 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); -int pf_syncookies_setmode(u_int8_t); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index d5b33a48a57c..96eb31b00ffb 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -276,6 +276,14 @@ pflog_packet_t *pflog_packet_ptr = NULL; extern u_long pf_ioctl_maxcount; +#define ERROUT_FUNCTION(target, x) \ + do { \ + error = (x); \ + SDT_PROBE3(pf, ioctl, function, error, __func__, error, \ + __LINE__); \ + goto target; \ + } while (0) + static void pfattach_vnet(void) { @@ -2137,6 +2145,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCOSFPGET: case DIOCGETSRCNODES: case DIOCCLRSRCNODES: + case DIOCGETSYNCOOKIES: case DIOCIGETIFACES: case DIOCGIFSPEEDV0: case DIOCGIFSPEEDV1: @@ -2184,6 +2193,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCRTSTADDRS: case DIOCOSFPGET: case DIOCGETSRCNODES: + case DIOCGETSYNCOOKIES: case DIOCIGETIFACES: case DIOCGIFSPEEDV1: case DIOCGIFSPEEDV0: @@ -4539,6 +4549,14 @@ DIOCCHANGEADDR_error: error = pf_keepcounters((struct pfioc_nv *)addr); break; + case DIOCGETSYNCOOKIES: + error = pf_get_syncookies((struct pfioc_nv *)addr); + break; + + case DIOCSETSYNCOOKIES: + error = pf_set_syncookies((struct pfioc_nv *)addr); + break; + case DIOCSETHOSTID: { u_int32_t *hostid = (u_int32_t *)addr; diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 0071bab0d7d5..d51f89fb47d4 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -110,6 +110,7 @@ struct pf_syncookie_status { VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); #define V_pf_syncookie_status VNET(pf_syncookie_status) +static int pf_syncookies_setmode(u_int8_t); void pf_syncookie_rotate(void *); void pf_syncookie_newkey(void); uint32_t pf_syncookie_mac(struct pf_pdesc *, union pf_syncookie, @@ -127,6 +128,89 @@ pf_syncookies_init(void) } int +pf_get_syncookies(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (ENOMEM); + + nvlist_add_bool(nvl, "enabled", + V_pf_status.syncookies_mode != PF_SYNCOOKIES_NEVER); + nvlist_add_bool(nvl, "adaptive", false); + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) { + nvlist_destroy(nvl); + return (ENOMEM); + } + if (nv->size == 0) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (0); + } else if (nv->size < nv->len) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (ENOSPC); + } + + return (copyout(nvlpacked, nv->data, nv->len)); +} + +int +pf_set_syncookies(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + int error; + bool enabled, adaptive; + + if (nv->len > pf_ioctl_maxcount) + return (ENOMEM); + + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + return (ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) { + free(nvlpacked, M_TEMP); + return (error); + } + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) { + free(nvlpacked, M_TEMP); + return (EBADMSG); + } + + if (! nvlist_exists_bool(nvl, "enabled") + || ! nvlist_exists_bool(nvl, "adaptive")) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (EBADMSG); + } + + enabled = nvlist_get_bool(nvl, "enabled"); + adaptive = nvlist_get_bool(nvl, "adaptive"); + + if (adaptive) { + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (ENOTSUP); + } + + PF_RULES_WLOCK(); + error = pf_syncookies_setmode(enabled ? + PF_SYNCOOKIES_ALWAYS : PF_SYNCOOKIES_NEVER); + PF_RULES_WUNLOCK(); + + return (error); +} + +static int pf_syncookies_setmode(u_int8_t mode) { if (mode > PF_SYNCOOKIES_MODE_MAX) From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 931A665E0B7; Tue, 27 Jul 2021 11:46:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4W0RWjz3rxN; Tue, 27 Jul 2021 11:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE3C91DF5; Tue, 27 Jul 2021 11:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkoWd067940; Tue, 27 Jul 2021 11:46:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkoCY067939; Tue, 27 Jul 2021 11:46:50 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:50 GMT Message-Id: <202107271146.16RBkoCY067939@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: eae9481e86ac - stable/13 - pf: fix LINT build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eae9481e86acfe95c721eccbad69b1530c3c58d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=eae9481e86acfe95c721eccbad69b1530c3c58d5 commit eae9481e86acfe95c721eccbad69b1530c3c58d5 Author: Kristof Provost AuthorDate: 2021-07-20 14:48:35 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:45:23 +0000 pf: fix LINT build We failed to list the new pf_syncookies.c file in sys/conf/files. This worked for the usual configurations, where pf is a module, but not for LINT builds. Reported by: lwhsu MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit b972a7fa9e1e01367435a5699b71cc7b5e494fee) --- sys/conf/files | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/conf/files b/sys/conf/files index 3b8b761fde3a..b0f313bb39de 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4531,6 +4531,7 @@ netpfil/pf/pf_norm.c optional pf inet netpfil/pf/pf_nv.c optional pf inet netpfil/pf/pf_osfp.c optional pf inet netpfil/pf/pf_ruleset.c optional pf inet +netpfil/pf/pf_syncookies.c optional pf inet netpfil/pf/pf_table.c optional pf inet netpfil/pf/in4_cksum.c optional pf inet netsmb/smb_conn.c optional netsmb From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E9D865E180; Tue, 27 Jul 2021 11:46:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4Z3ZPqz3sKD; Tue, 27 Jul 2021 11:46:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A0501C41; Tue, 27 Jul 2021 11:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkrWc068060; Tue, 27 Jul 2021 11:46:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkr1O068059; Tue, 27 Jul 2021 11:46:53 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:53 GMT Message-Id: <202107271146.16RBkr1O068059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: fbef5f8f7e85 - stable/12 - pf: clean up syncookie callout on vnet shutdown MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fbef5f8f7e8506890c81a7a1c72cab587e9205e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:56 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fbef5f8f7e8506890c81a7a1c72cab587e9205e7 commit fbef5f8f7e8506890c81a7a1c72cab587e9205e7 Author: Kristof Provost AuthorDate: 2021-07-20 19:03:08 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:27 +0000 pf: clean up syncookie callout on vnet shutdown Ensure that we cancel any outstanding callouts for syncookies when we terminate the vnet. MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 32271c4d383effeac7878201ef5cbdfaeedc3755) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 1 + sys/netpfil/pf/pf_syncookies.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index d072eedd3621..7d31e4ce21a0 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1842,6 +1842,7 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); +void pf_syncookies_cleanup(void); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index dde2aecc8ef5..a3026d394bde 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5633,6 +5633,7 @@ pf_unload_vnet(void) } PF_RULES_WLOCK(); + pf_syncookies_cleanup(); shutdown_pf(); PF_RULES_WUNLOCK(); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 43d3a0a0b036..bfcc4b3d4e82 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -127,6 +127,12 @@ pf_syncookies_init(void) PF_RULES_WUNLOCK(); } +void +pf_syncookies_cleanup(void) +{ + callout_stop(&V_pf_syncookie_status.keytimeout); +} + int pf_get_syncookies(struct pfioc_nv *nv) { From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 697DC65D779; Tue, 27 Jul 2021 11:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4T4JHzz3rv4; Tue, 27 Jul 2021 11:46:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D60C92120; Tue, 27 Jul 2021 11:46:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkmSN067868; Tue, 27 Jul 2021 11:46:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkmdJ067867; Tue, 27 Jul 2021 11:46:48 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:48 GMT Message-Id: <202107271146.16RBkmdJ067867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 91bf2e701ed7 - stable/12 - pf tests: Forwarding syncookie test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 91bf2e701ed789c990f3c75c0d166c60a634d3f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:50 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=91bf2e701ed789c990f3c75c0d166c60a634d3f1 commit 91bf2e701ed789c990f3c75c0d166c60a634d3f1 Author: Kristof Provost AuthorDate: 2021-06-02 16:16:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:26 +0000 pf tests: Forwarding syncookie test Test syncookies on a forwarding host. That is, in a setup where the machine (or vnet) running pf is not the same as the machine (or vnet) running the server it's protecting. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31141 (cherry picked from commit 3be9301a7e4fbd630cbde1bd3e1b59ac726e21af) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/syncookie.sh | 84 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 08174ad7ce19..fde02ea3933b 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -21,6 +21,7 @@ ATF_TESTS_SH+= anchor \ src_track \ rdr \ route_to \ + syncookie \ synproxy \ set_skip \ pfsync \ diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh new file mode 100644 index 000000000000..7bd045249be6 --- /dev/null +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -0,0 +1,84 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Modirum MDPay +# +# 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 THE 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 THE 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. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "forward" "cleanup" +forward_head() +{ + atf_set descr 'Syncookies for forwarded hosts' + atf_set require.user root +} + +forward_body() +{ + pft_init + + epair_in=$(vnet_mkepair) + epair_out=$(vnet_mkepair) + + vnet_mkjail fwd ${epair_in}b ${epair_out}a + vnet_mkjail srv ${epair_out}b + + jexec fwd ifconfig ${epair_in}b 192.0.2.1/24 up + jexec fwd ifconfig ${epair_out}a 198.51.100.1/24 up + jexec fwd sysctl net.inet.ip.forwarding=1 + + jexec srv ifconfig ${epair_out}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + jexec srv /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/echo_inetd.conf + + ifconfig ${epair_in}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + jexec fwd pfctl -e + pft_set_rules fwd \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + reply=$(echo foo | nc -N -w 5 198.51.100.2 7) + if [ "${reply}" != "foo" ]; + then + atf_fail "Failed to connect to syncookie protected echo daemon" + fi +} + +forward_cleanup() +{ + rm -f inetd-alcatraz.pid + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "forward" +} From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D990465D77A; Tue, 27 Jul 2021 11:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4V1p3wz3sM7; Tue, 27 Jul 2021 11:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01B501C3F; Tue, 27 Jul 2021 11:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBknKT067916; Tue, 27 Jul 2021 11:46:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBknKZ067915; Tue, 27 Jul 2021 11:46:49 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:49 GMT Message-Id: <202107271146.16RBknKZ067915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d0a815844eef - stable/12 - pf tests: ensure syncookie does not create state MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d0a815844eefe6087fd170e6664286d2c9334a30 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:51 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d0a815844eefe6087fd170e6664286d2c9334a30 commit d0a815844eefe6087fd170e6664286d2c9334a30 Author: Kristof Provost AuthorDate: 2021-06-30 13:27:46 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:26 +0000 pf tests: ensure syncookie does not create state Test that with syncookies enabled pf does not create state for connections before the remote peer has replied to the SYN|ACK message. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31142 (cherry picked from commit 27ab791a55191c0b6503391d411303b042b41047) --- tests/sys/netpfil/pf/syncookie.sh | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh index 7bd045249be6..49acd9fab11d 100644 --- a/tests/sys/netpfil/pf/syncookie.sh +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "forward" "cleanup" forward_head() { @@ -78,7 +80,54 @@ forward_cleanup() pft_cleanup } +atf_test_case "nostate" "cleanup" +nostate_head() +{ + atf_set descr 'Ensure that we do not create until SYN|ACK' + atf_set require.user root + atf_set require.progs scapy +} + +nostate_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + # Now syn flood to create many states + ${common_dir}/pft_synflood.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --count 20 + + states=$(jexec alcatraz pfctl -ss | grep tcp) + if [ -n "$states" ]; + then + echo "$states" + atf_fail "Found unexpected state" + fi +} + +nostate_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "forward" + atf_add_test_case "nostate" } From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4087465E124; Tue, 27 Jul 2021 11:46:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4Y6cL5z3s6G; Tue, 27 Jul 2021 11:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CF591C40; Tue, 27 Jul 2021 11:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkqcg068036; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkqGC068035; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:52 GMT Message-Id: <202107271146.16RBkqGC068035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 7d226e964ab7 - stable/13 - pf: clean up syncookie callout on vnet shutdown MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7d226e964ab78c704c9eec40daa95a4c6ab1b323 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7d226e964ab78c704c9eec40daa95a4c6ab1b323 commit 7d226e964ab78c704c9eec40daa95a4c6ab1b323 Author: Kristof Provost AuthorDate: 2021-07-20 19:03:08 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:45:41 +0000 pf: clean up syncookie callout on vnet shutdown Ensure that we cancel any outstanding callouts for syncookies when we terminate the vnet. MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 32271c4d383effeac7878201ef5cbdfaeedc3755) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 1 + sys/netpfil/pf/pf_syncookies.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b4a788436147..e54e734dcecf 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1841,6 +1841,7 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); +void pf_syncookies_cleanup(void); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 96eb31b00ffb..6af5197ef07d 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5574,6 +5574,7 @@ pf_unload_vnet(void) dehook_pf(); PF_RULES_WLOCK(); + pf_syncookies_cleanup(); shutdown_pf(); PF_RULES_WUNLOCK(); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 0313b817ad6d..8699ae855ec8 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -127,6 +127,12 @@ pf_syncookies_init(void) PF_RULES_WUNLOCK(); } +void +pf_syncookies_cleanup(void) +{ + callout_stop(&V_pf_syncookie_status.keytimeout); +} + int pf_get_syncookies(struct pfioc_nv *nv) { From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09EC365E122; Tue, 27 Jul 2021 11:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4X50Fzz3sMH; Tue, 27 Jul 2021 11:46:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 494A01E6D; Tue, 27 Jul 2021 11:46:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkq0W068012; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkqoV068011; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:52 GMT Message-Id: <202107271146.16RBkqoV068011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3a6cc067e900 - stable/12 - pf: remove stray debug line MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3a6cc067e900b3ec4254c37b90efd844cbef0031 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3a6cc067e900b3ec4254c37b90efd844cbef0031 commit 3a6cc067e900b3ec4254c37b90efd844cbef0031 Author: Kristof Provost AuthorDate: 2021-07-20 19:02:33 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:27 +0000 pf: remove stray debug line MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 84db87b8dafd9e9970fd36ac48c11ffdc89d31d0) --- sys/netpfil/pf/pf_syncookies.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index c05aed605e06..43d3a0a0b036 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -301,7 +301,6 @@ pf_syncookie_rotate(void *arg) pf_syncookie_newkey(); CURVNET_RESTORE(); - printf("KP: %s() return\n", __func__); } void From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F44565DF3D; Tue, 27 Jul 2021 11:46:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4V1qT8z3s34; Tue, 27 Jul 2021 11:46:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3CC41ADC; Tue, 27 Jul 2021 11:46:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkn1I067892; Tue, 27 Jul 2021 11:46:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBknSv067891; Tue, 27 Jul 2021 11:46:49 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:49 GMT Message-Id: <202107271146.16RBknSv067891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4aa52f90f71e - stable/13 - pf tests: ensure syncookie does not create state MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4aa52f90f71eb7d710da46e587354190d6df5566 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4aa52f90f71eb7d710da46e587354190d6df5566 commit 4aa52f90f71eb7d710da46e587354190d6df5566 Author: Kristof Provost AuthorDate: 2021-06-30 13:27:46 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:44:06 +0000 pf tests: ensure syncookie does not create state Test that with syncookies enabled pf does not create state for connections before the remote peer has replied to the SYN|ACK message. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31142 (cherry picked from commit 27ab791a55191c0b6503391d411303b042b41047) --- tests/sys/netpfil/pf/syncookie.sh | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh index 7bd045249be6..49acd9fab11d 100644 --- a/tests/sys/netpfil/pf/syncookie.sh +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "forward" "cleanup" forward_head() { @@ -78,7 +80,54 @@ forward_cleanup() pft_cleanup } +atf_test_case "nostate" "cleanup" +nostate_head() +{ + atf_set descr 'Ensure that we do not create until SYN|ACK' + atf_set require.user root + atf_set require.progs scapy +} + +nostate_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + # Now syn flood to create many states + ${common_dir}/pft_synflood.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --count 20 + + states=$(jexec alcatraz pfctl -ss | grep tcp) + if [ -n "$states" ]; + then + echo "$states" + atf_fail "Found unexpected state" + fi +} + +nostate_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "forward" + atf_add_test_case "nostate" } From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C052F65E121; Tue, 27 Jul 2021 11:46:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4W6sdRz3sHx; Tue, 27 Jul 2021 11:46:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27D7F1DF6; Tue, 27 Jul 2021 11:46:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkpO2067964; Tue, 27 Jul 2021 11:46:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkptm067963; Tue, 27 Jul 2021 11:46:51 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:51 GMT Message-Id: <202107271146.16RBkptm067963@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 9b663cf5ca7e - stable/12 - pf: fix LINT build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9b663cf5ca7ecd6a918343ee0d332026fb2d4ceb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9b663cf5ca7ecd6a918343ee0d332026fb2d4ceb commit 9b663cf5ca7ecd6a918343ee0d332026fb2d4ceb Author: Kristof Provost AuthorDate: 2021-07-20 14:48:35 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:26 +0000 pf: fix LINT build We failed to list the new pf_syncookies.c file in sys/conf/files. This worked for the usual configurations, where pf is a module, but not for LINT builds. Reported by: lwhsu MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit b972a7fa9e1e01367435a5699b71cc7b5e494fee) --- sys/conf/files | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/conf/files b/sys/conf/files index 624be0a7240b..e9557a2cd01c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4511,6 +4511,7 @@ netpfil/pf/pf_norm.c optional pf inet netpfil/pf/pf_nv.c optional pf inet netpfil/pf/pf_osfp.c optional pf inet netpfil/pf/pf_ruleset.c optional pf inet +netpfil/pf/pf_syncookies.c optional pf inet netpfil/pf/pf_table.c optional pf inet netpfil/pf/in4_cksum.c optional pf inet netsmb/smb_conn.c optional netsmb From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFB8A65E123; Tue, 27 Jul 2021 11:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GYw4X4gHfz3sMF; Tue, 27 Jul 2021 11:46:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC4421BC2; Tue, 27 Jul 2021 11:46:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RBkpoI067988; Tue, 27 Jul 2021 11:46:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkpBO067987; Tue, 27 Jul 2021 11:46:51 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:51 GMT Message-Id: <202107271146.16RBkpBO067987@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 00b005036b51 - stable/13 - pf: remove stray debug line MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 00b005036b51631f71cb8ca40aa2d6723e623bef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:53 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=00b005036b51631f71cb8ca40aa2d6723e623bef commit 00b005036b51631f71cb8ca40aa2d6723e623bef Author: Kristof Provost AuthorDate: 2021-07-20 19:02:33 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:45:31 +0000 pf: remove stray debug line MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 84db87b8dafd9e9970fd36ac48c11ffdc89d31d0) --- sys/netpfil/pf/pf_syncookies.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index d51f89fb47d4..0313b817ad6d 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -301,7 +301,6 @@ pf_syncookie_rotate(void *arg) pf_syncookie_newkey(); CURVNET_RESTORE(); - printf("KP: %s() return\n", __func__); } void From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 16:49:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3B6D663429; Tue, 27 Jul 2021 16:49:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ2pG6LrYz4mCY; Tue, 27 Jul 2021 16:49:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE4855F61; Tue, 27 Jul 2021 16:49:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RGnwip070247; Tue, 27 Jul 2021 16:49:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RGnwV1070246; Tue, 27 Jul 2021 16:49:58 GMT (envelope-from git) Date: Tue, 27 Jul 2021 16:49:58 GMT Message-Id: <202107271649.16RGnwV1070246@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: ba99ff623b80 - stable/12 - fusefs: improve warnings about buggy FUSE servers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ba99ff623b80d3b8173f6bd08758bc43626ea6d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 16:49:59 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=ba99ff623b80d3b8173f6bd08758bc43626ea6d9 commit ba99ff623b80d3b8173f6bd08758bc43626ea6d9 Author: Alan Somers AuthorDate: 2021-06-15 20:24:05 +0000 Commit: Alan Somers CommitDate: 2021-07-27 16:20:46 +0000 fusefs: improve warnings about buggy FUSE servers The fusefs driver will print warning messages about FUSE servers that commit protocol violations. Previously it would print those warnings on every violation, but that could spam the console. Now it will print each warning no more than once per lifetime of the mount. There is also now a dtrace probe for each violation. Sponsored by: Axcient Reviewed by: emaste, pfg Differential Revision: https://reviews.freebsd.org/D30780 (cherry picked from commit 0b9a5c6fa1733e600dcdb3b9df3b3d0ad5996920) --- sys/fs/fuse/fuse_internal.c | 19 ++++++++----------- sys/fs/fuse/fuse_io.c | 8 ++++---- sys/fs/fuse/fuse_ipc.c | 14 ++++++++++++++ sys/fs/fuse/fuse_ipc.h | 8 ++++++++ sys/fs/fuse/fuse_vfsops.c | 23 ++++++++++++++++++++--- sys/fs/fuse/fuse_vnops.c | 18 +++++++++--------- 6 files changed, 63 insertions(+), 27 deletions(-) diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c index 57ff01cd70b7..f70533b54028 100644 --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -871,9 +871,6 @@ fuse_internal_forget_send(struct mount *mp, fdisp_destroy(&fdi); } -SDT_PROBE_DEFINE2(fusefs, , internal, getattr_cache_incoherent, - "struct vnode*", "struct fuse_attr_out*"); - /* Fetch the vnode's attributes from the daemon*/ int fuse_internal_do_getattr(struct vnode *vp, struct vattr *vap, @@ -923,14 +920,14 @@ fuse_internal_do_getattr(struct vnode *vp, struct vattr *vap, * The server changed the file's size even though we had it * cached! That's a server bug. */ - SDT_PROBE2(fusefs, , internal, getattr_cache_incoherent, vp, - fao); - printf("%s: cache incoherent on %s! " - "Buggy FUSE server detected. To prevent data corruption, " - "disable the data cache by mounting with -o direct_io, or " - "as directed otherwise by your FUSE server's " - "documentation\n", __func__, - vnode_mount(vp)->mnt_stat.f_mntonname); + struct mount *mp = vnode_mount(vp); + struct fuse_data *data = fuse_get_mpdata(mp); + + fuse_warn(data, FSESS_WARN_CACHE_INCOHERENT, + "cache incoherent! " + "To prevent data corruption, disable the data cache " + "by mounting with -o direct_io, or as directed " + "otherwise by your FUSE server's documentation."); int iosize = fuse_iosize(vp); v_inval_buf_range(vp, 0, INT64_MAX, iosize); } diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c index ea599e9aab34..5769ac8eccd1 100644 --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -616,16 +616,16 @@ retry: fvdat->flag &= ~FN_SIZECHANGE; if (diff < 0) { - printf("WARNING: misbehaving FUSE filesystem " - "wrote more data than we provided it\n"); + fuse_warn(data, FSESS_WARN_WROTE_LONG, + "wrote more data than we provided it."); err = EINVAL; break; } else if (diff > 0) { /* Short write */ if (!direct_io) { - printf("WARNING: misbehaving FUSE filesystem: " + fuse_warn(data, FSESS_WARN_SHORT_WRITE, "short writes are only allowed with " - "direct_io\n"); + "direct_io."); } if (ioflag & IO_DIRECT) { /* Return early */ diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index 514f7857faf5..e3be63b9d6d4 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -1095,3 +1095,17 @@ fuse_ipc_destroy(void) counter_u64_free(fuse_ticket_count); uma_zdestroy(ticket_zone); } + +SDT_PROBE_DEFINE3(fusefs,, ipc, warn, "struct fuse_data*", "unsigned", "char*"); +void +fuse_warn(struct fuse_data *data, unsigned flag, const char *msg) +{ + SDT_PROBE3(fusefs, , ipc, warn, data, flag, msg); + if (!(data->dataflags & flag)) { + printf("WARNING: FUSE protocol violation for server mounted at " + "%s: %s " + "This warning will not be repeated.\n", + data->mp->mnt_stat.f_mntonname, msg); + data->dataflags |= flag; + } +} diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h index bedecefd157a..8e041529e119 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -231,6 +231,11 @@ struct fuse_data { #define FSESS_POSIX_LOCKS 0x2000 /* daemon supports POSIX locks */ #define FSESS_EXPORT_SUPPORT 0x10000 /* daemon supports NFS-style lookups */ #define FSESS_INTR 0x20000 /* interruptible mounts */ +#define FSESS_WARN_SHORT_WRITE 0x40000 /* Short write without direct_io */ +#define FSESS_WARN_WROTE_LONG 0x80000 /* Wrote more data than provided */ +#define FSESS_WARN_LSEXTATTR_LONG 0x100000 /* Returned too many extattrs */ +#define FSESS_WARN_CACHE_INCOHERENT 0x200000 /* Read cache incoherent */ +#define FSESS_WARN_WB_CACHE_INCOHERENT 0x400000 /* WB cache incoherent */ #define FSESS_MNTOPTS_MASK ( \ FSESS_DAEMON_CAN_SPY | FSESS_PUSH_SYMLINKS_IN | \ FSESS_DEFAULT_PERMISSIONS | FSESS_INTR) @@ -365,6 +370,9 @@ fuse_libabi_geq(struct fuse_data *data, uint32_t abi_maj, uint32_t abi_min) data->fuse_libabi_minor >= abi_min)); } +/* Print msg as a warning to the console, but no more than once per session */ +void fuse_warn(struct fuse_data *data, unsigned flag, const char *msg); + struct fuse_data *fdata_alloc(struct cdev *dev, struct ucred *cred); void fdata_trydestroy(struct fuse_data *data); void fdata_set_dead(struct fuse_data *data); diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c index a31b95df3318..a4a0ce3b86d0 100644 --- a/sys/fs/fuse/fuse_vfsops.c +++ b/sys/fs/fuse/fuse_vfsops.c @@ -590,9 +590,26 @@ fuse_vfsop_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) if (vnode_isreg(*vpp) && filesize != fvdat->cached_attrs.va_size && fvdat->flag & FN_SIZECHANGE) { - printf("%s: WB cache incoherent on %s!\n", __func__, - vnode_mount(*vpp)->mnt_stat.f_mntonname); - + if (data->cache_mode == fuse_data_cache_mode) { + const char *msg; + + if (fuse_libabi_geq(data, 7, 23)) { + msg = "writeback cache incoherent!." + "To prevent data corruption, disable " + "the writeback cache according to your " + "FUSE server's documentation."; + } else { + msg = "writeback cache incoherent!." + "To prevent data corruption, disable " + "the writeback cache by setting " + "vfs.fusefs.data_cache_mode to 0 or 1."; + } + fuse_warn(data, FSESS_WARN_WB_CACHE_INCOHERENT, msg); + } else { + /* If we get here, it's likely a fusefs kernel bug */ + printf("%s: WB cache incoherent on %s!\n", __func__, + vnode_mount(*vpp)->mnt_stat.f_mntonname); + } fvdat->flag &= ~FN_SIZECHANGE; } diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index d30fc32d1dc5..1c1ac7680f0e 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -967,8 +967,6 @@ fuse_lookup_alloc(struct mount *mp, void *arg, int lkflags, struct vnode **vpp) SDT_PROBE_DEFINE3(fusefs, , vnops, cache_lookup, "int", "struct timespec*", "struct timespec*"); -SDT_PROBE_DEFINE2(fusefs, , vnops, lookup_cache_incoherent, - "struct vnode*", "struct fuse_entry_out*"); /* struct vnop_lookup_args { struct vnodeop_desc *a_desc; @@ -1177,20 +1175,19 @@ fuse_vnop_lookup(struct vop_lookup_args *ap) ((vap = VTOVA(vp)) && filesize != vap->va_size))) { - SDT_PROBE2(fusefs, , vnops, lookup_cache_incoherent, vp, feo); fvdat->flag &= ~FN_SIZECHANGE; /* * The server changed the file's size even * though we had it cached, or had dirty writes * in the WB cache! */ - printf("%s: cache incoherent on %s! " - "Buggy FUSE server detected. To prevent " + fuse_warn(data, FSESS_WARN_CACHE_INCOHERENT, + "cache incoherent! " + "To prevent " "data corruption, disable the data cache " "by mounting with -o direct_io, or as " "directed otherwise by your FUSE server's " - "documentation\n", __func__, - vnode_mount(vp)->mnt_stat.f_mntonname); + "documentation."); int iosize = fuse_iosize(vp); v_inval_buf_range(vp, 0, INT64_MAX, iosize); } @@ -2357,9 +2354,12 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap) linux_list = fdi.answ; /* FUSE doesn't allow the server to return more data than requested */ if (fdi.iosize > linux_list_len) { - printf("WARNING: FUSE protocol violation. Server returned " + struct fuse_data *data = fuse_get_mpdata(mp); + + fuse_warn(data, FSESS_WARN_LSEXTATTR_LONG, + "server returned " "more extended attribute data than requested; " - "should've returned ERANGE instead"); + "should've returned ERANGE instead."); } else { /* But returning less data is fine */ linux_list_len = fdi.iosize; From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:04:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BB256646E7; Tue, 27 Jul 2021 17:04:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ37T1gl5z4nmJ; Tue, 27 Jul 2021 17:04:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 171C766B9; Tue, 27 Jul 2021 17:04:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RH4qHh097337; Tue, 27 Jul 2021 17:04:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH4q6j097336; Tue, 27 Jul 2021 17:04:52 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:04:52 GMT Message-Id: <202107271704.16RH4q6j097336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 6b2266b050a6 - stable/12 - fusefs: support EVFILT_WRITE on /dev/fuse MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6b2266b050a6e06f20c065323379eefc3b6ec2f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:04:53 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=6b2266b050a6e06f20c065323379eefc3b6ec2f5 commit 6b2266b050a6e06f20c065323379eefc3b6ec2f5 Author: Alan Somers AuthorDate: 2021-06-15 23:17:28 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:03:38 +0000 fusefs: support EVFILT_WRITE on /dev/fuse /dev/fuse is always ready for writing, so it's kind of dumb to poll it. But some applications do it anyway. Better to return ready than EINVAL. Reviewed by: emaste, pfg Differential Revision: https://reviews.freebsd.org/D30784 (cherry picked from commit 7b8622fa220b9c08041102f638f848c48e022644) --- sys/fs/fuse/fuse_device.c | 22 +++++++++++++++++++++- tests/sys/fs/fusefs/mockfs.cc | 20 +++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index 203da2c6f7ba..c918d593f1a4 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -116,6 +116,7 @@ static struct cdevsw fuse_device_cdevsw = { }; static int fuse_device_filt_read(struct knote *kn, long hint); +static int fuse_device_filt_write(struct knote *kn, long hint); static void fuse_device_filt_detach(struct knote *kn); struct filterops fuse_device_rfiltops = { @@ -124,6 +125,11 @@ struct filterops fuse_device_rfiltops = { .f_event = fuse_device_filt_read, }; +struct filterops fuse_device_wfiltops = { + .f_isfd = 1, + .f_event = fuse_device_filt_write, +}; + /**************************** * * >>> Fuse device op defs @@ -177,12 +183,14 @@ fuse_device_filter(struct cdev *dev, struct knote *kn) error = devfs_get_cdevpriv((void **)&data); - /* EVFILT_WRITE is not supported; the device is always ready to write */ if (error == 0 && kn->kn_filter == EVFILT_READ) { kn->kn_fop = &fuse_device_rfiltops; kn->kn_hook = data; knlist_add(&data->ks_rsel.si_note, kn, 0); error = 0; + } else if (error == 0 && kn->kn_filter == EVFILT_WRITE) { + kn->kn_fop = &fuse_device_wfiltops; + error = 0; } else if (error == 0) { error = EINVAL; kn->kn_data = error; @@ -228,6 +236,18 @@ fuse_device_filt_read(struct knote *kn, long hint) return (ready); } +static int +fuse_device_filt_write(struct knote *kn, long hint) +{ + int ready; + + /* The device is always ready to write */ + kn->kn_data = 0; + ready = 1; + + return (ready); +} + /* * Resources are set up on a per-open basis */ diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index f43afd247502..bbdd515f027d 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -820,8 +820,8 @@ void MockFS::read_request(mockfs_buf_in &in, ssize_t &res) { timeout_ts.tv_sec = 0; timeout_ts.tv_nsec = timeout_ms * 1'000'000; while (nready == 0) { - EV_SET(&changes[0], m_fuse_fd, EVFILT_READ, EV_ADD, 0, - 0, 0); + EV_SET(&changes[0], m_fuse_fd, EVFILT_READ, + EV_ADD | EV_ONESHOT, 0, 0, 0); nready = kevent(m_kq, &changes[0], 1, &events[0], 1, &timeout_ts); if (m_quit) @@ -883,12 +883,26 @@ void MockFS::read_request(mockfs_buf_in &in, ssize_t &res) { void MockFS::write_response(const mockfs_buf_out &out) { fd_set writefds; pollfd fds[1]; + struct kevent changes[1]; + struct kevent events[1]; int nready, nfds; ssize_t r; switch (m_pm) { case BLOCKING: - case KQ: /* EVFILT_WRITE is not supported */ + break; + case KQ: + EV_SET(&changes[0], m_fuse_fd, EVFILT_WRITE, + EV_ADD | EV_ONESHOT, 0, 0, 0); + nready = kevent(m_kq, &changes[0], 1, &events[0], 1, + NULL); + ASSERT_LE(0, nready) << strerror(errno); + ASSERT_EQ(events[0].ident, (uintptr_t)m_fuse_fd); + if (events[0].flags & EV_ERROR) + FAIL() << strerror(events[0].data); + else if (events[0].flags & EV_EOF) + FAIL() << strerror(events[0].fflags); + m_nready = events[0].data; break; case POLL: fds[0].fd = m_fuse_fd; From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:04:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 674E86644F3; Tue, 27 Jul 2021 17:04:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ37V2N7Bz4p5q; Tue, 27 Jul 2021 17:04:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39DBA65A6; Tue, 27 Jul 2021 17:04:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RH4s23097362; Tue, 27 Jul 2021 17:04:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH4sMX097361; Tue, 27 Jul 2021 17:04:54 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:04:54 GMT Message-Id: <202107271704.16RH4sMX097361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 3acfa48d1211 - stable/12 - Simplify fuse_device_filt_write MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3acfa48d1211ef7dd2c3970ac121f0e679da567b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:04:54 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=3acfa48d1211ef7dd2c3970ac121f0e679da567b commit 3acfa48d1211ef7dd2c3970ac121f0e679da567b Author: gAlfonso-bit <83477269+gAlfonso-bit@users.noreply.github.com> AuthorDate: 2021-06-16 19:45:04 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:03:42 +0000 Simplify fuse_device_filt_write It always returns 1, so why bother having a variable. Pull Request: https://github.com/freebsd/freebsd-src/pull/478 (cherry picked from commit 9b876fbd504e5c718d8d0275b32d806ab14558c8) --- sys/fs/fuse/fuse_device.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index c918d593f1a4..3022f8a1aa5b 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -239,13 +239,11 @@ fuse_device_filt_read(struct knote *kn, long hint) static int fuse_device_filt_write(struct knote *kn, long hint) { - int ready; - /* The device is always ready to write */ kn->kn_data = 0; - ready = 1; - return (ready); + /* The device is always ready to write, so we return 1*/ + return (1); } /* From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:04:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7BA9664826; Tue, 27 Jul 2021 17:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ37W4H5Yz4nvt; Tue, 27 Jul 2021 17:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EF976649; Tue, 27 Jul 2021 17:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RH4teq097386; Tue, 27 Jul 2021 17:04:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH4tD9097385; Tue, 27 Jul 2021 17:04:55 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:04:55 GMT Message-Id: <202107271704.16RH4tD9097385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 0272e88a2e59 - stable/12 - fusefs: delete dead code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0272e88a2e59c1a2443bb78265fc43fe769fbdb1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:04:55 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=0272e88a2e59c1a2443bb78265fc43fe769fbdb1 commit 0272e88a2e59c1a2443bb78265fc43fe769fbdb1 Author: Alan Somers AuthorDate: 2021-06-18 00:14:57 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:03:47 +0000 fusefs: delete dead code It was always dead, accidentally included in SVN r345876. Reviewed by: pfg (cherry picked from commit b97c7abc1a1cee72ef62109add860c1e8e618efd) --- sys/fs/fuse/fuse_ipc.c | 6 ------ sys/fs/fuse/fuse_ipc.h | 2 -- 2 files changed, 8 deletions(-) diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index e3be63b9d6d4..4c2acfbd87c6 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -998,12 +998,6 @@ fdisp_refresh_vp(struct fuse_dispatcher *fdip, enum fuse_opcode op, td->td_proc->p_pid, cred); } -void -fdisp_refresh(struct fuse_dispatcher *fdip) -{ - fticket_refresh(fdip->tick); -} - SDT_PROBE_DEFINE2(fusefs, , ipc, fdisp_wait_answ_error, "char*", "int"); int diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h index 8e041529e119..ea2eef2ea978 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -410,8 +410,6 @@ fdisp_destroy(struct fuse_dispatcher *fdisp) #endif } -void fdisp_refresh(struct fuse_dispatcher *fdip); - void fdisp_make(struct fuse_dispatcher *fdip, enum fuse_opcode op, struct mount *mp, uint64_t nid, struct thread *td, struct ucred *cred); From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:04:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23607664753; Tue, 27 Jul 2021 17:04:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ37X4DJYz4npM; Tue, 27 Jul 2021 17:04:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7554066BA; Tue, 27 Jul 2021 17:04:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RH4u5q097410; Tue, 27 Jul 2021 17:04:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RH4u1H097409; Tue, 27 Jul 2021 17:04:56 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:04:56 GMT Message-Id: <202107271704.16RH4u1H097409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 140aa8fff56c - stable/12 - fusefs: also debug INIT operations in the test suite MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 140aa8fff56c09e95f11320eec7a6b89093b8d00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:04:57 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=140aa8fff56c09e95f11320eec7a6b89093b8d00 commit 140aa8fff56c09e95f11320eec7a6b89093b8d00 Author: Alan Somers AuthorDate: 2021-06-17 22:06:43 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:03:49 +0000 fusefs: also debug INIT operations in the test suite Reviewed by: pfg (cherry picked from commit 77b040c993ba9d4844e36f1f5b057066a5b4015a) --- tests/sys/fs/fusefs/mockfs.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index bbdd515f027d..da634b5f15cd 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -655,6 +655,8 @@ void MockFS::init(uint32_t flags) { std::unique_ptr out(new mockfs_buf_out); read_request(*in, buflen); + if (verbosity > 0) + debug_request(*in, buflen); audit_request(*in, buflen); ASSERT_EQ(FUSE_INIT, in->header.opcode); From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:15:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3037664B22; Tue, 27 Jul 2021 17:15:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ3MW6S8Vz4pZm; Tue, 27 Jul 2021 17:15:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C581467D9; Tue, 27 Jul 2021 17:15:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RHFJBG010736; Tue, 27 Jul 2021 17:15:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHFJPe010735; Tue, 27 Jul 2021 17:15:19 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:15:19 GMT Message-Id: <202107271715.16RHFJPe010735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 43f57e98d032 - stable/12 - fusefs: delete some dead code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 43f57e98d032414a313f1871b805d8f07a5c416d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:15:20 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=43f57e98d032414a313f1871b805d8f07a5c416d commit 43f57e98d032414a313f1871b805d8f07a5c416d Author: Alan Somers AuthorDate: 2020-12-24 19:21:00 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:10:47 +0000 fusefs: delete some dead code The original fusefs GSoC project seems to have envisioned exchanging two types of messages with FUSE servers. Perhaps vectored and non-vectored? But in practice only one type has ever been used. Delete the other type. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D27770 (cherry picked from commit 4f4111d2c5ab64591b9e15dab4257d8187458fd1) --- sys/fs/fuse/fuse_device.c | 64 ++++++++++++++++------------------------------- sys/fs/fuse/fuse_ipc.c | 33 ++---------------------- sys/fs/fuse/fuse_ipc.h | 7 ------ 3 files changed, 24 insertions(+), 80 deletions(-) diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index 3022f8a1aa5b..c634f903e519 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -302,9 +302,8 @@ fuse_device_read(struct cdev *dev, struct uio *uio, int ioflag) int err; struct fuse_data *data; struct fuse_ticket *tick; - void *buf[] = {NULL, NULL, NULL}; - int buflen[3]; - int i; + void *buf; + int buflen; SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read"); @@ -367,46 +366,27 @@ again: SDT_PROBE2(fusefs, , device, trace, 1, "fuse device read message successfully"); - KASSERT(tick->tk_ms_bufdata || tick->tk_ms_bufsize == 0, - ("non-null buf pointer with positive size")); - - switch (tick->tk_ms_type) { - case FT_M_FIOV: - buf[0] = tick->tk_ms_fiov.base; - buflen[0] = tick->tk_ms_fiov.len; - break; - case FT_M_BUF: - buf[0] = tick->tk_ms_fiov.base; - buflen[0] = tick->tk_ms_fiov.len; - buf[1] = tick->tk_ms_bufdata; - buflen[1] = tick->tk_ms_bufsize; - break; - default: - panic("unknown message type for fuse_ticket %p", tick); - } + buf = tick->tk_ms_fiov.base; + buflen = tick->tk_ms_fiov.len; - for (i = 0; buf[i]; i++) { - /* - * Why not ban mercilessly stupid daemons who can't keep up - * with us? (There is no much use of a partial read here...) - */ - /* - * XXX note that in such cases Linux FUSE throws EIO at the - * syscall invoker and stands back to the message queue. The - * rationale should be made clear (and possibly adopt that - * behaviour). Keeping the current scheme at least makes - * fallacy as loud as possible... - */ - if (uio->uio_resid < buflen[i]) { - fdata_set_dead(data); - SDT_PROBE2(fusefs, , device, trace, 2, - "daemon is stupid, kick it off..."); - err = ENODEV; - break; - } - err = uiomove(buf[i], buflen[i], uio); - if (err) - break; + /* + * Why not ban mercilessly stupid daemons who can't keep up + * with us? (There is no much use of a partial read here...) + */ + /* + * XXX note that in such cases Linux FUSE throws EIO at the + * syscall invoker and stands back to the message queue. The + * rationale should be made clear (and possibly adopt that + * behaviour). Keeping the current scheme at least makes + * fallacy as loud as possible... + */ + if (uio->uio_resid < buflen) { + fdata_set_dead(data); + SDT_PROBE2(fusefs, , device, trace, 2, + "daemon is stupid, kick it off..."); + err = ENODEV; + } else { + err = uiomove(buf, buflen, uio); } FUSE_ASSERT_MS_DONE(tick); diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index 4c2acfbd87c6..73378dee959a 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -357,11 +357,9 @@ fticket_init(void *mem, int size, int flags) bzero(ftick, sizeof(struct fuse_ticket)); fiov_init(&ftick->tk_ms_fiov, sizeof(struct fuse_in_header)); - ftick->tk_ms_type = FT_M_FIOV; mtx_init(&ftick->tk_aw_mtx, "fuse answer delivery mutex", NULL, MTX_DEF); fiov_init(&ftick->tk_aw_fiov, 0); - ftick->tk_aw_type = FT_A_FIOV; return 0; } @@ -396,18 +394,11 @@ fticket_refresh(struct fuse_ticket *ftick) FUSE_ASSERT_AW_DONE(ftick); fiov_refresh(&ftick->tk_ms_fiov); - ftick->tk_ms_bufdata = NULL; - ftick->tk_ms_bufsize = 0; - ftick->tk_ms_type = FT_M_FIOV; bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); fiov_refresh(&ftick->tk_aw_fiov); ftick->tk_aw_errno = 0; - ftick->tk_aw_bufdata = NULL; - ftick->tk_aw_bufsize = 0; - ftick->tk_aw_type = FT_A_FIOV; - ftick->tk_flag = 0; } @@ -418,17 +409,9 @@ fticket_reset(struct fuse_ticket *ftick) FUSE_ASSERT_MS_DONE(ftick); FUSE_ASSERT_AW_DONE(ftick); - ftick->tk_ms_bufdata = NULL; - ftick->tk_ms_bufsize = 0; - ftick->tk_ms_type = FT_M_FIOV; - bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); ftick->tk_aw_errno = 0; - ftick->tk_aw_bufdata = NULL; - ftick->tk_aw_bufsize = 0; - ftick->tk_aw_type = FT_A_FIOV; - ftick->tk_flag = 0; } @@ -547,20 +530,8 @@ fticket_aw_pull_uio(struct fuse_ticket *ftick, struct uio *uio) size_t len = uio_resid(uio); if (len) { - switch (ftick->tk_aw_type) { - case FT_A_FIOV: - fiov_adjust(fticket_resp(ftick), len); - err = uiomove(fticket_resp(ftick)->base, len, uio); - break; - - case FT_A_BUF: - ftick->tk_aw_bufsize = len; - err = uiomove(ftick->tk_aw_bufdata, len, uio); - break; - - default: - panic("FUSE: unknown answer type for ticket %p", ftick); - } + fiov_adjust(fticket_resp(ftick), len); + err = uiomove(fticket_resp(ftick)->base, len, uio); } return err; } diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h index ea2eef2ea978..980fb2541ca1 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -123,17 +123,10 @@ struct fuse_ticket { /* fields for initiating an upgoing message */ struct fuse_iov tk_ms_fiov; - void *tk_ms_bufdata; - size_t tk_ms_bufsize; - enum { FT_M_FIOV, FT_M_BUF } tk_ms_type; STAILQ_ENTRY(fuse_ticket) tk_ms_link; /* fields for handling answers coming from userspace */ struct fuse_iov tk_aw_fiov; - void *tk_aw_bufdata; - size_t tk_aw_bufsize; - enum { FT_A_FIOV, FT_A_BUF } tk_aw_type; - struct fuse_out_header tk_aw_ohead; int tk_aw_errno; struct mtx tk_aw_mtx; From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:33:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48EED6659EA; Tue, 27 Jul 2021 17:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ3my1NXPz4qVD; Tue, 27 Jul 2021 17:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16F1865F3; Tue, 27 Jul 2021 17:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RHXruP037488; Tue, 27 Jul 2021 17:33:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHXr9Z037487; Tue, 27 Jul 2021 17:33:53 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:33:53 GMT Message-Id: <202107271733.16RHXr9Z037487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 46138f337bd8 - stable/12 - fusefs: ensure that FUSE ops' headers' unique values are actually unique MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 46138f337bd803f6546d0eae8b9b0f3879ca3224 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:33:54 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=46138f337bd803f6546d0eae8b9b0f3879ca3224 commit 46138f337bd803f6546d0eae8b9b0f3879ca3224 Author: Alan Somers AuthorDate: 2021-06-18 00:04:59 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:15:40 +0000 fusefs: ensure that FUSE ops' headers' unique values are actually unique Every FUSE operation has a unique value in its header. As the name implies, these values are supposed to be unique among all outstanding operations. And since FUSE_INTERRUPT is asynchronous and racy, it is desirable that the unique values be unique among all operations that are "close in time". Ensure that they are actually unique by incrementing them whenever we reuse a fuse_dispatcher object, for example during fsync, write, and listextattr. PR: 244686 Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30810 (cherry picked from commit 5403f2c163f7e3d1adb9431d216f88d57cf9d74b) --- sys/fs/fuse/fuse_ipc.c | 34 ++++++++++++++-------------------- tests/sys/fs/fusefs/mockfs.cc | 9 +++++++++ tests/sys/fs/fusefs/mockfs.hh | 3 +++ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index 73378dee959a..d871b7455450 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -103,6 +103,7 @@ static void fdisp_make_pid(struct fuse_dispatcher *fdip, enum fuse_opcode op, static void fuse_interrupt_send(struct fuse_ticket *otick, int err); static struct fuse_ticket *fticket_alloc(struct fuse_data *data); static void fticket_refresh(struct fuse_ticket *ftick); +static inline void fticket_reset(struct fuse_ticket *ftick); static void fticket_destroy(struct fuse_ticket *ftick); static int fticket_wait_answer(struct fuse_ticket *ftick); static inline int @@ -319,20 +320,12 @@ fticket_ctor(void *mem, int size, void *arg, int flags) FUSE_ASSERT_AW_DONE(ftick); ftick->tk_data = data; - - if (ftick->tk_unique != 0) - fticket_refresh(ftick); - - /* May be truncated to 32 bits */ - ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); - if (ftick->tk_unique == 0) - ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); - ftick->irq_unique = 0; - refcount_init(&ftick->tk_refcount, 1); counter_u64_add(fuse_ticket_count, 1); + fticket_refresh(ftick); + return 0; } @@ -386,26 +379,22 @@ fticket_destroy(struct fuse_ticket *ftick) return uma_zfree(ticket_zone, ftick); } -static inline -void +/* Prepare the ticket to be reused and clear its data buffers */ +static inline void fticket_refresh(struct fuse_ticket *ftick) { - FUSE_ASSERT_MS_DONE(ftick); - FUSE_ASSERT_AW_DONE(ftick); + fticket_reset(ftick); fiov_refresh(&ftick->tk_ms_fiov); - - bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); - fiov_refresh(&ftick->tk_aw_fiov); - ftick->tk_aw_errno = 0; - ftick->tk_flag = 0; } -/* Prepar the ticket to be reused, but don't clear its data buffers */ +/* Prepare the ticket to be reused, but don't clear its data buffers */ static inline void fticket_reset(struct fuse_ticket *ftick) { + struct fuse_data *data = ftick->tk_data; + FUSE_ASSERT_MS_DONE(ftick); FUSE_ASSERT_AW_DONE(ftick); @@ -413,6 +402,11 @@ fticket_reset(struct fuse_ticket *ftick) ftick->tk_aw_errno = 0; ftick->tk_flag = 0; + + /* May be truncated to 32 bits on LP32 arches */ + ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); + if (ftick->tk_unique == 0) + ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); } static int diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index da634b5f15cd..4effecc1cd82 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -370,6 +370,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, m_pm = pm; m_time_gran = time_gran; m_quit = false; + m_last_unique = 0; if (m_pm == KQ) m_kq = kqueue(); else @@ -646,6 +647,14 @@ void MockFS::audit_request(const mockfs_buf_in &in, ssize_t buflen) { default: FAIL() << "Unknown opcode " << in.header.opcode; } + /* + * Check that the ticket's unique value is sequential. Technically it + * doesn't need to be sequential, merely unique. But the current + * fusefs driver _does_ make it sequential, and that's easy to check + * for. + */ + if (in.header.unique != ++m_last_unique) + FAIL() << "Non-sequential unique value"; } void MockFS::init(uint32_t flags) { diff --git a/tests/sys/fs/fusefs/mockfs.hh b/tests/sys/fs/fusefs/mockfs.hh index 4cf6daea7e76..be8a05c344fa 100644 --- a/tests/sys/fs/fusefs/mockfs.hh +++ b/tests/sys/fs/fusefs/mockfs.hh @@ -277,6 +277,9 @@ class MockFS { /* pid of the test process */ pid_t m_pid; + /* The unique value of the header of the last received operation */ + uint64_t m_last_unique; + /* Method the daemon should use for I/O to and from /dev/fuse */ enum poll_method m_pm; From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:40:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF335665674; Tue, 27 Jul 2021 17:40:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ3wV4d2xz4qXp; Tue, 27 Jul 2021 17:40:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82ECC6D51; Tue, 27 Jul 2021 17:40:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RHeQw0046223; Tue, 27 Jul 2021 17:40:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHeQ7Z046222; Tue, 27 Jul 2021 17:40:26 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:40:26 GMT Message-Id: <202107271740.16RHeQ7Z046222@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 7d9771228715 - stable/12 - fusefs: correctly set lock owner during FUSE_SETLK MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7d9771228715bf2a32c7db323accecfb7f2f861c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:40:26 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=7d9771228715bf2a32c7db323accecfb7f2f861c commit 7d9771228715bf2a32c7db323accecfb7f2f861c Author: Alan Somers AuthorDate: 2021-05-20 01:10:15 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:34:08 +0000 fusefs: correctly set lock owner during FUSE_SETLK During FUSE_SETLK, the owner field should uniquely identify the calling process. The fusefs module now sets it to the process's pid. Previously, it expected the calling process to set it directly, which was wrong. libfuse also apparently expects the owner field to be set during FUSE_GETLK, though I'm not sure why. PR: 256005 Reported by: Agata Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30622 (cherry picked from commit 18b19f8c6e04935a63a951afe0e540674bc94455) --- sys/fs/fuse/fuse_vnops.c | 4 ++-- tests/sys/fs/fusefs/locks.cc | 50 ++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 1c1ac7680f0e..9e79a376cccd 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -427,14 +427,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) fdisp_make_vp(&fdi, op, vp, td, cred); fli = fdi.indata; fli->fh = fufh->fh_id; - fli->owner = fl->l_pid; + fli->owner = td->td_proc->p_pid; fli->lk.start = fl->l_start; if (fl->l_len != 0) fli->lk.end = fl->l_start + fl->l_len - 1; else fli->lk.end = INT64_MAX; fli->lk.type = fl->l_type; - fli->lk.pid = fl->l_pid; + fli->lk.pid = td->td_proc->p_pid; err = fdisp_wait_answ(&fdi); fdisp_destroy(&fdi); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index 49f495412259..cace779e981a 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -228,7 +228,7 @@ TEST_F(GetlkFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -247,7 +247,7 @@ TEST_F(Getlk, no_locks) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -256,11 +256,16 @@ TEST_F(Getlk, no_locks) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in, auto& out) { @@ -273,7 +278,7 @@ TEST_F(Getlk, no_locks) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -290,7 +295,7 @@ TEST_F(Getlk, lock_exists) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); pid_t pid2 = 1235; expect_lookup(RELPATH, ino); @@ -300,11 +305,16 @@ TEST_F(Getlk, lock_exists) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { @@ -319,7 +329,7 @@ TEST_F(Getlk, lock_exists) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -368,7 +378,7 @@ TEST_F(Setlk, clear) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -378,7 +388,7 @@ TEST_F(Setlk, clear) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -394,7 +404,7 @@ TEST_F(Setlk, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -404,7 +414,7 @@ TEST_F(Setlk, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -420,7 +430,7 @@ TEST_F(Setlk, set_eof) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -430,7 +440,7 @@ TEST_F(Setlk, set_eof) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 0; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -446,7 +456,7 @@ TEST_F(Setlk, eagain) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -456,7 +466,7 @@ TEST_F(Setlk, eagain) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -484,7 +494,7 @@ TEST_F(SetlkwFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -504,7 +514,7 @@ TEST_F(Setlkw, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -514,7 +524,7 @@ TEST_F(Setlkw, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:41:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA693665E4E; Tue, 27 Jul 2021 17:41:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ3xv6MX3z4qrD; Tue, 27 Jul 2021 17:41:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C227A6C3F; Tue, 27 Jul 2021 17:41:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RHfdmm050401; Tue, 27 Jul 2021 17:41:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHfdm1050400; Tue, 27 Jul 2021 17:41:39 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:41:39 GMT Message-Id: <202107271741.16RHfdm1050400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 9dbef3827d55 - stable/12 - [skip ci] correct a few SPDX license tags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9dbef3827d55011175e40482333eebd13da4e445 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:41:40 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9dbef3827d55011175e40482333eebd13da4e445 commit 9dbef3827d55011175e40482333eebd13da4e445 Author: Alan Somers AuthorDate: 2021-07-07 19:52:20 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:41:29 +0000 [skip ci] correct a few SPDX license tags These were all incorrectly labeled as 2-clause BSD licenses by a semi-automated process, when in fact they are 3-clause. Discussed with: pfg, imp Sponsored by: Axcient (cherry picked from commit 3874c0abb0afaea6adc24ac96dc9dc5043f2b69e) --- lib/libgeom/geom_getxml.c | 2 +- lib/libgeom/geom_stats.c | 2 +- lib/libgeom/geom_xml2tree.c | 2 +- lib/libgeom/libgeom.h | 2 +- sbin/fsck_ffs/ea.c | 2 +- usr.sbin/gstat/gstat.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libgeom/geom_getxml.c b/lib/libgeom/geom_getxml.c index f3d7ba9deb03..48565f707b03 100644 --- a/lib/libgeom/geom_getxml.c +++ b/lib/libgeom/geom_getxml.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index 7c9191e29686..e8e2969e835f 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c index 5f4636f9368b..824800070933 100644 --- a/lib/libgeom/geom_xml2tree.c +++ b/lib/libgeom/geom_xml2tree.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/libgeom.h b/lib/libgeom/libgeom.h index 075d2d21f26c..fc593b234302 100644 --- a/lib/libgeom/libgeom.h +++ b/lib/libgeom/libgeom.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/sbin/fsck_ffs/ea.c b/sbin/fsck_ffs/ea.c index 29e5f46d7651..cf048c51bcb9 100644 --- a/sbin/fsck_ffs/ea.c +++ b/sbin/fsck_ffs/ea.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2002 Poul-Henning Kamp * Copyright (c) 2002 Networks Associates Technology, Inc. diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index 1c75fd5bf2d8..7eb193e26442 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:57:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CD8A666094; Tue, 27 Jul 2021 17:57:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ4Hj3JnTz4rnr; Tue, 27 Jul 2021 17:57:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 591B171B7; Tue, 27 Jul 2021 17:57:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RHv5VM063976; Tue, 27 Jul 2021 17:57:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHv5ET063975; Tue, 27 Jul 2021 17:57:05 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:57:05 GMT Message-Id: <202107271757.16RHv5ET063975@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: c7fe00ae403f - stable/13 - fusefs: correctly set lock owner during FUSE_SETLK MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c7fe00ae403f08b17e8376cc98195171234bf3d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:57:05 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=c7fe00ae403f08b17e8376cc98195171234bf3d9 commit c7fe00ae403f08b17e8376cc98195171234bf3d9 Author: Alan Somers AuthorDate: 2021-05-20 01:10:15 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:44:28 +0000 fusefs: correctly set lock owner during FUSE_SETLK During FUSE_SETLK, the owner field should uniquely identify the calling process. The fusefs module now sets it to the process's pid. Previously, it expected the calling process to set it directly, which was wrong. libfuse also apparently expects the owner field to be set during FUSE_GETLK, though I'm not sure why. PR: 256005 Reported by: Agata Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30622 (cherry picked from commit 18b19f8c6e04935a63a951afe0e540674bc94455) --- sys/fs/fuse/fuse_vnops.c | 4 ++-- tests/sys/fs/fusefs/locks.cc | 50 ++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index c79d8d5b5223..adb297b6aacb 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -466,14 +466,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) fdisp_make_vp(&fdi, op, vp, td, cred); fli = fdi.indata; fli->fh = fufh->fh_id; - fli->owner = fl->l_pid; + fli->owner = td->td_proc->p_pid; fli->lk.start = fl->l_start; if (fl->l_len != 0) fli->lk.end = fl->l_start + fl->l_len - 1; else fli->lk.end = INT64_MAX; fli->lk.type = fl->l_type; - fli->lk.pid = fl->l_pid; + fli->lk.pid = td->td_proc->p_pid; err = fdisp_wait_answ(&fdi); fdisp_destroy(&fdi); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index 49f495412259..cace779e981a 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -228,7 +228,7 @@ TEST_F(GetlkFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -247,7 +247,7 @@ TEST_F(Getlk, no_locks) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -256,11 +256,16 @@ TEST_F(Getlk, no_locks) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in, auto& out) { @@ -273,7 +278,7 @@ TEST_F(Getlk, no_locks) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -290,7 +295,7 @@ TEST_F(Getlk, lock_exists) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); pid_t pid2 = 1235; expect_lookup(RELPATH, ino); @@ -300,11 +305,16 @@ TEST_F(Getlk, lock_exists) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { @@ -319,7 +329,7 @@ TEST_F(Getlk, lock_exists) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -368,7 +378,7 @@ TEST_F(Setlk, clear) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -378,7 +388,7 @@ TEST_F(Setlk, clear) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -394,7 +404,7 @@ TEST_F(Setlk, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -404,7 +414,7 @@ TEST_F(Setlk, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -420,7 +430,7 @@ TEST_F(Setlk, set_eof) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -430,7 +440,7 @@ TEST_F(Setlk, set_eof) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 0; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -446,7 +456,7 @@ TEST_F(Setlk, eagain) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -456,7 +466,7 @@ TEST_F(Setlk, eagain) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -484,7 +494,7 @@ TEST_F(SetlkwFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -504,7 +514,7 @@ TEST_F(Setlkw, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -514,7 +524,7 @@ TEST_F(Setlkw, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 17:57:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 036376660AC; Tue, 27 Jul 2021 17:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ4JB6jCfz4rVC; Tue, 27 Jul 2021 17:57:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3F41713B; Tue, 27 Jul 2021 17:57:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RHvUU6064122; Tue, 27 Jul 2021 17:57:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RHvU9Y064121; Tue, 27 Jul 2021 17:57:30 GMT (envelope-from git) Date: Tue, 27 Jul 2021 17:57:30 GMT Message-Id: <202107271757.16RHvU9Y064121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 1b58943ef867 - stable/13 - [skip ci] correct a few SPDX license tags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b58943ef8679ce862a10ebc9f6fcb1d5d394db9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 17:57:31 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=1b58943ef8679ce862a10ebc9f6fcb1d5d394db9 commit 1b58943ef8679ce862a10ebc9f6fcb1d5d394db9 Author: Alan Somers AuthorDate: 2021-07-07 19:52:20 +0000 Commit: Alan Somers CommitDate: 2021-07-27 17:57:17 +0000 [skip ci] correct a few SPDX license tags These were all incorrectly labeled as 2-clause BSD licenses by a semi-automated process, when in fact they are 3-clause. Discussed with: pfg, imp Sponsored by: Axcient (cherry picked from commit 3874c0abb0afaea6adc24ac96dc9dc5043f2b69e) --- lib/libgeom/geom_getxml.c | 2 +- lib/libgeom/geom_stats.c | 2 +- lib/libgeom/geom_xml2tree.c | 2 +- lib/libgeom/libgeom.h | 2 +- sbin/fsck_ffs/ea.c | 2 +- usr.sbin/gstat/gstat.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libgeom/geom_getxml.c b/lib/libgeom/geom_getxml.c index f3d7ba9deb03..48565f707b03 100644 --- a/lib/libgeom/geom_getxml.c +++ b/lib/libgeom/geom_getxml.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index 7c9191e29686..e8e2969e835f 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c index 5f4636f9368b..824800070933 100644 --- a/lib/libgeom/geom_xml2tree.c +++ b/lib/libgeom/geom_xml2tree.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/libgeom.h b/lib/libgeom/libgeom.h index 075d2d21f26c..fc593b234302 100644 --- a/lib/libgeom/libgeom.h +++ b/lib/libgeom/libgeom.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/sbin/fsck_ffs/ea.c b/sbin/fsck_ffs/ea.c index 7cf20196dfae..54353005bdc0 100644 --- a/sbin/fsck_ffs/ea.c +++ b/sbin/fsck_ffs/ea.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2002 Poul-Henning Kamp * Copyright (c) 2002 Networks Associates Technology, Inc. diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index c2d28720205f..65388c3002ff 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:20:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E08166778D; Tue, 27 Jul 2021 19:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ68B3TT4z4wrr; Tue, 27 Jul 2021 19:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FA0810519; Tue, 27 Jul 2021 19:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJKghe080730; Tue, 27 Jul 2021 19:20:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJKg8J080729; Tue, 27 Jul 2021 19:20:42 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:20:42 GMT Message-Id: <202107271920.16RJKg8J080729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 192a4072d7b3 - stable/13 - freebsd-update: Update URL of supported platforms information MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 192a4072d7b3c28f5de40bafbb4d8f011a9820a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:20:42 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=192a4072d7b3c28f5de40bafbb4d8f011a9820a8 commit 192a4072d7b3c28f5de40bafbb4d8f011a9820a8 Author: Li-Wen Hsu AuthorDate: 2021-07-04 13:45:08 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:19:55 +0000 freebsd-update: Update URL of supported platforms information MFC after: 3 days (cherry picked from commit 86d0d3aadb48a9a917167078ed197a061179fa4f) --- usr.sbin/freebsd-update/freebsd-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 7f9b06f0221f..f82ec7d7730c 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1041,7 +1041,7 @@ fetch_pick_server () { This may be because upgrading from this platform (${ARCH}) or release (${RELNUM}) is unsupported by `basename $0`. Only platforms with Tier 1 support can be upgraded by `basename $0`. - See https://www.freebsd.org/platforms/index.html for more info. + See https://www.freebsd.org/platforms/ for more info. If unsupported, FreeBSD must be upgraded by source. EOF From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:20:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2D6B66771D; Tue, 27 Jul 2021 19:20:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ68J5cK5z4wsB; Tue, 27 Jul 2021 19:20:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8A69106D7; Tue, 27 Jul 2021 19:20:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJKmD2080850; Tue, 27 Jul 2021 19:20:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJKmxY080849; Tue, 27 Jul 2021 19:20:48 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:20:48 GMT Message-Id: <202107271920.16RJKmxY080849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 5f94034cbfa5 - stable/12 - freebsd-update: Update URL of supported platforms information MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5f94034cbfa5b9c9f80d19404b4534687c7baca1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:20:48 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=5f94034cbfa5b9c9f80d19404b4534687c7baca1 commit 5f94034cbfa5b9c9f80d19404b4534687c7baca1 Author: Li-Wen Hsu AuthorDate: 2021-07-04 13:45:08 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:20:14 +0000 freebsd-update: Update URL of supported platforms information MFC after: 3 days (cherry picked from commit 86d0d3aadb48a9a917167078ed197a061179fa4f) --- usr.sbin/freebsd-update/freebsd-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 7f9b06f0221f..f82ec7d7730c 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1041,7 +1041,7 @@ fetch_pick_server () { This may be because upgrading from this platform (${ARCH}) or release (${RELNUM}) is unsupported by `basename $0`. Only platforms with Tier 1 support can be upgraded by `basename $0`. - See https://www.freebsd.org/platforms/index.html for more info. + See https://www.freebsd.org/platforms/ for more info. If unsupported, FreeBSD must be upgraded by source. EOF From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:21:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E1AE667828; Tue, 27 Jul 2021 19:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ69c0rYZz4x9b; Tue, 27 Jul 2021 19:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05D2E10806; Tue, 27 Jul 2021 19:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJLtrw081903; Tue, 27 Jul 2021 19:21:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJLtsr081902; Tue, 27 Jul 2021 19:21:55 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:21:55 GMT Message-Id: <202107271921.16RJLtsr081902@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 5201006cf97c - stable/13 - share/misc: Update FreeBSD.org URLs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5201006cf97c8b91c56f1e6b7dcbb7abd0682943 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:21:56 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=5201006cf97c8b91c56f1e6b7dcbb7abd0682943 commit 5201006cf97c8b91c56f1e6b7dcbb7abd0682943 Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:04:33 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:21:19 +0000 share/misc: Update FreeBSD.org URLs MFC after: 3 days (cherry picked from commit 89c0640c7090d5dfbe46adbe50186399923f360f) --- share/misc/iso3166 | 2 +- share/misc/organization.dot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/misc/iso3166 b/share/misc/iso3166 index 1e4cf98df12d..2410a9507ab7 100644 --- a/share/misc/iso3166 +++ b/share/misc/iso3166 @@ -1,6 +1,6 @@ # $FreeBSD$ # -# Please consult with https://www.FreeBSD.org/internal/i18n.html before +# Please consult with https://www.FreeBSD.org/internal/i18n/ before # making changes to this file. # # ISO 3166 country codes diff --git a/share/misc/organization.dot b/share/misc/organization.dot index 33a00452c607..b730b86be5b4 100644 --- a/share/misc/organization.dot +++ b/share/misc/organization.dot @@ -5,7 +5,7 @@ # each other. # For a detailed description of the responsibilities and duties of the listed # teams, please see our Administration page at -# https://www.freebsd.org/administration.html . +# https://www.freebsd.org/administration/ . # # The graphical output can be generated from this file with the following # command: From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:22:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 650496678C9; Tue, 27 Jul 2021 19:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ69k2DTkz4xPb; Tue, 27 Jul 2021 19:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33CDC1079A; Tue, 27 Jul 2021 19:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJM20s082034; Tue, 27 Jul 2021 19:22:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJM2j5082033; Tue, 27 Jul 2021 19:22:02 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:22:02 GMT Message-Id: <202107271922.16RJM2j5082033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 828572a66d9b - stable/12 - share/misc: Update FreeBSD.org URLs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 828572a66d9b4281145ff2f19a4d822fac7d2ca3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:22:02 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=828572a66d9b4281145ff2f19a4d822fac7d2ca3 commit 828572a66d9b4281145ff2f19a4d822fac7d2ca3 Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:04:33 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:21:22 +0000 share/misc: Update FreeBSD.org URLs MFC after: 3 days (cherry picked from commit 89c0640c7090d5dfbe46adbe50186399923f360f) --- share/misc/iso3166 | 2 +- share/misc/organization.dot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/misc/iso3166 b/share/misc/iso3166 index 1e4cf98df12d..2410a9507ab7 100644 --- a/share/misc/iso3166 +++ b/share/misc/iso3166 @@ -1,6 +1,6 @@ # $FreeBSD$ # -# Please consult with https://www.FreeBSD.org/internal/i18n.html before +# Please consult with https://www.FreeBSD.org/internal/i18n/ before # making changes to this file. # # ISO 3166 country codes diff --git a/share/misc/organization.dot b/share/misc/organization.dot index 8eff9b6a01cc..c1cc5e3aa007 100644 --- a/share/misc/organization.dot +++ b/share/misc/organization.dot @@ -5,7 +5,7 @@ # each other. # For a detailed description of the responsibilities and duties of the listed # teams, please see our Administration page at -# https://www.freebsd.org/administration.html . +# https://www.freebsd.org/administration/ . # # The graphical output can be generated from this file with the following # command: From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:23:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEBE46678D7; Tue, 27 Jul 2021 19:23:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ6CB5yCSz4xGn; Tue, 27 Jul 2021 19:23:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B47E5107A3; Tue, 27 Jul 2021 19:23:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJNI9u085333; Tue, 27 Jul 2021 19:23:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJNI8I085332; Tue, 27 Jul 2021 19:23:18 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:23:18 GMT Message-Id: <202107271923.16RJNI8I085332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: f61cd3dbe4ad - stable/13 - man7: Update FreeBSD.org URLs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f61cd3dbe4ada4952ecb18194b4eef8de7bdb326 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:23:18 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=f61cd3dbe4ada4952ecb18194b4eef8de7bdb326 commit f61cd3dbe4ada4952ecb18194b4eef8de7bdb326 Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:07:23 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:22:25 +0000 man7: Update FreeBSD.org URLs MFC after: 3 days (cherry picked from commit 8dfb00245701a4f9290cd3a24e9bdcafa55a075b) --- share/man/man7/ports.7 | 4 ++-- share/man/man7/tests.7 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index d90a91630e77..1c3cce31d2f0 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -115,7 +115,7 @@ in .No \&: .Sm on .Pp -.Lk https://www.FreeBSD.org/doc/en/books/handbook/ports.html +.Lk https://docs.FreeBSD.org/en/books/handbook/ports/ .Pp For information about creating new ports, see .Sm off @@ -123,7 +123,7 @@ For information about creating new ports, see .No \&: .Sm on .Pp -.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/ +.Lk https://docs.FreeBSD.org/en/books/porters-handbook/ .Sh TARGETS Some of the .Xr make 1 diff --git a/share/man/man7/tests.7 b/share/man/man7/tests.7 index cb75b7f389f5..ab1a3fd1262f 100644 --- a/share/man/man7/tests.7 +++ b/share/man/man7/tests.7 @@ -194,7 +194,7 @@ For more details please refer to: .It .Lk https://lists.freebsd.org/ "FreeBSD Mailing Lists" .It -.Lk https://www.freebsd.org/support.html "Problem Reporting" +.Lk https://www.freebsd.org/support/ "Problem Reporting" .El .Sh FILES .Bl -tag -compact -width "/etc/kyua/kyua.conf" From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:23:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC1646678DB; Tue, 27 Jul 2021 19:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ6CJ39pbz4xXk; Tue, 27 Jul 2021 19:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56E2610530; Tue, 27 Jul 2021 19:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJNOCg085451; Tue, 27 Jul 2021 19:23:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJNO3W085450; Tue, 27 Jul 2021 19:23:24 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:23:24 GMT Message-Id: <202107271923.16RJNO3W085450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 4e6b2537d1f7 - stable/12 - man7: Update FreeBSD.org URLs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4e6b2537d1f717abea51adb3c03b74d97de7dfda Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:23:24 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=4e6b2537d1f717abea51adb3c03b74d97de7dfda commit 4e6b2537d1f717abea51adb3c03b74d97de7dfda Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:07:23 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:22:28 +0000 man7: Update FreeBSD.org URLs MFC after: 3 days (cherry picked from commit 8dfb00245701a4f9290cd3a24e9bdcafa55a075b) --- share/man/man7/ports.7 | 4 ++-- share/man/man7/tests.7 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index a7b46e2bdd11..33d04e318c9c 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -70,7 +70,7 @@ in .No \&: .Sm on .Pp -.Lk https://www.FreeBSD.org/doc/en/books/handbook/ports.html +.Lk https://docs.FreeBSD.org/en/books/handbook/ports/ .Pp For information about creating new ports, see .Sm off @@ -78,7 +78,7 @@ For information about creating new ports, see .No \&: .Sm on .Pp -.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/ +.Lk https://docs.FreeBSD.org/en/books/porters-handbook/ .Sh TARGETS Some of the .Xr make 1 diff --git a/share/man/man7/tests.7 b/share/man/man7/tests.7 index cdb242d1a0af..9b1b26c9e0fa 100644 --- a/share/man/man7/tests.7 +++ b/share/man/man7/tests.7 @@ -200,7 +200,7 @@ For more details please refer to: .It .Lk https://lists.freebsd.org/ "FreeBSD Mailing Lists" .It -.Lk https://www.freebsd.org/support.html "Problem Reporting" +.Lk https://www.freebsd.org/support/ "Problem Reporting" .El .Sh FILES .Bl -tag -compact -width usrXlocalXetcXkyuaXkyuaXconfXX From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:26:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7D66667AC5; Tue, 27 Jul 2021 19:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ6Gg6D5Pz4xtN; Tue, 27 Jul 2021 19:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC9A610531; Tue, 27 Jul 2021 19:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJQJvv085758; Tue, 27 Jul 2021 19:26:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJQJAG085757; Tue, 27 Jul 2021 19:26:19 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:26:19 GMT Message-Id: <202107271926.16RJQJAG085757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: f4e3cb4b6bed - stable/13 - freebsd-tips: Use a fetchable URL as example MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f4e3cb4b6bedf7325a6c44ff95c5f7a7ef76272d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:26:20 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=f4e3cb4b6bedf7325a6c44ff95c5f7a7ef76272d commit f4e3cb4b6bedf7325a6c44ff95c5f7a7ef76272d Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:00:46 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:24:51 +0000 freebsd-tips: Use a fetchable URL as example MFC after: 3 days (cherry picked from commit ffe6afc4f0121f1909f2fa88694228f771dd3fcb) freebsd-tips: Fix the description of fetch(1) to match the command Reported by: jrtc27 MFC with: ffe6afc4f0121f1909f2fa88694228f771dd3fcb (cherry picked from commit 167897510919a76740eca0d79713abbd088660fe) --- usr.bin/fortune/datfiles/freebsd-tips | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 46f5ec31f8d6..aaee0ba6c400 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -443,9 +443,9 @@ You can use "pkg info" to see a list of packages you have installed. % You can use the 'fetch' command to retrieve files over ftp, http or https. - fetch https://www.FreeBSD.org/index.html + fetch https://www.FreeBSD.org/images/beastie.png -will download the front page of the FreeBSD web site. +will download the beastie image from the FreeBSD web site. % You can use "whereis" to search standard binary, manual page and source directories for the specified programs. This can be particularly handy From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:26:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A7DB667A59; Tue, 27 Jul 2021 19:26:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ6Gp20Qqz4y1t; Tue, 27 Jul 2021 19:26:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A7681098B; Tue, 27 Jul 2021 19:26:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJQPCr085876; Tue, 27 Jul 2021 19:26:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJQP41085875; Tue, 27 Jul 2021 19:26:25 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:26:25 GMT Message-Id: <202107271926.16RJQP41085875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 76b5de00137a - stable/12 - freebsd-tips: Use a fetchable URL as example MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 76b5de00137a7ba8a872ce18e9ccacdb11acac8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:26:26 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=76b5de00137a7ba8a872ce18e9ccacdb11acac8c commit 76b5de00137a7ba8a872ce18e9ccacdb11acac8c Author: Li-Wen Hsu AuthorDate: 2021-07-04 14:00:46 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-27 19:24:52 +0000 freebsd-tips: Use a fetchable URL as example MFC after: 3 days (cherry picked from commit ffe6afc4f0121f1909f2fa88694228f771dd3fcb) freebsd-tips: Fix the description of fetch(1) to match the command Reported by: jrtc27 MFC with: ffe6afc4f0121f1909f2fa88694228f771dd3fcb (cherry picked from commit 167897510919a76740eca0d79713abbd088660fe) --- usr.bin/fortune/datfiles/freebsd-tips | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 93075532cee4..761b6b172cd7 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -443,9 +443,9 @@ You can use "pkg info" to see a list of packages you have installed. % You can use the 'fetch' command to retrieve files over ftp, http or https. - fetch https://www.FreeBSD.org/index.html + fetch https://www.FreeBSD.org/images/beastie.png -will download the front page of the FreeBSD web site. +will download the beastie image from the FreeBSD web site. % You can use "whereis" to search standard binary, manual page and source directories for the specified programs. This can be particularly handy From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 19:59:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 254AC66848D; Tue, 27 Jul 2021 19:59:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ70Y0Fhgz50QV; Tue, 27 Jul 2021 19:59:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E56D410E93; Tue, 27 Jul 2021 19:59:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RJx8Zd025945; Tue, 27 Jul 2021 19:59:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RJx8Wb025944; Tue, 27 Jul 2021 19:59:08 GMT (envelope-from git) Date: Tue, 27 Jul 2021 19:59:08 GMT Message-Id: <202107271959.16RJx8Wb025944@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 933cb282b69d - stable/13 - Fix the 'linux' rc script on aarch64. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 933cb282b69d8ea606dab4980126805737e8d5fb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 19:59:09 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=933cb282b69d8ea606dab4980126805737e8d5fb commit 933cb282b69d8ea606dab4980126805737e8d5fb Author: Edward Tomasz Napierala AuthorDate: 2021-03-16 16:48:13 +0000 Commit: Ed Maste CommitDate: 2021-07-27 19:57:55 +0000 Fix the 'linux' rc script on aarch64. Previously it would try to load linux.ko instead of linux64.ko and fail. While here, don't try to match 'linuxaout'; even if implemented, it's the same module as `linuxelf`. Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29288 (cherry picked from commit e026f4243c5a65d19a63d98f55be17e8294a1e87) --- libexec/rc/rc.d/linux | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index f44a9d02fc8d..c9c45ba8b338 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -19,11 +19,17 @@ linux_start() { local _emul_path _tmpdir - load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in + aarch64) + load_kld -e 'linux64elf' linux64 + ;; amd64) + load_kld -e 'linuxelf' linux load_kld -e 'linux64elf' linux64 ;; + i386) + load_kld -e 'linuxelf' linux + ;; esac _emul_path="$(sysctl -n compat.linux.emul_path)" From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 20:06:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06175668235; Tue, 27 Jul 2021 20:06:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ78m6kkxz512v; Tue, 27 Jul 2021 20:06:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB3AD10EAE; Tue, 27 Jul 2021 20:06:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RK6G49039631; Tue, 27 Jul 2021 20:06:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RK6GTg039630; Tue, 27 Jul 2021 20:06:16 GMT (envelope-from git) Date: Tue, 27 Jul 2021 20:06:16 GMT Message-Id: <202107272006.16RK6GTg039630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: c3c458ce3c91 - stable/13 - bsdinstall: Only show menu if there are more items to be installed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c3c458ce3c9135bcb0aaa086d29a9b5e5492f25a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 20:06:17 -0000 The branch stable/13 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=c3c458ce3c9135bcb0aaa086d29a9b5e5492f25a commit c3c458ce3c9135bcb0aaa086d29a9b5e5492f25a Author: Renato Botelho AuthorDate: 2021-07-22 20:02:34 +0000 Commit: Glen Barber CommitDate: 2021-07-27 20:05:41 +0000 bsdinstall: Only show menu if there are more items to be installed Obtained from: Rubicon Communications, LLC ("Netgate") Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 95f0da5be1e3456c930f5f9538cbc099c65f2014) --- usr.sbin/bsdinstall/scripts/auto | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 68809a22671b..9f8946880f61 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -157,16 +157,18 @@ if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')" - exec 3>&1 - EXTRA_DISTS=$( eval dialog \ - --backtitle \"FreeBSD Installer\" \ - --title \"Distribution Select\" --nocancel --separate-output \ - --checklist \"Choose optional system components to install:\" \ - 0 0 0 $DISTMENU \ - 2>&1 1>&3 ) - for dist in $EXTRA_DISTS; do - export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" - done + if [ -n "$DISTMENU" ]; then + exec 3>&1 + EXTRA_DISTS=$( eval dialog \ + --backtitle \"FreeBSD Installer\" \ + --title \"Distribution Select\" --nocancel --separate-output \ + --checklist \"Choose optional system components to install:\" \ + 0 0 0 $DISTMENU \ + 2>&1 1>&3 ) + for dist in $EXTRA_DISTS; do + export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" + done + fi fi FETCH_DISTRIBUTIONS="" From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 20:06:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3C1D66841B; Tue, 27 Jul 2021 20:06:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ78x5hHxz50pn; Tue, 27 Jul 2021 20:06:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABA2711125; Tue, 27 Jul 2021 20:06:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RK6POJ039753; Tue, 27 Jul 2021 20:06:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RK6PlK039752; Tue, 27 Jul 2021 20:06:25 GMT (envelope-from git) Date: Tue, 27 Jul 2021 20:06:25 GMT Message-Id: <202107272006.16RK6PlK039752@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 3312bc6f109d - stable/12 - bsdinstall: Only show menu if there are more items to be installed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3312bc6f109d16d082db771c38832649a668c4de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 20:06:25 -0000 The branch stable/12 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=3312bc6f109d16d082db771c38832649a668c4de commit 3312bc6f109d16d082db771c38832649a668c4de Author: Renato Botelho AuthorDate: 2021-07-22 20:02:34 +0000 Commit: Glen Barber CommitDate: 2021-07-27 20:05:08 +0000 bsdinstall: Only show menu if there are more items to be installed Obtained from: Rubicon Communications, LLC ("Netgate") Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 95f0da5be1e3456c930f5f9538cbc099c65f2014) --- usr.sbin/bsdinstall/scripts/auto | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index f86ccb62c179..7e19f29c757f 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -118,16 +118,18 @@ if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')" - exec 3>&1 - EXTRA_DISTS=$( eval dialog \ - --backtitle \"FreeBSD Installer\" \ - --title \"Distribution Select\" --nocancel --separate-output \ - --checklist \"Choose optional system components to install:\" \ - 0 0 0 $DISTMENU \ - 2>&1 1>&3 ) - for dist in $EXTRA_DISTS; do - export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" - done + if [ -n "$DISTMENU" ]; then + exec 3>&1 + EXTRA_DISTS=$( eval dialog \ + --backtitle \"FreeBSD Installer\" \ + --title \"Distribution Select\" --nocancel --separate-output \ + --checklist \"Choose optional system components to install:\" \ + 0 0 0 $DISTMENU \ + 2>&1 1>&3 ) + for dist in $EXTRA_DISTS; do + export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" + done + fi fi LOCAL_DISTRIBUTIONS="MANIFEST" From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 20:13:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BC0D6686C9; Tue, 27 Jul 2021 20:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZ7Kf6dc6z51C8; Tue, 27 Jul 2021 20:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C16811141C; Tue, 27 Jul 2021 20:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16RKDw6P052882; Tue, 27 Jul 2021 20:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RKDwAS052881; Tue, 27 Jul 2021 20:13:58 GMT (envelope-from git) Date: Tue, 27 Jul 2021 20:13:58 GMT Message-Id: <202107272013.16RKDwAS052881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 27988b833300 - stable/11 - bsdinstall: Only show menu if there are more items to be installed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 27988b8333007d319eb9e9929bda787c5012e59e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 20:13:59 -0000 The branch stable/11 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=27988b8333007d319eb9e9929bda787c5012e59e commit 27988b8333007d319eb9e9929bda787c5012e59e Author: Renato Botelho AuthorDate: 2021-07-22 20:02:34 +0000 Commit: Glen Barber CommitDate: 2021-07-27 20:13:41 +0000 bsdinstall: Only show menu if there are more items to be installed Obtained from: Rubicon Communications, LLC ("Netgate") Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 95f0da5be1e3456c930f5f9538cbc099c65f2014) --- usr.sbin/bsdinstall/scripts/auto | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 3fd1dae7ed70..3226f9758b05 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -118,16 +118,18 @@ if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')" - exec 3>&1 - EXTRA_DISTS=$( eval dialog \ - --backtitle \"FreeBSD Installer\" \ - --title \"Distribution Select\" --nocancel --separate-output \ - --checklist \"Choose optional system components to install:\" \ - 0 0 0 $DISTMENU \ - 2>&1 1>&3 ) - for dist in $EXTRA_DISTS; do - export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" - done + if [ -n "$DISTMENU" ]; then + exec 3>&1 + EXTRA_DISTS=$( eval dialog \ + --backtitle \"FreeBSD Installer\" \ + --title \"Distribution Select\" --nocancel --separate-output \ + --checklist \"Choose optional system components to install:\" \ + 0 0 0 $DISTMENU \ + 2>&1 1>&3 ) + for dist in $EXTRA_DISTS; do + export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" + done + fi fi LOCAL_DISTRIBUTIONS="MANIFEST" From owner-dev-commits-src-branches@freebsd.org Wed Jul 28 12:40:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AF7F659FFD; Wed, 28 Jul 2021 12:40:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZYCx2qq6z4tDv; Wed, 28 Jul 2021 12:40:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 451DA1E312; Wed, 28 Jul 2021 12:40:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16SCeTpD069158; Wed, 28 Jul 2021 12:40:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SCeT7s069157; Wed, 28 Jul 2021 12:40:29 GMT (envelope-from git) Date: Wed, 28 Jul 2021 12:40:29 GMT Message-Id: <202107281240.16SCeT7s069157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e504e98ab5e6 - stable/13 - arm64: Print CPU features slightly earlier MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e504e98ab5e6a3155054a98660a244075609db0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 12:40:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e504e98ab5e6a3155054a98660a244075609db0b commit e504e98ab5e6a3155054a98660a244075609db0b Author: Mark Johnston AuthorDate: 2021-07-20 16:06:01 +0000 Commit: Mark Johnston CommitDate: 2021-07-28 12:40:25 +0000 arm64: Print CPU features slightly earlier In particular, print them before we release APs. Otherwise they tend to get mixed with other kernel messages. Reviewed by: andrew, manu Sponsored by: The FreeBSD Foundation (cherry picked from commit fa46a46a82498532f547be5f6b5a94d05f53b0be) --- sys/arm64/arm64/identcpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index c3544e9de9aa..5dc3a91031b6 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -1241,7 +1241,8 @@ cpu_features_sysinit(void *dummy __unused) CPU_FOREACH(cpu) print_cpu_features(cpu); } -SYSINIT(cpu_features, SI_SUB_SMP, SI_ORDER_ANY, cpu_features_sysinit, NULL); +/* Log features before APs are released and start printing to the dmesg. */ +SYSINIT(cpu_features, SI_SUB_SMP - 1, SI_ORDER_ANY, cpu_features_sysinit, NULL); static u_long parse_cpu_features_hwcap(void) From owner-dev-commits-src-branches@freebsd.org Wed Jul 28 12:40:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1880765A7E2; Wed, 28 Jul 2021 12:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZYDL08Vrz4t3G; Wed, 28 Jul 2021 12:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D80C61E313; Wed, 28 Jul 2021 12:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16SCenCp069298; Wed, 28 Jul 2021 12:40:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16SCenMW069297; Wed, 28 Jul 2021 12:40:49 GMT (envelope-from git) Date: Wed, 28 Jul 2021 12:40:49 GMT Message-Id: <202107281240.16SCenMW069297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 7fa95d69f108 - stable/12 - dd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file file when received. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7fa95d69f10827d0b02607682a2c4a1513d658e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 12:40:50 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7fa95d69f10827d0b02607682a2c4a1513d658e5 commit 7fa95d69f10827d0b02607682a2c4a1513d658e5 Author: Maxim Sobolev AuthorDate: 2020-09-24 02:44:58 +0000 Commit: Mark Johnston CommitDate: 2021-07-28 12:38:38 +0000 dd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file file when received. The default system log rotation mechanism (newsyslog(8)) requires ability to send signal to a daemon in order to properly complete rotation of the logs in an "atomic" manner without having to making a copy and truncating original file. Unfortunately our built-in mechanism to convert "dumb" programs into daemons has no way to handle this rotation properly. This change adds this ability, to be enabled by supplying -H option in addition to the -o option. PR: 255198 Reviewed by: markj, rpokala (manpages) (cherry picked from commit 4cd407ec933b81d9d0f733532d29426416cccc06) --- usr.sbin/daemon/daemon.8 | 18 ++++++++++++-- usr.sbin/daemon/daemon.c | 63 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/usr.sbin/daemon/daemon.8 b/usr.sbin/daemon/daemon.8 index bd853652c03f..665108df6afc 100644 --- a/usr.sbin/daemon/daemon.8 +++ b/usr.sbin/daemon/daemon.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 2, 2019 +.Dd September 22, 2020 .Dt DAEMON 8 .Os .Sh NAME @@ -34,7 +34,7 @@ .Nd run detached from the controlling terminal .Sh SYNOPSIS .Nm -.Op Fl cfrS +.Op Fl cfHrS .Op Fl p Ar child_pidfile .Op Fl P Ar supervisor_pidfile .Op Fl t Ar title @@ -68,6 +68,14 @@ or syslog output, the standard file descriptors are first redirected to .Pa /dev/null , then stdout and/or stderr is redirected to a file or to syslog as specified by the other options. +.It Fl H +Close +.Pa output_file +and re-open it when signal SIGHUP is received, for interoperability with +.Xr newsyslog 1 +and similar log rotation / archival mechanisms. If +.Fa o +is not specified, this flag is ignored. .It Fl S Enable syslog output. This is implicitly applied if other syslog parameters are provided. @@ -77,6 +85,12 @@ tag, respectively. Append output from the daemonized process to .Pa output_file . If the file does not exist, it is created with permissions 0600. +When this option is used together with options +.Fl c and +.Fl H +the absolute path needs to be provided to ensure +.Nm +can re-open the file after a SIGHUP. .It Fl m Ar output_mask Redirect output from the child process stdout (1), stderr (2), or both (3). This value specifies what is sent to syslog and the log file. diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 7a245421e4df..d8a26132223b 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -61,11 +61,15 @@ struct log_params { int logpri; int noclose; int outfd; + const char *outfn; }; static void restrict_process(const char *); static void handle_term(int); static void handle_chld(int); +static void handle_hup(int); +static int open_log(const char *); +static void reopen_log(struct log_params *); static int listen_child(int, struct log_params *); static int get_log_mapping(const char *, const CODE *); static void open_pid_files(const char *, const char *, struct pidfh **, @@ -74,7 +78,8 @@ static void do_output(const unsigned char *, size_t, struct log_params *); static void daemon_sleep(time_t, long); static void usage(void); -static volatile sig_atomic_t terminate = 0, child_gone = 0, pid = 0; +static volatile sig_atomic_t terminate = 0, child_gone = 0, pid = 0, + do_log_reopen = 0; int main(int argc, char *argv[]) @@ -84,7 +89,7 @@ main(int argc, char *argv[]) sigset_t mask_susp, mask_orig, mask_read, mask_term; struct log_params logpar; int pfd[2] = { -1, -1 }, outfd = -1; - int stdmask, logpri, logfac; + int stdmask, logpri, logfac, log_reopen; struct pidfh *ppfh, *pfh; char *p; @@ -97,9 +102,10 @@ main(int argc, char *argv[]) logtag = "daemon"; restart = 0; dosyslog = 0; + log_reopen = 0; outfn = NULL; title = NULL; - while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) { + while ((ch = getopt(argc, argv, "cfHSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) { switch (ch) { case 'c': nochdir = 0; @@ -107,6 +113,9 @@ main(int argc, char *argv[]) case 'f': noclose = 0; break; + case 'H': + log_reopen = 1; + break; case 'l': logfac = get_log_mapping(optarg, facilitynames); if (logfac == -1) @@ -168,7 +177,7 @@ main(int argc, char *argv[]) title = argv[0]; if (outfn) { - outfd = open(outfn, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0600); + outfd = open_log(outfn); if (outfd == -1) err(7, "open"); } @@ -201,7 +210,7 @@ main(int argc, char *argv[]) */ pid = -1; if (pidfile || ppidfile || restart || outfd != -1 || dosyslog) { - struct sigaction act_term, act_chld; + struct sigaction act_term, act_chld, act_hup; /* Avoid PID racing with SIGCHLD and SIGTERM. */ memset(&act_term, 0, sizeof(act_term)); @@ -214,6 +223,10 @@ main(int argc, char *argv[]) sigemptyset(&act_chld.sa_mask); sigaddset(&act_chld.sa_mask, SIGTERM); + memset(&act_hup, 0, sizeof(act_hup)); + act_hup.sa_handler = handle_hup; + sigemptyset(&act_hup.sa_mask); + /* Block these when avoiding racing before sigsuspend(). */ sigemptyset(&mask_susp); sigaddset(&mask_susp, SIGTERM); @@ -251,6 +264,12 @@ main(int argc, char *argv[]) logpar.dosyslog = dosyslog; logpar.logpri = logpri; logpar.noclose = noclose; + logpar.outfn = outfn; + if (log_reopen && outfd >= 0 && + sigaction(SIGHUP, &act_hup, NULL) == -1) { + warn("sigaction"); + goto exit; + } restart: if (pipe(pfd)) err(1, "pipe"); @@ -465,6 +484,8 @@ listen_child(int fd, struct log_params *logpar) assert(logpar); assert(bytes_read < LBUF_SIZE - 1); + if (do_log_reopen) + reopen_log(logpar); rv = read(fd, buf + bytes_read, LBUF_SIZE - bytes_read - 1); if (rv > 0) { unsigned char *cp; @@ -543,9 +564,9 @@ handle_term(int signo) } static void -handle_chld(int signo) +handle_chld(int signo __unused) { - (void)signo; + for (;;) { int rv = waitpid(-1, NULL, WNOHANG); if (pid == rv) { @@ -558,11 +579,37 @@ handle_chld(int signo) } } +static void +handle_hup(int signo __unused) +{ + + do_log_reopen = 1; +} + +static int +open_log(const char *outfn) +{ + + return open(outfn, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0600); +} + +static void +reopen_log(struct log_params *lpp) +{ + int outfd; + + do_log_reopen = 0; + outfd = open_log(lpp->outfn); + if (lpp->outfd >= 0) + close(lpp->outfd); + lpp->outfd = outfd; +} + static void usage(void) { (void)fprintf(stderr, - "usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]\n" + "usage: daemon [-cfHrS] [-p child_pidfile] [-P supervisor_pidfile]\n" " [-u user] [-o output_file] [-t title]\n" " [-l syslog_facility] [-s syslog_priority]\n" " [-T syslog_tag] [-m output_mask] [-R restart_delay_secs]\n" From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 12:13:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C3AB673162; Thu, 29 Jul 2021 12:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb8Zp1HZ2z4b8Z; Thu, 29 Jul 2021 12:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 145CA11AA2; Thu, 29 Jul 2021 12:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TCDrR2056477; Thu, 29 Jul 2021 12:13:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDr5o056476; Thu, 29 Jul 2021 12:13:53 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:53 GMT Message-Id: <202107291213.16TCDr5o056476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f9d3c6f4b5d1 - stable/13 - nfsclient: Avoid copying uninitialized bytes into statfs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 12:13:54 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322 commit f9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322 Author: Mark Johnston AuthorDate: 2021-07-15 16:18:17 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:11:16 +0000 nfsclient: Avoid copying uninitialized bytes into statfs hst will be nul-terminated but the remaining space in the buffer is left uninitialized. Avoid copying the entire buffer to ensure that uninitialized bytes are not leaked via statfs(2). Reported by: KMSAN Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation (cherry picked from commit 44de1834b53f4654cc2f6d76406f5705f8167927) --- sys/fs/nfsclient/nfs_clvfsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 974bc684bf5b..2fe30035b904 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1562,7 +1562,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, nmp->nm_fhsize = argp->fhsize; if (nmp->nm_fhsize > 0) bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize); - bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); + strlcpy(mp->mnt_stat.f_mntfromname, hst, MNAMELEN); nmp->nm_nam = nam; /* Set up the sockets and per-host congestion */ nmp->nm_sotype = argp->sotype; From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 12:13:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 617DC672C7A; Thu, 29 Jul 2021 12:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb8Zq258Dz4b15; Thu, 29 Jul 2021 12:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 279EB11668; Thu, 29 Jul 2021 12:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TCDtOo056503; Thu, 29 Jul 2021 12:13:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDtiv056502; Thu, 29 Jul 2021 12:13:55 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:55 GMT Message-Id: <202107291213.16TCDtiv056502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: c2edab507e92 - stable/13 - man9: Remove stray .In macros MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c2edab507e9227e30722b6c0b894c3eab864ff03 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 12:13:55 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c2edab507e9227e30722b6c0b894c3eab864ff03 commit c2edab507e9227e30722b6c0b894c3eab864ff03 Author: Mark Johnston AuthorDate: 2021-07-22 16:47:43 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:11:30 +0000 man9: Remove stray .In macros Fixes: 9c11d8d483c4 (cherry picked from commit 18c696c00159d1071ed17e3bed1863e412dd5cb5) --- share/man/man9/fetch.9 | 1 - share/man/man9/store.9 | 1 - 2 files changed, 2 deletions(-) diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9 index 5384c4f9204e..53927eb82584 100644 --- a/share/man/man9/fetch.9 +++ b/share/man/man9/fetch.9 @@ -67,7 +67,6 @@ .Fn fueword32 "volatile const void *base" "int32_t *val" .Ft int .Fn fueword64 "volatile const void *base" "int64_t *val" -.In sys/resourcevar.h .Sh DESCRIPTION The .Nm diff --git a/share/man/man9/store.9 b/share/man/man9/store.9 index 40a6d7e2b216..089949e53938 100644 --- a/share/man/man9/store.9 +++ b/share/man/man9/store.9 @@ -56,7 +56,6 @@ .Fn suword32 "volatile void *base" "int32_t word" .Ft int .Fn suword64 "volatile void *base" "int64_t word" -.In sys/resourcevar.h .Sh DESCRIPTION The .Nm From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 12:13:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79004673501; Thu, 29 Jul 2021 12:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb8Zr2YVjz4bM8; Thu, 29 Jul 2021 12:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 401E411936; Thu, 29 Jul 2021 12:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TCDuRG056532; Thu, 29 Jul 2021 12:13:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDuI1056531; Thu, 29 Jul 2021 12:13:56 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:56 GMT Message-Id: <202107291213.16TCDuI1056531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3afad070bddd - stable/13 - man9: Update guarantees for userspace fetch/store operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3afad070bdddb4718ccc8f2911551818f08a0840 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 12:13:56 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3afad070bdddb4718ccc8f2911551818f08a0840 commit 3afad070bdddb4718ccc8f2911551818f08a0840 Author: Mark Johnston AuthorDate: 2021-07-22 17:08:42 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:11:39 +0000 man9: Update guarantees for userspace fetch/store operations Platforms may either silently handle unaligned accesses or return an error. Atomicity is not guaranteed in this case, however. Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit fd5827b1785a9363abe601cbd9d8558b0fc8d3e8) --- share/man/man9/fetch.9 | 8 +++++--- share/man/man9/store.9 | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9 index 53927eb82584..16acb542c625 100644 --- a/share/man/man9/fetch.9 +++ b/share/man/man9/fetch.9 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2020 +.Dd July 22, 2021 .Dt FETCH 9 .Os .Sh NAME @@ -72,8 +72,10 @@ The .Nm functions are designed to copy small amounts of data from user-space of the current process. -If read is successful, it is performed atomically. -The data read must be naturally aligned. +If the user address is naturally aligned, then the operation will be +performed atomically. +Otherwise it may fail or be performed non-atomically, depending on +the platform. .Pp The .Nm diff --git a/share/man/man9/store.9 b/share/man/man9/store.9 index 089949e53938..6492fdbc3924 100644 --- a/share/man/man9/store.9 +++ b/share/man/man9/store.9 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 17, 2018 +.Dd July 22, 2021 .Dt STORE 9 .Os .Sh NAME @@ -60,8 +60,10 @@ The .Nm functions are designed to copy small amounts of data to user-space. -If write is successful, it is performed atomically. -The data written must be naturally aligned. +If the user address is naturally aligned, then the operation will be +performed atomically. +Otherwise it may fail or be performed non-atomically, depending on +the platform. .Pp The .Nm From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 12:13:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF457673589; Thu, 29 Jul 2021 12:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb8Zt4dysz4b30; Thu, 29 Jul 2021 12:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8628211829; Thu, 29 Jul 2021 12:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TCDwX7056580; Thu, 29 Jul 2021 12:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDw9c056579; Thu, 29 Jul 2021 12:13:58 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:58 GMT Message-Id: <202107291213.16TCDw9c056579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9f43633dd055 - stable/13 - pf: Constify tag name and queue name helper functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9f43633dd055ba4c99f27d1e64b7b95b462226c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 12:13:59 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9f43633dd055ba4c99f27d1e64b7b95b462226c2 commit 9f43633dd055ba4c99f27d1e64b7b95b462226c2 Author: Mark Johnston AuthorDate: 2021-07-15 16:17:58 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:12:01 +0000 pf: Constify tag name and queue name helper functions No functional change intended. Reviewed by: kp Sponsored by: The FreeBSD Foundation (cherry picked from commit 81f95106b8c14d7ce935864b4705d54a8e437ed6) --- sys/netpfil/pf/pf_ioctl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 6af5197ef07d..01601db07ea0 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -100,8 +100,8 @@ SDT_PROBE_DEFINE3(pf, ioctl, function, error, "char *", "int", "int"); SDT_PROBE_DEFINE2(pf, ioctl, addrule, error, "int", "int"); SDT_PROBE_DEFINE2(pf, ioctl, nvchk, error, "int", "int"); -static struct pf_kpool *pf_get_kpool(char *, u_int32_t, u_int8_t, u_int32_t, - u_int8_t, u_int8_t, u_int8_t); +static struct pf_kpool *pf_get_kpool(const char *, u_int32_t, u_int8_t, + u_int32_t, u_int8_t, u_int8_t, u_int8_t); static void pf_mv_kpool(struct pf_kpalist *, struct pf_kpalist *); static void pf_empty_kpool(struct pf_kpalist *); @@ -113,7 +113,7 @@ static int pf_rollback_altq(u_int32_t); static int pf_commit_altq(u_int32_t); static int pf_enable_altq(struct pf_altq *); static int pf_disable_altq(struct pf_altq *); -static u_int32_t pf_qname2qid(char *); +static u_int32_t pf_qname2qid(const char *); static void pf_qid_unref(u_int32_t); #endif /* ALTQ */ static int pf_begin_rules(u_int32_t *, int, const char *); @@ -189,8 +189,8 @@ static void pf_init_tagset(struct pf_tagset *, unsigned int *, static void pf_cleanup_tagset(struct pf_tagset *); static uint16_t tagname2hashindex(const struct pf_tagset *, const char *); static uint16_t tag2hashindex(const struct pf_tagset *, uint16_t); -static u_int16_t tagname2tag(struct pf_tagset *, char *); -static u_int16_t pf_tagname2tag(char *); +static u_int16_t tagname2tag(struct pf_tagset *, const char *); +static u_int16_t pf_tagname2tag(const char *); static void tag_unref(struct pf_tagset *, u_int16_t); #define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x @@ -366,7 +366,7 @@ pfattach_vnet(void) } static struct pf_kpool * -pf_get_kpool(char *anchor, u_int32_t ticket, u_int8_t rule_action, +pf_get_kpool(const char *anchor, u_int32_t ticket, u_int8_t rule_action, u_int32_t rule_number, u_int8_t r_last, u_int8_t active, u_int8_t check_ticket) { @@ -559,7 +559,7 @@ tag2hashindex(const struct pf_tagset *ts, uint16_t tag) } static u_int16_t -tagname2tag(struct pf_tagset *ts, char *tagname) +tagname2tag(struct pf_tagset *ts, const char *tagname) { struct pf_tagname *tag; u_int32_t index; @@ -638,14 +638,14 @@ tag_unref(struct pf_tagset *ts, u_int16_t tag) } static u_int16_t -pf_tagname2tag(char *tagname) +pf_tagname2tag(const char *tagname) { return (tagname2tag(&V_pf_tags, tagname)); } #ifdef ALTQ static u_int32_t -pf_qname2qid(char *qname) +pf_qname2qid(const char *qname) { return ((u_int32_t)tagname2tag(&V_pf_qids, qname)); } From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 12:13:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0CBB6731A2; Thu, 29 Jul 2021 12:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb8Zs3zjzz4b8n; Thu, 29 Jul 2021 12:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 635B011937; Thu, 29 Jul 2021 12:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TCDvQn056556; Thu, 29 Jul 2021 12:13:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDvfH056555; Thu, 29 Jul 2021 12:13:57 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:57 GMT Message-Id: <202107291213.16TCDvfH056555@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 50b26566c7f4 - stable/13 - mmc: Drain the intrhook in mmc_detach() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 50b26566c7f4b605d5db4464e259d7db9626dd86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 12:13:58 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=50b26566c7f4b605d5db4464e259d7db9626dd86 commit 50b26566c7f4b605d5db4464e259d7db9626dd86 Author: Yang Zhong AuthorDate: 2021-07-22 17:16:01 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:11:50 +0000 mmc: Drain the intrhook in mmc_detach() Buggy SD card drivers may attach and detach a mmc(4) driver instance in quick succession. In this case mmc(4) must disestablish its intrhook callback during detach. Thus, this change adds a call to config_intrhook_drain(), which blocks or does nothing if the intrhook is running or has already ran (the SD card was plugged in), and disestablishes the hook if it hasn't ran yet (the SD card was not plugged in). PR: 254373 Reviewed by: imp, manu, markj Sponsored by: The FreeBSD Foundation (cherry picked from commit d5341d72a11be200e536ac7d8967449a3f521792) --- sys/dev/mmc/mmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index ddbc2669b1f7..47df562e73fd 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -271,6 +271,7 @@ mmc_detach(device_t dev) struct mmc_softc *sc = device_get_softc(dev); int err; + config_intrhook_drain(&sc->config_intrhook); err = mmc_delete_cards(sc, true); if (err != 0) return (err); From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 12:14:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10067673164; Thu, 29 Jul 2021 12:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb8Zv67NQz4bFm; Thu, 29 Jul 2021 12:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2A20117C1; Thu, 29 Jul 2021 12:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TCDxdM056604; Thu, 29 Jul 2021 12:13:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCDx7d056603; Thu, 29 Jul 2021 12:13:59 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:13:59 GMT Message-Id: <202107291213.16TCDx7d056603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 822c62b7db64 - stable/13 - Assert that valid PTEs are not overwritten when installing a new PTP MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 822c62b7db64bd2a2326e460faf68b5442e4c52c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 12:14:00 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=822c62b7db64bd2a2326e460faf68b5442e4c52c commit 822c62b7db64bd2a2326e460faf68b5442e4c52c Author: Mark Johnston AuthorDate: 2021-07-15 16:17:33 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:12:12 +0000 Assert that valid PTEs are not overwritten when installing a new PTP amd64 and 32-bit ARM already had assertions to this effect. Add them to other pmaps. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit b092c58c006fd5c5c051b30ab097f5c1655e0d53) --- sys/arm64/arm64/pmap.c | 6 ++++++ sys/i386/i386/pmap.c | 5 ++++- sys/mips/mips/pmap.c | 4 ++++ sys/powerpc/aim/mmu_radix.c | 8 ++++++-- sys/riscv/riscv/pmap.c | 4 ++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index e9dd27981d61..e57a4033c3a3 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1870,6 +1870,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l0index = ptepindex - (NUL2E + NUL1E); l0 = &pmap->pm_l0[l0index]; + KASSERT((pmap_load(l0) & ATTR_DESCR_VALID) == 0, + ("%s: L0 entry %#lx is valid", __func__, pmap_load(l0))); pmap_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE); } else if (ptepindex >= NUL2E) { vm_pindex_t l0index, l1index; @@ -1896,6 +1898,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l1 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l0) & ~ATTR_MASK); l1 = &l1[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l1) & ATTR_DESCR_VALID) == 0, + ("%s: L1 entry %#lx is valid", __func__, pmap_load(l1))); pmap_store(l1, VM_PAGE_TO_PHYS(m) | L1_TABLE); } else { vm_pindex_t l0index, l1index; @@ -1938,6 +1942,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); l2 = &l2[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l2) & ATTR_DESCR_VALID) == 0, + ("%s: L2 entry %#lx is valid", __func__, pmap_load(l2))); pmap_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE); } diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index bc650cf378e0..b39f1c6f0a55 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2157,8 +2157,11 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) pmap->pm_stats.resident_count++; ptepa = VM_PAGE_TO_PHYS(m); + KASSERT((pmap->pm_pdir[ptepindex] & PG_V) == 0, + ("%s: page directory entry %#jx is valid", + __func__, (uintmax_t)pmap->pm_pdir[ptepindex])); pmap->pm_pdir[ptepindex] = - (pd_entry_t) (ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M); + (pd_entry_t)(ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M); return (m); } diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index 866013cbf38a..8b0eb1a3ce0b 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -1217,9 +1217,13 @@ _pmap_allocpte(pmap_t pmap, unsigned ptepindex, u_int flags) } /* Next level entry */ pde = (pd_entry_t *)*pdep; + KASSERT(pde[pdeindex] == 0, + ("%s: PTE %p is valid", __func__, pde[pdeindex])); pde[pdeindex] = (pd_entry_t)pageva; } #else + KASSERT(pmap->pm_segtab[ptepindex] == 0, + ("%s: PTE %p is valid", __func__, pmap->pm_segtab[ptepindex])); pmap->pm_segtab[ptepindex] = (pd_entry_t)pageva; #endif pmap->pm_stats.resident_count++; diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 0f5aa2ec151e..b9ca10448f9f 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -4246,8 +4246,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Wire up a new PDPE page */ pml1index = ptepindex - (NUPDE + NUPDPE); l1e = &pmap->pm_pml1[pml1index]; + KASSERT((be64toh(*l1e) & PG_V) == 0, + ("%s: L1 entry %#lx is valid", __func__, *l1e)); pde_store(l1e, VM_PAGE_TO_PHYS(m)); - } else if (ptepindex >= NUPDE) { vm_pindex_t pml1index; vm_pindex_t pdpindex; @@ -4276,8 +4277,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Now find the pdp page */ l2e = &l2e[pdpindex & RPTE_MASK]; + KASSERT((be64toh(*l2e) & PG_V) == 0, + ("%s: L2 entry %#lx is valid", __func__, *l2e)); pde_store(l2e, VM_PAGE_TO_PHYS(m)); - } else { vm_pindex_t pml1index; vm_pindex_t pdpindex; @@ -4322,6 +4324,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* Now we know where the page directory page is */ l3e = &l3e[ptepindex & RPTE_MASK]; + KASSERT((be64toh(*l3e) & PG_V) == 0, + ("%s: L3 entry %#lx is valid", __func__, *l3e)); pde_store(l3e, VM_PAGE_TO_PHYS(m)); } diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 9761d97f449a..9fd66f093d5e 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1285,6 +1285,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l1index = ptepindex - NUL1E; l1 = &pmap->pm_l1[l1index]; + KASSERT((pmap_load(l1) & PTE_V) == 0, + ("%s: L1 entry %#lx is valid", __func__, pmap_load(l1))); pn = (VM_PAGE_TO_PHYS(m) / PAGE_SIZE); entry = (PTE_V); @@ -1314,6 +1316,8 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) phys = PTE_TO_PHYS(pmap_load(l1)); l2 = (pd_entry_t *)PHYS_TO_DMAP(phys); l2 = &l2[ptepindex & Ln_ADDR_MASK]; + KASSERT((pmap_load(l2) & PTE_V) == 0, + ("%s: L2 entry %#lx is valid", __func__, pmap_load(l2))); pn = (VM_PAGE_TO_PHYS(m) / PAGE_SIZE); entry = (PTE_V); From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 12:14:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68968672F6E; Thu, 29 Jul 2021 12:14:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb8Zx0RmWz4b36; Thu, 29 Jul 2021 12:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D30B111669; Thu, 29 Jul 2021 12:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TCE0bL056628; Thu, 29 Jul 2021 12:14:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TCE0As056627; Thu, 29 Jul 2021 12:14:00 GMT (envelope-from git) Date: Thu, 29 Jul 2021 12:14:00 GMT Message-Id: <202107291214.16TCE0As056627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 90ffac35b778 - stable/13 - eli: Zero pad bytes that arise when certain auth algorithms are used MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 90ffac35b778564d1b4cb8ec7d2ff92ccc8e56dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 12:14:01 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=90ffac35b778564d1b4cb8ec7d2ff92ccc8e56dd commit 90ffac35b778564d1b4cb8ec7d2ff92ccc8e56dd Author: Mark Johnston AuthorDate: 2021-07-15 16:23:04 +0000 Commit: Mark Johnston CommitDate: 2021-07-29 12:12:22 +0000 eli: Zero pad bytes that arise when certain auth algorithms are used When authentication is configured, GELI ensures that the amount of data per sector is a multiple of 16 bytes. This is done in eli_metadata_softc(). When the digest size is not a multiple of 16 bytes, this leaves some extra pad bytes at the end of every sector, and they were not being zeroed before being written to disk. In particular, this happens with the HMAC/SHA1, HMAC/RIPEMD160 and HMAC/SHA384 data authentication algorithms. This change ensures that they are zeroed before being written to disk. Reported by: KMSAN Reviewed by: delphij, asomers Sponsored by: The FreeBSD Foundation (cherry picked from commit 0fcafe8516d170852aa73f029a6a28bed1e29292) --- sys/geom/eli/g_eli_integrity.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/geom/eli/g_eli_integrity.c b/sys/geom/eli/g_eli_integrity.c index 4cf982e3ddfa..d9ac0a2a3d72 100644 --- a/sys/geom/eli/g_eli_integrity.c +++ b/sys/geom/eli/g_eli_integrity.c @@ -510,6 +510,17 @@ g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp) if (bp->bio_cmd == BIO_WRITE) memset(data + sc->sc_alen + data_secsize, 0, encr_secsize - sc->sc_alen - data_secsize); + } else if (data_secsize + sc->sc_alen != encr_secsize) { + /* + * If the HMAC size is not a multiple of 128 bits, the + * per-sector data size is rounded down to ensure that + * encryption can be performed without requiring any + * padding. In this case, each sector contains unused + * bytes. + */ + if (bp->bio_cmd == BIO_WRITE) + memset(data + sc->sc_alen + data_secsize, 0, + encr_secsize - sc->sc_alen - data_secsize); } if (bp->bio_cmd == BIO_WRITE) { From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18575675CD1; Thu, 29 Jul 2021 15:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqb70vyz4spT; Thu, 29 Jul 2021 15:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8A47141E8; Thu, 29 Jul 2021 15:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPFsx009624; Thu, 29 Jul 2021 15:25:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPFBv009623; Thu, 29 Jul 2021 15:25:15 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:15 GMT Message-Id: <202107291525.16TFPFBv009623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 19135e372ff1 - stable/13 - arm64: Fix finding the pmc event ID MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 19135e372ff1627d2337f3014ee0bfe2e178d00a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:16 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=19135e372ff1627d2337f3014ee0bfe2e178d00a commit 19135e372ff1627d2337f3014ee0bfe2e178d00a Author: Andrew Turner AuthorDate: 2021-04-01 14:38:09 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:00:37 +0000 arm64: Fix finding the pmc event ID The lower pmc event bits were masked off to find the PMC event ID. The doesn't work when there are more events. Switch it to use the offser relative to the first event while also checking the ID is in the expected range. Reviewed by: gnn, ray Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29600 (cherry picked from commit 24b2f4ea49229618c5608846acfc10be2eb0d567) --- sys/dev/hwpmc/hwpmc_arm64.c | 4 +++- sys/dev/hwpmc/hwpmc_arm64.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 49375219a485..050f861a74fe 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -181,7 +181,9 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm, } pe = a->pm_ev; - config = (pe & EVENT_ID_MASK); + config = (uint32_t)pe - PMC_EV_ARMV8_FIRST; + if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) + return (EINVAL); pm->pm_md.pm_arm64.pm_arm64_evsel = config; PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config); diff --git a/sys/dev/hwpmc/hwpmc_arm64.h b/sys/dev/hwpmc/hwpmc_arm64.h index f0d43aa58ef8..fb7637a39c60 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.h +++ b/sys/dev/hwpmc/hwpmc_arm64.h @@ -40,7 +40,6 @@ #define ARMV8_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (-(R)) #define ARMV8_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P)) -#define EVENT_ID_MASK 0xFF #ifdef _KERNEL /* MD extension for 'struct pmc' */ From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BE5967587D; Thu, 29 Jul 2021 15:25:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqd1Mcbz4t4s; Thu, 29 Jul 2021 15:25:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0706C142BF; Thu, 29 Jul 2021 15:25:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPGuT009648; Thu, 29 Jul 2021 15:25:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPG5j009647; Thu, 29 Jul 2021 15:25:16 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:16 GMT Message-Id: <202107291525.16TFPG5j009647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: c0960dc8c677 - stable/13 - libpmc: remove unused PMC_MDEP_INIT_INTEL_V2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c0960dc8c67727ce9c4fdde77aefada350d91ad0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:17 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c0960dc8c67727ce9c4fdde77aefada350d91ad0 commit c0960dc8c67727ce9c4fdde77aefada350d91ad0 Author: Mitchell Horne AuthorDate: 2021-05-13 18:56:39 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: remove unused PMC_MDEP_INIT_INTEL_V2 All uses of this macro were removed in e92a1350b50e. Remove cpu_has_iaf_counters as well. Reviewed by: ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30195 (cherry picked from commit 4d8d74a4f52efd078bd6298e0adbdd476ed70de9) --- lib/libpmc/libpmc.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 512f3957962a..e66ec5822226 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -1367,10 +1367,6 @@ pmc_init(void) uint32_t abi_version; struct module_stat pmc_modstat; struct pmc_op_getcpuinfo op_cpu_info; -#if defined(__amd64__) || defined(__i386__) - int cpu_has_iaf_counters; - unsigned int t; -#endif if (pmc_syscall != -1) /* already inited */ return (0); @@ -1446,15 +1442,6 @@ pmc_init(void) #if defined(__amd64__) || defined(__i386__) if (cpu_info.pm_cputype != PMC_CPU_GENERIC) pmc_class_table[n++] = &tsc_class_table_descr; - - /* - * Check if this CPU has fixed function counters. - */ - cpu_has_iaf_counters = 0; - for (t = 0; t < cpu_info.pm_nclass; t++) - if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF && - cpu_info.pm_classes[t].pm_num > 0) - cpu_has_iaf_counters = 1; #endif #define PMC_MDEP_INIT(C) do { \ @@ -1464,15 +1451,6 @@ pmc_init(void) PMC_TABLE_SIZE(C##_pmc_classes); \ } while (0) -#define PMC_MDEP_INIT_INTEL_V2(C) do { \ - PMC_MDEP_INIT(C); \ - pmc_class_table[n++] = &iaf_class_table_descr; \ - if (!cpu_has_iaf_counters) \ - pmc_mdep_event_aliases = \ - C##_aliases_without_iaf; \ - pmc_class_table[n] = &C##_class_table_descr; \ - } while (0) - /* Configure the event name parser. */ switch (cpu_info.pm_cputype) { #if defined(__amd64__) || defined(__i386__) From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91A7B675BCD; Thu, 29 Jul 2021 15:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqf2lTtz4t2s; Thu, 29 Jul 2021 15:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26F47141E9; Thu, 29 Jul 2021 15:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPIbe009678; Thu, 29 Jul 2021 15:25:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPI03009677; Thu, 29 Jul 2021 15:25:18 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:18 GMT Message-Id: <202107291525.16TFPI03009677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 57caeb5109ee - stable/13 - libpmc: remove PMC_MDEP_TABLE logic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57caeb5109ee3f385fbabb667eca9588588bcc52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:18 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=57caeb5109ee3f385fbabb667eca9588588bcc52 commit 57caeb5109ee3f385fbabb667eca9588588bcc52 Author: Mitchell Horne AuthorDate: 2021-05-13 19:00:07 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: remove PMC_MDEP_TABLE logic This logic was added for handling some of the complicated relationships between events and x86 CPU models. Since that logic has been mostly removed from libpmc(3) in favor of pmu-events, this no longer serves much of a purpose. Mapping CPU types to event tables is already handled by the switch statement in pmc_init(). Reviewed by: ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30196 (cherry picked from commit da13ef6aa0565c8d79326bba5606671062033bbf) --- lib/libpmc/libpmc.c | 54 ++++------------------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index e66ec5822226..6636c974cb73 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -177,32 +177,6 @@ static const struct pmc_event_descr cortex_a76_event_table[] = __PMC_EV_ALIAS_ARMV8_CORTEX_A76() }; -/* - * PMC_MDEP_TABLE(NAME, PRIMARYCLASS, ADDITIONAL_CLASSES...) - * - * Map a CPU to the PMC classes it supports. - */ -#define PMC_MDEP_TABLE(N,C,...) \ - static const enum pmc_class N##_pmc_classes[] = { \ - PMC_CLASS_##C, __VA_ARGS__ \ - } - -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); -PMC_MDEP_TABLE(beri, BERI, PMC_CLASS_SOFT, PMC_CLASS_BERI); -PMC_MDEP_TABLE(cortex_a8, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); -PMC_MDEP_TABLE(cortex_a9, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); -PMC_MDEP_TABLE(cortex_a53, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(cortex_a57, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(cortex_a76, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K); -PMC_MDEP_TABLE(mips74k, MIPS74K, PMC_CLASS_SOFT, PMC_CLASS_MIPS74K); -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450, PMC_CLASS_TSC); -PMC_MDEP_TABLE(ppc970, PPC970, PMC_CLASS_SOFT, PMC_CLASS_PPC970, PMC_CLASS_TSC); -PMC_MDEP_TABLE(power8, POWER8, PMC_CLASS_SOFT, PMC_CLASS_POWER8, PMC_CLASS_TSC); -PMC_MDEP_TABLE(e500, E500, PMC_CLASS_SOFT, PMC_CLASS_E500, PMC_CLASS_TSC); -PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); - static const struct pmc_event_descr tsc_event_table[] = { __PMC_EV_TSC() @@ -264,9 +238,6 @@ static struct pmc_class_descr soft_class_table_descr = static const struct pmc_class_descr **pmc_class_table; #define PMC_CLASS_TABLE_SIZE cpu_info.pm_nclass -static const enum pmc_class *pmc_mdep_class_list; -static size_t pmc_mdep_class_list_size; - /* * Mapping tables, mapping enumeration values to human readable * strings. @@ -985,17 +956,6 @@ pmc_match_event_class(const char *name, return (NULL); } -static int -pmc_mdep_is_compatible_class(enum pmc_class pc) -{ - size_t n; - - for (n = 0; n < pmc_mdep_class_list_size; n++) - if (pmc_mdep_class_list[n] == pc) - return (1); - return (0); -} - /* * API entry points */ @@ -1070,9 +1030,8 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, ev = NULL; for (n = 0; n < PMC_CLASS_TABLE_SIZE; n++) { pcd = pmc_class_table[n]; - if (pcd && pmc_mdep_is_compatible_class(pcd->pm_evc_class) && - strncasecmp(ctrname, pcd->pm_evc_name, - pcd->pm_evc_name_size) == 0) { + if (pcd != NULL && strncasecmp(ctrname, pcd->pm_evc_name, + pcd->pm_evc_name_size) == 0) { if ((ev = pmc_match_event_class(ctrname + pcd->pm_evc_name_size, pcd)) == NULL) { errno = EINVAL; @@ -1088,7 +1047,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, */ for (n = 0; ev == NULL && n < PMC_CLASS_TABLE_SIZE; n++) { pcd = pmc_class_table[n]; - if (pcd && pmc_mdep_is_compatible_class(pcd->pm_evc_class)) + if (pcd != NULL) ev = pmc_match_event_class(ctrname, pcd); } @@ -1444,12 +1403,7 @@ pmc_init(void) pmc_class_table[n++] = &tsc_class_table_descr; #endif -#define PMC_MDEP_INIT(C) do { \ - pmc_mdep_event_aliases = C##_aliases; \ - pmc_mdep_class_list = C##_pmc_classes; \ - pmc_mdep_class_list_size = \ - PMC_TABLE_SIZE(C##_pmc_classes); \ - } while (0) +#define PMC_MDEP_INIT(C) pmc_mdep_event_aliases = C##_aliases /* Configure the event name parser. */ switch (cpu_info.pm_cputype) { From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C940675C23; Thu, 29 Jul 2021 15:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqg339sz4sph; Thu, 29 Jul 2021 15:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4778113FE3; Thu, 29 Jul 2021 15:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPJDq009705; Thu, 29 Jul 2021 15:25:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPJla009704; Thu, 29 Jul 2021 15:25:19 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:19 GMT Message-Id: <202107291525.16TFPJla009704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: dfb4fb41166b - stable/13 - libpmc: fall-back to kernel tables if pmu-events fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dfb4fb41166bc35935e5f6fd9351a0ada0f71159 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:19 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=dfb4fb41166bc35935e5f6fd9351a0ada0f71159 commit dfb4fb41166bc35935e5f6fd9351a0ada0f71159 Author: Mitchell Horne AuthorDate: 2021-05-13 18:57:37 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: fall-back to kernel tables if pmu-events fails On x86, the pmu_events table is the source of truth for finding supported events. However, events not found there may still be present in the kernel's static event tables. For example, the pmc.soft(3) events will never be available from pmu-events. Update pmc_allocate() to search the legacy event tables if pmc_pmu_pmcallocate() fails to return a result. This allows both event sources to be consulted before giving up, thus restoring pmc.soft(3) and pmc.tsc(3) on x86. Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30216 (cherry picked from commit dfdc57e8aa8ba4b4e4484f736e8c7645ab69b54a) --- lib/libpmc/libpmc.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 6636c974cb73..e2422f167267 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -989,25 +989,25 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, pmc_config.pm_count = count; if (PMC_IS_SAMPLING_MODE(mode)) pmc_config.pm_caps |= PMC_CAP_INTERRUPT; + /* - * Can we pull this straight from the pmu table? + * Try to pull the raw event ID directly from the pmu-events table. If + * this is unsupported on the platform, or the event is not found, + * continue with searching the regular event tables. */ r = spec_copy = strdup(ctrspec); ctrname = strsep(&r, ","); if (pmc_pmu_enabled()) { - if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) { - goto out; - } - retval = 0; - *pmcid = pmc_config.pm_pmcid; - goto out; - } - errx(EX_USAGE, "ERROR: pmc_pmu_allocate failed, check for ctrname %s\n", ctrname); - } else { - free(spec_copy); - spec_copy = NULL; + if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) + goto found; + + /* Otherwise, reset any changes */ + pmc_config.pm_ev = 0; + pmc_config.pm_caps = 0; + pmc_config.pm_class = 0; } + free(spec_copy); + spec_copy = NULL; /* replace an event alias with the canonical event specifier */ if (pmc_mdep_event_aliases) @@ -1064,14 +1064,12 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, goto out; } - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) - goto out; - - *pmcid = pmc_config.pm_pmcid; - - retval = 0; - - out: +found: + if (PMC_CALL(PMCALLOCATE, &pmc_config) == 0) { + *pmcid = pmc_config.pm_pmcid; + retval = 0; + } +out: if (spec_copy) free(spec_copy); From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5F8A675EE9; Thu, 29 Jul 2021 15:25:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqh4Bbpz4t30; Thu, 29 Jul 2021 15:25:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 725A413FE4; Thu, 29 Jul 2021 15:25:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPKJT009731; Thu, 29 Jul 2021 15:25:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPK6r009730; Thu, 29 Jul 2021 15:25:20 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:20 GMT Message-Id: <202107291525.16TFPK6r009730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 96da64391de9 - stable/13 - hwpmc: fix PMC_CPU_LAST MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 96da64391de97b2b6775e14d73a1749ea5c3030b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:20 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=96da64391de97b2b6775e14d73a1749ea5c3030b commit 96da64391de97b2b6775e14d73a1749ea5c3030b Author: Mitchell Horne AuthorDate: 2021-05-05 18:40:39 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 hwpmc: fix PMC_CPU_LAST It is unused, but incorrect. MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit f59127dac5ca0be3648ecc0a031a21e472afb133) --- sys/sys/pmc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index 1486c7aa91c7..9328a7bdfa05 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -138,7 +138,7 @@ enum pmc_cputype { }; #define PMC_CPU_FIRST PMC_CPU_AMD_K7 -#define PMC_CPU_LAST PMC_CPU_GENERIC +#define PMC_CPU_LAST PMC_CPU_ARMV8_CORTEX_A76 /* * Classes of PMCs From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD8F6675F02; Thu, 29 Jul 2021 15:25:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqj4mt8z4smW; Thu, 29 Jul 2021 15:25:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 861C413FE5; Thu, 29 Jul 2021 15:25:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPLd4009755; Thu, 29 Jul 2021 15:25:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPLdF009754; Thu, 29 Jul 2021 15:25:21 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:21 GMT Message-Id: <202107291525.16TFPLdF009754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: eae121b18f5b - stable/13 - libpmc: fix "instructions" alias on Intel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eae121b18f5b2599e56c5101c40c9f71856246e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:21 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=eae121b18f5b2599e56c5101c40c9f71856246e7 commit eae121b18f5b2599e56c5101c40c9f71856246e7 Author: Mitchell Horne AuthorDate: 2021-05-31 14:16:16 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: fix "instructions" alias on Intel The typo prevents the counter from being allocated. This fixes e.g. pmcstat -s instructions sleep 5 Reviewed by: mizhka, gnn, ray, emaste MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30527 (cherry picked from commit bc1a6a9d692a1f827514144b6bce0654a8be4f4d) --- lib/libpmc/libpmc_pmu_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index d652573a883f..259a2a5faa47 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -72,7 +72,7 @@ static struct pmu_alias pmu_intel_alias_table[] = { {"BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, {"cycles", "tsc-tsc"}, {"unhalted-cycles", "CPU_CLK_UNHALTED.THREAD_P_ANY"}, - {"instructions", "inst-retired.any_p"}, + {"instructions", "inst_retired.any_p"}, {"branch-mispredicts", "br_misp_retired.all_branches"}, {"branches", "br_inst_retired.all_branches"}, {"interrupts", "hw_interrupts.received"}, From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E42F4675B59; Thu, 29 Jul 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqk5hdpz4spy; Thu, 29 Jul 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7E2B141EA; Thu, 29 Jul 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPMOM009779; Thu, 29 Jul 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPM4s009778; Thu, 29 Jul 2021 15:25:22 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:22 GMT Message-Id: <202107291525.16TFPM4s009778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b85044cea605 - stable/13 - libpmc: remove unused 'isfixed' variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b85044cea6055c005f7a4ac816f5796da49b7ce9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:23 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b85044cea6055c005f7a4ac816f5796da49b7ce9 commit b85044cea6055c005f7a4ac816f5796da49b7ce9 Author: Mitchell Horne AuthorDate: 2021-05-31 14:22:30 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: remove unused 'isfixed' variable Reviewed by: gnn, emaste MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30529 (cherry picked from commit 0092642f863946ee1edc88fa634887d7c8a54656) --- lib/libpmc/libpmc_pmu_util.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 259a2a5faa47..1b2c10e07368 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -472,9 +472,7 @@ pmc_pmu_intel_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, struct pmu_event_desc *ped) { struct pmc_md_iap_op_pmcallocate *iap; - int isfixed; - isfixed = 0; iap = &pm->pm_md.pm_iap; if (strcasestr(event_name, "UNC_") == event_name || strcasestr(event_name, "uncore") != NULL) { From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75A53675F06; Thu, 29 Jul 2021 15:25:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqm0MWTz4t3M; Thu, 29 Jul 2021 15:25:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD4C7142C0; Thu, 29 Jul 2021 15:25:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPNjm009805; Thu, 29 Jul 2021 15:25:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPNYn009804; Thu, 29 Jul 2021 15:25:23 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:23 GMT Message-Id: <202107291525.16TFPNYn009804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b44f0bd4109f - stable/13 - libpmc: always generate libpmc_events.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b44f0bd4109fd2dcbedd2dcab19c4bd1c3037153 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:24 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b44f0bd4109fd2dcbedd2dcab19c4bd1c3037153 commit b44f0bd4109fd2dcbedd2dcab19c4bd1c3037153 Author: Mitchell Horne AuthorDate: 2021-05-31 14:24:04 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: always generate libpmc_events.c The jevents build tool will create an empty table if it doesn't find any events, so we can remove the extra $MACHINE_CPUARCH checks. Reviewed by: gnn, ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30531 (cherry picked from commit 689c7e7975cdee38ca6fd60ad3372d55c43c948c) --- Makefile.inc1 | 4 +--- Makefile.libcompat | 2 +- lib/libpmc/Makefile | 7 +++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 288d16a7574e..a595dfbb76c9 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2535,9 +2535,7 @@ _tcsh=bin/csh _libmagic=lib/libmagic .endif -.if ${MK_PMC} != "no" && \ - (${TARGET_ARCH} == "aarch64" || ${TARGET_ARCH} == "amd64" || \ - ${TARGET_ARCH} == "i386") +.if ${MK_PMC} != "no" _jevents=lib/libpmc/pmu-events .endif diff --git a/Makefile.libcompat b/Makefile.libcompat index e4d9cd94e835..779bcb163cf7 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -51,7 +51,7 @@ _LC_INCDIRS= \ .if ${MK_FILE} != "no" _libmagic= lib/libmagic .endif -.if ${MK_PMC} != "no" && ${TARGET_ARCH} == "amd64" +.if ${MK_PMC} != "no" _jevents= lib/libpmc/pmu-events .endif diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 42aa14e58471..1006b6f93469 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -8,15 +8,15 @@ INCS= pmc.h pmclog.h pmcformat.h CFLAGS+= -I${SRCTOP}/${RELDIR:H}/libpmcstat LDADD+= -lc++ -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64" || \ - ${MACHINE_ARCH} == "i386" - .if ${MACHINE_CPUARCH} == "aarch64" EVENT_ARCH="arm64" .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" EVENT_ARCH="x86" .elif ${MACHINE_ARCH} == "powerpc" EVENT_ARCH="powerpc" +.else +# This will generate an empty events table +EVENT_ARCH="none" .endif .if ${MK_DIRDEPS_BUILD} == "yes" @@ -40,7 +40,6 @@ libpmc_events.c: ${JEVENTS} .META fi CLEANFILES+= libpmc_events.c libpmc_events.c.tmp SRCS+= libpmc_events.c -.endif WARNS?= 3 From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A582E675B62; Thu, 29 Jul 2021 15:25:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqq32l0z4t3c; Thu, 29 Jul 2021 15:25:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44ECB13F72; Thu, 29 Jul 2021 15:25:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPRAQ009885; Thu, 29 Jul 2021 15:25:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPRgZ009884; Thu, 29 Jul 2021 15:25:27 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:27 GMT Message-Id: <202107291525.16TFPRgZ009884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 6b2ccad29745 - stable/13 - pmccontrol: improve -L with pmu-events MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6b2ccad297459910f14ee7bdbbd517aacc64dafe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:27 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6b2ccad297459910f14ee7bdbbd517aacc64dafe commit 6b2ccad297459910f14ee7bdbbd517aacc64dafe Author: Mitchell Horne AuthorDate: 2021-05-31 14:14:36 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 pmccontrol: improve -L with pmu-events Check if the pmu utils are supported rather than carrying a machine-dependent #ifdef. Reviewed by: gnn, ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30526 (cherry picked from commit 167cdaa7e30093215a753d4f788d921b1f7c1474) --- usr.sbin/pmccontrol/pmccontrol.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.sbin/pmccontrol/pmccontrol.c b/usr.sbin/pmccontrol/pmccontrol.c index 147aab2d2ba1..9d57a2923784 100644 --- a/usr.sbin/pmccontrol/pmccontrol.c +++ b/usr.sbin/pmccontrol/pmccontrol.c @@ -282,14 +282,6 @@ pmcc_do_list_state(void) return 0; } -#if defined(__i386__) || defined(__amd64__) -static int -pmcc_do_list_events(void) -{ - pmc_pmu_print_counters(NULL); - return (0); -} -#else static int pmcc_do_list_events(void) { @@ -298,6 +290,13 @@ pmcc_do_list_events(void) const char **eventnamelist; const struct pmc_cpuinfo *ci; + /* First, try pmu events. */ + if (pmc_pmu_enabled()) { + pmc_pmu_print_counters(NULL); + return (0); + } + + /* Otherwise, use the legacy pmc(3) interfaces. */ if (pmc_cpuinfo(&ci) != 0) err(EX_OSERR, "Unable to determine CPU information"); @@ -319,7 +318,6 @@ pmcc_do_list_events(void) } return 0; } -#endif static int pmcc_show_statistics(void) From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82BEF675F0A; Thu, 29 Jul 2021 15:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqn1Yh8z4t5M; Thu, 29 Jul 2021 15:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0264D1432A; Thu, 29 Jul 2021 15:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPOWf009835; Thu, 29 Jul 2021 15:25:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPOgn009834; Thu, 29 Jul 2021 15:25:24 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:24 GMT Message-Id: <202107291525.16TFPOgn009834@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 3a9b3a847026 - stable/13 - libpmc: remove pe->alias MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a9b3a8470261d052d25a2a2b628a0dd214d1091 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:25 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=3a9b3a8470261d052d25a2a2b628a0dd214d1091 commit 3a9b3a8470261d052d25a2a2b628a0dd214d1091 Author: Mitchell Horne AuthorDate: 2021-05-31 14:23:19 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: remove pe->alias It has never been a part of upstream's struct pmu_event. The jevents utility will not fill this field, so remove it. Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30530 (cherry picked from commit 0c915023dbb7000cd30bb768eb84f6dc757adcc5) --- lib/libpmc/libpmc_pmu_util.c | 4 ---- lib/libpmc/pmu-events/pmu-events.h | 1 - 2 files changed, 5 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 1b2c10e07368..6a287a66a2f8 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -302,8 +302,6 @@ pmc_pmu_sample_rate_get(const char *event_name) event_name = pmu_alias_get(event_name); if ((pe = pmu_event_get(NULL, event_name, NULL)) == NULL) return (DEFAULT_SAMPLE_COUNT); - if (pe->alias && (pe = pmu_event_get(NULL, pe->alias, NULL)) == NULL) - return (DEFAULT_SAMPLE_COUNT); if (pe->event == NULL) return (DEFAULT_SAMPLE_COUNT); if (pmu_parse_event(&ped, pe->event)) @@ -526,8 +524,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) event_name = pmu_alias_get(event_name); if ((pe = pmu_event_get(NULL, event_name, &idx)) == NULL) return (ENOENT); - if (pe->alias && (pe = pmu_event_get(NULL, pe->alias, &idx)) == NULL) - return (ENOENT); assert(idx >= 0); pm->pm_ev = idx; diff --git a/lib/libpmc/pmu-events/pmu-events.h b/lib/libpmc/pmu-events/pmu-events.h index c4c01e20114d..cfc82f20364c 100644 --- a/lib/libpmc/pmu-events/pmu-events.h +++ b/lib/libpmc/pmu-events/pmu-events.h @@ -10,7 +10,6 @@ */ struct pmu_event { const char *name; - const char *alias; const char *event; const char *desc; const char *topic; From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA3FF675F88; Thu, 29 Jul 2021 15:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqv170tz4t5g; Thu, 29 Jul 2021 15:25:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3C9C1451A; Thu, 29 Jul 2021 15:25:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPUjP009965; Thu, 29 Jul 2021 15:25:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPUoZ009964; Thu, 29 Jul 2021 15:25:30 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:30 GMT Message-Id: <202107291525.16TFPUoZ009964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 87c9a2933bdb - stable/13 - libpmc: make libpmc_pmu_utils.c more amenable to porting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 87c9a2933bdb537cc163aaeb16e588d303dc1d50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:31 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=87c9a2933bdb537cc163aaeb16e588d303dc1d50 commit 87c9a2933bdb537cc163aaeb16e588d303dc1d50 Author: Mitchell Horne AuthorDate: 2021-05-31 14:24:44 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: make libpmc_pmu_utils.c more amenable to porting The current version has every function stubbed out for !x86. Only two functions (pmu_alias_get() and pmc_pmu_pmcallocate() are really platform dependent, so reduce the width of the ifdefs and remove some of the stubs. Reviewed by: ray MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30532 (cherry picked from commit 0024f1aa7720d5f4f587a6c5911fc5238195ae49) --- lib/libpmc/libpmc_pmu_util.c | 65 ++++++++------------------------------------ 1 file changed, 12 insertions(+), 53 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 90ce0feafa52..81320a3dc954 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -43,12 +43,12 @@ #include #include "pmu-events/pmu-events.h" -#if defined(__amd64__) || defined(__i386__) struct pmu_alias { const char *pa_alias; const char *pa_name; }; +#if defined(__amd64__) || defined(__i386__) typedef enum { PMU_INVALID, PMU_INTEL, @@ -139,6 +139,16 @@ pmu_alias_get(const char *name) return (name); } +#else + +static const char * +pmu_alias_get(const char *name) +{ + + return (name); +} +#endif + struct pmu_event_desc { uint64_t ped_period; uint64_t ped_offcore_rsp; @@ -417,6 +427,7 @@ pmc_pmu_print_counter_full(const char *ev) } } +#if defined(__amd64__) || defined(__i386__) static int pmc_pmu_amd_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, struct pmu_event_desc *ped) @@ -540,61 +551,9 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) #else -uint64_t -pmc_pmu_sample_rate_get(const char *event_name __unused) -{ - return (DEFAULT_SAMPLE_COUNT); -} - -void -pmc_pmu_print_counters(const char *event_name __unused) -{ -} - -void -pmc_pmu_print_counter_desc(const char *e __unused) -{ -} - -void -pmc_pmu_print_counter_desc_long(const char *e __unused) -{ -} - -void -pmc_pmu_print_counter_full(const char *e __unused) -{ - -} - -int -pmc_pmu_enabled(void) -{ - return (0); -} - int pmc_pmu_pmcallocate(const char *e __unused, struct pmc_op_pmcallocate *p __unused) { return (EOPNOTSUPP); } - -const char * -pmc_pmu_event_get_by_idx(const char *c __unused, int idx __unused) -{ - return (NULL); -} - -int -pmc_pmu_stat_mode(const char ***a __unused) -{ - return (EOPNOTSUPP); -} - -int -pmc_pmu_idx_get_by_event(const char *c __unused, const char *e __unused) -{ - return (-1); -} - #endif From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0580676105; Thu, 29 Jul 2021 15:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDr070r1z4t67; Thu, 29 Jul 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94370142C2; Thu, 29 Jul 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPagf010095; Thu, 29 Jul 2021 15:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPaWf010094; Thu, 29 Jul 2021 15:25:36 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:36 GMT Message-Id: <202107291525.16TFPaWf010094@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 28ff0070f7c8 - stable/13 - libpmc: Import AMD Zen 3 PMU events MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 28ff0070f7c81f8a65b94e2ff8bb1e9cda98b065 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:38 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=28ff0070f7c81f8a65b94e2ff8bb1e9cda98b065 commit 28ff0070f7c81f8a65b94e2ff8bb1e9cda98b065 Author: Greg V AuthorDate: 2021-06-30 21:15:21 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:05:55 +0000 libpmc: Import AMD Zen 3 PMU events Reviewed by: mav, mhorne MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30965 (cherry picked from commit 8c2dd68caa963f1900a8228b0732b04f5d530ffa) --- lib/libpmc/pmu-events/arch/x86/amdzen3/branch.json | 53 +++ lib/libpmc/pmu-events/arch/x86/amdzen3/cache.json | 402 +++++++++++++++++++ lib/libpmc/pmu-events/arch/x86/amdzen3/core.json | 137 +++++++ .../pmu-events/arch/x86/amdzen3/data-fabric.json | 98 +++++ .../arch/x86/amdzen3/floating-point.json | 139 +++++++ lib/libpmc/pmu-events/arch/x86/amdzen3/memory.json | 428 +++++++++++++++++++++ lib/libpmc/pmu-events/arch/x86/amdzen3/other.json | 103 +++++ .../pmu-events/arch/x86/amdzen3/recommended.json | 214 +++++++++++ lib/libpmc/pmu-events/arch/x86/mapfile.csv | 1 + 9 files changed, 1575 insertions(+) diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/branch.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/branch.json new file mode 100644 index 000000000000..018a7fe94fb9 --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/branch.json @@ -0,0 +1,53 @@ +[ + { + "EventName": "bp_l1_btb_correct", + "EventCode": "0x8a", + "BriefDescription": "L1 Branch Prediction Overrides Existing Prediction (speculative)." + }, + { + "EventName": "bp_l2_btb_correct", + "EventCode": "0x8b", + "BriefDescription": "L2 Branch Prediction Overrides Existing Prediction (speculative)." + }, + { + "EventName": "bp_dyn_ind_pred", + "EventCode": "0x8e", + "BriefDescription": "Dynamic Indirect Predictions.", + "PublicDescription": "The number of times a branch used the indirect predictor to make a prediction." + }, + { + "EventName": "bp_de_redirect", + "EventCode": "0x91", + "BriefDescription": "Decode Redirects", + "PublicDescription": "The number of times the instruction decoder overrides the predicted target." + }, + { + "EventName": "bp_l1_tlb_fetch_hit", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB.", + "UMask": "0xff" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if1g", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. L1 Instruction TLB hit (1G page size).", + "UMask": "0x04" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if2m", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. L1 Instruction TLB hit (2M page size).", + "UMask": "0x02" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if4k", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. L1 Instrcution TLB hit (4K or 16K page size).", + "UMask": "0x01" + }, + { + "EventName": "bp_tlb_rel", + "EventCode": "0x99", + "BriefDescription": "The number of ITLB reload requests." + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/cache.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/cache.json new file mode 100644 index 000000000000..fa1d7499a2e3 --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/cache.json @@ -0,0 +1,402 @@ +[ + { + "EventName": "l2_request_g1.rd_blk_l", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Data cache reads (including hardware and software prefetch).", + "UMask": "0x80" + }, + { + "EventName": "l2_request_g1.rd_blk_x", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Data cache stores.", + "UMask": "0x40" + }, + { + "EventName": "l2_request_g1.ls_rd_blk_c_s", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Data cache shared reads.", + "UMask": "0x20" + }, + { + "EventName": "l2_request_g1.cacheable_ic_read", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Instruction cache reads.", + "UMask": "0x10" + }, + { + "EventName": "l2_request_g1.change_to_x", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). Data cache state change requests. Request change to writable, check L2 for current state.", + "UMask": "0x08" + }, + { + "EventName": "l2_request_g1.prefetch_l2_cmd", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). PrefetchL2Cmd.", + "UMask": "0x04" + }, + { + "EventName": "l2_request_g1.l2_hw_pf", + "EventCode": "0x60", + "BriefDescription": "All L2 Cache Requests (Breakdown 1 - Common). L2 Prefetcher. All prefetches accepted by L2 pipeline, hit or miss. Types of PF and L2 hit/miss broken out in a separate perfmon event.", + "UMask": "0x02" + }, + { + "EventName": "l2_request_g1.group2", + "EventCode": "0x60", + "BriefDescription": "Miscellaneous events covered in more detail by l2_request_g2 (PMCx061).", + "UMask": "0x01" + }, + { + "EventName": "l2_request_g1.all_no_prefetch", + "EventCode": "0x60", + "UMask": "0xf9" + }, + { + "EventName": "l2_request_g2.group1", + "EventCode": "0x61", + "BriefDescription": "Miscellaneous events covered in more detail by l2_request_g1 (PMCx060).", + "UMask": "0x80" + }, + { + "EventName": "l2_request_g2.ls_rd_sized", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Data cache read sized.", + "UMask": "0x40" + }, + { + "EventName": "l2_request_g2.ls_rd_sized_nc", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Data cache read sized non-cacheable.", + "UMask": "0x20" + }, + { + "EventName": "l2_request_g2.ic_rd_sized", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Instruction cache read sized.", + "UMask": "0x10" + }, + { + "EventName": "l2_request_g2.ic_rd_sized_nc", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Instruction cache read sized non-cacheable.", + "UMask": "0x08" + }, + { + "EventName": "l2_request_g2.smc_inval", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Self-modifying code invalidates.", + "UMask": "0x04" + }, + { + "EventName": "l2_request_g2.bus_locks_originator", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Bus locks.", + "UMask": "0x02" + }, + { + "EventName": "l2_request_g2.bus_locks_responses", + "EventCode": "0x61", + "BriefDescription": "All L2 Cache Requests (Breakdown 2 - Rare). Bus lock response.", + "UMask": "0x01" + }, + { + "EventName": "l2_latency.l2_cycles_waiting_on_fills", + "EventCode": "0x62", + "BriefDescription": "Total cycles spent waiting for L2 fills to complete from L3 or memory, divided by four. Event counts are for both threads. To calculate average latency, the number of fills from both threads must be used.", + "UMask": "0x01" + }, + { + "EventName": "l2_wcb_req.wcb_write", + "EventCode": "0x63", + "BriefDescription": "LS to L2 WCB write requests. LS (Load/Store unit) to L2 WCB (Write Combining Buffer) write requests.", + "UMask": "0x40" + }, + { + "EventName": "l2_wcb_req.wcb_close", + "EventCode": "0x63", + "BriefDescription": "LS to L2 WCB close requests. LS (Load/Store unit) to L2 WCB (Write Combining Buffer) close requests.", + "UMask": "0x20" + }, + { + "EventName": "l2_wcb_req.zero_byte_store", + "EventCode": "0x63", + "BriefDescription": "LS to L2 WCB zero byte store requests. LS (Load/Store unit) to L2 WCB (Write Combining Buffer) zero byte store requests.", + "UMask": "0x04" + }, + { + "EventName": "l2_wcb_req.cl_zero", + "EventCode": "0x63", + "BriefDescription": "LS to L2 WCB cache line zeroing requests. LS (Load/Store unit) to L2 WCB (Write Combining Buffer) cache line zeroing requests.", + "UMask": "0x01" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_cs", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache shared read hit in L2", + "UMask": "0x80" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_l_hit_x", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache read hit in L2. Modifiable.", + "UMask": "0x40" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_l_hit_s", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache read hit non-modifiable line in L2.", + "UMask": "0x20" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_x", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache store or state change hit in L2.", + "UMask": "0x10" + }, + { + "EventName": "l2_cache_req_stat.ls_rd_blk_c", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Data cache request miss in L2 (all types). Use l2_cache_misses_from_dc_misses instead.", + "UMask": "0x08" + }, + { + "EventName": "l2_cache_req_stat.ic_fill_hit_x", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache hit modifiable line in L2.", + "UMask": "0x04" + }, + { + "EventName": "l2_cache_req_stat.ic_fill_hit_s", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache hit non-modifiable line in L2.", + "UMask": "0x02" + }, + { + "EventName": "l2_cache_req_stat.ic_fill_miss", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache request miss in L2. Use l2_cache_misses_from_ic_miss instead.", + "UMask": "0x01" + }, + { + "EventName": "l2_cache_req_stat.ic_access_in_l2", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache requests in L2.", + "UMask": "0x07" + }, + { + "EventName": "l2_cache_req_stat.ic_dc_miss_in_l2", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache request miss in L2 and Data cache request miss in L2 (all types).", + "UMask": "0x09" + }, + { + "EventName": "l2_cache_req_stat.ic_dc_hit_in_l2", + "EventCode": "0x64", + "BriefDescription": "Core to L2 cacheable request access status (not including L2 Prefetch). Instruction cache request hit in L2 and Data cache request hit in L2 (all types).", + "UMask": "0xf6" + }, + { + "EventName": "l2_fill_pending.l2_fill_busy", + "EventCode": "0x6d", + "BriefDescription": "Cycles with fill pending from L2. Total cycles spent with one or more fill requests in flight from L2.", + "UMask": "0x01" + }, + { + "EventName": "l2_pf_hit_l2", + "EventCode": "0x70", + "BriefDescription": "L2 prefetch hit in L2. Use l2_cache_hits_from_l2_hwpf instead.", + "UMask": "0xff" + }, + { + "EventName": "l2_pf_miss_l2_hit_l3", + "EventCode": "0x71", + "BriefDescription": "L2 prefetcher hits in L3. Counts all L2 prefetches accepted by the L2 pipeline which miss the L2 cache and hit the L3.", + "UMask": "0xff" + }, + { + "EventName": "l2_pf_miss_l2_l3", + "EventCode": "0x72", + "BriefDescription": "L2 prefetcher misses in L3. Counts all L2 prefetches accepted by the L2 pipeline which miss the L2 and the L3 caches.", + "UMask": "0xff" + }, + { + "EventName": "ic_fw32", + "EventCode": "0x80", + "BriefDescription": "The number of 32B fetch windows transferred from IC pipe to DE instruction decoder (includes non-cacheable and cacheable fill responses)." + }, + { + "EventName": "ic_fw32_miss", + "EventCode": "0x81", + "BriefDescription": "The number of 32B fetch windows tried to read the L1 IC and missed in the full tag." + }, + { + "EventName": "ic_cache_fill_l2", + "EventCode": "0x82", + "BriefDescription": "Instruction Cache Refills from L2. The number of 64 byte instruction cache line was fulfilled from the L2 cache." + }, + { + "EventName": "ic_cache_fill_sys", + "EventCode": "0x83", + "BriefDescription": "Instruction Cache Refills from System. The number of 64 byte instruction cache line fulfilled from system memory or another cache." + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_hit", + "EventCode": "0x84", + "BriefDescription": "L1 ITLB Miss, L2 ITLB Hit. The number of instruction fetches that miss in the L1 ITLB but hit in the L2 ITLB." + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss", + "EventCode": "0x85", + "BriefDescription": "The number of instruction fetches that miss in both the L1 and L2 TLBs.", + "UMask": "0xff" + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss.coalesced_4k", + "EventCode": "0x85", + "BriefDescription": "The number of valid fills into the ITLB originating from the LS Page-Table Walker. Tablewalk requests are issued for L1-ITLB and L2-ITLB misses. Walk for >4K Coalesced page.", + "UMask": "0x08" + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss.if1g", + "EventCode": "0x85", + "BriefDescription": "The number of valid fills into the ITLB originating from the LS Page-Table Walker. Tablewalk requests are issued for L1-ITLB and L2-ITLB misses. Walk for 1G page.", + "UMask": "0x04" + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss.if2m", + "EventCode": "0x85", + "BriefDescription": "The number of valid fills into the ITLB originating from the LS Page-Table Walker. Tablewalk requests are issued for L1-ITLB and L2-ITLB misses. Walk for 2M page.", + "UMask": "0x02" + }, + { + "EventName": "bp_l1_tlb_miss_l2_tlb_miss.if4k", + "EventCode": "0x85", + "BriefDescription": "The number of valid fills into the ITLB originating from the LS Page-Table Walker. Tablewalk requests are issued for L1-ITLB and L2-ITLB misses. Walk to 4K page.", + "UMask": "0x01" + }, + { + "EventName": "bp_snp_re_sync", + "EventCode": "0x86", + "BriefDescription": "The number of pipeline restarts caused by invalidating probes that hit on the instruction stream currently being executed. This would happen if the active instruction stream was being modified by another processor in an MP system - typically a highly unlikely event." + }, + { + "EventName": "ic_fetch_stall.ic_stall_any", + "EventCode": "0x87", + "BriefDescription": "Instruction Pipe Stall. IC pipe was stalled during this clock cycle for any reason (nothing valid in pipe ICM1).", + "UMask": "0x04" + }, + { + "EventName": "ic_fetch_stall.ic_stall_dq_empty", + "EventCode": "0x87", + "BriefDescription": "Instruction Pipe Stall. IC pipe was stalled during this clock cycle (including IC to OC fetches) due to DQ empty.", + "UMask": "0x02" + }, + { + "EventName": "ic_fetch_stall.ic_stall_back_pressure", + "EventCode": "0x87", + "BriefDescription": "Instruction Pipe Stall. IC pipe was stalled during this clock cycle (including IC to OC fetches) due to back-pressure.", + "UMask": "0x01" + }, + { + "EventName": "ic_cache_inval.l2_invalidating_probe", + "EventCode": "0x8c", + "BriefDescription": "IC line invalidated due to L2 invalidating probe (external or LS). The number of instruction cache lines invalidated. A non-SMC event is CMC (cross modifying code), either from the other thread of the core or another core.", + "UMask": "0x02" + }, + { + "EventName": "ic_cache_inval.fill_invalidated", + "EventCode": "0x8c", + "BriefDescription": "IC line invalidated due to overwriting fill response. The number of instruction cache lines invalidated. A non-SMC event is CMC (cross modifying code), either from the other thread of the core or another core.", + "UMask": "0x01" + }, + { + "EventName": "ic_tag_hit_miss.all_instruction_cache_accesses", + "EventCode": "0x18e", + "BriefDescription": "All Instruction Cache Accesses. Counts various IC tag related hit and miss events.", + "UMask": "0x1f" + }, + { + "EventName": "ic_tag_hit_miss.instruction_cache_miss", + "EventCode": "0x18e", + "BriefDescription": "Instruction Cache Miss. Counts various IC tag related hit and miss events.", + "UMask": "0x18" + }, + { + "EventName": "ic_tag_hit_miss.instruction_cache_hit", + "EventCode": "0x18e", + "BriefDescription": "Instruction Cache Hit. Counts various IC tag related hit and miss events.", + "UMask": "0x07" + }, + { + "EventName": "ic_oc_mode_switch.oc_ic_mode_switch", + "EventCode": "0x28a", + "BriefDescription": "OC Mode Switch. OC to IC mode switch.", + "UMask": "0x02" + }, + { + "EventName": "ic_oc_mode_switch.ic_oc_mode_switch", + "EventCode": "0x28a", + "BriefDescription": "OC Mode Switch. IC to OC mode switch.", + "UMask": "0x01" + }, + { + "EventName": "op_cache_hit_miss.all_op_cache_accesses", + "EventCode": "0x28f", + "BriefDescription": "All Op Cache accesses. Counts Op Cache micro-tag hit/miss events", + "UMask": "0x07" + }, + { + "EventName": "op_cache_hit_miss.op_cache_miss", + "EventCode": "0x28f", + "BriefDescription": "Op Cache Miss. Counts Op Cache micro-tag hit/miss events", + "UMask": "0x04" + }, + { + "EventName": "op_cache_hit_miss.op_cache_hit", + "EventCode": "0x28f", + "BriefDescription": "Op Cache Hit. Counts Op Cache micro-tag hit/miss events", + "UMask": "0x03" + }, + { + "EventName": "l3_request_g1.caching_l3_cache_accesses", + "EventCode": "0x01", + "BriefDescription": "Caching: L3 cache accesses", + "UMask": "0x80", + "Unit": "L3PMC" + }, + { + "EventName": "l3_lookup_state.all_l3_req_typs", + "EventCode": "0x04", + "BriefDescription": "All L3 Request Types. All L3 cache Requests", + "UMask": "0xff", + "Unit": "L3PMC" + }, + { + "EventName": "l3_comb_clstr_state.other_l3_miss_typs", + "EventCode": "0x06", + "BriefDescription": "Other L3 Miss Request Types", + "UMask": "0xfe", + "Unit": "L3PMC" + }, + { + "EventName": "l3_comb_clstr_state.request_miss", + "EventCode": "0x06", + "BriefDescription": "L3 cache misses", + "UMask": "0x01", + "Unit": "L3PMC" + }, + { + "EventName": "xi_sys_fill_latency", + "EventCode": "0x90", + "BriefDescription": "L3 Cache Miss Latency. Total cycles for all transactions divided by 16. Ignores SliceMask and ThreadMask.", + "Unit": "L3PMC" + }, + { + "EventName": "xi_ccx_sdp_req1", + "EventCode": "0x9a", + "BriefDescription": "L3 Misses by Request Type. Ignores SliceID, EnAllSlices, CoreID, EnAllCores and ThreadMask. Requires unit mask 0xFF to engage event for counting.", + "UMask": "0xff", + "Unit": "L3PMC" + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/core.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/core.json new file mode 100644 index 000000000000..4e27a2be359e --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/core.json @@ -0,0 +1,137 @@ +[ + { + "EventName": "ex_ret_instr", + "EventCode": "0xc0", + "BriefDescription": "Retired Instructions." + }, + { + "EventName": "ex_ret_ops", + "EventCode": "0xc1", + "BriefDescription": "Retired Ops. Use macro_ops_retired instead.", + "PublicDescription": "The number of macro-ops retired." + }, + { + "EventName": "ex_ret_brn", + "EventCode": "0xc2", + "BriefDescription": "Retired Branch Instructions.", + "PublicDescription": "The number of branch instructions retired. This includes all types of architectural control flow changes, including exceptions and interrupts." + }, + { + "EventName": "ex_ret_brn_misp", + "EventCode": "0xc3", + "BriefDescription": "Retired Branch Instructions Mispredicted.", + "PublicDescription": "The number of retired branch instructions, that were mispredicted." + }, + { + "EventName": "ex_ret_brn_tkn", + "EventCode": "0xc4", + "BriefDescription": "Retired Taken Branch Instructions.", + "PublicDescription": "The number of taken branches that were retired. This includes all types of architectural control flow changes, including exceptions and interrupts." + }, + { + "EventName": "ex_ret_brn_tkn_misp", + "EventCode": "0xc5", + "BriefDescription": "Retired Taken Branch Instructions Mispredicted.", + "PublicDescription": "The number of retired taken branch instructions that were mispredicted." + }, + { + "EventName": "ex_ret_brn_far", + "EventCode": "0xc6", + "BriefDescription": "Retired Far Control Transfers.", + "PublicDescription": "The number of far control transfers retired including far call/jump/return, IRET, SYSCALL and SYSRET, plus exceptions and interrupts. Far control transfers are not subject to branch prediction." + }, + { + "EventName": "ex_ret_brn_resync", + "EventCode": "0xc7", + "BriefDescription": "Retired Branch Resyncs.", + "PublicDescription": "The number of resync branches. These reflect pipeline restarts due to certain microcode assists and events such as writes to the active instruction stream, among other things. Each occurrence reflects a restart penalty similar to a branch mispredict. This is relatively rare." + }, + { + "EventName": "ex_ret_near_ret", + "EventCode": "0xc8", + "BriefDescription": "Retired Near Returns.", + "PublicDescription": "The number of near return instructions (RET or RET Iw) retired." + }, + { + "EventName": "ex_ret_near_ret_mispred", + "EventCode": "0xc9", + "BriefDescription": "Retired Near Returns Mispredicted.", + "PublicDescription": "The number of near returns retired that were not correctly predicted by the return address predictor. Each such mispredict incurs the same penalty as a mispredicted conditional branch instruction." + }, + { + "EventName": "ex_ret_brn_ind_misp", + "EventCode": "0xca", + "BriefDescription": "Retired Indirect Branch Instructions Mispredicted.", + "PublicDescription": "The number of indirect branches retired that were not correctly predicted. Each such mispredict incurs the same penalty as a mispredicted conditional branch instruction. Note that only EX mispredicts are counted." + }, + { + "EventName": "ex_ret_mmx_fp_instr.sse_instr", + "EventCode": "0xcb", + "BriefDescription": "SSE instructions (SSE, SSE2, SSE3, SSSE3, SSE4A, SSE41, SSE42, AVX).", + "PublicDescription": "The number of MMX, SSE or x87 instructions retired. The UnitMask allows the selection of the individual classes of instructions as given in the table. Each increment represents one complete instruction. Since this event includes non-numeric instructions it is not suitable for measuring MFLOPS.", + "UMask": "0x04" + }, + { + "EventName": "ex_ret_mmx_fp_instr.mmx_instr", + "EventCode": "0xcb", + "BriefDescription": "MMX instructions.", + "PublicDescription": "The number of MMX, SSE or x87 instructions retired. The UnitMask allows the selection of the individual classes of instructions as given in the table. Each increment represents one complete instruction. Since this event includes non-numeric instructions it is not suitable for measuring MFLOPS. MMX instructions.", + "UMask": "0x02" + }, + { + "EventName": "ex_ret_mmx_fp_instr.x87_instr", + "EventCode": "0xcb", + "BriefDescription": "x87 instructions.", + "PublicDescription": "The number of MMX, SSE or x87 instructions retired. The UnitMask allows the selection of the individual classes of instructions as given in the table. Each increment represents one complete instruction. Since this event includes non-numeric instructions it is not suitable for measuring MFLOPS. x87 instructions.", + "UMask": "0x01" + }, + { + "EventName": "ex_ret_ind_brch_instr", + "EventCode": "0xcc", + "BriefDescription": "Retired Indirect Branch Instructions. The number of indirect branches retired." + }, + { + "EventName": "ex_ret_cond", + "EventCode": "0xd1", + "BriefDescription": "Retired Conditional Branch Instructions." + }, + { + "EventName": "ex_div_busy", + "EventCode": "0xd3", + "BriefDescription": "Div Cycles Busy count." + }, + { + "EventName": "ex_div_count", + "EventCode": "0xd4", + "BriefDescription": "Div Op Count." + }, + { + "EventName": "ex_ret_msprd_brnch_instr_dir_msmtch", + "EventCode": "0x1c7", + "BriefDescription": "Retired Mispredicted Branch Instructions due to Direction Mismatch", + "PublicDescription": "The number of retired conditional branch instructions that were not correctly predicted because of a branch direction mismatch." + }, + { + "EventName": "ex_tagged_ibs_ops.ibs_count_rollover", + "EventCode": "0x1cf", + "BriefDescription": "Tagged IBS Ops. Number of times an op could not be tagged by IBS because of a previous tagged op that has not retired.", + "UMask": "0x04" + }, + { + "EventName": "ex_tagged_ibs_ops.ibs_tagged_ops_ret", + "EventCode": "0x1cf", + "BriefDescription": "Tagged IBS Ops. Number of Ops tagged by IBS that retired.", + "UMask": "0x02" + }, + { + "EventName": "ex_tagged_ibs_ops.ibs_tagged_ops", + "EventCode": "0x1cf", + "BriefDescription": "Tagged IBS Ops. Number of Ops tagged by IBS.", + "UMask": "0x01" + }, + { + "EventName": "ex_ret_fused_instr", + "EventCode": "0x1d0", + "BriefDescription": "Counts retired Fused Instructions." + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/data-fabric.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/data-fabric.json new file mode 100644 index 000000000000..40271df40015 --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/data-fabric.json @@ -0,0 +1,98 @@ +[ + { + "EventName": "remote_outbound_data_controller_0", + "PublicDescription": "Remote Link Controller Outbound Packet Types: Data (32B): Remote Link Controller 0", + "EventCode": "0x7c7", + "UMask": "0x02", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "remote_outbound_data_controller_1", + "PublicDescription": "Remote Link Controller Outbound Packet Types: Data (32B): Remote Link Controller 1", + "EventCode": "0x807", + "UMask": "0x02", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "remote_outbound_data_controller_2", + "PublicDescription": "Remote Link Controller Outbound Packet Types: Data (32B): Remote Link Controller 2", + "EventCode": "0x847", + "UMask": "0x02", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "remote_outbound_data_controller_3", + "PublicDescription": "Remote Link Controller Outbound Packet Types: Data (32B): Remote Link Controller 3", + "EventCode": "0x887", + "UMask": "0x02", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_0", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x07", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_1", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x47", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_2", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x87", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_3", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0xc7", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_4", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x107", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_5", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x147", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_6", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x187", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + }, + { + "EventName": "dram_channel_data_controller_7", + "PublicDescription": "DRAM Channel Controller Request Types: Requests with Data (64B): DRAM Channel Controller 0", + "EventCode": "0x1c7", + "UMask": "0x38", + "PerPkg": "1", + "Unit": "DFPMC" + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/floating-point.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/floating-point.json new file mode 100644 index 000000000000..98cfcb9c78ec --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/floating-point.json @@ -0,0 +1,139 @@ +[ + { + "EventName": "fpu_pipe_assignment.total", + "EventCode": "0x00", + "BriefDescription": "Total number of fp uOps.", + "PublicDescription": "Total number of fp uOps. The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS.", + "UMask": "0x0f" + }, + { + "EventName": "fpu_pipe_assignment.total3", + "EventCode": "0x00", + "BriefDescription": "Total number uOps assigned to pipe 3.", + "PublicDescription": "The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one-cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS. Total number uOps assigned to pipe 3.", + "UMask": "0x08" + }, + { + "EventName": "fpu_pipe_assignment.total2", + "EventCode": "0x00", + "BriefDescription": "Total number uOps assigned to pipe 2.", + "PublicDescription": "The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS. Total number uOps assigned to pipe 2.", + "UMask": "0x04" + }, + { + "EventName": "fpu_pipe_assignment.total1", + "EventCode": "0x00", + "BriefDescription": "Total number uOps assigned to pipe 1.", + "PublicDescription": "The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS. Total number uOps assigned to pipe 1.", + "UMask": "0x02" + }, + { + "EventName": "fpu_pipe_assignment.total0", + "EventCode": "0x00", + "BriefDescription": "Total number of fp uOps on pipe 0.", + "PublicDescription": "The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS. Total number uOps assigned to pipe 0.", + "UMask": "0x01" + }, + { + "EventName": "fp_ret_sse_avx_ops.all", + "EventCode": "0x03", + "BriefDescription": "All FLOPS. This is a retire-based event. The number of retired SSE/AVX FLOPS. The number of events logged per cycle can vary from 0 to 64. This event can count above 15.", + "UMask": "0xff" + }, + { + "EventName": "fp_ret_sse_avx_ops.mac_flops", + "EventCode": "0x03", + "BriefDescription": "Multiply-Accumulate FLOPs. Each MAC operation is counted as 2 FLOPS. This is a retire-based event. The number of retired SSE/AVX FLOPs. The number of events logged per cycle can vary from 0 to 64. This event requires the use of the MergeEvent since it can count above 15 events per cycle. See 2.1.17.3 [Large Increment per Cycle Events]. It does not provide a useful count without the use of the MergeEvent.", + "UMask": "0x08" + }, + { + "EventName": "fp_ret_sse_avx_ops.div_flops", + "EventCode": "0x03", + "BriefDescription": "Divide/square root FLOPs. This is a retire-based event. The number of retired SSE/AVX FLOPs. The number of events logged per cycle can vary from 0 to 64. This event requires the use of the MergeEvent since it can count above 15 events per cycle. See 2.1.17.3 [Large Increment per Cycle Events]. It does not provide a useful count without the use of the MergeEvent.", + "UMask": "0x04" + }, + { + "EventName": "fp_ret_sse_avx_ops.mult_flops", + "EventCode": "0x03", + "BriefDescription": "Multiply FLOPs. This is a retire-based event. The number of retired SSE/AVX FLOPs. The number of events logged per cycle can vary from 0 to 64. This event requires the use of the MergeEvent since it can count above 15 events per cycle. See 2.1.17.3 [Large Increment per Cycle Events]. It does not provide a useful count without the use of the MergeEvent.", + "UMask": "0x02" + }, + { + "EventName": "fp_ret_sse_avx_ops.add_sub_flops", + "EventCode": "0x03", + "BriefDescription": "Add/subtract FLOPs. This is a retire-based event. The number of retired SSE/AVX FLOPs. The number of events logged per cycle can vary from 0 to 64. This event requires the use of the MergeEvent since it can count above 15 events per cycle. See 2.1.17.3 [Large Increment per Cycle Events]. It does not provide a useful count without the use of the MergeEvent.", + "UMask": "0x01" + }, + { + "EventName": "fp_num_mov_elim_scal_op.optimized", + "EventCode": "0x04", + "BriefDescription": "Number of Scalar Ops optimized. This is a dispatch based speculative event, and is useful for measuring the effectiveness of the Move elimination and Scalar code optimization schemes.", + "UMask": "0x08" + }, + { + "EventName": "fp_num_mov_elim_scal_op.opt_potential", + "EventCode": "0x04", + "BriefDescription": "Number of Ops that are candidates for optimization (have Z-bit either set or pass). This is a dispatch based speculative event, and is useful for measuring the effectiveness of the Move elimination and Scalar code optimization schemes.", + "UMask": "0x04" + }, + { + "EventName": "fp_num_mov_elim_scal_op.sse_mov_ops_elim", + "EventCode": "0x04", + "BriefDescription": "Number of SSE Move Ops eliminated. This is a dispatch based speculative event, and is useful for measuring the effectiveness of the Move elimination and Scalar code optimization schemes.", + "UMask": "0x02" + }, + { + "EventName": "fp_num_mov_elim_scal_op.sse_mov_ops", + "EventCode": "0x04", + "BriefDescription": "Number of SSE Move Ops. This is a dispatch based speculative event, and is useful for measuring the effectiveness of the Move elimination and Scalar code optimization schemes.", + "UMask": "0x01" + }, + { + "EventName": "fp_retired_ser_ops.sse_bot_ret", + "EventCode": "0x05", + "BriefDescription": "SSE/AVX bottom-executing ops retired. The number of serializing Ops retired.", + "UMask": "0x08" + }, + { + "EventName": "fp_retired_ser_ops.sse_ctrl_ret", + "EventCode": "0x05", + "BriefDescription": "SSE/AVX control word mispredict traps. The number of serializing Ops retired.", + "UMask": "0x04" + }, + { + "EventName": "fp_retired_ser_ops.x87_bot_ret", + "EventCode": "0x05", + "BriefDescription": "x87 bottom-executing ops retired. The number of serializing Ops retired.", + "UMask": "0x02" + }, + { + "EventName": "fp_retired_ser_ops.x87_ctrl_ret", + "EventCode": "0x05", + "BriefDescription": "x87 control word mispredict traps due to mispredictions in RC or PC, or changes in mask bits. The number of serializing Ops retired.", + "UMask": "0x01" + }, + { + "EventName": "fp_disp_faults.ymm_spill_fault", + "EventCode": "0x0e", + "BriefDescription": "Floating Point Dispatch Faults. YMM spill fault.", + "UMask": "0x08" + }, + { + "EventName": "fp_disp_faults.ymm_fill_fault", + "EventCode": "0x0e", + "BriefDescription": "Floating Point Dispatch Faults. YMM fill fault.", + "UMask": "0x04" + }, + { + "EventName": "fp_disp_faults.xmm_fill_fault", + "EventCode": "0x0e", + "BriefDescription": "Floating Point Dispatch Faults. XMM fill fault.", + "UMask": "0x02" + }, + { + "EventName": "fp_disp_faults.x87_fill_fault", + "EventCode": "0x0e", + "BriefDescription": "Floating Point Dispatch Faults. x87 fill fault.", + "UMask": "0x01" + } +] diff --git a/lib/libpmc/pmu-events/arch/x86/amdzen3/memory.json b/lib/libpmc/pmu-events/arch/x86/amdzen3/memory.json new file mode 100644 index 000000000000..a2833955dcd2 --- /dev/null +++ b/lib/libpmc/pmu-events/arch/x86/amdzen3/memory.json @@ -0,0 +1,428 @@ +[ + { + "EventName": "ls_bad_status2.stli_other", + "EventCode": "0x24", + "BriefDescription": "Non-forwardable conflict; used to reduce STLI's via software. All reasons. Store To Load Interlock (STLI) are loads that were unable to complete because of a possible match with an older store, and the older store could not do STLF for some reason.", + "PublicDescription" : "Store-to-load conflicts: A load was unable to complete due to a non-forwardable conflict with an older store. Most commonly, a load's address range partially but not completely overlaps with an uncompleted older store. Software can avoid this problem by using same-size and same-alignment loads and stores when accessing the same data. Vector/SIMD code is particularly susceptible to this problem; software should construct wide vector stores by manipulating vector elements in registers using shuffle/blend/swap instructions prior to storing to memory, instead of using narrow element-by-element stores.", + "UMask": "0x02" + }, + { + "EventName": "ls_locks.spec_lock_hi_spec", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions. High speculative cacheable lock speculation succeeded.", + "UMask": "0x08" + }, + { + "EventName": "ls_locks.spec_lock_lo_spec", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions. Low speculative cacheable lock speculation succeeded.", + "UMask": "0x04" + }, + { + "EventName": "ls_locks.non_spec_lock", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions. Non-speculative lock succeeded.", + "UMask": "0x02" + }, + { + "EventName": "ls_locks.bus_lock", + "EventCode": "0x25", + "BriefDescription": "Retired lock instructions. Comparable to legacy bus lock.", + "UMask": "0x01" + }, + { + "EventName": "ls_ret_cl_flush", + "EventCode": "0x26", + "BriefDescription": "The number of retired CLFLUSH instructions. This is a non-speculative event." + }, + { + "EventName": "ls_ret_cpuid", + "EventCode": "0x27", + "BriefDescription": "The number of CPUID instructions retired." + }, + { + "EventName": "ls_dispatch.ld_st_dispatch", + "EventCode": "0x29", + "BriefDescription": "Load-op-Store Dispatch. Dispatch of a single op that performs a load from and store to the same memory address. Counts the number of operations dispatched to the LS unit. Unit Masks ADDed.", + "UMask": "0x04" + }, + { + "EventName": "ls_dispatch.store_dispatch", + "EventCode": "0x29", + "BriefDescription": "Dispatch of a single op that performs a memory store. Counts the number of operations dispatched to the LS unit. Unit Masks ADDed.", + "UMask": "0x02" + }, + { + "EventName": "ls_dispatch.ld_dispatch", + "EventCode": "0x29", + "BriefDescription": "Dispatch of a single op that performs a memory load. Counts the number of operations dispatched to the LS unit. Unit Masks ADDed.", + "UMask": "0x01" + }, + { + "EventName": "ls_smi_rx", + "EventCode": "0x2b", + "BriefDescription": "Counts the number of SMIs received." + }, + { + "EventName": "ls_int_taken", + "EventCode": "0x2c", + "BriefDescription": "Counts the number of interrupts taken." + }, + { + "EventName": "ls_rdtsc", + "EventCode": "0x2d", + "BriefDescription": "Number of reads of the TSC (RDTSC instructions). The count is speculative." + }, + { + "EventName": "ls_stlf", + "EventCode": "0x35", + "BriefDescription": "Number of STLF hits." + }, + { + "EventName": "ls_st_commit_cancel2.st_commit_cancel_wcb_full", + "EventCode": "0x37", + "BriefDescription": "A non-cacheable store and the non-cacheable commit buffer is full.", + "UMask": "0x01" + }, + { + "EventName": "ls_dc_accesses", + "EventCode": "0x40", + "BriefDescription": "Number of accesses to the dcache for load/store references.", + "PublicDescription": "The number of accesses to the data cache for load and store references. This may include certain microcode scratchpad accesses, although these are generally rare. Each increment represents an eight-byte access, although the instruction may only be accessing a portion of that. This event is a speculative event." + }, + { *** 674 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDCF3676093; Thu, 29 Jul 2021 15:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqy3Qjmz4tBR; Thu, 29 Jul 2021 15:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 423DC142C1; Thu, 29 Jul 2021 15:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPYnx010039; Thu, 29 Jul 2021 15:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPYEe010038; Thu, 29 Jul 2021 15:25:34 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:34 GMT Message-Id: <202107291525.16TFPYEe010038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 83166f871407 - stable/13 - arm64 support for pmu-events MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 83166f87140764c36d7c6bdfab0433aceada66a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:35 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=83166f87140764c36d7c6bdfab0433aceada66a9 commit 83166f87140764c36d7c6bdfab0433aceada66a9 Author: Mitchell Horne AuthorDate: 2021-05-19 16:11:33 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:02:05 +0000 arm64 support for pmu-events 8cc3815f: hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE Make it possible to specify event codes without an offset of PMC_EV_ARMV8_FIRST, by setting a machine-dependent flag. This is required to make use of event definitions from pmu-events. Reviewed by: ray (slightly earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30602 28dd6730: libpmc: enable pmu_utils on arm64 This allows supported libpmc to query/select from the pmu-events table, which may have a more complete set of events than what we define manually. A future update to these definitions should greatly improve this support. The alias table is empty for now, until this future import is complete. Add the Foundation's copyright for recent work on this file. Reviewed by: ray (slightly earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30603 27ea55fc: libpmc/hwpmc: fix issues with arm64 pmu-events support Due to a mis-merge, the changes committed to libpmc never called pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be used to carry the actual pmc event code anyway, as it is expected to contain the index into the pmu event array (otherwise, it breaks event name lookup in pmclog_get_event()). Add a new MD field, pm_md.pm_md_config, to pass the raw event code to arm64_allocate_pmc(). Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as this is a union, not a struct. Restore the proper padding size. Reviewed by: luporl, ray, andrew Fixes: 28dd6730a5d6 ("libpmc: enable pmu_utils on arm64") Fixes: 8cc3815f02be ("hwpmc_arm64: accept raw event codes...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31221 (cherry picked from commit 8cc3815f02be9fa2a96e47713ad989e6d787e12a) (cherry picked from commit 28dd6730a5d6bc73aca4c015c0ff875a9def25ac) (cherry picked from commit 27ea55fc655b0081f760a34ff5dd5526ba02a0fb) --- lib/libpmc/libpmc_pmu_util.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ sys/arm64/include/pmc_mdep.h | 5 +++++ sys/dev/hwpmc/hwpmc_arm64.c | 11 ++++++---- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 81320a3dc954..e6f74e6abe81 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -2,6 +2,10 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018, Matthew Macy + * Copyright (c) 2021, The FreeBSD Foundation + * + * Portions of this software were developed by Mitchell Horne + * 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 @@ -139,6 +143,24 @@ pmu_alias_get(const char *name) return (name); } +#elif defined(__aarch64__) + +static struct pmu_alias pmu_armv8_alias_table[] = { + {NULL, NULL}, +}; + +static const char * +pmu_alias_get(const char *name) +{ + struct pmu_alias *pa; + + for (pa = pmu_armv8_alias_table; pa->pa_alias != NULL; pa++) + if (strcasecmp(name, pa->pa_alias) == 0) + return (pa->pa_name); + + return (name); +} + #else static const char * @@ -549,6 +571,33 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) return (pmc_pmu_amd_pmcallocate(event_name, pm, &ped)); } +#elif defined(__aarch64__) + +int +pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) +{ + const struct pmu_event *pe; + struct pmu_event_desc ped; + int idx = -1; + + event_name = pmu_alias_get(event_name); + if ((pe = pmu_event_get(NULL, event_name, &idx)) == NULL) + return (ENOENT); + if (pe->event == NULL) + return (ENOENT); + if (pmu_parse_event(&ped, pe->event)) + return (ENOENT); + + assert(idx >= 0); + pm->pm_ev = idx; + pm->pm_md.pm_md_config = ped.ped_event; + pm->pm_md.pm_md_flags |= PM_MD_RAW_EVENT; + pm->pm_class = PMC_CLASS_ARMV8; + pm->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); + + return (0); +} + #else int diff --git a/sys/arm64/include/pmc_mdep.h b/sys/arm64/include/pmc_mdep.h index bcf08a7f9551..dec90b386b13 100644 --- a/sys/arm64/include/pmc_mdep.h +++ b/sys/arm64/include/pmc_mdep.h @@ -38,6 +38,11 @@ #include union pmc_md_op_pmcallocate { + struct { + uint32_t pm_md_config; + uint32_t pm_md_flags; +#define PM_MD_RAW_EVENT 0x1 + }; uint64_t __pad[4]; }; diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index be26605bad51..06e2e66c7fda 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -181,11 +181,14 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm, } pe = a->pm_ev; - config = (uint32_t)pe - PMC_EV_ARMV8_FIRST; - if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) - return (EINVAL); + /* Adjust the config value if needed. */ + config = a->pm_md.pm_md_config; + if ((a->pm_md.pm_md_flags & PM_MD_RAW_EVENT) == 0) { + config = (uint32_t)pe - PMC_EV_ARMV8_FIRST; + if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) + return (EINVAL); + } pm->pm_md.pm_arm64.pm_arm64_evsel = config; - PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config); return (0); From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 882B1675B60; Thu, 29 Jul 2021 15:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqp317Rz4sjj; Thu, 29 Jul 2021 15:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29BAC13FE6; Thu, 29 Jul 2021 15:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPQC7009859; Thu, 29 Jul 2021 15:25:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPQOR009858; Thu, 29 Jul 2021 15:25:26 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:26 GMT Message-Id: <202107291525.16TFPQOR009858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b040b03d32c3 - stable/13 - libpmc: eliminate pmc_pmu_stat_mode() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b040b03d32c3deee6cfaf68e490558554cefb180 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:26 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b040b03d32c3deee6cfaf68e490558554cefb180 commit b040b03d32c3deee6cfaf68e490558554cefb180 Author: Mitchell Horne AuthorDate: 2021-05-31 14:21:57 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: eliminate pmc_pmu_stat_mode() There is a single consumer, the pmc utility, that clearly has knowledge of which counters it is expecting. Remove this function and have it use common counter aliases instead. Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30528 (cherry picked from commit ec66cc955b629e614cf493bf168048de033f6a2c) --- lib/libpmc/libpmc_pmu_util.c | 22 ---------------------- lib/libpmc/pmc.h | 1 - usr.sbin/pmc/cmd_pmc_stat.c | 15 +++++++++++---- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 6a287a66a2f8..90ce0feafa52 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -538,28 +538,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) return (pmc_pmu_amd_pmcallocate(event_name, pm, &ped)); } -/* - * Ultimately rely on AMD calling theirs the same - */ -static const char *stat_mode_cntrs[] = { - "cpu_clk_unhalted.thread", - "inst_retired.any", - "br_inst_retired.all_branches", - "br_misp_retired.all_branches", - "longest_lat_cache.reference", - "longest_lat_cache.miss", -}; - -int -pmc_pmu_stat_mode(const char ***cntrs) -{ - if (pmc_pmu_enabled()) { - *cntrs = stat_mode_cntrs; - return (0); - } - return (EOPNOTSUPP); -} - #else uint64_t diff --git a/lib/libpmc/pmc.h b/lib/libpmc/pmc.h index 9d12085364e5..7579f93a42b1 100644 --- a/lib/libpmc/pmc.h +++ b/lib/libpmc/pmc.h @@ -122,7 +122,6 @@ uint64_t pmc_pmu_sample_rate_get(const char *); int pmc_pmu_pmcallocate(const char *, struct pmc_op_pmcallocate *); const char *pmc_pmu_event_get_by_idx(const char *, int idx); int pmc_pmu_idx_get_by_event(const char*, const char *); -int pmc_pmu_stat_mode(const char ***); __END_DECLS #endif diff --git a/usr.sbin/pmc/cmd_pmc_stat.c b/usr.sbin/pmc/cmd_pmc_stat.c index 44ca7b92dea7..55d1f1ca7a3b 100644 --- a/usr.sbin/pmc/cmd_pmc_stat.c +++ b/usr.sbin/pmc/cmd_pmc_stat.c @@ -104,6 +104,16 @@ static const char *pmc_stat_mode_names[] = { "cache-misses", }; +/* Common aliases for the desired stat counter */ +static const char *pmc_stat_mode_aliases[] = { + "unhalted-cycles", + "instructions", + "branches", + "branch-mispredicts", + "LLC-REFERENCE", + "LLC-MISSES", +}; + static int pmcstat_sockpair[NSOCKPAIRFD]; static void __dead2 @@ -153,7 +163,6 @@ static void pmc_stat_setup_stat(int system_mode, const char *arg) { const char *new_cntrs[STAT_MODE_NPMCS]; - static const char **pmc_stat_mode_cntrs; struct pmcstat_ev *ev; char *counters, *counter; int i, c, start, newcnt; @@ -164,13 +173,11 @@ pmc_stat_setup_stat(int system_mode, const char *arg) err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); CPU_COPY(&rootmask, &cpumask); - if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0) - errx(EX_USAGE, "ERROR: hwmpc.ko not loaded or stat not supported on host."); if (system_mode && geteuid() != 0) errx(EX_USAGE, "ERROR: system mode counters can only be used as root"); counters = NULL; for (i = 0; i < STAT_MODE_NPMCS; i++) { - stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i]; + stat_mode_cntrs[i] = pmc_stat_mode_aliases[i]; stat_mode_names[i] = pmc_stat_mode_names[i]; } if (arg) { From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10072675F86; Thu, 29 Jul 2021 15:25:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqr4R65z4t7l; Thu, 29 Jul 2021 15:25:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C613143A1; Thu, 29 Jul 2021 15:25:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPS5K009909; Thu, 29 Jul 2021 15:25:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPSjB009908; Thu, 29 Jul 2021 15:25:28 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:28 GMT Message-Id: <202107291525.16TFPSjB009908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 440e5ecbe13d - stable/13 - libpmc: use $MACHINE_CPUARCH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 440e5ecbe13d65fb2d4f01290ccb25217f8bc0b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:29 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=440e5ecbe13d65fb2d4f01290ccb25217f8bc0b3 commit 440e5ecbe13d65fb2d4f01290ccb25217f8bc0b3 Author: Mitchell Horne AuthorDate: 2021-05-31 20:20:08 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: use $MACHINE_CPUARCH This is preferred over $MACHINE_ARCH for these types of checks, although it makes no difference for amd64 or i386. No functional change intended. Sponsored by: The FreeBSD Foundation (cherry picked from commit 3864da302af34853ddb2c33a42de5668a0d68cdd) --- lib/libpmc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 1006b6f93469..da3f8a72d26b 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -10,7 +10,7 @@ LDADD+= -lc++ .if ${MACHINE_CPUARCH} == "aarch64" EVENT_ARCH="arm64" -.elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" EVENT_ARCH="x86" .elif ${MACHINE_ARCH} == "powerpc" EVENT_ARCH="powerpc" From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC34D675BE2; Thu, 29 Jul 2021 15:25:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqs5FYWz4t5b; Thu, 29 Jul 2021 15:25:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93D47143A2; Thu, 29 Jul 2021 15:25:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPTp2009935; Thu, 29 Jul 2021 15:25:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPTgh009934; Thu, 29 Jul 2021 15:25:29 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:29 GMT Message-Id: <202107291525.16TFPTgh009934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 6911f3988766 - stable/13 - libpmc: limit pmu-events to 64-bit powerpc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6911f39887662f95a2a20c521ce5b5a8d048f687 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:30 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6911f39887662f95a2a20c521ce5b5a8d048f687 commit 6911f39887662f95a2a20c521ce5b5a8d048f687 Author: Mitchell Horne AuthorDate: 2021-05-31 20:24:15 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 libpmc: limit pmu-events to 64-bit powerpc Although currently unused, there are only pmu event definitions for POWER8 and POWER9. There is no sense in building these on 32-bit platforms. Sponsored by: The FreeBSD Foundation (cherry picked from commit 507d68984a010dab0c3ecc5477c36526c3a7fa48) --- lib/libpmc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index da3f8a72d26b..285b6c539ece 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -12,7 +12,7 @@ LDADD+= -lc++ EVENT_ARCH="arm64" .elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" EVENT_ARCH="x86" -.elif ${MACHINE_ARCH} == "powerpc" +.elif ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH:Mpowerpc64*} != "" EVENT_ARCH="powerpc" .else # This will generate an empty events table From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85B18676087; Thu, 29 Jul 2021 15:25:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqw1lMnz4tB7; Thu, 29 Jul 2021 15:25:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB8EB143A3; Thu, 29 Jul 2021 15:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPV0v009989; Thu, 29 Jul 2021 15:25:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPV0x009988; Thu, 29 Jul 2021 15:25:31 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:31 GMT Message-Id: <202107291525.16TFPV0x009988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: a2d252f89fbc - stable/13 - hwpmc_arm64.c: fix return style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a2d252f89fbccae119c8401a6c9a89d8f088b765 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:32 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a2d252f89fbccae119c8401a6c9a89d8f088b765 commit a2d252f89fbccae119c8401a6c9a89d8f088b765 Author: Mitchell Horne AuthorDate: 2021-06-14 15:21:08 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:10 +0000 hwpmc_arm64.c: fix return style In accordance to style(9). MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit 2129c8f6771a9a33253a1fe2d4e9d3494bc77f10) --- sys/dev/hwpmc/hwpmc_arm64.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 050f861a74fe..ba98eaefcc9a 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -188,7 +188,7 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm, PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config); - return 0; + return (0); } @@ -231,7 +231,7 @@ arm64_read_pmc(int cpu, int ri, pmc_value_t *v) else *v = tmp; - return 0; + return (0); } static int @@ -254,7 +254,7 @@ arm64_write_pmc(int cpu, int ri, pmc_value_t v) pm->pm_pcpu_state[cpu].pps_overflowcnt = v >> 32; arm64_pmcn_write(ri, v); - return 0; + return (0); } static int @@ -277,7 +277,7 @@ arm64_config_pmc(int cpu, int ri, struct pmc *pm) phw->phw_pmc = pm; - return 0; + return (0); } static int @@ -305,7 +305,7 @@ arm64_start_pmc(int cpu, int ri) arm64_interrupt_enable(ri); arm64_counter_enable(ri); - return 0; + return (0); } static int @@ -323,7 +323,7 @@ arm64_stop_pmc(int cpu, int ri) arm64_counter_disable(ri); arm64_interrupt_disable(ri); - return 0; + return (0); } static int @@ -340,7 +340,7 @@ arm64_release_pmc(int cpu, int ri, struct pmc *pmc) KASSERT(phw->phw_pmc == NULL, ("[arm64,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); - return 0; + return (0); } static int From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59664675F30; Thu, 29 Jul 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDr00ZBVz4t24; Thu, 29 Jul 2021 15:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64C6113FE7; Thu, 29 Jul 2021 15:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPZJ3010065; Thu, 29 Jul 2021 15:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPZT7010064; Thu, 29 Jul 2021 15:25:35 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:35 GMT Message-Id: <202107291525.16TFPZT7010064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 862ea25915cc - stable/13 - hwpmc_arm64: add a PMCDBG to the interrupt handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 862ea25915ccb70d8a25ee2b2e792c3974717e51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:36 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=862ea25915ccb70d8a25ee2b2e792c3974717e51 commit 862ea25915ccb70d8a25ee2b2e792c3974717e51 Author: Mitchell Horne AuthorDate: 2021-05-19 16:29:59 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:05:55 +0000 hwpmc_arm64: add a PMCDBG to the interrupt handler MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit 13f5a3076bc8f3774b82f2d5ca29e2e0e2af997b) --- sys/dev/hwpmc/hwpmc_arm64.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 06e2e66c7fda..8a149f5f508f 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -359,6 +359,9 @@ arm64_intr(struct trapframe *tf) KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[arm64,%d] CPU %d out of range", __LINE__, cpu)); + PMCDBG3(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *)tf, + TRAPF_USERMODE(tf)); + retval = 0; pc = arm64_pcpu[cpu]; From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2DBD675BE7; Thu, 29 Jul 2021 15:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqx3HMcz4t87; Thu, 29 Jul 2021 15:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EDDD1451B; Thu, 29 Jul 2021 15:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPXCQ010015; Thu, 29 Jul 2021 15:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPXeC010014; Thu, 29 Jul 2021 15:25:33 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:33 GMT Message-Id: <202107291525.16TFPXeC010014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: d876c5a052fb - stable/13 - hwpmc_arm64: fill kern.hwpmc.cpuid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d876c5a052fb589f213d20da2c146e5471047044 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:33 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=d876c5a052fb589f213d20da2c146e5471047044 commit d876c5a052fb589f213d20da2c146e5471047044 Author: Mitchell Horne AuthorDate: 2021-04-01 13:19:43 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:11 +0000 hwpmc_arm64: fill kern.hwpmc.cpuid This will be used to detect supported pmu events. The expected format is the MIDR register with the revision and variant fields masked. See also: lib/libpmc/pmu-events/arch/arm64/mapfile.csv. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30601 (cherry picked from commit 5867cccdc49df3e7eb3147d6516b488dd8384afe) --- sys/dev/hwpmc/hwpmc_arm64.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index ba98eaefcc9a..be26605bad51 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -505,6 +505,7 @@ pmc_arm64_initialize() struct pmc_classdep *pcd; int idcode, impcode; int reg; + uint64_t midr; reg = arm64_pmcr_read(); arm64_npmcs = (reg & PMCR_N_MASK) >> PMCR_N_SHIFT; @@ -513,6 +514,18 @@ pmc_arm64_initialize() PMCDBG1(MDP, INI, 1, "arm64-init npmcs=%d", arm64_npmcs); + /* + * Write the CPU model to kern.hwpmc.cpuid. + * + * We zero the variant and revision fields. + * + * TODO: how to handle differences between cores due to big.LITTLE? + * For now, just use MIDR from CPU 0. + */ + midr = (uint64_t)(pcpu_find(0)->pc_midr); + midr &= ~(CPU_VAR_MASK | CPU_REV_MASK); + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "0x%016lx", midr); + /* * Allocate space for pointers to PMC HW descriptors and for * the MDEP structure used by MI code. From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:31:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C2406570F5; Fri, 30 Jul 2021 00:31:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbSxP3zwHz4vQY; Fri, 30 Jul 2021 00:31:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 723B91B7A8; Fri, 30 Jul 2021 00:31:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0V5C6038562; Fri, 30 Jul 2021 00:31:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0V5QW038561; Fri, 30 Jul 2021 00:31:05 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:31:05 GMT Message-Id: <202107300031.16U0V5QW038561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: fe6803c18e81 - stable/13 - ixgbe: Clean up ix_txrx MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fe6803c18e814d3fdf901ecec3442f7ad959b6a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:31:05 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fe6803c18e814d3fdf901ecec3442f7ad959b6a4 commit fe6803c18e814d3fdf901ecec3442f7ad959b6a4 Author: Kevin Bowling AuthorDate: 2021-07-18 06:24:28 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 00:27:24 +0000 ixgbe: Clean up ix_txrx The intention here is to reduce differences with D30072. The only functional change is logical simplification in ixgbe_rx_checksum. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D30074 (cherry picked from commit 51e46835e10a2628482deefc0efd356fb733337a) --- sys/dev/ixgbe/ix_txrx.c | 87 +++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 9d31e0b1b43e..fe38919fc594 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -50,16 +50,19 @@ static void ixgbe_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); static int ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void ixgbe_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, uint8_t flidx __unused, qidx_t pidx); +static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, + uint8_t flidx __unused, qidx_t pidx); static int ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, - qidx_t budget); + qidx_t budget); static int ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static void ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, if_pkt_info_t); +static void ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri, + uint32_t ptype); +static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, + if_pkt_info_t); extern void ixgbe_if_enable_intr(if_ctx_t ctx); -static int ixgbe_determine_rsstype(u16 pkt_info); +static int ixgbe_determine_rsstype(uint16_t pkt_info); struct if_txrx ixgbe_txrx = { .ift_txd_encap = ixgbe_isc_txd_encap, @@ -81,8 +84,8 @@ struct if_txrx ixgbe_txrx = { static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) { - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 olinfo_status, mss_l4len_idx, pktlen, offload; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t olinfo_status, mss_l4len_idx, pktlen, offload; u8 ehdrlen; offload = TRUE; @@ -150,7 +153,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) offload = FALSE; break; } -/* Insert L4 checksum into data descriptors */ + /* Insert L4 checksum into data descriptors */ if (offload) olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; @@ -180,7 +183,7 @@ ixgbe_isc_txd_encap(void *arg, if_pkt_info_t pi) union ixgbe_adv_tx_desc *txd = NULL; struct ixgbe_adv_tx_context_desc *TXD; int i, j, first, pidx_last; - u32 olinfo_status, cmd, flags; + uint32_t olinfo_status, cmd, flags; qidx_t ntxd; cmd = (IXGBE_ADVTXD_DTYP_DATA | @@ -364,7 +367,7 @@ ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, qidx_t budget) struct ix_rx_queue *que = &sc->rx_queues[qsidx]; struct rx_ring *rxr = &que->rxr; union ixgbe_adv_rx_desc *rxd; - u32 staterr; + uint32_t staterr; int cnt, i, nrxd; nrxd = sc->shared->isc_nrxd[0]; @@ -400,11 +403,11 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union ixgbe_adv_rx_desc *rxd; - u16 pkt_info, len, cidx, i; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; - bool eop; + uint16_t pkt_info, len, cidx, i; + uint16_t vtag = 0; + uint32_t ptype; + uint32_t staterr = 0; + bool eop; i = 0; cidx = ri->iri_cidx; @@ -434,11 +437,8 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) { - -#if __FreeBSD_version >= 1100036 if (adapter->feat_en & IXGBE_FEATURE_VF) if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); -#endif rxr->rx_discarded++; return (EBADMSG); @@ -483,35 +483,28 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. ************************************************************************/ static void -ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) { - u16 status = (u16)staterr; - u8 errors = (u8)(staterr >> 24); - bool sctp = false; - - if ((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & IXGBE_RXDADV_PKTTYPE_SCTP) != 0) - sctp = TRUE; - - /* IPv4 checksum */ - if (status & IXGBE_RXD_STAT_IPCS) { - if (!(errors & IXGBE_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } - /* TCP/UDP/SCTP checksum */ - if (status & IXGBE_RXD_STAT_L4CS) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); -#if __FreeBSD_version >= 800000 - if (sctp) - type = CSUM_SCTP_VALID; -#endif - if (!(errors & IXGBE_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (!sctp) - ri->iri_csum_data = htons(0xffff); + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); + + /* If there is a layer 3 or 4 error we are done */ + if (__predict_false(errors & (IXGBE_RXD_ERR_IPE | IXGBE_RXD_ERR_TCPE))) + return; + + /* IP Checksum Good */ + if (status & IXGBE_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & IXGBE_RXD_STAT_L4CS)) { + /* SCTP header present. */ + if (__predict_false((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & IXGBE_RXDADV_PKTTYPE_SCTP) != 0)) { + ri->iri_csum_flags |= CSUM_SCTP_VALID; + } else { + ri->iri_csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + ri->iri_csum_data = htons(0xffff); } } } /* ixgbe_rx_checksum */ @@ -522,7 +515,7 @@ ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * Parse the packet type to determine the appropriate hash ************************************************************************/ static int -ixgbe_determine_rsstype(u16 pkt_info) +ixgbe_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) { case IXGBE_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:31:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C276B6576EC; Fri, 30 Jul 2021 00:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbSxN31TXz4vQW; Fri, 30 Jul 2021 00:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FFD91B889; Fri, 30 Jul 2021 00:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0V4rG038538; Fri, 30 Jul 2021 00:31:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0V4ic038537; Fri, 30 Jul 2021 00:31:04 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:31:04 GMT Message-Id: <202107300031.16U0V4ic038537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: ebdd2bc44108 - stable/13 - ixgbe: Print FW NVM and Option ROM versions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ebdd2bc441082a874407cb4e220391b46ca36595 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:31:04 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ebdd2bc441082a874407cb4e220391b46ca36595 commit ebdd2bc441082a874407cb4e220391b46ca36595 Author: Kevin Bowling AuthorDate: 2021-07-16 06:50:14 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 00:26:45 +0000 ixgbe: Print FW NVM and Option ROM versions It can be useful for system operators to see this kind of information when correlating issues or requesting support from the OEM or Intel for hardware and firmware issues. Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30178 (cherry picked from commit 7660e4ea5cb750ded38a0bd81cde2e2b130222df) --- sys/dev/ixgbe/if_ix.c | 100 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe_type.h | 2 +- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index fbe4f1df38ca..8e14a008e09b 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -173,6 +173,8 @@ static void ixgbe_initialize_transmit_units(if_ctx_t ctx); static int ixgbe_setup_interface(if_ctx_t ctx); static void ixgbe_init_device_features(struct adapter *adapter); static void ixgbe_check_fan_failure(struct adapter *, u32, bool); +static void ixgbe_sbuf_fw_version(struct ixgbe_hw *, struct sbuf *); +static void ixgbe_print_fw_version(if_ctx_t ctx); static void ixgbe_add_media_types(if_ctx_t ctx); static void ixgbe_update_stats_counters(struct adapter *adapter); static void ixgbe_config_link(if_ctx_t ctx); @@ -196,6 +198,7 @@ static int ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_temp(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS); #ifdef IXGBE_DEBUG static int ixgbe_sysctl_power_state(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS); @@ -1119,6 +1122,9 @@ ixgbe_if_attach_post(if_ctx_t ctx) */ ixgbe_bypass_init(adapter); + /* Display NVM and Option ROM versions */ + ixgbe_print_fw_version(ctx); + /* Set an initial dmac value */ adapter->dmac = 0; /* Set initial advertised speeds (if applicable) */ @@ -2648,6 +2654,10 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) SYSCTL_ADD_INT(ctx_list, child, OID_AUTO, "enable_aim", CTLFLAG_RW, &adapter->enable_aim, 0, "Interrupt Moderation"); + SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + ixgbe_sysctl_print_fw_version, "A", "Prints FW/NVM Versions"); + #ifdef IXGBE_DEBUG /* testing sysctls (for all devices) */ SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state", @@ -4674,3 +4684,93 @@ ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt) if (reg & mask) device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n"); } /* ixgbe_check_fan_failure */ + +/************************************************************************ + * ixgbe_sbuf_fw_version + ************************************************************************/ +static void +ixgbe_sbuf_fw_version(struct ixgbe_hw *hw, struct sbuf *buf) +{ + struct ixgbe_nvm_version nvm_ver = {0}; + uint16_t phyfw = 0; + int status; + + ixgbe_get_oem_prod_version(hw, &nvm_ver); /* OEM's NVM version */ + ixgbe_get_orom_version(hw, &nvm_ver); /* Option ROM */ + ixgbe_get_etk_id(hw, &nvm_ver); /* eTrack identifies a build in Intel's SCM */ + status = ixgbe_get_phy_firmware_version(hw, &phyfw); + + if (nvm_ver.oem_valid) + sbuf_printf(buf, "NVM OEM V%d.%d R%d ", nvm_ver.oem_major, + nvm_ver.oem_minor, nvm_ver.oem_release); + + if (nvm_ver.or_valid) + sbuf_printf(buf, "Option ROM V%d-b%d-p%d ", nvm_ver.or_major, + nvm_ver.or_build, nvm_ver.or_patch); + + if (nvm_ver.etk_id != ((NVM_VER_INVALID << NVM_ETK_SHIFT) | NVM_VER_INVALID)) + sbuf_printf(buf, "eTrack 0x%08x ", nvm_ver.etk_id); + + if (phyfw != 0 && status == IXGBE_SUCCESS) + sbuf_printf(buf, "PHY FW V%d ", phyfw); + + sbuf_trim(buf); +} /* ixgbe_sbuf_fw_version */ + +/************************************************************************ + * ixgbe_print_fw_version + ************************************************************************/ +static void +ixgbe_print_fw_version(if_ctx_t ctx) +{ + struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_auto(); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return; + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + else if (sbuf_len(buf)) + device_printf(dev, "%s\n", sbuf_data(buf)); + + sbuf_delete(buf); +} /* ixgbe_print_fw_version */ + +/************************************************************************ + * ixgbe_sysctl_print_fw_version + ************************************************************************/ +static int +ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *)arg1; + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return (ENOMEM); + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + + sbuf_delete(buf); + + return (0); +} /* ixgbe_sysctl_print_fw_version */ diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index fc5f191ee65e..1d00eadc890a 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -306,7 +306,7 @@ #define NVM_VER_INVALID 0xFFFF #define NVM_ETK_VALID 0x8000 #define NVM_INVALID_PTR 0xFFFF -#define NVM_VER_SIZE 32 /* version sting size */ +#define NVM_VER_SIZE 32 /* version string size */ struct ixgbe_nvm_version { u32 etk_id; From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E08E657A32; Fri, 30 Jul 2021 00:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbSzt2jqjz4vdC; Fri, 30 Jul 2021 00:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4551F1B999; Fri, 30 Jul 2021 00:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XEiJ043597; Fri, 30 Jul 2021 00:33:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XEAi043596; Fri, 30 Jul 2021 00:33:14 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:14 GMT Message-Id: <202107300033.16U0XEAi043596@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b76e41fca95f - stable/13 - Add required sysctl name length checks to various handlers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b76e41fca95f189a1bc759f3318c96ff8653ba01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:14 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b76e41fca95f189a1bc759f3318c96ff8653ba01 commit b76e41fca95f189a1bc759f3318c96ff8653ba01 Author: Mark Johnston AuthorDate: 2021-07-23 14:37:11 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 Add required sysctl name length checks to various handlers Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 0dcef81de9915e8ce1e3985204bebe7026d96b6f) --- sys/kern/kern_descrip.c | 20 ++++++++++++++++++++ sys/kern/kern_proc.c | 16 +++++++++++++++- sys/net/rtsock.c | 5 ++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 36092c9acd42..c7269e4b33a9 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -4092,8 +4092,13 @@ sysctl_kern_proc_nfds(SYSCTL_HANDLER_ARGS) { NDSLOTTYPE *map; struct filedesc *fdp; + u_int namelen; int count, off, minoff; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + if (*(int *)arg1 != 0) return (EINVAL); @@ -4482,8 +4487,13 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER_ARGS) struct sbuf sb; struct proc *p; ssize_t maxlen; + u_int namelen; int error, error2, *name; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; sbuf_new_for_sysctl(&sb, NULL, FILEDESC_SBUF_SIZE, req); @@ -4561,10 +4571,15 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLER_ARGS) struct filedesc *fdp; struct pwddesc *pdp; struct pwd *pwd; + u_int namelen; int error, i, lastfile, *name; struct file *fp; struct proc *p; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; error = pget((pid_t)name[0], PGET_CANDEBUG | PGET_NOTWEXIT, &p); if (error != 0) @@ -4706,8 +4721,13 @@ sysctl_kern_proc_cwd(SYSCTL_HANDLER_ARGS) struct sbuf sb; struct proc *p; ssize_t maxlen; + u_int namelen; int error, error2, *name; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; sbuf_new_for_sysctl(&sb, NULL, sizeof(struct kinfo_file), req); diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index ec732e8db060..2017f824f6ad 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2297,7 +2297,7 @@ static int sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) { vm_map_entry_t entry, tmp_entry; - unsigned int last_timestamp; + unsigned int last_timestamp, namelen; char *fullpath, *freepath; struct kinfo_ovmentry *kve; struct vattr va; @@ -2308,6 +2308,10 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) vm_map_t map; struct vmspace *vm; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; error = pget((pid_t)name[0], PGET_WANTREAD, &p); if (error != 0) @@ -2678,8 +2682,13 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS) { struct proc *p; struct sbuf sb; + u_int namelen; int error, error2, *name; + namelen = arg2; + if (namelen != 1) + return (EINVAL); + name = (int *)arg1; sbuf_new_for_sysctl(&sb, NULL, sizeof(struct kinfo_vmentry), req); sbuf_clear_flags(&sb, SBUF_INCLUDENUL); @@ -2705,6 +2714,11 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) struct stack *st; struct sbuf sb; struct proc *p; + u_int namelen; + + namelen = arg2; + if (namelen != 1) + return (EINVAL); name = (int *)arg1; error = pget((pid_t)name[0], PGET_NOTINEXEC | PGET_WANTREAD, &p); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 3cb645f42e4c..1f898c739725 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -2563,7 +2563,10 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) u_char af; struct walkarg w; - name ++; + if (namelen < 3) + return (EINVAL); + + name++; namelen--; if (req->newptr) return (EPERM); From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B309A657C0C; Fri, 30 Jul 2021 00:33:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbSzv4ZFlz4vTr; Fri, 30 Jul 2021 00:33:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6ED931B99A; Fri, 30 Jul 2021 00:33:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XFGm043621; Fri, 30 Jul 2021 00:33:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XFx0043620; Fri, 30 Jul 2021 00:33:15 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:15 GMT Message-Id: <202107300033.16U0XFx0043620@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a67749ac451e - stable/13 - vfs: Initialize "lastfail" in vfs_mountroot_wait() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a67749ac451e1ca22bde3c2a63db9ec0e962aa21 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:15 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a67749ac451e1ca22bde3c2a63db9ec0e962aa21 commit a67749ac451e1ca22bde3c2a63db9ec0e962aa21 Author: Mark Johnston AuthorDate: 2021-07-23 16:04:02 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 vfs: Initialize "lastfail" in vfs_mountroot_wait() This variable is only used to rate-limit "Root mount waiting for: ..." messages using ppsratecheck(). Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 048cd371f3d793fa354f1d3a1d484bc2725a3fc1) --- sys/kern/vfs_mountroot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c index 3b968fd19bbd..a34ae3fe06e3 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -982,6 +982,7 @@ vfs_mountroot_wait(void) TSENTER(); curfail = 0; + lastfail.tv_sec = 0; while (1) { g_waitidle(); mtx_lock(&root_holds_mtx); From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3D6F657D87; Fri, 30 Jul 2021 00:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbSzw4v1nz4vn8; Fri, 30 Jul 2021 00:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DA7D1B90B; Fri, 30 Jul 2021 00:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XGRl043645; Fri, 30 Jul 2021 00:33:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XGaW043644; Fri, 30 Jul 2021 00:33:16 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:16 GMT Message-Id: <202107300033.16U0XGaW043644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fdeacf8fdf65 - stable/13 - acct: Zero pad bytes in accounting records MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fdeacf8fdf653805084d6a72292f902ed019ef23 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:17 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fdeacf8fdf653805084d6a72292f902ed019ef23 commit fdeacf8fdf653805084d6a72292f902ed019ef23 Author: Mark Johnston AuthorDate: 2021-07-23 14:29:57 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 acct: Zero pad bytes in accounting records Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 90959dd1e50ee820e84bed4bc63fbed140298441) --- sys/kern/kern_acct.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 4c1efada10da..ad272676083e 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -349,6 +349,8 @@ acct_process(struct thread *td) if (acct_vp == NULL || acct_suspended) return (0); + memset(&acct, 0, sizeof(acct)); + sx_slock(&acct_sx); /* From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0794C657C0E; Fri, 30 Jul 2021 00:33:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbSzx61rNz4vLn; Fri, 30 Jul 2021 00:33:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3C431B633; Fri, 30 Jul 2021 00:33:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XHna043675; Fri, 30 Jul 2021 00:33:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XHHu043674; Fri, 30 Jul 2021 00:33:17 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:17 GMT Message-Id: <202107300033.16U0XHHu043674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 24c558ca3c04 - stable/13 - imgact_elf: Avoid redefining suword() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 24c558ca3c04e23681ddefe13d0cd5f98bba9fac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:18 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=24c558ca3c04e23681ddefe13d0cd5f98bba9fac commit 24c558ca3c04e23681ddefe13d0cd5f98bba9fac Author: Mark Johnston AuthorDate: 2021-07-23 19:40:54 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 imgact_elf: Avoid redefining suword() Otherwise this interferes with the definition for sanitizer interceptors. Sponsored by: The FreeBSD Foundation (cherry picked from commit ebf9886654f42718229011524a81e2b36e51f9b1) --- sys/kern/imgact_elf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 563629b747b5..9d039b914fb5 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1345,7 +1345,7 @@ ret: return (error); } -#define suword __CONCAT(suword, __ELF_WORD_SIZE) +#define elf_suword __CONCAT(suword, __ELF_WORD_SIZE) int __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base) @@ -1418,7 +1418,7 @@ __elfN(freebsd_fixup)(uintptr_t *stack_base, struct image_params *imgp) base = (Elf_Addr *)*stack_base; base--; - if (suword(base, imgp->args->argc) == -1) + if (elf_suword(base, imgp->args->argc) == -1) return (EFAULT); *stack_base = (uintptr_t)base; return (0); From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8976A657D92; Fri, 30 Jul 2021 00:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbT001YVfz4vgy; Fri, 30 Jul 2021 00:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F15C71B462; Fri, 30 Jul 2021 00:33:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XJ3x043724; Fri, 30 Jul 2021 00:33:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XJ5F043723; Fri, 30 Jul 2021 00:33:19 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:19 GMT Message-Id: <202107300033.16U0XJ5F043723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 61acafc6c67e - stable/13 - rtld/arm64: Remove checks for undefined symbols when processing TPREL64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 61acafc6c67e1930803f70002d3a610f4314042a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:20 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=61acafc6c67e1930803f70002d3a610f4314042a commit 61acafc6c67e1930803f70002d3a610f4314042a Author: Mark Johnston AuthorDate: 2021-07-16 02:26:25 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 rtld/arm64: Remove checks for undefined symbols when processing TPREL64 lld emits several GOT relocations referencing the null sumbol in libc.so when compiled with -ftls-model=initial-exec. This symbol is specified to be undefined. We generally do not handle dynamic TLS relocations against weak, undefined symbols, so avoid printing a warning here. This makes it possible to compile libc.so using the initial-exec TLS model on arm64. Reviewed by: jrtc27, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit f238ebd1429312ac2a4cb9f764babc4b6f69721e) --- libexec/rtld-elf/aarch64/reloc.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c index 8d9c23a41aa5..8cc66c87d698 100644 --- a/libexec/rtld-elf/aarch64/reloc.c +++ b/libexec/rtld-elf/aarch64/reloc.c @@ -479,25 +479,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, return (-1); } } - /* Test weak undefined thread variable */ - if (def->st_shndx != SHN_UNDEF) { - *where = def->st_value + rela->r_addend + - defobj->tlsoffset; - } else { - /* - * XXX We should relocate undefined thread - * weak variable address to NULL, but how? - * Can we return error in this situation? - */ - rtld_printf("%s: Unable to relocate undefined " - "weak TLS variable\n", obj->path); -#if 0 - return (-1); -#else - *where = def->st_value + rela->r_addend + - defobj->tlsoffset; -#endif - } + *where = def->st_value + rela->r_addend + + defobj->tlsoffset; break; /* From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DD45657D14; Fri, 30 Jul 2021 00:33:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbT011tbqz4vh2; Fri, 30 Jul 2021 00:33:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D5551B634; Fri, 30 Jul 2021 00:33:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XLC8043750; Fri, 30 Jul 2021 00:33:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XLQq043749; Fri, 30 Jul 2021 00:33:21 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:21 GMT Message-Id: <202107300033.16U0XLQq043749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d364264b29bc - stable/13 - cdefs: Add a default definition for __nosanitizememory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d364264b29bca40de1a8fd728637be42644c4259 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:21 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d364264b29bca40de1a8fd728637be42644c4259 commit d364264b29bca40de1a8fd728637be42644c4259 Author: Mark Johnston AuthorDate: 2021-07-23 14:30:00 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 cdefs: Add a default definition for __nosanitizememory Sponsored by: The FreeBSD Foundation (cherry picked from commit 4cd7e82a4c7aed19dd722afa809466d5a45765d6) --- sys/sys/cdefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index ff461db9ec2e..85e9ea227150 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -872,6 +872,7 @@ #define __nosanitizethread __attribute__((no_sanitize("thread"))) #else #define __nosanitizeaddress +#define __nosanitizememory #define __nosanitizethread #endif From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04F7C657A47; Fri, 30 Jul 2021 00:33:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbT023SyCz4vnT; Fri, 30 Jul 2021 00:33:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43D741B7CE; Fri, 30 Jul 2021 00:33:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XMT4043774; Fri, 30 Jul 2021 00:33:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XMnA043773; Fri, 30 Jul 2021 00:33:22 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:22 GMT Message-Id: <202107300033.16U0XMnA043773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3e148d60295d - stable/13 - select: Define select_flags[] as const MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3e148d60295d08a0dc42efcc58a35f00f8e89d54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:23 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e148d60295d08a0dc42efcc58a35f00f8e89d54 commit 3e148d60295d08a0dc42efcc58a35f00f8e89d54 Author: Mark Johnston AuthorDate: 2021-07-23 14:30:32 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:59 +0000 select: Define select_flags[] as const Sponsored by: The FreeBSD Foundation (cherry picked from commit cae3f9dd01fd1f8d579546b359305e985f8087d8) --- sys/kern/sys_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 6fcdee7a088f..09c60611e755 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1244,7 +1244,7 @@ done: * The backend always returns POLLHUP/POLLERR if appropriate and we * return this as a set bit in any set. */ -static int select_flags[3] = { +static const int select_flags[3] = { POLLRDNORM | POLLHUP | POLLERR, POLLWRNORM | POLLHUP | POLLERR, POLLRDBAND | POLLERR From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 570586579C1; Fri, 30 Jul 2021 00:33:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbSzy6z8Mz4vgn; Fri, 30 Jul 2021 00:33:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D25F91B7CD; Fri, 30 Jul 2021 00:33:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XIg9043700; Fri, 30 Jul 2021 00:33:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XIdu043699; Fri, 30 Jul 2021 00:33:18 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:18 GMT Message-Id: <202107300033.16U0XIdu043699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9ac0aec3a32c - stable/13 - lio_listio: Don't post a completion notification if none was requested MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9ac0aec3a32c84599cfbcc9f70ca2e035a3ddc0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:19 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9ac0aec3a32c84599cfbcc9f70ca2e035a3ddc0b commit 9ac0aec3a32c84599cfbcc9f70ca2e035a3ddc0b Author: Mark Johnston AuthorDate: 2021-07-16 02:38:46 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:58 +0000 lio_listio: Don't post a completion notification if none was requested One is allowed to use LIO_NOWAIT without specifying a sigevent. In this case, lj->lioj_signal is left uninitialized, but several code paths examine liov_signal.sigev_notify to figure out which notification to post. Unconditionally initialize that field to SIGEV_NONE. Add a dumb test case which triggers the bug. Reported by: KMSAN+syzkaller Reviewed by: asomers Sponsored by: The FreeBSD Foundation (cherry picked from commit 2e5f6152952e4cfbaab3d96368c3dc4218786632) --- sys/kern/vfs_aio.c | 1 + tests/sys/aio/lio_test.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 640e82b6f0ff..7d4d9ac3e94b 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -2246,6 +2246,7 @@ kern_lio_listio(struct thread *td, int mode, struct aiocb * const *uacb_list, lj->lioj_flags = 0; lj->lioj_count = 0; lj->lioj_finished_count = 0; + lj->lioj_signal.sigev_notify = SIGEV_NONE; knlist_init_mtx(&lj->klist, AIO_MTX(ki)); ksiginfo_init(&lj->lioj_ksi); diff --git a/tests/sys/aio/lio_test.c b/tests/sys/aio/lio_test.c index fb519aac978d..a4f5a6a38632 100644 --- a/tests/sys/aio/lio_test.c +++ b/tests/sys/aio/lio_test.c @@ -133,6 +133,15 @@ ATF_TC_BODY(lio_listio_empty_wait, tc) ATF_REQUIRE_EQ(0, lio_listio(LIO_WAIT, &list, 0, NULL)); } +/* With LIO_NOWAIT, an empty lio_listio should return immediately */ +ATF_TC_WITHOUT_HEAD(lio_listio_empty_nowait); +ATF_TC_BODY(lio_listio_empty_nowait, tc) +{ + struct aiocb *list = NULL; + + ATF_REQUIRE_EQ(0, lio_listio(LIO_NOWAIT, &list, 0, NULL)); +} + /* * With LIO_NOWAIT, an empty lio_listio should send completion notification * immediately @@ -253,6 +262,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, lio_listio_eagain_kevent); + ATF_TP_ADD_TC(tp, lio_listio_empty_nowait); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_kevent); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_signal); ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_thread); From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:33:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A9C9657A4A; Fri, 30 Jul 2021 00:33:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbT0354d4z4vtk; Fri, 30 Jul 2021 00:33:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 556721B90C; Fri, 30 Jul 2021 00:33:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0XNBx043804; Fri, 30 Jul 2021 00:33:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0XNLQ043803; Fri, 30 Jul 2021 00:33:23 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:33:23 GMT Message-Id: <202107300033.16U0XNLQ043803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 057275e4be56 - stable/13 - ktrace: Zero request structures when populating the pool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 057275e4be560e02b5ba31918dc262beb474188d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:33:25 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=057275e4be560e02b5ba31918dc262beb474188d commit 057275e4be560e02b5ba31918dc262beb474188d Author: Mark Johnston AuthorDate: 2021-07-23 14:29:53 +0000 Commit: Mark Johnston CommitDate: 2021-07-30 00:32:59 +0000 ktrace: Zero request structures when populating the pool Otherwise uninitialized pad bytes may be copied into the ktrace log file. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit 5c18bf9d5fd7684024e0a55da1e8537d4cfaf0bf) --- sys/kern/kern_ktrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 1b9e0942b702..9221a9ceb765 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -219,7 +219,8 @@ ktrace_init(void *dummy) sx_init(&ktrace_sx, "ktrace_sx"); STAILQ_INIT(&ktr_free); for (i = 0; i < ktr_requestpool; i++) { - req = malloc(sizeof(struct ktr_request), M_KTRACE, M_WAITOK); + req = malloc(sizeof(struct ktr_request), M_KTRACE, M_WAITOK | + M_ZERO); STAILQ_INSERT_HEAD(&ktr_free, req, ktr_list); } } @@ -285,7 +286,7 @@ ktrace_resize_pool(u_int oldsize, u_int newsize) STAILQ_INIT(&ktr_new); while (bound-- > 0) { req = malloc(sizeof(struct ktr_request), M_KTRACE, - M_WAITOK); + M_WAITOK | M_ZERO); STAILQ_INSERT_HEAD(&ktr_new, req, ktr_list); } mtx_lock(&ktrace_mtx); From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:42:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40FC565A04B; Fri, 30 Jul 2021 00:42:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbTB70kS1z3CDm; Fri, 30 Jul 2021 00:42:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01C591B9B8; Fri, 30 Jul 2021 00:42:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0g6gU056773; Fri, 30 Jul 2021 00:42:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0g6bg056772; Fri, 30 Jul 2021 00:42:06 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:42:06 GMT Message-Id: <202107300042.16U0g6bg056772@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 07ab33cfc108 - stable/12 - ixgbe: Print FW NVM and Option ROM versions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 07ab33cfc108618ce0ba48cabfbabbb1ebcc6538 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:42:07 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=07ab33cfc108618ce0ba48cabfbabbb1ebcc6538 commit 07ab33cfc108618ce0ba48cabfbabbb1ebcc6538 Author: Kevin Bowling AuthorDate: 2021-07-16 06:50:14 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 00:41:14 +0000 ixgbe: Print FW NVM and Option ROM versions It can be useful for system operators to see this kind of information when correlating issues or requesting support from the OEM or Intel for hardware and firmware issues. Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30178 (cherry picked from commit 7660e4ea5cb750ded38a0bd81cde2e2b130222df) --- sys/dev/ixgbe/if_ix.c | 100 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe_type.h | 2 +- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 144204f98fdc..d9fa2f4f77c5 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -173,6 +173,8 @@ static void ixgbe_initialize_transmit_units(if_ctx_t ctx); static int ixgbe_setup_interface(if_ctx_t ctx); static void ixgbe_init_device_features(struct adapter *adapter); static void ixgbe_check_fan_failure(struct adapter *, u32, bool); +static void ixgbe_sbuf_fw_version(struct ixgbe_hw *, struct sbuf *); +static void ixgbe_print_fw_version(if_ctx_t ctx); static void ixgbe_add_media_types(if_ctx_t ctx); static void ixgbe_update_stats_counters(struct adapter *adapter); static void ixgbe_config_link(if_ctx_t ctx); @@ -196,6 +198,7 @@ static int ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_temp(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS); #ifdef IXGBE_DEBUG static int ixgbe_sysctl_power_state(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS); @@ -1109,6 +1112,9 @@ ixgbe_if_attach_post(if_ctx_t ctx) */ ixgbe_bypass_init(adapter); + /* Display NVM and Option ROM versions */ + ixgbe_print_fw_version(ctx); + /* Set an initial dmac value */ adapter->dmac = 0; /* Set initial advertised speeds (if applicable) */ @@ -2557,6 +2563,10 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) CTLTYPE_INT | CTLFLAG_RW, adapter, 0, ixgbe_sysctl_advertise, "I", IXGBE_SYSCTL_DESC_ADV_SPEED); + SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + ixgbe_sysctl_print_fw_version, "A", "Prints FW/NVM Versions"); + #ifdef IXGBE_DEBUG /* testing sysctls (for all devices) */ SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state", @@ -4580,3 +4590,93 @@ ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt) if (reg & mask) device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n"); } /* ixgbe_check_fan_failure */ + +/************************************************************************ + * ixgbe_sbuf_fw_version + ************************************************************************/ +static void +ixgbe_sbuf_fw_version(struct ixgbe_hw *hw, struct sbuf *buf) +{ + struct ixgbe_nvm_version nvm_ver = {0}; + uint16_t phyfw = 0; + int status; + + ixgbe_get_oem_prod_version(hw, &nvm_ver); /* OEM's NVM version */ + ixgbe_get_orom_version(hw, &nvm_ver); /* Option ROM */ + ixgbe_get_etk_id(hw, &nvm_ver); /* eTrack identifies a build in Intel's SCM */ + status = ixgbe_get_phy_firmware_version(hw, &phyfw); + + if (nvm_ver.oem_valid) + sbuf_printf(buf, "NVM OEM V%d.%d R%d ", nvm_ver.oem_major, + nvm_ver.oem_minor, nvm_ver.oem_release); + + if (nvm_ver.or_valid) + sbuf_printf(buf, "Option ROM V%d-b%d-p%d ", nvm_ver.or_major, + nvm_ver.or_build, nvm_ver.or_patch); + + if (nvm_ver.etk_id != ((NVM_VER_INVALID << NVM_ETK_SHIFT) | NVM_VER_INVALID)) + sbuf_printf(buf, "eTrack 0x%08x ", nvm_ver.etk_id); + + if (phyfw != 0 && status == IXGBE_SUCCESS) + sbuf_printf(buf, "PHY FW V%d ", phyfw); + + sbuf_trim(buf); +} /* ixgbe_sbuf_fw_version */ + +/************************************************************************ + * ixgbe_print_fw_version + ************************************************************************/ +static void +ixgbe_print_fw_version(if_ctx_t ctx) +{ + struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_auto(); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return; + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + else if (sbuf_len(buf)) + device_printf(dev, "%s\n", sbuf_data(buf)); + + sbuf_delete(buf); +} /* ixgbe_print_fw_version */ + +/************************************************************************ + * ixgbe_sysctl_print_fw_version + ************************************************************************/ +static int +ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *)arg1; + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sbuf *buf; + int error = 0; + + buf = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (!buf) { + device_printf(dev, "Could not allocate sbuf for output.\n"); + return (ENOMEM); + } + + ixgbe_sbuf_fw_version(hw, buf); + + error = sbuf_finish(buf); + if (error) + device_printf(dev, "Error finishing sbuf: %d\n", error); + + sbuf_delete(buf); + + return (0); +} /* ixgbe_sysctl_print_fw_version */ diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index fc5f191ee65e..1d00eadc890a 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -306,7 +306,7 @@ #define NVM_VER_INVALID 0xFFFF #define NVM_ETK_VALID 0x8000 #define NVM_INVALID_PTR 0xFFFF -#define NVM_VER_SIZE 32 /* version sting size */ +#define NVM_VER_SIZE 32 /* version string size */ struct ixgbe_nvm_version { u32 etk_id; From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 00:42:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 512F165A230; Fri, 30 Jul 2021 00:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbTB81mdqz3CBR; Fri, 30 Jul 2021 00:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24AD71B9BA; Fri, 30 Jul 2021 00:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U0g8mb056797; Fri, 30 Jul 2021 00:42:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U0g8te056796; Fri, 30 Jul 2021 00:42:08 GMT (envelope-from git) Date: Fri, 30 Jul 2021 00:42:08 GMT Message-Id: <202107300042.16U0g8te056796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: fd350dd7ff94 - stable/12 - ixgbe: Clean up ix_txrx MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fd350dd7ff94d3f77804d55ee57ecd1820f8d25d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 00:42:08 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fd350dd7ff94d3f77804d55ee57ecd1820f8d25d commit fd350dd7ff94d3f77804d55ee57ecd1820f8d25d Author: Kevin Bowling AuthorDate: 2021-07-18 06:24:28 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 00:41:30 +0000 ixgbe: Clean up ix_txrx The intention here is to reduce differences with D30072. The only functional change is logical simplification in ixgbe_rx_checksum. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D30074 (cherry picked from commit 51e46835e10a2628482deefc0efd356fb733337a) --- sys/dev/ixgbe/ix_txrx.c | 87 +++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 43e64b0c0df0..b566bce3d7c7 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -50,16 +50,19 @@ static void ixgbe_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); static int ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear); static void ixgbe_isc_rxd_refill(void *arg, if_rxd_update_t iru); -static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, uint8_t flidx __unused, qidx_t pidx); +static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, + uint8_t flidx __unused, qidx_t pidx); static int ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, - qidx_t budget); + qidx_t budget); static int ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri); -static void ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype); -static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, if_pkt_info_t); +static void ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri, + uint32_t ptype); +static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *, + if_pkt_info_t); extern void ixgbe_if_enable_intr(if_ctx_t ctx); -static int ixgbe_determine_rsstype(u16 pkt_info); +static int ixgbe_determine_rsstype(uint16_t pkt_info); struct if_txrx ixgbe_txrx = { .ift_txd_encap = ixgbe_isc_txd_encap, @@ -83,8 +86,8 @@ extern if_shared_ctx_t ixgbe_sctx; static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) { - u32 vlan_macip_lens, type_tucmd_mlhl; - u32 olinfo_status, mss_l4len_idx, pktlen, offload; + uint32_t vlan_macip_lens, type_tucmd_mlhl; + uint32_t olinfo_status, mss_l4len_idx, pktlen, offload; u8 ehdrlen; offload = TRUE; @@ -152,7 +155,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) offload = FALSE; break; } -/* Insert L4 checksum into data descriptors */ + /* Insert L4 checksum into data descriptors */ if (offload) olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; @@ -182,7 +185,7 @@ ixgbe_isc_txd_encap(void *arg, if_pkt_info_t pi) union ixgbe_adv_tx_desc *txd = NULL; struct ixgbe_adv_tx_context_desc *TXD; int i, j, first, pidx_last; - u32 olinfo_status, cmd, flags; + uint32_t olinfo_status, cmd, flags; qidx_t ntxd; cmd = (IXGBE_ADVTXD_DTYP_DATA | @@ -366,7 +369,7 @@ ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, qidx_t budget) struct ix_rx_queue *que = &sc->rx_queues[qsidx]; struct rx_ring *rxr = &que->rxr; union ixgbe_adv_rx_desc *rxd; - u32 staterr; + uint32_t staterr; int cnt, i, nrxd; nrxd = sc->shared->isc_nrxd[0]; @@ -402,11 +405,11 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) struct ifnet *ifp = iflib_get_ifp(adapter->ctx); union ixgbe_adv_rx_desc *rxd; - u16 pkt_info, len, cidx, i; - u16 vtag = 0; - u32 ptype; - u32 staterr = 0; - bool eop; + uint16_t pkt_info, len, cidx, i; + uint16_t vtag = 0; + uint32_t ptype; + uint32_t staterr = 0; + bool eop; i = 0; cidx = ri->iri_cidx; @@ -436,11 +439,8 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) { - -#if __FreeBSD_version >= 1100036 if (adapter->feat_en & IXGBE_FEATURE_VF) if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); -#endif rxr->rx_discarded++; return (EBADMSG); @@ -485,35 +485,28 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. ************************************************************************/ static void -ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) +ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri, uint32_t ptype) { - u16 status = (u16)staterr; - u8 errors = (u8)(staterr >> 24); - bool sctp = false; - - if ((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && - (ptype & IXGBE_RXDADV_PKTTYPE_SCTP) != 0) - sctp = TRUE; - - /* IPv4 checksum */ - if (status & IXGBE_RXD_STAT_IPCS) { - if (!(errors & IXGBE_RXD_ERR_IPE)) { - /* IP Checksum Good */ - ri->iri_csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID; - } else - ri->iri_csum_flags = 0; - } - /* TCP/UDP/SCTP checksum */ - if (status & IXGBE_RXD_STAT_L4CS) { - u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); -#if __FreeBSD_version >= 800000 - if (sctp) - type = CSUM_SCTP_VALID; -#endif - if (!(errors & IXGBE_RXD_ERR_TCPE)) { - ri->iri_csum_flags |= type; - if (!sctp) - ri->iri_csum_data = htons(0xffff); + uint16_t status = (uint16_t)staterr; + uint8_t errors = (uint8_t)(staterr >> 24); + + /* If there is a layer 3 or 4 error we are done */ + if (__predict_false(errors & (IXGBE_RXD_ERR_IPE | IXGBE_RXD_ERR_TCPE))) + return; + + /* IP Checksum Good */ + if (status & IXGBE_RXD_STAT_IPCS) + ri->iri_csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID); + + /* Valid L4E checksum */ + if (__predict_true(status & IXGBE_RXD_STAT_L4CS)) { + /* SCTP header present. */ + if (__predict_false((ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && + (ptype & IXGBE_RXDADV_PKTTYPE_SCTP) != 0)) { + ri->iri_csum_flags |= CSUM_SCTP_VALID; + } else { + ri->iri_csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + ri->iri_csum_data = htons(0xffff); } } } /* ixgbe_rx_checksum */ @@ -524,7 +517,7 @@ ixgbe_rx_checksum(u32 staterr, if_rxd_info_t ri, u32 ptype) * Parse the packet type to determine the appropriate hash ************************************************************************/ static int -ixgbe_determine_rsstype(u16 pkt_info) +ixgbe_determine_rsstype(uint16_t pkt_info) { switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) { case IXGBE_RXDADV_RSSTYPE_IPV4_TCP: From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 02:34:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC6CF65E83A; Fri, 30 Jul 2021 02:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbWh15Bpqz3Km7; Fri, 30 Jul 2021 02:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B95B1D384; Fri, 30 Jul 2021 02:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16U2YfMf003061; Fri, 30 Jul 2021 02:34:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16U2Yflv003060; Fri, 30 Jul 2021 02:34:41 GMT (envelope-from git) Date: Fri, 30 Jul 2021 02:34:41 GMT Message-Id: <202107300234.16U2Yflv003060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: e1d7668f872d - stable/12 - ixgbe: Fix the build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e1d7668f872d7c7f9c814c918890bfaaebdee858 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 02:34:41 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e1d7668f872d7c7f9c814c918890bfaaebdee858 commit e1d7668f872d7c7f9c814c918890bfaaebdee858 Author: Kevin Bowling AuthorDate: 2021-07-30 02:32:22 +0000 Commit: Kevin Bowling CommitDate: 2021-07-30 02:32:22 +0000 ixgbe: Fix the build I forgot to amend my commit after dropping CTLFLAG_NEEDGIANT. Reported by: jenkins Fixes: 07ab33cfc108 --- sys/dev/ixgbe/if_ix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index d9fa2f4f77c5..740c8e224653 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -2564,7 +2564,7 @@ ixgbe_add_device_sysctls(if_ctx_t ctx) IXGBE_SYSCTL_DESC_ADV_SPEED); SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fw_version", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + CTLTYPE_STRING | CTLFLAG_RD, adapter, 0, ixgbe_sysctl_print_fw_version, "A", "Prints FW/NVM Versions"); #ifdef IXGBE_DEBUG From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 11:59:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC216665FCD; Fri, 30 Jul 2021 11:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbmCP4V1Jz4htB; Fri, 30 Jul 2021 11:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 824D724373; Fri, 30 Jul 2021 11:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UBxDDe050620; Fri, 30 Jul 2021 11:59:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UBxDhL050619; Fri, 30 Jul 2021 11:59:13 GMT (envelope-from git) Date: Fri, 30 Jul 2021 11:59:13 GMT Message-Id: <202107301159.16UBxDhL050619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 6581afbb3335 - stable/12 - pf tests: make killstate:match more robust MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6581afbb3335a620ba5f219011ccc898ea2a32ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 11:59:13 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6581afbb3335a620ba5f219011ccc898ea2a32ba commit 6581afbb3335a620ba5f219011ccc898ea2a32ba Author: Kristof Provost AuthorDate: 2021-07-27 13:31:00 +0000 Commit: Kristof Provost CommitDate: 2021-07-30 11:57:02 +0000 pf tests: make killstate:match more robust Only lists the states relevant to the connection we're killing. Sometimes there are IPv6 related states (due to the usual IPv6 background traffic of router solicitations, DAD, ...) that causes us to think we failed to kill the state, which in turn caused the test to fail intermittently. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4e860bd5da1423aac9aed0541c484ebf9c1d1621) --- tests/sys/netpfil/pf/killstate.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index 2b77ea189294..adf229945911 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -354,7 +354,7 @@ match_body() wait_for_state alcatraz 192.0.2.1 # Expect two states - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 2 ] ; then atf_fail "Expected two states, found $states" @@ -362,7 +362,7 @@ match_body() # If we don't kill the matching NAT state one should be left jexec alcatraz pfctl -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 1 ] ; then atf_fail "Expected one states, found $states" @@ -376,7 +376,7 @@ match_body() # Kill matching states, expect all of them to be gone jexec alcatraz pfctl -M -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 0 ] ; then atf_fail "Expected zero states, found $states" From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 11:59:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FDEA665FCA; Fri, 30 Jul 2021 11:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbmCP1ZqDz4hnf; Fri, 30 Jul 2021 11:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E1D9246AE; Fri, 30 Jul 2021 11:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UBxDTI050543; Fri, 30 Jul 2021 11:59:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UBxDmB050542; Fri, 30 Jul 2021 11:59:13 GMT (envelope-from git) Date: Fri, 30 Jul 2021 11:59:13 GMT Message-Id: <202107301159.16UBxDmB050542@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: efe3bf0fb092 - stable/13 - pf tests: make killstate:match more robust MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: efe3bf0fb092ebf79c04c760b8b6d703817c37c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 11:59:13 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=efe3bf0fb092ebf79c04c760b8b6d703817c37c0 commit efe3bf0fb092ebf79c04c760b8b6d703817c37c0 Author: Kristof Provost AuthorDate: 2021-07-27 13:31:00 +0000 Commit: Kristof Provost CommitDate: 2021-07-30 07:51:04 +0000 pf tests: make killstate:match more robust Only lists the states relevant to the connection we're killing. Sometimes there are IPv6 related states (due to the usual IPv6 background traffic of router solicitations, DAD, ...) that causes us to think we failed to kill the state, which in turn caused the test to fail intermittently. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 4e860bd5da1423aac9aed0541c484ebf9c1d1621) --- tests/sys/netpfil/pf/killstate.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index f53ede8c7578..e140ee4d144d 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -426,7 +426,7 @@ match_body() wait_for_state alcatraz 192.0.2.1 # Expect two states - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 2 ] ; then atf_fail "Expected two states, found $states" @@ -434,7 +434,7 @@ match_body() # If we don't kill the matching NAT state one should be left jexec alcatraz pfctl -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 1 ] ; then atf_fail "Expected one states, found $states" @@ -448,7 +448,7 @@ match_body() # Kill matching states, expect all of them to be gone jexec alcatraz pfctl -M -k 192.0.2.1 - states=$(jexec alcatraz pfctl -s s | wc -l) + states=$(jexec alcatraz pfctl -s s | grep 192.0.2.1 | wc -l) if [ $states -ne 0 ] ; then atf_fail "Expected zero states, found $states" From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5860066F574; Fri, 30 Jul 2021 23:34:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dL20GMz4R0c; Fri, 30 Jul 2021 23:34:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C9116301; Fri, 30 Jul 2021 23:34:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYEYU084172; Fri, 30 Jul 2021 23:34:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYEFW084171; Fri, 30 Jul 2021 23:34:14 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:14 GMT Message-Id: <202107302334.16UNYEFW084171@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 631cf89fd4c8 - stable/13 - boot: fix OBJS to not include BTX's crt0.o MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 631cf89fd4c869d3688a63402199e0500b1a65a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:14 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=631cf89fd4c869d3688a63402199e0500b1a65a8 commit 631cf89fd4c869d3688a63402199e0500b1a65a8 Author: Warner Losh AuthorDate: 2021-05-06 19:05:09 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:00:17 +0000 boot: fix OBJS to not include BTX's crt0.o According to comments in the Makefile, to make pxeboot work we need to have crt0.o first. This is needed because the simplified loader in pxeboot assumes that the startup code is at offset 0 in this binary. In normal booting, the start address can be obtained from headers of the binary, but since pxeboot encodes this as a pure binary, it has no way of knowing where that is and assumes 0. Added comments to that effect in the Makefile. We've done this by adding it to OBJS before all the other .o's are added. However, there's a problem. This also adds it to the CLEANFILES variable, which causes it to be removed from multiple places. The dependencies may also cause it to be re-built at a time that's after boot2 is built. This causes installs to fail because at install time boot2 is considered to be out of date and the programs to rebuild it are no longer in the path. Cope with this problem by just adding it to LDFLAGS instead. Glanced at by: kevans ("I thought that went in ages ago") Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28876 (cherry picked from commit e713d3a013882893fceb84dd14569052271497a9) --- stand/i386/loader/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index ad95948ec50a..dcae7bd67a14 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -89,8 +89,18 @@ LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/loader FILES+= ${LOADER} FILESMODE_${LOADER}= ${BINMODE} -b -# XXX crt0.o needs to be first for pxeboot(8) to work -OBJS= ${BTXCRT} +# Note: crt0.o needs to be first for pxeboot(8) to work. It assumes that the +# startup code is located at the start of the loader and will jump +# there. Although btx is more flexible than this, the emulated boot2 environment +# that pxeloader provides has none of that flexibility because it lacks access +# to the a.out/elf headers and assumes an entry point of 0. +# +# We must add it to the LDFLAGS instead of the OBJS becauce the former won't try +# to clean it. When it is in OBJS, this cleaning can lead to races where +# btxcrt.o is rebuilt, but boot2 isn't, leading to errors at installation time. +# LDFLAGS does not have this baggage and will be included first in the list of +# files. +LDFLAGS+= ${BTXCRT} DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84F5166FB5C; Fri, 30 Jul 2021 23:34:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dM304Qz4R0f; Fri, 30 Jul 2021 23:34:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B42D612C; Fri, 30 Jul 2021 23:34:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYFLk084196; Fri, 30 Jul 2021 23:34:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYF2w084195; Fri, 30 Jul 2021 23:34:15 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:15 GMT Message-Id: <202107302334.16UNYF2w084195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a05125907261 - stable/13 - typo: becauce -> because MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a051259072615dfa2e8c86cb8e08f0016f611c65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:15 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a051259072615dfa2e8c86cb8e08f0016f611c65 commit a051259072615dfa2e8c86cb8e08f0016f611c65 Author: Warner Losh AuthorDate: 2021-07-22 02:02:44 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:07 +0000 typo: becauce -> because Noticed by: Piotr P. Stefaniak Sponsored by: Netflix (cherry picked from commit 2b720db8d409f6fcdffa7f06b1d8c1b981435a83) --- stand/i386/loader/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index dcae7bd67a14..0abf6120c1e3 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -95,7 +95,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b # that pxeloader provides has none of that flexibility because it lacks access # to the a.out/elf headers and assumes an entry point of 0. # -# We must add it to the LDFLAGS instead of the OBJS becauce the former won't try +# We must add it to the LDFLAGS instead of the OBJS because the former won't try # to clean it. When it is in OBJS, this cleaning can lead to races where # btxcrt.o is rebuilt, but boot2 isn't, leading to errors at installation time. # LDFLAGS does not have this baggage and will be included first in the list of From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C537566F7AB; Fri, 30 Jul 2021 23:34:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dN4m32z3wXs; Fri, 30 Jul 2021 23:34:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BB1E5FDA; Fri, 30 Jul 2021 23:34:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYGMY084220; Fri, 30 Jul 2021 23:34:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYGRs084219; Fri, 30 Jul 2021 23:34:16 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:16 GMT Message-Id: <202107302334.16UNYGRs084219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: ea4936b4708e - stable/13 - awk: Reduce diffs with upstream to almost nothing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ea4936b4708ec3ba8f0ce67a161d136c35d71d63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:16 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ea4936b4708ec3ba8f0ce67a161d136c35d71d63 commit ea4936b4708ec3ba8f0ce67a161d136c35d71d63 Author: Warner Losh AuthorDate: 2021-07-09 03:51:24 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:12 +0000 awk: Reduce diffs with upstream to almost nothing. In the merge of 20210215, I left two merge conflicts #if 0'd by mistake to check later rather than resolve them as part of the merge. This code turns out to be from the original one-true-awk import and not FreeBSD specific, so remove them. Remove a extra definition of HAT. Remove a stylistic change that also appears to be a mismerge along the way. Remove FREEBSD-upgrade. Nobody has updated it since the original 2007 cvs import. It talks about old CVS branches that never made it into svn, let alone git. New imports will follow the standard practices now, so there's nothing left to document. Move README to README.md and copy the README.md from upstream over. This leaves just the $FreeBSD$ lines (which remain for the stable/12 merge) and the strcoll part of ru@'s r201989/d98dd8e5f94c as the only diffs with upstream. FreeBSD also still has its own man page, which I don't plan on changing. Once this commit is merged to stable/12, I plan no further merges to stable/12. Sometime after that I'll remove the $FreeBSD$ lines to reduce the diffs even more (though i want to make sure plans won't change first). I also plan to talk to upstream about this change... MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit f68a53dba933f9c1143863603f5a16fdbe5f070e) --- contrib/one-true-awk/FREEBSD-upgrade | 24 ------- contrib/one-true-awk/README | 94 --------------------------- contrib/one-true-awk/README.md | 119 +++++++++++++++++++++++++++++++++++ contrib/one-true-awk/awk.h | 2 - contrib/one-true-awk/b.c | 32 +--------- 5 files changed, 120 insertions(+), 151 deletions(-) diff --git a/contrib/one-true-awk/FREEBSD-upgrade b/contrib/one-true-awk/FREEBSD-upgrade deleted file mode 100644 index f0f70ab7b17b..000000000000 --- a/contrib/one-true-awk/FREEBSD-upgrade +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -Import of the 2005/04/24 version of the "one true awk", as described -in "The AWK Programming Language", by Al Aho, Brian Kernighan, and -Peter Weinberger (Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Original sources were taken from the Brian Kernighan's AWK page -http://www.cs.princeton.edu/~bwk/btl.mirror -and include bug fixes up thru Oct 23, 2007. - -The following files were removed for this import: - - buildwin.bat - makefile.win - missing95.c - vcvars32.bat - ytab.c - ytab.h - ytabc.bak - ytabh.bak - -The vendor import was done by: - - cvs import src/contrib/one-true-awk BELL_LABS bwk_20071023 diff --git a/contrib/one-true-awk/README b/contrib/one-true-awk/README deleted file mode 100644 index 24aaf9092d58..000000000000 --- a/contrib/one-true-awk/README +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************** -Copyright (C) Lucent Technologies 1997 -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name Lucent Technologies or any of -its entities not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. -****************************************************************/ - -This is the version of awk described in "The AWK Programming Language", -by Al Aho, Brian Kernighan, and Peter Weinberger -(Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Changes, mostly bug fixes and occasional enhancements, are listed -in FIXES. If you distribute this code further, please please please -distribute FIXES with it. If you find errors, please report them -to bwk@cs.princeton.edu. Thanks. - -The program itself is created by - make -which should produce a sequence of messages roughly like this: - - yacc -d awkgram.y - -conflicts: 43 shift/reduce, 85 reduce/reduce - mv y.tab.c ytab.c - mv y.tab.h ytab.h - cc -c ytab.c - cc -c b.c - cc -c main.c - cc -c parse.c - cc maketab.c -o maketab - ./maketab >proctab.c - cc -c proctab.c - cc -c tran.c - cc -c lib.c - cc -c run.c - cc -c lex.c - cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm - -This produces an executable a.out; you will eventually want to -move this to some place like /usr/bin/awk. - -If your system does not have yacc or bison (the GNU -equivalent), you must compile the pieces manually. We have -included yacc output in ytab.c and ytab.h, and backup copies in -case you overwrite them. We have also included a copy of -proctab.c so you do not need to run maketab. - -NOTE: This version uses ANSI C, as you should also. We have -compiled this without any changes using gcc -Wall and/or local C -compilers on a variety of systems, but new systems or compilers -may raise some new complaint; reports of difficulties are -welcome. - -This also compiles with Visual C++ on all flavors of Windows, -*if* you provide versions of popen and pclose. The file -missing95.c contains versions that can be used to get started -with, though the underlying support has mysterious properties, -the symptom of which can be truncated pipe output. Beware. The -file makefile.win gives hints on how to proceed; if you run -vcvars32.bat, it will set up necessary paths and parameters so -you can subsequently run nmake -f makefile.win. Beware also that -when running on Windows under command.com, various quoting -conventions are different from Unix systems: single quotes won't -work around arguments, and various characters like % are -interpreted within double quotes. - -This compiles without change on Macintosh OS X using gcc and -the standard developer tools. - -This is also said to compile on Macintosh OS 9 systems, using the -file "buildmac" provided by Dan Allen (danallen@microsoft.com), -to whom many thanks. - -The version of malloc that comes with some systems is sometimes -astonishly slow. If awk seems slow, you might try fixing that. -More generally, turning on optimization can significantly improve -awk's speed, perhaps by 1/3 for highest levels. diff --git a/contrib/one-true-awk/README.md b/contrib/one-true-awk/README.md new file mode 100644 index 000000000000..b8089b3a4803 --- /dev/null +++ b/contrib/one-true-awk/README.md @@ -0,0 +1,119 @@ +# The One True Awk + +This is the version of `awk` described in _The AWK Programming Language_, +by Al Aho, Brian Kernighan, and Peter Weinberger +(Addison-Wesley, 1988, ISBN 0-201-07981-X). + +## Copyright + +Copyright (C) Lucent Technologies 1997
+All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Distribution and Reporting Problems + +Changes, mostly bug fixes and occasional enhancements, are listed +in `FIXES`. If you distribute this code further, please please please +distribute `FIXES` with it. + +If you find errors, please report them +to bwk@cs.princeton.edu. +Please _also_ open an issue in the GitHub issue tracker, to make +it easy to track issues. +Thanks. + +## Submitting Pull Requests + +Pull requests are welcome. Some guidelines: + +* Please do not use functions or facilities that are not standard (e.g., +`strlcpy()`, `fpurge()`). + +* Please run the test suite and make sure that your changes pass before +posting the pull request. To do so: + + 1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example). + 1. Run `oldawk=nawk make check > check.out 2>&1`. + 1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors. + +* Please create the pull request with a request +to merge into the `staging` branch instead of into the `master` branch. +This allows us to do testing, and to make any additional edits or changes +after the merge but before merging to `master`. + +## Building + +The program itself is created by + + make + +which should produce a sequence of messages roughly like this: + + yacc -d awkgram.y + conflicts: 43 shift/reduce, 85 reduce/reduce + mv y.tab.c ytab.c + mv y.tab.h ytab.h + cc -c ytab.c + cc -c b.c + cc -c main.c + cc -c parse.c + cc maketab.c -o maketab + ./maketab >proctab.c + cc -c proctab.c + cc -c tran.c + cc -c lib.c + cc -c run.c + cc -c lex.c + cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm + +This produces an executable `a.out`; you will eventually want to +move this to some place like `/usr/bin/awk`. + +If your system does not have `yacc` or `bison` (the GNU +equivalent), you need to install one of them first. + +NOTE: This version uses ANSI C (C 99), as you should also. We have +compiled this without any changes using `gcc -Wall` and/or local C +compilers on a variety of systems, but new systems or compilers +may raise some new complaint; reports of difficulties are +welcome. + +This compiles without change on Macintosh OS X using `gcc` and +the standard developer tools. + +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + +The version of `malloc` that comes with some systems is sometimes +astonishly slow. If `awk` seems slow, you might try fixing that. +More generally, turning on optimization can significantly improve +`awk`'s speed, perhaps by 1/3 for highest levels. + +## A Note About Maintenance + +NOTICE! Maintenance of this program is on a ``best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + +#### Last Updated + +Fri Dec 25 16:53:34 EST 2020 diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 230eac41548c..51c00df9f279 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -237,8 +237,6 @@ extern int pairstack[], paircnt; /* watch out in match(), etc. */ #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 -#define HAT (NCHARS+2) /* matches ^ in regular expr */ - /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 20f4a8bee7f9..dd64f09647b0 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -614,22 +614,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */ } nextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) -n xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in pmatch"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif - } while (*p++ != 0); + } while (*p++); return (0); } @@ -670,21 +655,6 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ } nnextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of state space"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif p++; } return (0); From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E182666FD11; Fri, 30 Jul 2021 23:34:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dP52PKz4R5n; Fri, 30 Jul 2021 23:34:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91650612D; Fri, 30 Jul 2021 23:34:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYHV5084244; Fri, 30 Jul 2021 23:34:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYHmV084243; Fri, 30 Jul 2021 23:34:17 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:17 GMT Message-Id: <202107302334.16UNYHmV084243@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: da30af61b5af - stable/13 - awk: revert to upstream behavior for ranges for gawk compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: da30af61b5af3353a0e2156fc027dd2fe38cc753 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:18 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=da30af61b5af3353a0e2156fc027dd2fe38cc753 commit da30af61b5af3353a0e2156fc027dd2fe38cc753 Author: Warner Losh AuthorDate: 2021-07-22 02:22:43 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:12 +0000 awk: revert to upstream behavior for ranges for gawk compatibility In 2005, FreeBSD changed one-true-awk to honor the locale's collating order. This was billed as a temporary patch. It was also compatible with the then-current behavior of gawk. That temporary patch has lasted 16 years now. However, IEEE Std 1003.1-2008 changed the behaivor of ranges in regular expressions outside of the "C" and "POSIX" locales to be undefined. Starting in 2011, gawk 4.0 stopped using the locale for the range regular expressions and used the traditional behavior only. The maintainer had grown weary of answering why '[A-Z]' would sometimes match lower-case expressions. The details about are explained here: https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html To restore compatibility with other implementaitons of awk, revert this patch. FreeBSD is the odd-system out. It also has the nice side effect of eliminating the last of our differences with upstream one-true-awk. Reviewed by: cy, rgrimes MFC After: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31114 (cherry picked from commit 628bd30ab5a492839b84dbf2aaf25848dae3866a) --- contrib/one-true-awk/b.c | 22 ++++------------------ contrib/one-true-awk/main.c | 1 - contrib/one-true-awk/run.c | 2 +- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index dd64f09647b0..01119470de05 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -361,20 +361,9 @@ int quoted(const uschar **pp) /* pick up next thing after a \\ */ return c; } -static int collate_range_cmp(int a, int b) -{ - static char s[2][2]; - - if ((uschar)a == (uschar)b) - return 0; - s[0][0] = a; - s[1][0] = b; - return (strcoll(s[0], s[1])); -} - char *cclenter(const char *argp) /* add a character class */ { - int i, c, c2, j; + int i, c, c2; const uschar *op, *p = (const uschar *) argp; uschar *bp; static uschar *buf = NULL; @@ -393,18 +382,15 @@ char *cclenter(const char *argp) /* add a character class */ c2 = *p++; if (c2 == '\\') c2 = quoted(&p); - if (collate_range_cmp(c, c2) > 0) { + if (c > c2) { /* empty; ignore */ bp--; i--; continue; } - for (j = 0; j < NCHARS; j++) { - if ((collate_range_cmp(c, j) > 0) || - collate_range_cmp(j, c2) > 0) - continue; + while (c < c2) { if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) FATAL("out of space for character class [%.10s...] 2", p); - *bp++ = j; + *bp++ = ++c; i++; } continue; diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index cfe3fafaf7fe..95eeba00d9ca 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -117,7 +117,6 @@ int main(int argc, char *argv[]) char *fn, *vn; setlocale(LC_CTYPE, ""); - setlocale(LC_COLLATE, ""); setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ cmdname = argv[0]; if (argc == 1) { diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 9752cd773630..3342eb274e3a 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -665,7 +665,7 @@ Cell *relop(Node **a, int n) /* a[0 < a[1], etc. */ j = x->fval - y->fval; i = j<0? -1: (j>0? 1: 0); } else { - i = strcoll(getsval(x), getsval(y)); + i = strcmp(getsval(x), getsval(y)); } tempfree(x); tempfree(y); From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 090AB66F9B3; Fri, 30 Jul 2021 23:34:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dQ5dSSz4R41; Fri, 30 Jul 2021 23:34:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A65AD6192; Fri, 30 Jul 2021 23:34:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYIjU084275; Fri, 30 Jul 2021 23:34:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYIht084274; Fri, 30 Jul 2021 23:34:18 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:18 GMT Message-Id: <202107302334.16UNYIht084274@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 5193261c3631 - stable/13 - awk: Remove last markings we have on awk MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5193261c3631cca7accbff77d66cd38572d491b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:19 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5193261c3631cca7accbff77d66cd38572d491b6 commit 5193261c3631cca7accbff77d66cd38572d491b6 Author: Warner Losh AuthorDate: 2021-07-22 02:24:57 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:13 +0000 awk: Remove last markings we have on awk We normally don't add $FreeBSD$ to contrib software. However, these changes date back to the CVS era of source code management and have been overlooked. Now that all these files are back to the same as the upstream bsd-features branch, remove the FreeBSD specific changes, which are now just $FreeBSD$ and the (FreeBSD) in the version string. MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit 5ab82b00cca74feb9d047e9c8aa29e5118810edc) --- contrib/one-true-awk/b.c | 3 --- contrib/one-true-awk/main.c | 4 +--- contrib/one-true-awk/run.c | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 01119470de05..f889ee57b3fb 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -24,9 +24,6 @@ THIS SOFTWARE. /* lasciate ogne speranza, voi ch'intrate. */ -#include -__FBSDID("$FreeBSD$"); - #define DEBUG #include diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index 95eeba00d9ca..f3936341ae75 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -22,9 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -#include -__FBSDID("$FreeBSD$"); -const char *version = "version 20210215 (FreeBSD)"; +const char *version = "version 20210215"; #define DEBUG #include diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 3342eb274e3a..117fb0748bd8 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -22,9 +22,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -#include -__FBSDID("$FreeBSD$"); - #define DEBUG #include #include From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E56666F7CC; Fri, 30 Jul 2021 23:34:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dT1SlSz4R4C; Fri, 30 Jul 2021 23:34:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED4BB6302; Fri, 30 Jul 2021 23:34:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYKSl084323; Fri, 30 Jul 2021 23:34:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYKwK084322; Fri, 30 Jul 2021 23:34:20 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:20 GMT Message-Id: <202107302334.16UNYKwK084322@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 2cbf9eff2d97 - stable/13 - nanobsd: fix typo in NANO_WORLDDIR MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2cbf9eff2d97a8e87f55928f6dbd8bcb1799e98d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:21 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2cbf9eff2d97a8e87f55928f6dbd8bcb1799e98d commit 2cbf9eff2d97a8e87f55928f6dbd8bcb1799e98d Author: Yann Kerherve AuthorDate: 2021-07-20 17:10:28 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:13 +0000 nanobsd: fix typo in NANO_WORLDDIR Reviewed by: imp PR: 257299 (cherry picked from commit 5a9e5a5111af59dbc96383fcd73129e31648e017) --- tools/tools/nanobsd/embedded/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common index 013495997554..7186aa5ba4b5 100644 --- a/tools/tools/nanobsd/embedded/common +++ b/tools/tools/nanobsd/embedded/common @@ -297,7 +297,7 @@ create_diskimage_mbr ( ) ( # and p5 is alt-root (after resize) mkimg -a 2 ${fmtarg} ${bootmbr} -s gpt \ -p efi:=${NANO_WORLDDIR}/boot/efiboot.img \ - -p freebsd-boot:=${NAANO_WORLDDIR}/boot/gptboot \ + -p freebsd-boot:=${NANO_WORLDDIR}/boot/gptboot \ -p ${p3}:=${NANO_LOG}/_.p3 \ -p ${p4}:=${NANO_LOG}/_.p4 \ -o ${out} From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EE0E66F9B7; Fri, 30 Jul 2021 23:34:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dV2JLhz4QqJ; Fri, 30 Jul 2021 23:34:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A194612E; Fri, 30 Jul 2021 23:34:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYMCR084347; Fri, 30 Jul 2021 23:34:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYM7c084346; Fri, 30 Jul 2021 23:34:22 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:22 GMT Message-Id: <202107302334.16UNYM7c084346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d2d322b0123e - stable/13 - Fix the pattern for changing PermitRootLogin MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2d322b0123e7654529c800664861b836de0daf2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:22 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d2d322b0123e7654529c800664861b836de0daf2 commit d2d322b0123e7654529c800664861b836de0daf2 Author: Jose Luis Duran AuthorDate: 2021-07-16 17:11:47 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:13 +0000 Fix the pattern for changing PermitRootLogin The previous pattern had the (harmless) side-effect of duplicating the entry in the config file. No functional change intended. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/510 (cherry picked from commit 73358cd2cfccf9aafde069ffcb8185a0f3420ffd) --- tools/tools/nanobsd/defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 77c0e216ec80..45d9fe44c650 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -728,7 +728,7 @@ cust_comconsole ( ) ( # Allow root login via ssh cust_allow_ssh_root ( ) ( - sed -i "" -e '/PermitRootLogin/s/.*/PermitRootLogin yes/' \ + sed -i "" -E 's/^#?PermitRootLogin.*/PermitRootLogin yes/' \ ${NANO_WORLDDIR}/etc/ssh/sshd_config ) From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C76566FD1C; Fri, 30 Jul 2021 23:34:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dR6vbXz4R1v; Fri, 30 Jul 2021 23:34:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCEC65DD0; Fri, 30 Jul 2021 23:34:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYJmS084299; Fri, 30 Jul 2021 23:34:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYJU7084298; Fri, 30 Jul 2021 23:34:19 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:19 GMT Message-Id: <202107302334.16UNYJU7084298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f4ed53c6f525 - stable/13 - awk: Make -F '' and -v FS="" behave the same MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f4ed53c6f5254edcc28c34cbe67d698bd93cb05e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:20 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f4ed53c6f5254edcc28c34cbe67d698bd93cb05e commit f4ed53c6f5254edcc28c34cbe67d698bd93cb05e Author: Warner Losh AuthorDate: 2021-07-20 04:47:30 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:02:13 +0000 awk: Make -F '' and -v FS="" behave the same IEEE Std 1003.1-2008 mandates that -F str be treated the same as -v FS=str. For a null string, this was not the case. Since awk(1) documents that a null string for FS has a specific behavior, make -F '' behave consistently with -v FS="". PR: 241441 Upstream issue: https://github.com/onetrueawk/awk/issues/127 Upstream pull request: https://github.com/onetrueawk/awk/pull/128 MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit a2e3e1187309f9404940b61ca49a93bd0536559d) --- contrib/one-true-awk/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index f3936341ae75..4e68bfb46d27 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -91,9 +91,7 @@ setfs(char *p) /* wart: t=>\t */ if (p[0] == 't' && p[1] == '\0') return "\t"; - else if (p[0] != '\0') - return p; - return NULL; + return p; } static char * @@ -169,8 +167,6 @@ int main(int argc, char *argv[]) break; case 'F': /* set field separator */ fs = setfs(getarg(&argc, &argv, "no field separator")); - if (fs == NULL) - WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ vn = getarg(&argc, &argv, "no variable name"); From owner-dev-commits-src-branches@freebsd.org Fri Jul 30 23:34:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88C5066F5F8; Fri, 30 Jul 2021 23:34:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc3dW2xk5z4QtP; Fri, 30 Jul 2021 23:34:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40AB662F1; Fri, 30 Jul 2021 23:34:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16UNYNQo084371; Fri, 30 Jul 2021 23:34:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16UNYNXG084370; Fri, 30 Jul 2021 23:34:23 GMT (envelope-from git) Date: Fri, 30 Jul 2021 23:34:23 GMT Message-Id: <202107302334.16UNYNXG084370@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: b96680d9ca08 - stable/13 - RELNOTES: add notes about awk updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b96680d9ca08c1001868778ff9764b93e20f59be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 23:34:23 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b96680d9ca08c1001868778ff9764b93e20f59be commit b96680d9ca08c1001868778ff9764b93e20f59be Author: Warner Losh AuthorDate: 2021-07-30 23:04:53 +0000 Commit: Warner Losh CommitDate: 2021-07-30 23:04:53 +0000 RELNOTES: add notes about awk updates Direct commit to stable/13 to note user-visible changes in the awk update. Sponsored by: Netflix --- RELNOTES | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/RELNOTES b/RELNOTES index 1e8c23f98703..376615308ada 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,20 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +various: + One True Awk has been updated to the latest from upstream + (20210215). All the FreeBSD patches, but one, have now been + either up streamed or discarded. Notable changes include: + o Locale is no longer used for ranges + o Various bugs fixed + o Better compatibility with gawk and mawk + + The one FreeBSD change, likely to be removed in FreeBSD 14, is that + we still allow hex numbers, prefixed with 0x, to be parsed and + interpreted as hex numbers while all other awks (including one + true awk now) interpret them as 0 in line with awk's historic + behavior. + 8a04edfdcbd2: Change the default minor version used for an NFSv4 mount to the highest minor version supported by the NFSv4 server. From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E642E650AE5; Sat, 31 Jul 2021 00:21:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gS67Zdz4VTM; Sat, 31 Jul 2021 00:21:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBDFF6C29; Sat, 31 Jul 2021 00:21:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0L8cT047870; Sat, 31 Jul 2021 00:21:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0L8Xw047869; Sat, 31 Jul 2021 00:21:08 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:08 GMT Message-Id: <202107310021.16V0L8Xw047869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: b2577d0cbcb4 - stable/12 - awk: Reduce diffs with upstream to almost nothing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b2577d0cbcb43d6ffeaadb79bbaf60497198b6c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:09 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b2577d0cbcb43d6ffeaadb79bbaf60497198b6c4 commit b2577d0cbcb43d6ffeaadb79bbaf60497198b6c4 Author: Warner Losh AuthorDate: 2021-07-09 03:51:24 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:50 +0000 awk: Reduce diffs with upstream to almost nothing. In the merge of 20210215, I left two merge conflicts #if 0'd by mistake to check later rather than resolve them as part of the merge. This code turns out to be from the original one-true-awk import and not FreeBSD specific, so remove them. Remove a extra definition of HAT. Remove a stylistic change that also appears to be a mismerge along the way. Remove FREEBSD-upgrade. Nobody has updated it since the original 2007 cvs import. It talks about old CVS branches that never made it into svn, let alone git. New imports will follow the standard practices now, so there's nothing left to document. Move README to README.md and copy the README.md from upstream over. This leaves just the $FreeBSD$ lines (which remain for the stable/12 merge) and the strcoll part of ru@'s r201989/d98dd8e5f94c as the only diffs with upstream. FreeBSD also still has its own man page, which I don't plan on changing. Once this commit is merged to stable/12, I plan no further merges to stable/12. Sometime after that I'll remove the $FreeBSD$ lines to reduce the diffs even more (though i want to make sure plans won't change first). I also plan to talk to upstream about this change... MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit f68a53dba933f9c1143863603f5a16fdbe5f070e) --- contrib/one-true-awk/FREEBSD-upgrade | 24 ------- contrib/one-true-awk/README | 94 --------------------------- contrib/one-true-awk/README.md | 119 +++++++++++++++++++++++++++++++++++ contrib/one-true-awk/awk.h | 2 - contrib/one-true-awk/b.c | 32 +--------- 5 files changed, 120 insertions(+), 151 deletions(-) diff --git a/contrib/one-true-awk/FREEBSD-upgrade b/contrib/one-true-awk/FREEBSD-upgrade deleted file mode 100644 index f0f70ab7b17b..000000000000 --- a/contrib/one-true-awk/FREEBSD-upgrade +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -Import of the 2005/04/24 version of the "one true awk", as described -in "The AWK Programming Language", by Al Aho, Brian Kernighan, and -Peter Weinberger (Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Original sources were taken from the Brian Kernighan's AWK page -http://www.cs.princeton.edu/~bwk/btl.mirror -and include bug fixes up thru Oct 23, 2007. - -The following files were removed for this import: - - buildwin.bat - makefile.win - missing95.c - vcvars32.bat - ytab.c - ytab.h - ytabc.bak - ytabh.bak - -The vendor import was done by: - - cvs import src/contrib/one-true-awk BELL_LABS bwk_20071023 diff --git a/contrib/one-true-awk/README b/contrib/one-true-awk/README deleted file mode 100644 index 24aaf9092d58..000000000000 --- a/contrib/one-true-awk/README +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************** -Copyright (C) Lucent Technologies 1997 -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name Lucent Technologies or any of -its entities not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. -****************************************************************/ - -This is the version of awk described in "The AWK Programming Language", -by Al Aho, Brian Kernighan, and Peter Weinberger -(Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Changes, mostly bug fixes and occasional enhancements, are listed -in FIXES. If you distribute this code further, please please please -distribute FIXES with it. If you find errors, please report them -to bwk@cs.princeton.edu. Thanks. - -The program itself is created by - make -which should produce a sequence of messages roughly like this: - - yacc -d awkgram.y - -conflicts: 43 shift/reduce, 85 reduce/reduce - mv y.tab.c ytab.c - mv y.tab.h ytab.h - cc -c ytab.c - cc -c b.c - cc -c main.c - cc -c parse.c - cc maketab.c -o maketab - ./maketab >proctab.c - cc -c proctab.c - cc -c tran.c - cc -c lib.c - cc -c run.c - cc -c lex.c - cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm - -This produces an executable a.out; you will eventually want to -move this to some place like /usr/bin/awk. - -If your system does not have yacc or bison (the GNU -equivalent), you must compile the pieces manually. We have -included yacc output in ytab.c and ytab.h, and backup copies in -case you overwrite them. We have also included a copy of -proctab.c so you do not need to run maketab. - -NOTE: This version uses ANSI C, as you should also. We have -compiled this without any changes using gcc -Wall and/or local C -compilers on a variety of systems, but new systems or compilers -may raise some new complaint; reports of difficulties are -welcome. - -This also compiles with Visual C++ on all flavors of Windows, -*if* you provide versions of popen and pclose. The file -missing95.c contains versions that can be used to get started -with, though the underlying support has mysterious properties, -the symptom of which can be truncated pipe output. Beware. The -file makefile.win gives hints on how to proceed; if you run -vcvars32.bat, it will set up necessary paths and parameters so -you can subsequently run nmake -f makefile.win. Beware also that -when running on Windows under command.com, various quoting -conventions are different from Unix systems: single quotes won't -work around arguments, and various characters like % are -interpreted within double quotes. - -This compiles without change on Macintosh OS X using gcc and -the standard developer tools. - -This is also said to compile on Macintosh OS 9 systems, using the -file "buildmac" provided by Dan Allen (danallen@microsoft.com), -to whom many thanks. - -The version of malloc that comes with some systems is sometimes -astonishly slow. If awk seems slow, you might try fixing that. -More generally, turning on optimization can significantly improve -awk's speed, perhaps by 1/3 for highest levels. diff --git a/contrib/one-true-awk/README.md b/contrib/one-true-awk/README.md new file mode 100644 index 000000000000..b8089b3a4803 --- /dev/null +++ b/contrib/one-true-awk/README.md @@ -0,0 +1,119 @@ +# The One True Awk + +This is the version of `awk` described in _The AWK Programming Language_, +by Al Aho, Brian Kernighan, and Peter Weinberger +(Addison-Wesley, 1988, ISBN 0-201-07981-X). + +## Copyright + +Copyright (C) Lucent Technologies 1997
+All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Distribution and Reporting Problems + +Changes, mostly bug fixes and occasional enhancements, are listed +in `FIXES`. If you distribute this code further, please please please +distribute `FIXES` with it. + +If you find errors, please report them +to bwk@cs.princeton.edu. +Please _also_ open an issue in the GitHub issue tracker, to make +it easy to track issues. +Thanks. + +## Submitting Pull Requests + +Pull requests are welcome. Some guidelines: + +* Please do not use functions or facilities that are not standard (e.g., +`strlcpy()`, `fpurge()`). + +* Please run the test suite and make sure that your changes pass before +posting the pull request. To do so: + + 1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example). + 1. Run `oldawk=nawk make check > check.out 2>&1`. + 1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors. + +* Please create the pull request with a request +to merge into the `staging` branch instead of into the `master` branch. +This allows us to do testing, and to make any additional edits or changes +after the merge but before merging to `master`. + +## Building + +The program itself is created by + + make + +which should produce a sequence of messages roughly like this: + + yacc -d awkgram.y + conflicts: 43 shift/reduce, 85 reduce/reduce + mv y.tab.c ytab.c + mv y.tab.h ytab.h + cc -c ytab.c + cc -c b.c + cc -c main.c + cc -c parse.c + cc maketab.c -o maketab + ./maketab >proctab.c + cc -c proctab.c + cc -c tran.c + cc -c lib.c + cc -c run.c + cc -c lex.c + cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm + +This produces an executable `a.out`; you will eventually want to +move this to some place like `/usr/bin/awk`. + +If your system does not have `yacc` or `bison` (the GNU +equivalent), you need to install one of them first. + +NOTE: This version uses ANSI C (C 99), as you should also. We have +compiled this without any changes using `gcc -Wall` and/or local C +compilers on a variety of systems, but new systems or compilers +may raise some new complaint; reports of difficulties are +welcome. + +This compiles without change on Macintosh OS X using `gcc` and +the standard developer tools. + +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + +The version of `malloc` that comes with some systems is sometimes +astonishly slow. If `awk` seems slow, you might try fixing that. +More generally, turning on optimization can significantly improve +`awk`'s speed, perhaps by 1/3 for highest levels. + +## A Note About Maintenance + +NOTICE! Maintenance of this program is on a ``best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + +#### Last Updated + +Fri Dec 25 16:53:34 EST 2020 diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 230eac41548c..51c00df9f279 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -237,8 +237,6 @@ extern int pairstack[], paircnt; /* watch out in match(), etc. */ #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 -#define HAT (NCHARS+2) /* matches ^ in regular expr */ - /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 20f4a8bee7f9..dd64f09647b0 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -614,22 +614,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */ } nextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) -n xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in pmatch"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif - } while (*p++ != 0); + } while (*p++); return (0); } @@ -670,21 +655,6 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ } nnextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of state space"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif p++; } return (0); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FCE1651205; Sat, 31 Jul 2021 00:21:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gV2bXCz4VKy; Sat, 31 Jul 2021 00:21:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E933B68F6; Sat, 31 Jul 2021 00:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0L9bw047901; Sat, 31 Jul 2021 00:21:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0L9En047900; Sat, 31 Jul 2021 00:21:09 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:09 GMT Message-Id: <202107310021.16V0L9En047900@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: c26dea4361ae - stable/12 - nanobsd: fix typo in NANO_WORLDDIR MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c26dea4361aebff81ac8b1a7e0fac362d94216fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:10 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c26dea4361aebff81ac8b1a7e0fac362d94216fa commit c26dea4361aebff81ac8b1a7e0fac362d94216fa Author: Yann Kerherve AuthorDate: 2021-07-20 17:10:28 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:50 +0000 nanobsd: fix typo in NANO_WORLDDIR Reviewed by: imp PR: 257299 (cherry picked from commit 5a9e5a5111af59dbc96383fcd73129e31648e017) --- tools/tools/nanobsd/embedded/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common index 72461fff8062..47a13f4cd43e 100644 --- a/tools/tools/nanobsd/embedded/common +++ b/tools/tools/nanobsd/embedded/common @@ -311,7 +311,7 @@ create_diskimage_mbr ( ) ( # and p5 is alt-root (after resize) mkimg -a 2 ${fmtarg} ${bootmbr} -s gpt \ -p efi:=${NANO_WORLDDIR}/boot/boot1.efifat \ - -p freebsd-boot:=${NAANO_WORLDDIR}/boot/gptboot \ + -p freebsd-boot:=${NANO_WORLDDIR}/boot/gptboot \ -p ${p3}:=${NANO_LOG}/_.p3 \ -p ${p4}:=${NANO_LOG}/_.p4 \ -o ${out} From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40C39651191; Sat, 31 Jul 2021 00:21:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gW15zNz4VWR; Sat, 31 Jul 2021 00:21:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B60C6C94; Sat, 31 Jul 2021 00:21:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LAEl047925; Sat, 31 Jul 2021 00:21:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LAhk047924; Sat, 31 Jul 2021 00:21:10 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:10 GMT Message-Id: <202107310021.16V0LAhk047924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 831859f8ee49 - stable/12 - type: becauce -> because MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 831859f8ee49ba994a20a91eb8146cc8d8be6969 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:11 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=831859f8ee49ba994a20a91eb8146cc8d8be6969 commit 831859f8ee49ba994a20a91eb8146cc8d8be6969 Author: Warner Losh AuthorDate: 2021-07-22 02:02:44 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 type: becauce -> because Noticed by: Piotr P. Stefaniak Sponsored by: Netflix (cherry picked from commit 2b720db8d409f6fcdffa7f06b1d8c1b981435a83) --- stand/i386/loader/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index 8fbea355d726..d332ea0530c7 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -81,7 +81,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b # that pxeloader provides has none of that flexibility because it lacks access # to the a.out/elf headers and assumes an entry point of 0. # -# We must add it to the LDFLAGS instead of the OBJS becauce the former won't try +# We must add it to the LDFLAGS instead of the OBJS because the former won't try # to clean it. When it is in OBJS, this cleaning can lead to races where # btxcrt.o is rebuilt, but boot2 isn't, leading to errors at installation time. # LDFLAGS does not have this baggage and will be included first in the list of From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E82FD6512B4; Sat, 31 Jul 2021 00:21:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gY4GpNz4Vgb; Sat, 31 Jul 2021 00:21:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47B8F6C96; Sat, 31 Jul 2021 00:21:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LDst048049; Sat, 31 Jul 2021 00:21:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LDq7048037; Sat, 31 Jul 2021 00:21:13 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:13 GMT Message-Id: <202107310021.16V0LDq7048037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 97de70c68dd7 - stable/12 - awk: Remove last markings we have on awk MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 97de70c68dd78ec73f30d07ab46b5b4dd490e031 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:14 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=97de70c68dd78ec73f30d07ab46b5b4dd490e031 commit 97de70c68dd78ec73f30d07ab46b5b4dd490e031 Author: Warner Losh AuthorDate: 2021-07-22 02:24:57 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 awk: Remove last markings we have on awk We normally don't add $FreeBSD$ to contrib software. However, these changes date back to the CVS era of source code management and have been overlooked. Now that all these files are back to the same as the upstream bsd-features branch, remove the FreeBSD specific changes, which are now just $FreeBSD$ and the (FreeBSD) in the version string. MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit 5ab82b00cca74feb9d047e9c8aa29e5118810edc) --- contrib/one-true-awk/b.c | 3 --- contrib/one-true-awk/main.c | 4 +--- contrib/one-true-awk/run.c | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 01119470de05..f889ee57b3fb 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -24,9 +24,6 @@ THIS SOFTWARE. /* lasciate ogne speranza, voi ch'intrate. */ -#include -__FBSDID("$FreeBSD$"); - #define DEBUG #include diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index 95eeba00d9ca..f3936341ae75 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -22,9 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -#include -__FBSDID("$FreeBSD$"); -const char *version = "version 20210215 (FreeBSD)"; +const char *version = "version 20210215"; #define DEBUG #include diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 3342eb274e3a..117fb0748bd8 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -22,9 +22,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -#include -__FBSDID("$FreeBSD$"); - #define DEBUG #include #include From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85AB365119C; Sat, 31 Jul 2021 00:21:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gX2p6Lz4VQR; Sat, 31 Jul 2021 00:21:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 364346A58; Sat, 31 Jul 2021 00:21:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LC14047949; Sat, 31 Jul 2021 00:21:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LC5h047948; Sat, 31 Jul 2021 00:21:12 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:12 GMT Message-Id: <202107310021.16V0LC5h047948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a32cc696990e - stable/12 - awk: revert to upstream behavior for ranges for gawk compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a32cc696990ea7b21fe7005ec2b5637fa9e3a6e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:12 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a32cc696990ea7b21fe7005ec2b5637fa9e3a6e9 commit a32cc696990ea7b21fe7005ec2b5637fa9e3a6e9 Author: Warner Losh AuthorDate: 2021-07-22 02:22:43 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 awk: revert to upstream behavior for ranges for gawk compatibility In 2005, FreeBSD changed one-true-awk to honor the locale's collating order. This was billed as a temporary patch. It was also compatible with the then-current behavior of gawk. That temporary patch has lasted 16 years now. However, IEEE Std 1003.1-2008 changed the behaivor of ranges in regular expressions outside of the "C" and "POSIX" locales to be undefined. Starting in 2011, gawk 4.0 stopped using the locale for the range regular expressions and used the traditional behavior only. The maintainer had grown weary of answering why '[A-Z]' would sometimes match lower-case expressions. The details about are explained here: https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html To restore compatibility with other implementaitons of awk, revert this patch. FreeBSD is the odd-system out. It also has the nice side effect of eliminating the last of our differences with upstream one-true-awk. Reviewed by: cy, rgrimes MFC After: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31114 (cherry picked from commit 628bd30ab5a492839b84dbf2aaf25848dae3866a) --- contrib/one-true-awk/b.c | 22 ++++------------------ contrib/one-true-awk/main.c | 1 - contrib/one-true-awk/run.c | 2 +- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index dd64f09647b0..01119470de05 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -361,20 +361,9 @@ int quoted(const uschar **pp) /* pick up next thing after a \\ */ return c; } -static int collate_range_cmp(int a, int b) -{ - static char s[2][2]; - - if ((uschar)a == (uschar)b) - return 0; - s[0][0] = a; - s[1][0] = b; - return (strcoll(s[0], s[1])); -} - char *cclenter(const char *argp) /* add a character class */ { - int i, c, c2, j; + int i, c, c2; const uschar *op, *p = (const uschar *) argp; uschar *bp; static uschar *buf = NULL; @@ -393,18 +382,15 @@ char *cclenter(const char *argp) /* add a character class */ c2 = *p++; if (c2 == '\\') c2 = quoted(&p); - if (collate_range_cmp(c, c2) > 0) { + if (c > c2) { /* empty; ignore */ bp--; i--; continue; } - for (j = 0; j < NCHARS; j++) { - if ((collate_range_cmp(c, j) > 0) || - collate_range_cmp(j, c2) > 0) - continue; + while (c < c2) { if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) FATAL("out of space for character class [%.10s...] 2", p); - *bp++ = j; + *bp++ = ++c; i++; } continue; diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index cfe3fafaf7fe..95eeba00d9ca 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -117,7 +117,6 @@ int main(int argc, char *argv[]) char *fn, *vn; setlocale(LC_CTYPE, ""); - setlocale(LC_COLLATE, ""); setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ cmdname = argv[0]; if (argc == 1) { diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 9752cd773630..3342eb274e3a 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -665,7 +665,7 @@ Cell *relop(Node **a, int n) /* a[0 < a[1], etc. */ j = x->fval - y->fval; i = j<0? -1: (j>0? 1: 0); } else { - i = strcoll(getsval(x), getsval(y)); + i = strcmp(getsval(x), getsval(y)); } tempfree(x); tempfree(y); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7666F650AFC; Sat, 31 Jul 2021 00:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gb5Qjdz4VX2; Sat, 31 Jul 2021 00:21:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80A456BA8; Sat, 31 Jul 2021 00:21:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LFnW048747; Sat, 31 Jul 2021 00:21:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LF1v048746; Sat, 31 Jul 2021 00:21:15 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:15 GMT Message-Id: <202107310021.16V0LF1v048746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f8b424526bcc - stable/12 - Fix the pattern for changing PermitRootLogin MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f8b424526bcc259b1cd2b46a4612b55f1b598db3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:17 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f8b424526bcc259b1cd2b46a4612b55f1b598db3 commit f8b424526bcc259b1cd2b46a4612b55f1b598db3 Author: Jose Luis Duran AuthorDate: 2021-07-16 17:11:47 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Fix the pattern for changing PermitRootLogin The previous pattern had the (harmless) side-effect of duplicating the entry in the config file. No functional change intended. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/510 (cherry picked from commit 73358cd2cfccf9aafde069ffcb8185a0f3420ffd) --- tools/tools/nanobsd/defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index cc75e3527bca..4e219531b0f1 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -731,7 +731,7 @@ cust_comconsole ( ) ( # Allow root login via ssh cust_allow_ssh_root ( ) ( - sed -i "" -e '/PermitRootLogin/s/.*/PermitRootLogin yes/' \ + sed -i "" -E 's/^#?PermitRootLogin.*/PermitRootLogin yes/' \ ${NANO_WORLDDIR}/etc/ssh/sshd_config ) From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFCC66512BE; Sat, 31 Jul 2021 00:21:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gZ4TJFz4Vgl; Sat, 31 Jul 2021 00:21:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6976B6DC2; Sat, 31 Jul 2021 00:21:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LE0H048719; Sat, 31 Jul 2021 00:21:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LEuo048718; Sat, 31 Jul 2021 00:21:14 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:14 GMT Message-Id: <202107310021.16V0LEuo048718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: ab1dedd49460 - stable/12 - awk: Make -F '' and -v FS="" behave the same MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ab1dedd4946098fe7202e825d299a2cbec81dae0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:15 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ab1dedd4946098fe7202e825d299a2cbec81dae0 commit ab1dedd4946098fe7202e825d299a2cbec81dae0 Author: Warner Losh AuthorDate: 2021-07-20 04:47:30 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 awk: Make -F '' and -v FS="" behave the same IEEE Std 1003.1-2008 mandates that -F str be treated the same as -v FS=str. For a null string, this was not the case. Since awk(1) documents that a null string for FS has a specific behavior, make -F '' behave consistently with -v FS="". PR: 241441 Upstream issue: https://github.com/onetrueawk/awk/issues/127 Upstream pull request: https://github.com/onetrueawk/awk/pull/128 MFC After: 2 weeks Sponsored by: Netflix (cherry picked from commit a2e3e1187309f9404940b61ca49a93bd0536559d) --- contrib/one-true-awk/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index f3936341ae75..4e68bfb46d27 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -91,9 +91,7 @@ setfs(char *p) /* wart: t=>\t */ if (p[0] == 't' && p[1] == '\0') return "\t"; - else if (p[0] != '\0') - return p; - return NULL; + return p; } static char * @@ -169,8 +167,6 @@ int main(int argc, char *argv[]) break; case 'F': /* set field separator */ fs = setfs(getarg(&argc, &argv, "no field separator")); - if (fs == NULL) - WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ vn = getarg(&argc, &argv, "no variable name"); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2F1365131B; Sat, 31 Jul 2021 00:21:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gc60nXz4VQj; Sat, 31 Jul 2021 00:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A089568FD; Sat, 31 Jul 2021 00:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LGNh048773; Sat, 31 Jul 2021 00:21:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LG3Y048772; Sat, 31 Jul 2021 00:21:16 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:16 GMT Message-Id: <202107310021.16V0LG3Y048772@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 718283a2b709 - stable/12 - Generate a devctl event for interesting events MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 718283a2b7098e8f48b0bd003066d7c3e72a1513 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:17 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=718283a2b7098e8f48b0bd003066d7c3e72a1513 commit 718283a2b7098e8f48b0bd003066d7c3e72a1513 Author: Warner Losh AuthorDate: 2020-04-30 00:27:19 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Generate a devctl event for interesting events When we reset the controller, and when the controller tells us about a critical warning, send an event. (cherry picked from commit 244b805397208842e4d8bbf1ad5b1b83dbcd4c91) --- sys/dev/nvme/nvme_ctrlr.c | 51 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d011eec99722..18a22aa4f041 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -40,7 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include "nvme_private.h" @@ -50,6 +52,34 @@ __FBSDID("$FreeBSD$"); static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); +static void +nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const char *msg, ...) +{ + struct sbuf sb; + va_list ap; + int error; + + sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT); + sbuf_printf(&sb, "%s: ", device_get_nameunit(ctrlr->dev)); + va_start(ap, msg); + sbuf_vprintf(&sb, msg, ap); + va_end(ap); + error = sbuf_finish(&sb); + if (error == 0) + printf("%s\n", sbuf_data(&sb)); + + sbuf_clear(&sb); + sbuf_printf(&sb, "name=\"%s\" reason=\"", device_get_nameunit(ctrlr->dev)); + va_start(ap, msg); + sbuf_vprintf(&sb, msg, ap); + va_end(ap); + sbuf_printf(&sb, "\""); + error = sbuf_finish(&sb); + if (error == 0) + devctl_notify("nvme", "controller", type, sbuf_data(&sb)); + sbuf_delete(&sb); +} + static int nvme_ctrlr_construct_admin_qpair(struct nvme_controller *ctrlr) { @@ -606,23 +636,28 @@ nvme_ctrlr_log_critical_warnings(struct nvme_controller *ctrlr, { if (state & NVME_CRIT_WARN_ST_AVAILABLE_SPARE) - nvme_printf(ctrlr, "available spare space below threshold\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "available spare space below threshold"); if (state & NVME_CRIT_WARN_ST_TEMPERATURE) - nvme_printf(ctrlr, "temperature above threshold\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "temperature above threshold"); if (state & NVME_CRIT_WARN_ST_DEVICE_RELIABILITY) - nvme_printf(ctrlr, "device reliability degraded\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "device reliability degraded"); if (state & NVME_CRIT_WARN_ST_READ_ONLY) - nvme_printf(ctrlr, "media placed in read only mode\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "media placed in read only mode"); if (state & NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP) - nvme_printf(ctrlr, "volatile memory backup device failed\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "volatile memory backup device failed"); if (state & NVME_CRIT_WARN_ST_RESERVED_MASK) - nvme_printf(ctrlr, - "unknown critical warning(s): state = 0x%02x\n", state); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "unknown critical warning(s): state = 0x%02x", state); } static void @@ -1129,7 +1164,7 @@ nvme_ctrlr_reset_task(void *arg, int pending) struct nvme_controller *ctrlr = arg; int status; - nvme_printf(ctrlr, "resetting controller\n"); + nvme_ctrlr_devctl_log(ctrlr, "RESET", "resetting controller"); status = nvme_ctrlr_hw_reset(ctrlr); /* * Use pause instead of DELAY, so that we yield to any nvme interrupt From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06F14651056; Sat, 31 Jul 2021 00:21:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gd6T7kz4VhY; Sat, 31 Jul 2021 00:21:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF7A36BAA; Sat, 31 Jul 2021 00:21:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LHCj048797; Sat, 31 Jul 2021 00:21:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LHZL048796; Sat, 31 Jul 2021 00:21:17 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:17 GMT Message-Id: <202107310021.16V0LHZL048796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 26fd09ae5fc4 - stable/12 - Make sure that we get the sbuf resources we need. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 26fd09ae5fc4c1865d7ca15fc33e808c51a8ef52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:18 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=26fd09ae5fc4c1865d7ca15fc33e808c51a8ef52 commit 26fd09ae5fc4c1865d7ca15fc33e808c51a8ef52 Author: Warner Losh AuthorDate: 2020-04-30 00:43:11 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Make sure that we get the sbuf resources we need. Since we're calling sbuf_new with NOWAIT, make sure it can allocate a buffer to use. Don't print anything if we can't get it. Noticed by: rpokala (cherry picked from commit 4e6a434b6bb81a7ae80911ec6730ff79b9352a88) --- sys/dev/nvme/nvme_ctrlr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 18a22aa4f041..a6e2429dbd19 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -59,7 +59,8 @@ nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const cha va_list ap; int error; - sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT); + if (sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT) == NULL) + return; sbuf_printf(&sb, "%s: ", device_get_nameunit(ctrlr->dev)); va_start(ap, msg); sbuf_vprintf(&sb, msg, ap); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F9F1651330; Sat, 31 Jul 2021 00:21:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gk4mngz4VYx; Sat, 31 Jul 2021 00:21:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54C3C6A59; Sat, 31 Jul 2021 00:21:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LMkj048919; Sat, 31 Jul 2021 00:21:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LMQH048910; Sat, 31 Jul 2021 00:21:22 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:22 GMT Message-Id: <202107310021.16V0LMQH048910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d46fa8be05a7 - stable/12 - Use symbolic names for asych events MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d46fa8be05a75e1d580e3311f87e0c0d63db7de9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:23 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d46fa8be05a75e1d580e3311f87e0c0d63db7de9 commit d46fa8be05a75e1d580e3311f87e0c0d63db7de9 Author: Warner Losh AuthorDate: 2020-08-31 19:38:03 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 Use symbolic names for asych events Rather than |= 0x300, define and use asyn event names for the name space changes and the firmware activations that we're asking for. (cherry picked from commit 881534f09cccbf4bc749be22eb34ad57b5c13563) --- sys/dev/nvme/nvme.h | 2 ++ sys/dev/nvme/nvme_ctrlr.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 41d5362f6982..982c994d6433 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -497,6 +497,8 @@ enum nvme_critical_warning_state { NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP = 0x10, }; #define NVME_CRIT_WARN_ST_RESERVED_MASK (0xE0) +#define NVME_ASYNC_EVENT_NS_ATTRIBUTE (0x100) +#define NVME_ASYNC_EVENT_FW_ACTIVATE (0x200) /* slot for current FW */ #define NVME_FIRMWARE_PAGE_AFI_SLOT_SHIFT (0) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index a6e2429dbd19..efc8fbcdf567 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -834,7 +834,8 @@ nvme_ctrlr_configure_aer(struct nvme_controller *ctrlr) NVME_CRIT_WARN_ST_READ_ONLY | NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP; if (ctrlr->cdata.ver >= NVME_REV(1, 2)) - ctrlr->async_event_config |= 0x300; + ctrlr->async_event_config |= NVME_ASYNC_EVENT_NS_ATTRIBUTE | + NVME_ASYNC_EVENT_FW_ACTIVATE; status.done = 0; nvme_ctrlr_cmd_get_feature(ctrlr, NVME_FEAT_TEMPERATURE_THRESHOLD, From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 906CB6511F6; Sat, 31 Jul 2021 00:21:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gl6w4kz4Vhr; Sat, 31 Jul 2021 00:21:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67F186B68; Sat, 31 Jul 2021 00:21:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LNan050307; Sat, 31 Jul 2021 00:21:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LN4w050294; Sat, 31 Jul 2021 00:21:23 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:23 GMT Message-Id: <202107310021.16V0LN4w050294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 88cf6df20468 - stable/12 - nvme: Remove compat code for older kernels MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 88cf6df204683da0e71ac7f5de062686ad8445b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:25 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=88cf6df204683da0e71ac7f5de062686ad8445b7 commit 88cf6df204683da0e71ac7f5de062686ad8445b7 Author: Warner Losh AuthorDate: 2020-10-24 01:59:01 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 nvme: Remove compat code for older kernels Remove code that supported pre-2011 kernels. CTLTYPE_S64 was defined in rev 217616. All supported branches have it, so remove its compat definition as OBE. (cherry picked from commit 0fc1d2088169456d469b53ecbe7832349917c29d) --- sys/dev/nvme/nvme_sysctl.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c index fc67f2c87fd5..327c3ddbfc99 100644 --- a/sys/dev/nvme/nvme_sysctl.c +++ b/sys/dev/nvme/nvme_sysctl.c @@ -51,16 +51,6 @@ SYSCTL_BOOL(_hw_nvme, OID_AUTO, verbose_cmd_dump, CTLFLAG_RWTUN, &nvme_verbose_cmd_dump, 0, "enable verbose command printting when a command fails"); -/* - * CTLTYPE_S64 and sysctl_handle_64 were added in r217616. Define these - * explicitly here for older kernels that don't include the r217616 - * changeset. - */ -#ifndef CTLTYPE_S64 -#define CTLTYPE_S64 CTLTYPE_QUAD -#define sysctl_handle_64 sysctl_handle_quad -#endif - static void nvme_dump_queue(struct nvme_qpair *qpair) { From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43177651061; Sat, 31 Jul 2021 00:21:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gj6LRgz4VnJ; Sat, 31 Jul 2021 00:21:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36AB26C2F; Sat, 31 Jul 2021 00:21:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LL4X048872; Sat, 31 Jul 2021 00:21:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LLpc048870; Sat, 31 Jul 2021 00:21:21 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:21 GMT Message-Id: <202107310021.16V0LLpc048870@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 5afd13ff5b6a - stable/12 - Report cpi->hba_* for nda(4) because why not. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5afd13ff5b6a7a828dffa505e984fec6946ca5b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:22 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5afd13ff5b6a7a828dffa505e984fec6946ca5b3 commit 5afd13ff5b6a7a828dffa505e984fec6946ca5b3 Author: Alexander Motin AuthorDate: 2020-08-12 20:05:43 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 Report cpi->hba_* for nda(4) because why not. MFC after: 1 week --- sys/dev/nvme/nvme_sim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c index c9d8d94543d7..efec8d34868a 100644 --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -197,8 +197,12 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.nvme.slot = pci_get_slot(dev); cpi->xport_specific.nvme.function = pci_get_function(dev); cpi->xport_specific.nvme.extra = 0; - strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(ctrlr->dev), + strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(dev), sizeof(cpi->xport_specific.nvme.dev_name)); + cpi->hba_vendor = pci_get_vendor(dev); + cpi->hba_device = pci_get_device(dev); + cpi->hba_subvendor = pci_get_subvendor(dev); + cpi->hba_subdevice = pci_get_subdevice(dev); cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91AF9651336; Sat, 31 Jul 2021 00:21:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gq0Ss5z4Vnn; Sat, 31 Jul 2021 00:21:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB3366B6B; Sat, 31 Jul 2021 00:21:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LQaQ051989; Sat, 31 Jul 2021 00:21:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LQZd051988; Sat, 31 Jul 2021 00:21:26 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:26 GMT Message-Id: <202107310021.16V0LQZd051988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f12339d9c14e - stable/12 - Always use the __unused attribute even for potentially unused parameters. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f12339d9c14ecfd0f1d02ee8692df94a89181311 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:28 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f12339d9c14ecfd0f1d02ee8692df94a89181311 commit f12339d9c14ecfd0f1d02ee8692df94a89181311 Author: Michal Meloun AuthorDate: 2020-12-01 08:52:13 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 Always use the __unused attribute even for potentially unused parameters. Requested by: ian, imp MFC with: r368167 (cherry picked from commit cf7c06293236710cc33de029fccd1185cb38c5fb) --- sys/dev/nvme/nvme.h | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 4ca4ea3373f6..982c994d6433 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1738,15 +1738,9 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ -#if _BYTE_ORDER != _LITTLE_ENDIAN -#define MODIF -#else -#define MODIF __unused -#endif - /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s MODIF) +void nvme_completion_swapbytes(struct nvme_completion *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1760,7 +1754,7 @@ void nvme_completion_swapbytes(struct nvme_completion *s MODIF) } static inline -void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) +void nvme_power_state_swapbytes(struct nvme_power_state *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1773,7 +1767,7 @@ void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) } static inline -void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) +void nvme_controller_data_swapbytes(struct nvme_controller_data *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1825,7 +1819,7 @@ void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) } static inline -void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) +void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1855,7 +1849,7 @@ void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) static inline void nvme_error_information_entry_swapbytes( - struct nvme_error_information_entry *s MODIF) + struct nvme_error_information_entry *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1872,7 +1866,7 @@ void nvme_error_information_entry_swapbytes( } static inline -void nvme_le128toh(void *p MODIF) +void nvme_le128toh(void *p __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN /* Swap 16 bytes in place */ @@ -1889,7 +1883,7 @@ void nvme_le128toh(void *p MODIF) static inline void nvme_health_information_page_swapbytes( - struct nvme_health_information_page *s MODIF) + struct nvme_health_information_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1918,7 +1912,7 @@ void nvme_health_information_page_swapbytes( static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) +void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1929,7 +1923,7 @@ void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) } static inline -void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) +void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1941,7 +1935,7 @@ void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) static inline void nvme_command_effects_page_swapbytes( - struct nvme_command_effects_page *s MODIF) + struct nvme_command_effects_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1955,7 +1949,7 @@ void nvme_command_effects_page_swapbytes( static inline void nvme_res_notification_page_swapbytes( - struct nvme_res_notification_page *s MODIF) + struct nvme_res_notification_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); @@ -1965,7 +1959,7 @@ void nvme_res_notification_page_swapbytes( static inline void nvme_sanitize_status_page_swapbytes( - struct nvme_sanitize_status_page *s MODIF) + struct nvme_sanitize_status_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); @@ -1981,7 +1975,7 @@ void nvme_sanitize_status_page_swapbytes( } static inline -void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) +void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1998,8 +1992,8 @@ void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) } static inline -void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, - size_t size MODIF) +void nvme_resv_status_swapbytes(struct nvme_resv_status *s __unused, + size_t size __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2016,8 +2010,8 @@ void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, } static inline -void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s MODIF, - size_t size MODIF) +void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, + size_t size __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2032,6 +2026,5 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s MODIF, } #endif } -#undef MODIF #endif /* __NVME_H__ */ From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B09126513A8; Sat, 31 Jul 2021 00:21:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gr2lgGz4VlM; Sat, 31 Jul 2021 00:21:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9BFF6C9B; Sat, 31 Jul 2021 00:21:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LRnX052019; Sat, 31 Jul 2021 00:21:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LRjv052018; Sat, 31 Jul 2021 00:21:27 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:27 GMT Message-Id: <202107310021.16V0LRjv052018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 696065e4f21a - stable/12 - NVME: Multiple busdma related fixes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 696065e4f21ad9bb52def38726c2f4ed593a2602 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:29 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=696065e4f21ad9bb52def38726c2f4ed593a2602 commit 696065e4f21ad9bb52def38726c2f4ed593a2602 Author: Michal Meloun AuthorDate: 2020-12-02 16:54:24 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 NVME: Multiple busdma related fixes. - in nvme_qpair_process_completions() do dma sync before completion buffer is used. - in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm and arm64. Bus_dmamap_sync() on these architectures is sufficient to ensure that all CPU stores are visible to external (including DMA) observers. - Allocate completion buffer as BUS_DMA_COHERENT. On not-DMA coherent systems, buffers continuously owned (and accessed) by DMA must be allocated with this flag. Note that BUS_DMA_COHERENT flag is no-op on DMA coherent systems (or coherent buses in mixed systems). MFC after: 4 weeks Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D27446 (cherry picked from commit 8f9d5a8dbf4ea69c5f9a1e3a36e23732ffaa5c75) --- sys/dev/nvme/nvme_qpair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 9be4fc67b923..e43e8285e9bb 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -550,6 +550,8 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) if (!qpair->is_enabled) return (false); + bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* * A panic can stop the CPU this routine is running on at any point. If * we're called during a panic, complete the sq_head wrap protocol for @@ -583,8 +585,6 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) } } - bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); while (1) { cpl = qpair->cpl[qpair->cq_head]; @@ -701,7 +701,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, bus_dma_tag_set_domain(qpair->dma_tag, qpair->domain); if (bus_dmamem_alloc(qpair->dma_tag, (void **)&queuemem, - BUS_DMA_NOWAIT, &qpair->queuemem_map)) { + BUS_DMA_COHERENT | BUS_DMA_NOWAIT, &qpair->queuemem_map)) { nvme_printf(ctrlr, "failed to alloc qpair memory\n"); goto out; } @@ -987,7 +987,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifndef __powerpc__ +#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) /* * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but * no other archs do. From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DD1E65116C; Sat, 31 Jul 2021 00:21:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gv4cxLz4Vx5; Sat, 31 Jul 2021 00:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A8196C9E; Sat, 31 Jul 2021 00:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LV17052091; Sat, 31 Jul 2021 00:21:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LVCt052090; Sat, 31 Jul 2021 00:21:31 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:31 GMT Message-Id: <202107310021.16V0LVCt052090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f5a43e10fe4d - stable/12 - fix big-endian platforms after 6733401935f8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f5a43e10fe4d0fcc13f64d14e4c6c7ba285d8b3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:32 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f5a43e10fe4d0fcc13f64d14e4c6c7ba285d8b3c commit f5a43e10fe4d0fcc13f64d14e4c6c7ba285d8b3c Author: Chuck Tuffli AuthorDate: 2021-01-08 22:36:37 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 fix big-endian platforms after 6733401935f8 The NVMe byte-swap routines for big-endian platforms used memcpy() to move the unaligned 64-bit value into a temp register to byte swap it. Instead of introducing a dependency, manually byte-swap the values in place. Point hat: me (cherry picked from commit e83fdf8bb391579fa422d34663cd8c1f82a00dc0) --- sys/dev/nvme/nvme.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index f42d1e9caa3b..2caf8171be5b 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -2053,16 +2053,20 @@ static inline void nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN - uint64_t failing_lba; - uint32_t r; + uint8_t *tmp; + uint32_t r, i; + uint8_t b; for (r = 0; r < 20; r++) { s->result[r].poh = le64toh(s->result[r].poh); s->result[r].nsid = le32toh(s->result[r].nsid); /* Unaligned 64-bit loads fail on some architectures */ - memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_lba)); - failing_lba = le64toh(failing_lba); - memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_lba)); + tmp = s->result[r].failing_lba; + for (i = 0; i < 4; i++) { + b = tmp[i]; + tmp[i] = tmp[7-i]; + tmp[7-i] = b; + } } #endif } From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28A29651423; Sat, 31 Jul 2021 00:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gs60g5z4Vp2; Sat, 31 Jul 2021 00:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0703A6C31; Sat, 31 Jul 2021 00:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LSKG052043; Sat, 31 Jul 2021 00:21:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LSE2052042; Sat, 31 Jul 2021 00:21:28 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:28 GMT Message-Id: <202107310021.16V0LSE2052042@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 644837397fa7 - stable/12 - nvme: Remove a wmb() that's not necessary. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 644837397fa7fbc6f5bdd7d885c6347045c18bf3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:31 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=644837397fa7fbc6f5bdd7d885c6347045c18bf3 commit 644837397fa7fbc6f5bdd7d885c6347045c18bf3 Author: Warner Losh AuthorDate: 2020-12-04 21:34:48 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 nvme: Remove a wmb() that's not necessary. bus_dmamap_sync() ensures that memory that's prepared for PREWRITE can be DMA'd immediately after it returns. The details differ, but this mirrors atomic thread release semantics, at least for the buffers synced. For non-x86 platforms, bus_dmamap_sync() has the right syncing and fences. So in the past, wmb() had been omitted for them. For x86 platforms, the memory ordering is already strong enough to ensure DMA to the device sees the current contents. As such, we don't need the wmb() here. It translates to an sfence which is only needed for writes to regions that have the write combining attribute set or when some exotic opcodes are used. The nvme driver does neither of these. Since bus_dmamap_sync() includes atomic_thread_fence_rel, we can be assured any optimizer won't reorder the bus_dmamap_sync and the bus_space_write operations. The wmb() was a vestiage of the pre-busdma version initially committed to the tree. Reviewed by: kib@, gallatin@, chuck@, mav@ Differential Revision: https://reviews.freebsd.org/D27448 (cherry picked from commit 082905cad121bf6721606b6b9ba20a09bc6e56d0) --- sys/dev/nvme/nvme_qpair.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index e43e8285e9bb..651eee121be1 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -987,14 +987,6 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) - /* - * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but - * no other archs do. - */ - wmb(); -#endif - bus_space_write_4(qpair->ctrlr->bus_tag, qpair->ctrlr->bus_handle, qpair->sq_tdbl_off, qpair->sq_tail); qpair->num_cmds++; From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0F68651328; Sat, 31 Jul 2021 00:21:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gg18R5z4VR3; Sat, 31 Jul 2021 00:21:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E55D66C99; Sat, 31 Jul 2021 00:21:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LI2E048821; Sat, 31 Jul 2021 00:21:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LIPV048820; Sat, 31 Jul 2021 00:21:18 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:18 GMT Message-Id: <202107310021.16V0LIPV048820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 8ed05c686fba - stable/12 - Rename ns notification function... MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8ed05c686fba2300cc66a89418c14ab84e033c5f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:20 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ed05c686fba2300cc66a89418c14ab84e033c5f commit 8ed05c686fba2300cc66a89418c14ab84e033c5f Author: Warner Losh AuthorDate: 2020-05-01 21:24:15 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Rename ns notification function... This function is called whenever the namespace is added, deleted or changes. Update the name to reflect that. No functional change. (cherry picked from commit 950475ca2062b5d95efcf4d758cb5f33d7710aed) --- sys/dev/nvme/nvme_sim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c index b66126b11bce..c9d8d94543d7 100644 --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -315,7 +315,7 @@ err1: } static void * -nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg) +nvme_sim_ns_change(struct nvme_namespace *ns, void *sc_arg) { struct nvme_sim_softc *sc = sc_arg; union ccb *ccb; @@ -339,7 +339,7 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg) } xpt_rescan(ccb); - return (ns); + return (sc_arg); } static void @@ -362,7 +362,7 @@ nvme_sim_init(void) if (nvme_use_nvd) return; - consumer_cookie = nvme_register_consumer(nvme_sim_new_ns, + consumer_cookie = nvme_register_consumer(nvme_sim_ns_change, nvme_sim_new_controller, NULL, nvme_sim_controller_fail); } From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04E30651410; Sat, 31 Jul 2021 00:21:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gm6Lqkz4VtG; Sat, 31 Jul 2021 00:21:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C3AC6BAC; Sat, 31 Jul 2021 00:21:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LOCE051409; Sat, 31 Jul 2021 00:21:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LOem051400; Sat, 31 Jul 2021 00:21:24 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:24 GMT Message-Id: <202107310021.16V0LOem051400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f502f8abe08b - stable/12 - nvme: change namei_request_zone into a malloc type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f502f8abe08b1b39ec3b53eeaadf7dfad8930574 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:26 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f502f8abe08b1b39ec3b53eeaadf7dfad8930574 commit f502f8abe08b1b39ec3b53eeaadf7dfad8930574 Author: Mateusz Guzik AuthorDate: 2020-11-05 21:44:58 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 nvme: change namei_request_zone into a malloc type Both the size (128 bytes) and ephemeral nature of allocations make it a great fit for malloc. A dedicated zone unnecessarily avoids sharing buckets with 128-byte objects. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D27103 (cherry picked from commit 71460dfcb275f0a2a20b39a332b0e1149c6e7e3f) --- sys/dev/nvme/nvme.c | 5 ----- sys/dev/nvme/nvme_private.h | 5 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 843aa80bb4fb..8e5bc11b35d4 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -49,7 +49,6 @@ struct nvme_consumer { struct nvme_consumer nvme_consumer[NVME_MAX_CONSUMERS]; #define INVALID_CONSUMER_ID 0xFFFF -uma_zone_t nvme_request_zone; int32_t nvme_retry_count; @@ -62,9 +61,6 @@ nvme_init(void) { uint32_t i; - nvme_request_zone = uma_zcreate("nvme_request", - sizeof(struct nvme_request), NULL, NULL, NULL, NULL, 0, 0); - for (i = 0; i < NVME_MAX_CONSUMERS; i++) nvme_consumer[i].id = INVALID_CONSUMER_ID; } @@ -74,7 +70,6 @@ SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init, NULL); static void nvme_uninit(void) { - uma_zdestroy(nvme_request_zone); } SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL); diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 2e2c383f455f..39b5af66501f 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -104,7 +104,6 @@ MALLOC_DECLARE(M_NVME); #define CACHE_LINE_SIZE (64) #endif -extern uma_zone_t nvme_request_zone; extern int32_t nvme_retry_count; extern bool nvme_verbose_cmd_dump; @@ -488,7 +487,7 @@ _nvme_allocate_request(nvme_cb_fn_t cb_fn, void *cb_arg) { struct nvme_request *req; - req = uma_zalloc(nvme_request_zone, M_NOWAIT | M_ZERO); + req = malloc(sizeof(*req), M_NVME, M_NOWAIT | M_ZERO); if (req != NULL) { req->cb_fn = cb_fn; req->cb_arg = cb_arg; @@ -550,7 +549,7 @@ nvme_allocate_request_ccb(union ccb *ccb, nvme_cb_fn_t cb_fn, void *cb_arg) return (req); } -#define nvme_free_request(req) uma_zfree(nvme_request_zone, req) +#define nvme_free_request(req) free(req, M_NVME) void nvme_notify_async_consumers(struct nvme_controller *ctrlr, const struct nvme_completion *async_cpl, From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8BA86512DB; Sat, 31 Jul 2021 00:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gt6H9kz4Vp8; Sat, 31 Jul 2021 00:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 226546C9C; Sat, 31 Jul 2021 00:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LUgR052067; Sat, 31 Jul 2021 00:21:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LUet052066; Sat, 31 Jul 2021 00:21:30 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:30 GMT Message-Id: <202107310021.16V0LUet052066@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 0980844b7fe7 - stable/12 - nvmecontrol: add device self-test op and log page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0980844b7fe76f5dd782cacd17edac59d2bc6c12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:31 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0980844b7fe76f5dd782cacd17edac59d2bc6c12 commit 0980844b7fe76f5dd782cacd17edac59d2bc6c12 Author: Chuck Tuffli AuthorDate: 2021-01-08 17:19:37 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 nvmecontrol: add device self-test op and log page Add decoding of the Device Self-test log page and the ability to start or abort a test. Reviewed by: imp, mav Tested by: Muhammad Ahmad MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27517 (cherry picked from commit 6733401935f83754b4b2744bc3d33ef84b1271e0) --- sbin/nvmecontrol/Makefile | 1 + sbin/nvmecontrol/logpage.c | 103 ++++++++++++++++++++++++++++++- sbin/nvmecontrol/nvmecontrol.8 | 23 +++++++ sbin/nvmecontrol/selftest.c | 137 +++++++++++++++++++++++++++++++++++++++++ sys/dev/nvme/nvme.h | 39 ++++++++++++ 5 files changed, 302 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/Makefile b/sbin/nvmecontrol/Makefile index 71212930a6c4..b5ceb350ed0d 100644 --- a/sbin/nvmecontrol/Makefile +++ b/sbin/nvmecontrol/Makefile @@ -9,6 +9,7 @@ SRCS+= devlist.c firmware.c format.c identify.c logpage.c ns.c nsid.c SRCS+= perftest.c power.c reset.c resv.c sanitize.c SRCS+= passthru.c SRCS+= identify_ext.c nvme_util.c nc_util.c +SRCS+= selftest.c MAN= nvmecontrol.8 LDFLAGS+= -rdynamic LIBADD+= util diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index 2f7cec005592..f00d5d94897b 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -239,6 +239,10 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, case NVME_LOG_CHANGED_NAMESPACE: nvme_ns_list_swapbytes((struct nvme_ns_list *)payload); break; + case NVME_LOG_DEVICE_SELF_TEST: + nvme_device_self_test_swapbytes( + (struct nvme_device_self_test_page *)payload); + break; case NVME_LOG_COMMAND_EFFECT: nvme_command_effects_page_swapbytes( (struct nvme_command_effects_page *)payload); @@ -588,6 +592,103 @@ print_log_sanitize_status(const struct nvme_controller_data *cdata __unused, printf("Time For Crypto Erase No-Deallocate: %u sec\n", ss->etfcewnd); } +static const char * +self_test_res[] = { + [0] = "completed without error", + [1] = "aborted by a Device Self-test command", + [2] = "aborted by a Controller Level Reset", + [3] = "aborted due to namespace removal", + [4] = "aborted due to Format NVM command", + [5] = "failed due to fatal or unknown test error", + [6] = "completed with an unknown segment that failed", + [7] = "completed with one or more failed segments", + [8] = "aborted for unknown reason", + [9] = "aborted due to a sanitize operation", +}; +static uint32_t self_test_res_max = nitems(self_test_res); + +static void +print_log_self_test_status(const struct nvme_controller_data *cdata __unused, + void *buf, uint32_t size __unused) +{ + struct nvme_device_self_test_page *dst; + uint32_t r; + + dst = buf; + printf("Device Self-test Status\n"); + printf("=======================\n"); + + printf("Current Operation: "); + switch (dst->curr_operation) { + case 0x0: + printf("No device self-test operation in progress\n"); + break; + case 0x1: + printf("Short device self-test operation in progress\n"); + break; + case 0x2: + printf("Extended device self-test operation in progress\n"); + break; + case 0xe: + printf("Vendor specific\n"); + break; + default: + printf("Reserved (0x%x)\n", dst->curr_operation); + } + + if (dst->curr_operation != 0) + printf("Current Completion: %u%%\n", dst->curr_compl & 0x7f); + + printf("Results\n"); + for (r = 0; r < 20; r++) { + uint64_t failing_lba; + uint8_t code, res; + + code = (dst->result[r].status >> 4) & 0xf; + res = dst->result[r].status & 0xf; + + if (res == 0xf) + continue; + + printf("[%2u] ", r); + switch (code) { + case 0x1: + printf("Short device self-test"); + break; + case 0x2: + printf("Extended device self-test"); + break; + case 0xe: + printf("Vendor specific"); + break; + default: + printf("Reserved (0x%x)", code); + } + if (res < self_test_res_max) + printf(" %s", self_test_res[res]); + else + printf(" Reserved status 0x%x", res); + + if (res == 7) + printf(" starting in segment %u", dst->result[r].segment_num); + +#define BIT(b) (1 << (b)) + if (dst->result[r].valid_diag_info & BIT(0)) + printf(" NSID=0x%x", dst->result[r].nsid); + if (dst->result[r].valid_diag_info & BIT(1)) { + memcpy(&failing_lba, dst->result[r].failing_lba, + sizeof(failing_lba)); + printf(" FLBA=0x%lx", failing_lba); + } + if (dst->result[r].valid_diag_info & BIT(2)) + printf(" SCT=0x%x", dst->result[r].status_code_type); + if (dst->result[r].valid_diag_info & BIT(3)) + printf(" SC=0x%x", dst->result[r].status_code); +#undef BIT + printf("\n"); + } +} + /* * Table of log page printer / sizing. * @@ -611,7 +712,7 @@ NVME_LOGPAGE(ce, print_log_command_effects, sizeof(struct nvme_command_effects_page)); NVME_LOGPAGE(dst, NVME_LOG_DEVICE_SELF_TEST, NULL, "Device Self-test", - NULL, 564); + print_log_self_test_status, sizeof(struct nvme_device_self_test_page)); NVME_LOGPAGE(thi, NVME_LOG_TELEMETRY_HOST_INITIATED, NULL, "Telemetry Host-Initiated", NULL, DEFAULT_SIZE); diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 976532932a69..2d634eb54216 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -177,6 +177,10 @@ .Op Fl p power_state .Op Fl w workload_hint .Nm +.Ic selftest +.Aq Fl c Ar code +.Aq Ar device-id | Ar namespace-id +.Nm .Ic wdc cap-diag .Op Fl o path_template .Aq Ar device-id @@ -254,6 +258,8 @@ Firmware Information Changed Namespace List .It Dv Page 0x05 Commands Supported and Effects +.It Dv Page 0x06 +Device Self-test .It Dv Page 0x80 Reservation Notification .It Dv Page 0x81 @@ -464,6 +470,23 @@ Run in mode. This will report status on a sanitize that is already running on the drive. .El +.Ss selftest +Start the specified device self-test: +.Bl -tag -width 6n +.It Fl c Ar code +Specify the device self-test command code. +Common codes are: +.Bl -tag -compact -width 6n +.It Dv 0x1 +Start a short device self-test operation +.It Dv 0x2 +Start an extended device self-test operation +.It Dv 0xe +Start a vendor specific device self-test operation +.It Dv 0xf +Abort the device self-test operation +.El +.El .Ss wdc The various wdc command retrieve log data from the wdc/hgst drives. The diff --git a/sbin/nvmecontrol/selftest.c b/sbin/nvmecontrol/selftest.c new file mode 100644 index 000000000000..17945248f8e3 --- /dev/null +++ b/sbin/nvmecontrol/selftest.c @@ -0,0 +1,137 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Chuck Tuffli + * + * 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 THE 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 THE 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nvmecontrol.h" + +#define SELFTEST_CODE_NONE 0xffu +#define SELFTEST_CODE_MAX 0xfu + +static struct options { + const char *dev; + uint8_t stc; /* Self-test Code */ +} opt = { + .dev = NULL, + .stc = SELFTEST_CODE_NONE, +}; + +static void +selftest_op(int fd, uint32_t nsid, uint8_t stc) +{ + struct nvme_pt_command pt; + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_DEVICE_SELF_TEST; + pt.cmd.nsid = htole32(nsid); + pt.cmd.cdw10 = htole32(stc); + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(EX_IOERR, "self-test request failed"); + + if (NVME_STATUS_GET_SCT(pt.cpl.status) == NVME_SCT_COMMAND_SPECIFIC && + NVME_STATUS_GET_SC(pt.cpl.status) == NVME_SC_SELF_TEST_IN_PROGRESS) + errx(EX_UNAVAILABLE, "device self-test in progress"); + else if (nvme_completion_is_error(&pt.cpl)) + errx(EX_IOERR, "self-test request returned error"); +} + +static void +selftest(const struct cmd *f, int argc, char *argv[]) +{ + struct nvme_controller_data cdata; + int fd; + char *path; + uint32_t nsid; + + if (arg_parse(argc, argv, f)) + return; + + open_dev(opt.dev, &fd, 1, 1); + get_nsid(fd, &path, &nsid); + if (nsid != 0) { + close(fd); + open_dev(path, &fd, 1, 1); + } + free(path); + + if (opt.stc == SELFTEST_CODE_NONE) + errx(EX_USAGE, "must specify a Self-test Code"); + else if (opt.stc > SELFTEST_CODE_MAX) + errx(EX_DATAERR, "illegal Self-test Code 0x%x", opt.stc); + + if (read_controller_data(fd, &cdata)) + errx(EX_IOERR, "Identify request failed"); + + if (((cdata.oacs >> NVME_CTRLR_DATA_OACS_SELFTEST_SHIFT) & + NVME_CTRLR_DATA_OACS_SELFTEST_MASK) == 0) + errx(EX_UNAVAILABLE, "controller does not support self-test"); + + selftest_op(fd, nsid, opt.stc); + + close(fd); + exit(0); +} + +static const struct opts selftest_opts[] = { +#define OPT(l, s, t, opt, addr, desc) { l, s, t, &opt.addr, desc } + OPT("test-code", 'c', arg_uint8, opt, stc, + "Self-test Code to execute"), + { NULL, 0, arg_none, NULL, NULL } +}; +#undef OPT + +static struct args selftest_args[] = { + { arg_string, &opt.dev, "controller-id|namespace-id" }, + { arg_none, NULL, NULL }, +}; + +static struct cmd selftest_cmd = { + .name = "selftest", + .fn = selftest, + .descr = "Start device self-test", + .ctx_size = sizeof(opt), + .opts = selftest_opts, + .args = selftest_args, +}; + +CMD_COMMAND(selftest_cmd); diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 982c994d6433..f42d1e9caa3b 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1403,6 +1403,28 @@ struct nvme_command_effects_page { _Static_assert(sizeof(struct nvme_command_effects_page) == 4096, "bad size for nvme_command_effects_page"); +struct nvme_device_self_test_page { + uint8_t curr_operation; + uint8_t curr_compl; + uint8_t rsvd2[2]; + struct { + uint8_t status; + uint8_t segment_num; + uint8_t valid_diag_info; + uint8_t rsvd3; + uint64_t poh; + uint32_t nsid; + /* Define as an array to simplify alignment issues */ + uint8_t failing_lba[8]; + uint8_t status_code_type; + uint8_t status_code; + uint8_t vendor_specific[2]; + } __packed result[20]; +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_device_self_test_page) == 564, + "bad size for nvme_device_self_test_page"); + struct nvme_res_notification_page { uint64_t log_page_count; uint8_t log_page_type; @@ -2027,4 +2049,21 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, #endif } +static inline void +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unused) +{ +#if _BYTE_ORDER != _LITTLE_ENDIAN + uint64_t failing_lba; + uint32_t r; + + for (r = 0; r < 20; r++) { + s->result[r].poh = le64toh(s->result[r].poh); + s->result[r].nsid = le32toh(s->result[r].nsid); + /* Unaligned 64-bit loads fail on some architectures */ + memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_lba)); + failing_lba = le64toh(failing_lba); + memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_lba)); + } +#endif +} #endif /* __NVME_H__ */ From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0871651177; Sat, 31 Jul 2021 00:21:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4h02BRZz4Vtf; Sat, 31 Jul 2021 00:21:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB8CD6DC6; Sat, 31 Jul 2021 00:21:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LZLg052193; Sat, 31 Jul 2021 00:21:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LZrM052192; Sat, 31 Jul 2021 00:21:35 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:35 GMT Message-Id: <202107310021.16V0LZrM052192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 225c0eda7efb - stable/12 - nvme: fix a race between failing the controller and failing requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 225c0eda7efb73c9af75fc54c434b0ec694f506a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:36 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=225c0eda7efb73c9af75fc54c434b0ec694f506a commit 225c0eda7efb73c9af75fc54c434b0ec694f506a Author: Warner Losh AuthorDate: 2021-05-29 05:01:52 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: fix a race between failing the controller and failing requests Part of the nvme recovery process for errors is to reset the card. Sometimes, this results in failing the entire controller. When nda is in use, we free the sim, which will sleep until all the I/O has completed. However, with only one thread, the request fail task never runs once the reset thread sleeps here. Create two threads to allow I/O to fail until it's all processed and the reset task can proceed. This is a temporary kludge until I can work out questions that arose during the review, not least is what was the race that queueing to a failure task solved. The original commit is vague and other error paths in the same context do a direct failure. I'll investigate that more completely before committing changing that to a direct failure. mav@ raised this issue during the review, but didn't otherwise object. Multiple threads, though, solve the problem in the mean time until other such means can be perfected. Reviewed by: jhb@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30366 (cherry picked from commit f0f47121653e88197d8537572294b90f5aef7f17) --- sys/dev/nvme/nvme_ctrlr.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 007e0758023a..0cd2c31ab086 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1442,9 +1442,20 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) if (nvme_ctrlr_construct_admin_qpair(ctrlr) != 0) return (ENXIO); + /* + * Create 2 threads for the taskqueue. The reset thread will block when + * it detects that the controller has failed until all I/O has been + * failed up the stack. The fail_req task needs to be able to run in + * this case to finish the request failure for some cases. + * + * We could partially solve this race by draining the failed requeust + * queue before proceding to free the sim, though nothing would stop + * new I/O from coming in after we do that drain, but before we reach + * cam_sim_free, so this big hammer is used instead. + */ ctrlr->taskqueue = taskqueue_create("nvme_taskq", M_WAITOK, taskqueue_thread_enqueue, &ctrlr->taskqueue); - taskqueue_start_threads(&ctrlr->taskqueue, 1, PI_DISK, "nvme taskq"); + taskqueue_start_threads(&ctrlr->taskqueue, 2, PI_DISK, "nvme taskq"); ctrlr->is_resetting = 0; ctrlr->is_initialized = 0; From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F41D665106B; Sat, 31 Jul 2021 00:21:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gn6HpSz4Vl3; Sat, 31 Jul 2021 00:21:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A9D26A5A; Sat, 31 Jul 2021 00:21:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LPMY051963; Sat, 31 Jul 2021 00:21:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LPji051962; Sat, 31 Jul 2021 00:21:25 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:25 GMT Message-Id: <202107310021.16V0LPji051962@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 2c54d6d4df6d - stable/12 - Unbreak r368167 in userland. Decorate unused arguments. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2c54d6d4df6de4bf3ae79c61cc61e9738ffdc171 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:27 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2c54d6d4df6de4bf3ae79c61cc61e9738ffdc171 commit 2c54d6d4df6de4bf3ae79c61cc61e9738ffdc171 Author: Michal Meloun AuthorDate: 2020-11-30 14:51:48 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:52 +0000 Unbreak r368167 in userland. Decorate unused arguments. Reported by: kp, tuexen, jenkins, and many others MFC with: r368167 (cherry picked from commit b2e9e573a392a973bea0ff180932913b7aa0eb66) --- sys/dev/nvme/nvme.h | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 982c994d6433..4ca4ea3373f6 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1738,9 +1738,15 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ +#if _BYTE_ORDER != _LITTLE_ENDIAN +#define MODIF +#else +#define MODIF __unused +#endif + /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s __unused) +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1754,7 +1760,7 @@ void nvme_completion_swapbytes(struct nvme_completion *s __unused) } static inline -void nvme_power_state_swapbytes(struct nvme_power_state *s __unused) +void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1767,7 +1773,7 @@ void nvme_power_state_swapbytes(struct nvme_power_state *s __unused) } static inline -void nvme_controller_data_swapbytes(struct nvme_controller_data *s __unused) +void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1819,7 +1825,7 @@ void nvme_controller_data_swapbytes(struct nvme_controller_data *s __unused) } static inline -void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused) +void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1849,7 +1855,7 @@ void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused) static inline void nvme_error_information_entry_swapbytes( - struct nvme_error_information_entry *s __unused) + struct nvme_error_information_entry *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1866,7 +1872,7 @@ void nvme_error_information_entry_swapbytes( } static inline -void nvme_le128toh(void *p __unused) +void nvme_le128toh(void *p MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN /* Swap 16 bytes in place */ @@ -1883,7 +1889,7 @@ void nvme_le128toh(void *p __unused) static inline void nvme_health_information_page_swapbytes( - struct nvme_health_information_page *s __unused) + struct nvme_health_information_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1912,7 +1918,7 @@ void nvme_health_information_page_swapbytes( static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) +void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1923,7 +1929,7 @@ void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) } static inline -void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) +void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1935,7 +1941,7 @@ void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) static inline void nvme_command_effects_page_swapbytes( - struct nvme_command_effects_page *s __unused) + struct nvme_command_effects_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1949,7 +1955,7 @@ void nvme_command_effects_page_swapbytes( static inline void nvme_res_notification_page_swapbytes( - struct nvme_res_notification_page *s __unused) + struct nvme_res_notification_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); @@ -1959,7 +1965,7 @@ void nvme_res_notification_page_swapbytes( static inline void nvme_sanitize_status_page_swapbytes( - struct nvme_sanitize_status_page *s __unused) + struct nvme_sanitize_status_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); @@ -1975,7 +1981,7 @@ void nvme_sanitize_status_page_swapbytes( } static inline -void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s __unused) +void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1992,8 +1998,8 @@ void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s __unused) } static inline -void nvme_resv_status_swapbytes(struct nvme_resv_status *s __unused, - size_t size __unused) +void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, + size_t size MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2010,8 +2016,8 @@ void nvme_resv_status_swapbytes(struct nvme_resv_status *s __unused, } static inline -void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, - size_t size __unused) +void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s MODIF, + size_t size MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2026,5 +2032,6 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, } #endif } +#undef MODIF #endif /* __NVME_H__ */ From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28FD56512CB; Sat, 31 Jul 2021 00:21:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gh3Xqvz4VRB; Sat, 31 Jul 2021 00:21:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 162DD6DC3; Sat, 31 Jul 2021 00:21:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LJUr048845; Sat, 31 Jul 2021 00:21:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LJSM048844; Sat, 31 Jul 2021 00:21:19 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:19 GMT Message-Id: <202107310021.16V0LJSM048844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 90a63b91ec09 - stable/12 - Add KASSERT to ensure sane nsid. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 90a63b91ec092e94f97d87f0f187cf1d393ee4a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:21 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=90a63b91ec092e94f97d87f0f187cf1d393ee4a0 commit 90a63b91ec092e94f97d87f0f187cf1d393ee4a0 Author: Warner Losh AuthorDate: 2020-05-01 21:24:19 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:51 +0000 Add KASSERT to ensure sane nsid. All callers are currently filtering bad nsid to this function, however, we'll have undefined behavior if that's not true. Add the KASSERT to prevent that. (cherry picked from commit d5cc572ce6009993fb3c4f6c887194b9ec3c9815) --- sys/dev/nvme/nvme.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 97f35afb36da..843aa80bb4fb 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -291,13 +291,18 @@ void nvme_notify_ns(struct nvme_controller *ctrlr, int nsid) { struct nvme_consumer *cons; - struct nvme_namespace *ns = &ctrlr->ns[nsid - 1]; + struct nvme_namespace *ns; void *ctrlr_cookie; uint32_t i; + KASSERT(nsid <= NVME_MAX_NAMESPACES, + ("%s: Namespace notification to nsid %d exceeds range\n", + device_get_nameunit(ctrlr->dev), nsid)); + if (!ctrlr->is_initialized) return; + ns = &ctrlr->ns[nsid - 1]; for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL && From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17D506512E1; Sat, 31 Jul 2021 00:21:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gy179Hz4VZX; Sat, 31 Jul 2021 00:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D45A6B6E; Sat, 31 Jul 2021 00:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LXpj052145; Sat, 31 Jul 2021 00:21:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LXq7052144; Sat, 31 Jul 2021 00:21:33 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:33 GMT Message-Id: <202107310021.16V0LXq7052144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d0f91d7de3f9 - stable/12 - nvme: Make nvme_ctrlr_hw_reset static MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d0f91d7de3f97259fc86bf615da5cf9357a3d066 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:35 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d0f91d7de3f97259fc86bf615da5cf9357a3d066 commit d0f91d7de3f97259fc86bf615da5cf9357a3d066 Author: Warner Losh AuthorDate: 2021-02-08 20:28:18 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: Make nvme_ctrlr_hw_reset static nvme_ctrlr_hw_reset is no longer used outside of nvme_ctrlr.c, so make it static. If we need to change this in the future we can. (cherry picked from commit dd2516fc078f15633ad5aedaad6de140cb491f80) --- sys/dev/nvme/nvme_ctrlr.c | 2 +- sys/dev/nvme/nvme_private.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 2bc0e1081d2b..d4d472878b82 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -402,7 +402,7 @@ nvme_ctrlr_disable_qpairs(struct nvme_controller *ctrlr) } } -int +static int nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr) { int err; diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index f26afbe29542..001d45f2acc4 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -405,7 +405,6 @@ void nvme_completion_poll_cb(void *arg, const struct nvme_completion *cpl); int nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev); void nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev); void nvme_ctrlr_shutdown(struct nvme_controller *ctrlr); -int nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr); void nvme_ctrlr_reset(struct nvme_controller *ctrlr); /* ctrlr defined as void * to allow use with config_intrhook. */ void nvme_ctrlr_start_config_hook(void *ctrlr_arg); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA7D36512E7; Sat, 31 Jul 2021 00:21:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4h21Fg7z4Vjr; Sat, 31 Jul 2021 00:21:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEFE56E07; Sat, 31 Jul 2021 00:21:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0La7T052217; Sat, 31 Jul 2021 00:21:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0La0L052216; Sat, 31 Jul 2021 00:21:36 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:36 GMT Message-Id: <202107310021.16V0La0L052216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 4fad4eeb75fe - stable/12 - nvme: style nit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4fad4eeb75fe440a9f307af4804cc211a451e603 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:38 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4fad4eeb75fe440a9f307af4804cc211a451e603 commit 4fad4eeb75fe440a9f307af4804cc211a451e603 Author: Warner Losh AuthorDate: 2021-07-02 21:58:14 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: style nit Put the { on the same line as the struct nvme_foo when we define these structures. It's FreeBSD standard and these were inconsistent. Sponsored by: Netflix (cherry picked from commit 80a75155e1601bddc2c595c06ab6ea916c603071) --- sys/dev/nvme/nvme.h | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 2caf8171be5b..d53bf3dd9357 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -546,8 +546,7 @@ enum shst_value { NVME_SHST_COMPLETE = 0x2, }; -struct nvme_registers -{ +struct nvme_registers { uint32_t cap_lo; /* controller capabilities */ uint32_t cap_hi; uint32_t vs; /* version */ @@ -584,8 +583,7 @@ struct nvme_registers _Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for nvme_registers"); -struct nvme_command -{ +struct nvme_command { /* dword 0 */ uint8_t opc; /* opcode */ uint8_t fuse; /* fused operation */ @@ -1453,8 +1451,7 @@ struct nvme_sanitize_status_page { _Static_assert(sizeof(struct nvme_sanitize_status_page) == 512, "bad size for nvme_sanitize_status_page"); -struct intel_log_temp_stats -{ +struct intel_log_temp_stats { uint64_t current; uint64_t overtemp_flag_last; uint64_t overtemp_flag_life; @@ -1468,8 +1465,7 @@ struct intel_log_temp_stats _Static_assert(sizeof(struct intel_log_temp_stats) == 13 * 8, "bad size for intel_log_temp_stats"); -struct nvme_resv_reg_ctrlr -{ +struct nvme_resv_reg_ctrlr { uint16_t ctrlr_id; /* Controller ID */ uint8_t rcsts; /* Reservation Status */ uint8_t reserved3[5]; @@ -1479,8 +1475,7 @@ struct nvme_resv_reg_ctrlr _Static_assert(sizeof(struct nvme_resv_reg_ctrlr) == 24, "bad size for nvme_resv_reg_ctrlr"); -struct nvme_resv_reg_ctrlr_ext -{ +struct nvme_resv_reg_ctrlr_ext { uint16_t ctrlr_id; /* Controller ID */ uint8_t rcsts; /* Reservation Status */ uint8_t reserved3[5]; @@ -1491,8 +1486,7 @@ struct nvme_resv_reg_ctrlr_ext _Static_assert(sizeof(struct nvme_resv_reg_ctrlr_ext) == 64, "bad size for nvme_resv_reg_ctrlr_ext"); -struct nvme_resv_status -{ +struct nvme_resv_status { uint32_t gen; /* Generation */ uint8_t rtype; /* Reservation Type */ uint8_t regctl[2]; /* Number of Registered Controllers */ @@ -1504,8 +1498,7 @@ struct nvme_resv_status _Static_assert(sizeof(struct nvme_resv_status) == 24, "bad size for nvme_resv_status"); -struct nvme_resv_status_ext -{ +struct nvme_resv_status_ext { uint32_t gen; /* Generation */ uint8_t rtype; /* Reservation Type */ uint8_t regctl[2]; /* Number of Registered Controllers */ From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42F72651087; Sat, 31 Jul 2021 00:21:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4h24MmCz4W0m; Sat, 31 Jul 2021 00:21:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F2366E09; Sat, 31 Jul 2021 00:21:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0Lc3g052241; Sat, 31 Jul 2021 00:21:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LctC052240; Sat, 31 Jul 2021 00:21:38 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:38 GMT Message-Id: <202107310021.16V0LctC052240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d85d7244d8bb - stable/12 - nvme: Fix alignment on nvme structures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d85d7244d8bb20d5d5040045856c8038333736ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:39 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d85d7244d8bb20d5d5040045856c8038333736ce commit d85d7244d8bb20d5d5040045856c8038333736ce Author: Warner Losh AuthorDate: 2021-07-02 21:58:19 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: Fix alignment on nvme structures Remove __packed from nvme_command, nvme_completion and nvme_dsm_trim. Add super-alignment to nvme_completion since it's always at least that aligned in hardware (and in our existing uses of it embedded in structures). It generates better code in nvme_qpair_process_completions on riscv64 because otherwise the ABI assumes a 4-byte alignment, and the same on all other platforms. Reviewed by: jrtc27@, mav@, chuck@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31001 (cherry picked from commit fea3cf1d6da0acf40bc1d3dadeeea7eeccbc10dd) --- sys/dev/nvme/nvme.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index d53bf3dd9357..fa0ac546e9c8 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -578,8 +578,8 @@ struct nvme_registers { struct { uint32_t sq_tdbl; /* submission queue tail doorbell */ uint32_t cq_hdbl; /* completion queue head doorbell */ - } doorbell[1] __packed; -} __packed; + } doorbell[1]; +}; _Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for nvme_registers"); @@ -612,7 +612,7 @@ struct nvme_command { uint32_t cdw13; /* command-specific */ uint32_t cdw14; /* command-specific */ uint32_t cdw15; /* command-specific */ -} __packed; +}; _Static_assert(sizeof(struct nvme_command) == 16 * 4, "bad size for nvme_command"); @@ -631,7 +631,7 @@ struct nvme_completion { /* dword 3 */ uint16_t cid; /* command identifier */ uint16_t status; -} __packed; +} __aligned(8); /* riscv: nvme_qpair_process_completions has better code gen */ _Static_assert(sizeof(struct nvme_completion) == 4 * 4, "bad size for nvme_completion"); @@ -639,7 +639,7 @@ struct nvme_dsm_range { uint32_t attributes; uint32_t length; uint64_t starting_lba; -} __packed; +}; /* Largest DSM Trim that can be done */ #define NVME_MAX_DSM_TRIM 4096 From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32147651096; Sat, 31 Jul 2021 00:21:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4h40grXz4Vk1; Sat, 31 Jul 2021 00:21:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A5326BB1; Sat, 31 Jul 2021 00:21:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LdR7052271; Sat, 31 Jul 2021 00:21:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LdN3052270; Sat, 31 Jul 2021 00:21:39 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:39 GMT Message-Id: <202107310021.16V0LdN3052270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f76c34659f9d - stable/12 - nvme: coherently read status of completion records MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f76c34659f9d94683e1161b8913b6466a2fdbaba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:41 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f76c34659f9d94683e1161b8913b6466a2fdbaba commit f76c34659f9d94683e1161b8913b6466a2fdbaba Author: Warner Losh AuthorDate: 2021-07-02 22:00:42 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: coherently read status of completion records Coherently read the phase bit of the status completion record. We loop over the completion record array, looking for all the transactions in the same phase that have been completed. In doing that, we have to be careful to read the status field first, and if it indicates a complete record, we need to read and process that record. Otherwise, the host might be overtaken by device when reading this completion record, leading to a mistaken belief that the record is in phase. This leads to the code using old values and looking at an already completed entry, which has no current tracker. To work around this problem, we read the status and make sure it is in phase, we then re-read the entire completion record guaranteeing it's complete, valid, and consistent . In addition we resync the dmatag to reflect changes since the prior loop for the bouncing dma case. Reviewed by: jrtc27@, chuck@ Found by: jrtc27 (this fix is based in part on her D30995 fix) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31002 (cherry picked from commit aa0ab681ae755e01cd69435fab50f6852f248c42) --- sys/dev/nvme/nvme_qpair.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index e188ef9e3ebd..d126b9dbeb18 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -586,13 +586,30 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) } while (1) { - cpl = qpair->cpl[qpair->cq_head]; + uint16_t status; - /* Convert to host endian */ + /* + * We need to do this dance to avoid a race between the host and + * the device where the device overtakes the host while the host + * is reading this record, leaving the status field 'new' and + * the sqhd and cid fields potentially stale. If the phase + * doesn't match, that means status hasn't yet been updated and + * we'll get any pending changes next time. It also means that + * the phase must be the same the second time. We have to sync + * before reading to ensure any bouncing completes. + */ + status = le16toh(qpair->cpl[qpair->cq_head].status); + if (NVME_STATUS_GET_P(status) != qpair->phase) + break; + + bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + cpl = qpair->cpl[qpair->cq_head]; nvme_completion_swapbytes(&cpl); - if (NVME_STATUS_GET_P(cpl.status) != qpair->phase) - break; + KASSERT( + NVME_STATUS_GET_P(status) == NVME_STATUS_GET_P(cpl.status), + ("Phase unexpectedly inconsistent")); tr = qpair->act_tr[cpl.cid]; From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFA8F65149D; Sat, 31 Jul 2021 00:21:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gz0TYVz4Vtd; Sat, 31 Jul 2021 00:21:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7E366CA1; Sat, 31 Jul 2021 00:21:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LY2Q052169; Sat, 31 Jul 2021 00:21:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LYrt052168; Sat, 31 Jul 2021 00:21:34 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:34 GMT Message-Id: <202107310021.16V0LYrt052168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 5b59c5186902 - stable/12 - nvme: use config_intrhook_drain to avoid removable card races MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5b59c5186902f8ac402b89796567fa630abb10c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:36 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5b59c5186902f8ac402b89796567fa630abb10c2 commit 5b59c5186902f8ac402b89796567fa630abb10c2 Author: Warner Losh AuthorDate: 2021-03-11 15:42:44 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: use config_intrhook_drain to avoid removable card races nvme drives are configured early in boot. However, a number of the configuration steps takes which take a while, so we defer those to a config intrhook that runs before the root filesystem is mounted. At the same time, the PCI hot plug wakes up and tests the status of the card. It may decide that the card has gone away and deletes the child. As part of that process nvme_detach is called. If this call happens after the config_intrhook starts to run, but before it is finished, there's a race where we can tear down the device's soft state while the config_intrhook is still using it. Use the new config_intrhook_drain to disestablish the hook. Either it will be removed w/o running, or the routine will wait for it to finish. This closes the race and allows safe hotplug at any time, even very early in boot. Sponsored by: Netflix, Inc Reviewed by: jhb, mav Differential Revision: https://reviews.freebsd.org/D29006 (cherry picked from commit 8423f5d4c127f18e7500bc455bc7b6b1691385ef) --- sys/dev/nvme/nvme.c | 5 +---- sys/dev/nvme/nvme_ctrlr.c | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 8e5bc11b35d4..17ee7b19177d 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -144,10 +144,7 @@ nvme_detach(device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); - if (ctrlr->config_hook.ich_arg != NULL) { - config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; - } + config_intrhook_drain(&ctrlr->config_hook); nvme_ctrlr_destruct(ctrlr, dev); return (0); diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d4d472878b82..007e0758023a 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1135,7 +1135,6 @@ nvme_ctrlr_start_config_hook(void *arg) fail: nvme_ctrlr_fail(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; return; } @@ -1154,7 +1153,6 @@ fail: nvme_sysctl_initialize_ctrlr(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; ctrlr->is_initialized = 1; nvme_notify_new_controller(ctrlr); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 00:21:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 304AF651495; Sat, 31 Jul 2021 00:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc4gw5MKwz4VZS; Sat, 31 Jul 2021 00:21:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 675B46DC5; Sat, 31 Jul 2021 00:21:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V0LWxg052115; Sat, 31 Jul 2021 00:21:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V0LWxD052114; Sat, 31 Jul 2021 00:21:32 GMT (envelope-from git) Date: Sat, 31 Jul 2021 00:21:32 GMT Message-Id: <202107310021.16V0LWxD052114@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: c7064b73eda5 - stable/12 - nvme: use NVME_GONE rather than hard-coded 0xffffffff MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c7064b73eda5984afddd80b3ec518312b5f307b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 00:21:33 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c7064b73eda5984afddd80b3ec518312b5f307b6 commit c7064b73eda5984afddd80b3ec518312b5f307b6 Author: Warner Losh AuthorDate: 2021-02-08 20:08:48 +0000 Commit: Warner Losh CommitDate: 2021-07-31 00:02:53 +0000 nvme: use NVME_GONE rather than hard-coded 0xffffffff Make it clearer that the value 0xfffffff is being used to detect the device is gone. We use it other places in the driver for other meanings. (cherry picked from commit 9600aa31aa633bbb9e8a56d91a781d5a7ce2bff6) --- sys/dev/nvme/nvme_ctrlr.c | 6 +++--- sys/dev/nvme/nvme_private.h | 2 ++ sys/dev/nvme/nvme_qpair.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index efc8fbcdf567..2bc0e1081d2b 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -260,7 +260,7 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) while (1) { csts = nvme_mmio_read_4(ctrlr, csts); - if (csts == 0xffffffff) /* Hot unplug. */ + if (csts == NVME_GONE) /* Hot unplug. */ return (ENXIO); if (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) == desired_val) @@ -1483,7 +1483,7 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) * Check whether it is a hot unplug or a clean driver detach. * If device is not there any more, skip any shutdown commands. */ - gone = (nvme_mmio_read_4(ctrlr, csts) == 0xffffffff); + gone = (nvme_mmio_read_4(ctrlr, csts) == NVME_GONE); if (gone) nvme_ctrlr_fail(ctrlr); else @@ -1561,7 +1561,7 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) ((uint64_t)ctrlr->cdata.rtd3e * hz + 999999) / 1000000); while (1) { csts = nvme_mmio_read_4(ctrlr, csts); - if (csts == 0xffffffff) /* Hot unplug. */ + if (csts == NVME_GONE) /* Hot unplug. */ break; if (NVME_CSTS_GET_SHST(csts) == NVME_SHST_COMPLETE) break; diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 39b5af66501f..f26afbe29542 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -104,6 +104,8 @@ MALLOC_DECLARE(M_NVME); #define CACHE_LINE_SIZE (64) #endif +#define NVME_GONE 0xfffffffful + extern int32_t nvme_retry_count; extern bool nvme_verbose_cmd_dump; diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 651eee121be1..e188ef9e3ebd 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -950,7 +950,7 @@ nvme_timeout(void *arg) nvme_abort_complete, tr); } else { nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", - (csts == 0xffffffff) ? " and possible hot unplug" : + (csts == NVME_GONE) ? " and possible hot unplug" : (cfs ? " and fatal error status" : "")); nvme_ctrlr_reset(ctrlr); } From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 02:02:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE3E46534E0; Sat, 31 Jul 2021 02:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gc6wG4PGNz4jHh; Sat, 31 Jul 2021 02:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F3AE10622; Sat, 31 Jul 2021 02:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V22MWq085065; Sat, 31 Jul 2021 02:02:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V22MXs085064; Sat, 31 Jul 2021 02:02:22 GMT (envelope-from git) Date: Sat, 31 Jul 2021 02:02:22 GMT Message-Id: <202107310202.16V22MXs085064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 3ff5432f9262 - stable/12 - Fix 32-bit build post 6733401935f83754b4b2744bc3d33ef84b1271e0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3ff5432f9262b69db4fdac328c16ae6381e837ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 02:02:22 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3ff5432f9262b69db4fdac328c16ae6381e837ac commit 3ff5432f9262b69db4fdac328c16ae6381e837ac Author: Dimitry Andric AuthorDate: 2021-01-08 22:38:21 +0000 Commit: Warner Losh CommitDate: 2021-07-31 02:01:01 +0000 Fix 32-bit build post 6733401935f83754b4b2744bc3d33ef84b1271e0 The general style in sbin/nvmecontrol apppears to print uint64_t types using %j, so I'm using that instead of the more general (but admittedly ugly) PRIu64. (cherry picked from commit a82f07fc2e2456b0ddc847d611f56a3152a6f940) --- sbin/nvmecontrol/logpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index f00d5d94897b..7daf012499a2 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -678,7 +678,7 @@ print_log_self_test_status(const struct nvme_controller_data *cdata __unused, if (dst->result[r].valid_diag_info & BIT(1)) { memcpy(&failing_lba, dst->result[r].failing_lba, sizeof(failing_lba)); - printf(" FLBA=0x%lx", failing_lba); + printf(" FLBA=0x%jx", failing_lba); } if (dst->result[r].valid_diag_info & BIT(2)) printf(" SCT=0x%x", dst->result[r].status_code_type); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 05:06:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AFBD6558AB; Sat, 31 Jul 2021 05:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcC192L3cz4txQ; Sat, 31 Jul 2021 05:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 383E112EB0; Sat, 31 Jul 2021 05:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V56rSu026884; Sat, 31 Jul 2021 05:06:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56rn0026883; Sat, 31 Jul 2021 05:06:53 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:53 GMT Message-Id: <202107310506.16V56rn0026883@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 51a4fad8d0bd - stable/12 - nvmecontrol: fix typo (s/Managment/Management/) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 51a4fad8d0bd11dfb34541eae98b0a42d34088c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 05:06:53 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=51a4fad8d0bd11dfb34541eae98b0a42d34088c1 commit 51a4fad8d0bd11dfb34541eae98b0a42d34088c1 Author: Edward Tomasz Napierala AuthorDate: 2021-05-07 12:12:30 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:02:13 +0000 nvmecontrol: fix typo (s/Managment/Management/) Reported By: pstef (cherry picked from commit 95a74ab4fb0879da270342bc98719b0e735694f3) --- sbin/nvmecontrol/identify_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c index 6e30ef0487a8..311c8cba09a9 100644 --- a/sbin/nvmecontrol/identify_ext.c +++ b/sbin/nvmecontrol/identify_ext.c @@ -138,7 +138,7 @@ nvme_print_controller(struct nvme_controller_data *cdata) fmt ? "Supported" : "Not Supported"); printf("Firmware Activate/Download: %s\n", fw ? "Supported" : "Not Supported"); - printf("Namespace Managment: %s\n", + printf("Namespace Management: %s\n", nsmgmt ? "Supported" : "Not Supported"); printf("Device Self-test: %sSupported\n", ((oacs >> NVME_CTRLR_DATA_OACS_SELFTEST_SHIFT) & From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 05:06:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B725E655572; Sat, 31 Jul 2021 05:06:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcC1C4jMNz4vBn; Sat, 31 Jul 2021 05:06:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8119F12EB2; Sat, 31 Jul 2021 05:06:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V56tqh026932; Sat, 31 Jul 2021 05:06:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56tuW026931; Sat, 31 Jul 2021 05:06:55 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:55 GMT Message-Id: <202107310506.16V56tuW026931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: bf7ea64d79bd - stable/12 - Add SPDX tag. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bf7ea64d79bd9b9bc3265f28a843fac9df2bf36b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 05:06:55 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bf7ea64d79bd9b9bc3265f28a843fac9df2bf36b commit bf7ea64d79bd9b9bc3265f28a843fac9df2bf36b Author: Warner Losh AuthorDate: 2019-02-28 02:29:48 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:03:35 +0000 Add SPDX tag. (cherry picked from commit e96f6eda1b292c9d91051be0fbe7070a5f83a464) --- sbin/nvmecontrol/nc_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/nvmecontrol/nc_util.c b/sbin/nvmecontrol/nc_util.c index 8f73256003a5..e2ad59b2fd23 100644 --- a/sbin/nvmecontrol/nc_util.c +++ b/sbin/nvmecontrol/nc_util.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2017 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 05:06:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 038D3655AAC; Sat, 31 Jul 2021 05:06:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcC1D5sjzz4v8Z; Sat, 31 Jul 2021 05:06:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A22E312CEC; Sat, 31 Jul 2021 05:06:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V56u1m026962; Sat, 31 Jul 2021 05:06:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56uFO026961; Sat, 31 Jul 2021 05:06:56 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:56 GMT Message-Id: <202107310506.16V56uFO026961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: abb811c40c94 - stable/12 - nvmecontrol: Report status from passthru commands MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: abb811c40c9458976ff1935cd50b95fab0bad643 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 05:06:57 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=abb811c40c9458976ff1935cd50b95fab0bad643 commit abb811c40c9458976ff1935cd50b95fab0bad643 Author: Warner Losh AuthorDate: 2021-03-25 07:41:53 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:04:16 +0000 nvmecontrol: Report status from passthru commands Report status from dword0 for passthru commands. Many commands report some status or information here, so reporting it can help know what's going on. Sponsored by: Netflix (cherry picked from commit 510a3da1477a917aa2aaf6b9e3cd6fd50dd13206) --- sbin/nvmecontrol/passthru.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c index add6cf1cc7ca..8284261b769b 100644 --- a/sbin/nvmecontrol/passthru.c +++ b/sbin/nvmecontrol/passthru.c @@ -246,7 +246,8 @@ passthru(const struct cmd *f, int argc, char *argv[]) errno = 0; if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) err(EX_IOERR, "passthrough request failed"); - /* XXX report status */ + if (!opt.binary) + printf("DWORD0 status= %#x\n", pt.cpl.cdw0); if (opt.read) { if (opt.binary) write(STDOUT_FILENO, data, opt.data_len); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 05:06:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D3A9655A2B; Sat, 31 Jul 2021 05:06:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcC1B3LsYz4v37; Sat, 31 Jul 2021 05:06:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58BBA12EB1; Sat, 31 Jul 2021 05:06:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V56sc7026908; Sat, 31 Jul 2021 05:06:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56s1r026907; Sat, 31 Jul 2021 05:06:54 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:54 GMT Message-Id: <202107310506.16V56s1r026907@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 4905e7273229 - stable/12 - nvmecontrol: document power command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4905e7273229106f7fc62d2801f5295d50d718d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 05:06:54 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4905e7273229106f7fc62d2801f5295d50d718d0 commit 4905e7273229106f7fc62d2801f5295d50d718d0 Author: Warner Losh AuthorDate: 2021-07-10 16:51:15 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:02:56 +0000 nvmecontrol: document power command The description of the power command is missing. While the synopsis is present, there's no explanation. Add one. Reviewed by: mav, chuck PR: 237866 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31122 (cherry picked from commit 445b5554bf97254a0ead3d70f801871d62dcfb62) --- sbin/nvmecontrol/nvmecontrol.8 | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 2d634eb54216..7d70e1762f73 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -470,6 +470,37 @@ Run in mode. This will report status on a sanitize that is already running on the drive. .El +.Ss power +Manage the power modes of the NVMe controller. +.Bl -tag -width 6n +.It Fl l +List all supported power modes. +.It Fl p Ar mode +Set the power mode to +.Ar mode . +This must be a mode listed with the +.Dl nvmecontrol power -l +command. +.It Fl w Ar hint +Set the workload hint for automatic power mode control. +.Bl -tag -compact -width 6n +.It 0 +No workload hint is provided. +.It 1 +Extended idle period workload. +The device is often idle for minutes at a time. +A burst of write commands comes in over a period of seconds. +Then the device returns to being idle. +.It 2 +Heavy sequential writes. +A huge number of sequential writes will be submitted, filling the submission queues. +.It Other +All other values are reserved and have no standard meaning. +.El +Please see the +.Dq NVM Subsystem Workloads +section of the relevant NVM Express Base Standard for details. +.El .Ss selftest Start the specified device self-test: .Bl -tag -width 6n @@ -505,7 +536,7 @@ and commands send NVMe commands to either the administrative or the data part of the device. These commands are expected to be compatible with nvme-cli. -Please see the NVMe Standard for details. +Please see the NVM Express Base Standard for details. .Bl -tag -width 16n .It Fl o -opcode Ar opcode Opcode to send. From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 05:06:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88D2D655AB6; Sat, 31 Jul 2021 05:06:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcC1F6f9Gz4vMn; Sat, 31 Jul 2021 05:06:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C241812CED; Sat, 31 Jul 2021 05:06:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16V56vpC026987; Sat, 31 Jul 2021 05:06:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V56vFY026986; Sat, 31 Jul 2021 05:06:57 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:06:57 GMT Message-Id: <202107310506.16V56vFY026986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: e605851b118c - stable/12 - nvmecontrol: update copyright on passthru command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e605851b118cb5870bfa250cb5577ca269400fee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 05:06:58 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e605851b118cb5870bfa250cb5577ca269400fee commit e605851b118cb5870bfa250cb5577ca269400fee Author: Warner Losh AuthorDate: 2021-05-06 22:05:42 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:04:52 +0000 nvmecontrol: update copyright on passthru command I wrote this code, not Intel, so put my copyright on this. I mistakenly copied it for the initial commit. Sponsored by: Netflix (cherry picked from commit 6d6cca363392943689204f920fa2da9226e42056) --- sbin/nvmecontrol/passthru.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/nvmecontrol/passthru.c b/sbin/nvmecontrol/passthru.c index 8284261b769b..0b24d7b1ea1f 100644 --- a/sbin/nvmecontrol/passthru.c +++ b/sbin/nvmecontrol/passthru.c @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (C) 2012-2013 Intel Corporation - * All rights reserved. + * Copyright (c) 2019-2021 Netflix, Inc * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 09:11:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C869A658976; Sat, 31 Jul 2021 09:11:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcJRt531Vz3m4C; Sat, 31 Jul 2021 09:11:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 6CA9641FD; Sat, 31 Jul 2021 09:11:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 5201E10DF5; Sat, 31 Jul 2021 11:11:52 +0200 (CEST) From: "Kristof Provost" To: "Warner Losh" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Date: Sat, 31 Jul 2021 11:11:51 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> In-Reply-To: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 09:11:54 -0000 Hi Warner, On 10 Jul 2021, at 19:12, Warner Losh wrote: > The branch stable/12 has been updated by imp: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38= efe5b83b0ec > > commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec > Author: Warner Losh > AuthorDate: 2021-07-07 23:30:35 +0000 > Commit: Warner Losh > CommitDate: 2021-07-10 17:11:15 +0000 > > one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number = > of bugs > > Import the latest bsd-features branch of the one-true-awk = > upstream: > > o Move to bison for $YACC > o Set close-on-exec flag for file and pipe redirects that aren't = > std* > o lots of little fixes to modernize ocde base > o free sval member before setting it > o fix a bug where a{0,3} could match aaaa > o pull in systime and strftime from NetBSD awk > o pull in fixes from {Net,Free,Open}BSD (normalized our code with = > them) > o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly = > a nop) > > Also revert a few of the trivial FreeBSD changes that were done = > slightly > differently in the upstreaming process. Also, our PR database may = > have > been mined by upstream for these fixes, and Mikolaj Golub may = > deserve > credit for some of the fixes in this update. > > Suggested by: Mikolaj Golub > PR: = > 143363,143365,143368,143369,143373,143375,214782 > Sponsored by: Netflix > > (cherry picked from commit = > f39dd6a9784467f0db5886012b3f4b13899be6b8) I *think* this is the relevant commit, but I=E2=80=99m not 100% sure. Anyway, I=E2=80=99ve recently started seeing issues building pfSense for = aarch64. I=E2=80=99ve finally narrowed it down, and replicated the proble= m on = base FreeBSD (stable/12, but I assume other branches are affected too). It fails to build proctab.c. This file is generated by maketab, a tool = built as part of the build process. In my case this tool is built for = aarch64, which makes executing it on amd64 less successful than we=E2=80=99= d = like. This only happens when building with META_MODE though. I do not = understand the build system sufficiently to debug why. Hopefully = you=E2=80=99ll have a better idea. This triggers the build failure: % cat /usr/src/src_env.conf WITH_META_MODE=3Dyes % env SRC_ENV_CONF=3D/usr/src/src_env.conf TARGET_ARCH=3Daarch64 make -j= 8 = buildworld =E2=80=A6 --- proctab.c --- *** [proctab.c] Error code 255 make[4]: stopped in /usr/src/usr.bin/awk .ERROR_TARGET=3D'proctab.c' .ERROR_META_FILE=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk/proctab.c= =2Emeta' .MAKE.LEVEL=3D'4' MAKEFILE=3D'' .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes silent=3Dyes= = verbose' _ERROR_CMD=3D'./maketab awkgram.h > proctab.c;' .CURDIR=3D'/usr/src/usr.bin/awk' .MAKE=3D'make' .OBJDIR=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk' .TARGETS=3D'all' DESTDIR=3D'/usr/obj/usr/src/arm64.aarch64/tmp' LD_LIBRARY_PATH=3D'' MACHINE=3D'arm64' MACHINE_ARCH=3D'aarch64' MAKEOBJDIRPREFIX=3D'' MAKESYSPATH=3D'/usr/src/share/mk' MAKE_VERSION=3D'20200710' Further up in the build output: --- maketab --- cc -target aarch64-unknown-freebsd12.2 = --sysroot=3D/usr/obj/usr/src/arm64.aarch64/tmp = -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-common = -DHAS_ISBLANK -I. -I/usr/src/contrib/one-true-awk -DFOPEN_MAX=3D64 -g = -std=3Dgnu99 -Wno-format-zero-length -fstack-protector-strong = -Wsystem-headers -Werror -Wno-pointer-sign -Wno-empty-body = -Wno-string-plus-int -Wno-unused-const-variable = -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality = -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef = -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum = -Wno-knr-promoted-parameter -Wno-parentheses -Qunused-arguments = /usr/src/contrib/one-true-awk/maketab.c -o maketab Without META_MODE maketab is built as an amd64 binary, and the entire = build succeeds. Best regards, Kristof From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9624065C467; Sat, 31 Jul 2021 13:03:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbW3Zx5z4SVH; Sat, 31 Jul 2021 13:03:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 634A919497; Sat, 31 Jul 2021 13:03:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3pqD066309; Sat, 31 Jul 2021 13:03:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3pJA066308; Sat, 31 Jul 2021 13:03:51 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:51 GMT Message-Id: <202107311303.16VD3pJA066308@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b0e7f371cde1 - stable/13 - Add FEATURE sysctls for ALTQ disciplines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b0e7f371cde199895a9071046e951beb38b1f4b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b0e7f371cde199895a9071046e951beb38b1f4b4 commit b0e7f371cde199895a9071046e951beb38b1f4b4 Author: Kristof Provost AuthorDate: 2021-01-23 09:36:33 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:01 +0000 Add FEATURE sysctls for ALTQ disciplines This will allow userspace to more easily figure out if ALTQ is built into the kernel and what disciplines are supported. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28302 (cherry picked from commit e111d79806fe3652bc85593ca77ee1b4ff85498d) --- sys/net/altq/altq_subr.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index ba1d3af5f5fd..609c18482845 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -114,6 +114,38 @@ static struct ip4_frag *ip4f_alloc(void); static void ip4f_free(struct ip4_frag *); #endif /* ALTQ3_CLFIER_COMPAT */ +#ifdef ALTQ +SYSCTL_NODE(_kern_features, OID_AUTO, altq, CTLFLAG_RD | CTLFLAG_CAPRD, 0, + "ALTQ packet queuing"); + +#define ALTQ_FEATURE(name, desc) \ + SYSCTL_INT_WITH_LABEL(_kern_features_altq, OID_AUTO, name, \ + CTLFLAG_RD | CTLFLAG_CAPRD, SYSCTL_NULL_INT_PTR, 1, \ + desc, "feature") + +#ifdef ALTQ_CBQ +ALTQ_FEATURE(cbq, "ATLQ Class Based Queuing discipline"); +#endif +#ifdef ALTQ_CODEL +ALTQ_FEATURE(codel, "ALTQ Controlled Delay discipline"); +#endif +#ifdef ALTQ_RED +ALTQ_FEATURE(red, "ALTQ Random Early Detection discipline"); +#endif +#ifdef ALTQ_RIO +ALTQ_FEATURE(rio, "ALTQ Random Early Drop discipline"); +#endif +#ifdef ALTQ_HFSC +ALTQ_FEATURE(hfsc, "ALTQ Hierarchical Packet Scheduler discipline"); +#endif +#ifdef ALTQ_PRIQ +ALTQ_FEATURE(priq, "ATLQ Priority Queuing discipline"); +#endif +#ifdef ALTQ_FAIRQ +ALTQ_FEATURE(fairq, "ALTQ Fair Queuing discipline"); +#endif +#endif + /* * alternate queueing support routines */ From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A768B65C46C; Sat, 31 Jul 2021 13:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbX47N1z4Skb; Sat, 31 Jul 2021 13:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76D7019511; Sat, 31 Jul 2021 13:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3qxA066381; Sat, 31 Jul 2021 13:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3qZO066380; Sat, 31 Jul 2021 13:03:52 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:52 GMT Message-Id: <202107311303.16VD3qZO066380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 5a1bc5f9028e - stable/13 - altq: Fix typo in features sysctl description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a1bc5f9028ec0087f4f4e096afd29bb6fd62f0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:52 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5a1bc5f9028ec0087f4f4e096afd29bb6fd62f0a commit 5a1bc5f9028ec0087f4f4e096afd29bb6fd62f0a Author: Kristof Provost AuthorDate: 2021-01-26 15:02:45 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:01 +0000 altq: Fix typo in features sysctl description Reported by: Jose Luis Duran (cherry picked from commit 35dabb7b9cff601045b623aeca59ccc68930d520) --- sys/net/altq/altq_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index 609c18482845..68ec9cd80418 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -124,7 +124,7 @@ SYSCTL_NODE(_kern_features, OID_AUTO, altq, CTLFLAG_RD | CTLFLAG_CAPRD, 0, desc, "feature") #ifdef ALTQ_CBQ -ALTQ_FEATURE(cbq, "ATLQ Class Based Queuing discipline"); +ALTQ_FEATURE(cbq, "ALTQ Class Based Queuing discipline"); #endif #ifdef ALTQ_CODEL ALTQ_FEATURE(codel, "ALTQ Controlled Delay discipline"); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2AEF65C09B; Sat, 31 Jul 2021 13:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbX5PlKz4SYR; Sat, 31 Jul 2021 13:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BD8E19498; Sat, 31 Jul 2021 13:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3qsY066437; Sat, 31 Jul 2021 13:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3qON066436; Sat, 31 Jul 2021 13:03:52 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:52 GMT Message-Id: <202107311303.16VD3qON066436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 58ca52f752a8 - stable/12 - Add FEATURE sysctls for ALTQ disciplines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 58ca52f752a81cd670e3f7fc6f300c5667ffe4b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:53 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=58ca52f752a81cd670e3f7fc6f300c5667ffe4b3 commit 58ca52f752a81cd670e3f7fc6f300c5667ffe4b3 Author: Kristof Provost AuthorDate: 2021-01-23 09:36:33 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:12:51 +0000 Add FEATURE sysctls for ALTQ disciplines This will allow userspace to more easily figure out if ALTQ is built into the kernel and what disciplines are supported. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28302 (cherry picked from commit e111d79806fe3652bc85593ca77ee1b4ff85498d) --- sys/net/altq/altq_subr.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index 01aa1efef53d..f28a4383364a 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -117,6 +117,38 @@ static struct ip4_frag *ip4f_alloc(void); static void ip4f_free(struct ip4_frag *); #endif /* ALTQ3_CLFIER_COMPAT */ +#ifdef ALTQ +SYSCTL_NODE(_kern_features, OID_AUTO, altq, CTLFLAG_RD | CTLFLAG_CAPRD, 0, + "ALTQ packet queuing"); + +#define ALTQ_FEATURE(name, desc) \ + SYSCTL_INT_WITH_LABEL(_kern_features_altq, OID_AUTO, name, \ + CTLFLAG_RD | CTLFLAG_CAPRD, SYSCTL_NULL_INT_PTR, 1, \ + desc, "feature") + +#ifdef ALTQ_CBQ +ALTQ_FEATURE(cbq, "ATLQ Class Based Queuing discipline"); +#endif +#ifdef ALTQ_CODEL +ALTQ_FEATURE(codel, "ALTQ Controlled Delay discipline"); +#endif +#ifdef ALTQ_RED +ALTQ_FEATURE(red, "ALTQ Random Early Detection discipline"); +#endif +#ifdef ALTQ_RIO +ALTQ_FEATURE(rio, "ALTQ Random Early Drop discipline"); +#endif +#ifdef ALTQ_HFSC +ALTQ_FEATURE(hfsc, "ALTQ Hierarchical Packet Scheduler discipline"); +#endif +#ifdef ALTQ_PRIQ +ALTQ_FEATURE(priq, "ATLQ Priority Queuing discipline"); +#endif +#ifdef ALTQ_FAIRQ +ALTQ_FEATURE(fairq, "ALTQ Fair Queuing discipline"); +#endif +#endif + /* * alternate queueing support routines */ From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB6B765C0A0; Sat, 31 Jul 2021 13:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbY5GF5z4SSr; Sat, 31 Jul 2021 13:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90F9719426; Sat, 31 Jul 2021 13:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3rpu066461; Sat, 31 Jul 2021 13:03:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3rhq066460; Sat, 31 Jul 2021 13:03:53 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:53 GMT Message-Id: <202107311303.16VD3rhq066460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2400173b9377 - stable/13 - altq tests: Basic ALTQ test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2400173b937739966d2bf0cc305c564243074cc9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2400173b937739966d2bf0cc305c564243074cc9 commit 2400173b937739966d2bf0cc305c564243074cc9 Author: Kristof Provost AuthorDate: 2021-01-23 09:37:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:02 +0000 altq tests: Basic ALTQ test Activate ALTQ_HFSC, crudely check if it really limits bandwidth as we'd expect. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28303 (cherry picked from commit 16b3833344ad04194f10b567bc6fae829a52a850) --- tests/sys/netpfil/pf/Makefile | 3 ++- tests/sys/netpfil/pf/altq.sh | 49 +++++++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/pf/utils.subr | 24 ++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index cfa5f5c7c912..2f9ce73f381b 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -5,7 +5,8 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/netpfil/pf TESTS_SUBDIRS+= ioctl -ATF_TESTS_SH+= anchor \ +ATF_TESTS_SH+= altq \ + anchor \ checksum \ dup \ forward \ diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh new file mode 100644 index 000000000000..89da4c0deb6f --- /dev/null +++ b/tests/sys/netpfil/pf/altq.sh @@ -0,0 +1,49 @@ +. $(atf_get_srcdir)/utils.subr + +atf_test_case "hfsc" "cleanup" +hfsc_head() +{ + atf_set descr 'Basic HFSC test' + atf_set require.user root +} + +hfsc_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_hfsc ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_hfsc ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_hfsc pfctl -e + pft_set_rules altq_hfsc \ + "altq on ${epair}b bandwidth 100b hfsc queue { default }" \ + "queue default hfsc(default linkshare 80b)" \ + "pass proto icmp " + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +hfsc_cleanup() +{ + altq_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "hfsc" +} + diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr index 62e85d5cc463..d7df2a6747da 100644 --- a/tests/sys/netpfil/pf/utils.subr +++ b/tests/sys/netpfil/pf/utils.subr @@ -79,3 +79,27 @@ pfsynct_cleanup() { pft_cleanup } + +is_altq_supported() +{ + sysctl -q kern.features.altq >/dev/null || \ + atf_skip "Test requires ALTQ" + + while [ -n "$1" ] + do + sysctl -q kern.features.altq.${1} >/dev/null || \ + atf_skip "Test required ALTQ_${1}" + shift + done +} + +altq_init() +{ + pft_init + is_altq_supported +} + +altq_cleanup() +{ + pft_cleanup +} From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96D9765C31C; Sat, 31 Jul 2021 13:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbc2Kdvz4SDH; Sat, 31 Jul 2021 13:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D489E191AB; Sat, 31 Jul 2021 13:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3tPO066559; Sat, 31 Jul 2021 13:03:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3tSj066558; Sat, 31 Jul 2021 13:03:55 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:55 GMT Message-Id: <202107311303.16VD3tSj066558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c1bb4edaa06d - stable/13 - pf tests: Test the match keyword MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c1bb4edaa06dd1d8d81fadc9b6aa6d87693976b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:56 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c1bb4edaa06dd1d8d81fadc9b6aa6d87693976b9 commit c1bb4edaa06dd1d8d81fadc9b6aa6d87693976b9 Author: Kristof Provost AuthorDate: 2021-03-02 15:57:27 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:02 +0000 pf tests: Test the match keyword The new match keyword can currently only assign queues, so we can only test it with ALTQ. Set up a basic scenario where we use 'match' to assign ICMP traffic to a slow queue, and confirm that it's really getting slowed down. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31116 (cherry picked from commit d363ebc78cbb50bc334d74fb5bb755af53c69ff0) --- tests/sys/netpfil/pf/altq.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh index 89da4c0deb6f..294c01e9f8bd 100644 --- a/tests/sys/netpfil/pf/altq.sh +++ b/tests/sys/netpfil/pf/altq.sh @@ -42,8 +42,53 @@ hfsc_cleanup() altq_cleanup } +atf_test_case "match" "cleanup" +match_head() +{ + atf_set descr 'Basic match keyword test' + atf_set require.user root +} + +match_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_match ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_match ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_match pfctl -e + pft_set_rules altq_match \ + "altq on ${epair}b bandwidth 100000000b hfsc queue { default, slow }" \ + "queue default hfsc(default linkshare 80000000b)" \ + "queue slow hfsc(linkshare 80b upperlimit 80b)" \ + "match proto icmp queue slow" \ + "pass" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +match_cleanup() +{ + altq_cleanup +} + atf_init_test_cases() { atf_add_test_case "hfsc" + atf_add_test_case "match" } From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 962F665C495; Sat, 31 Jul 2021 13:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbc2NTdz4SYf; Sat, 31 Jul 2021 13:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AA5719669; Sat, 31 Jul 2021 13:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3tvI066585; Sat, 31 Jul 2021 13:03:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3tEw066584; Sat, 31 Jul 2021 13:03:55 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:55 GMT Message-Id: <202107311303.16VD3tEw066584@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c6fd64da525a - stable/12 - pf: match keyword support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c6fd64da525a31890e42cef5665daeba665570d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:56 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c6fd64da525a31890e42cef5665daeba665570d0 commit c6fd64da525a31890e42cef5665daeba665570d0 Author: Kristof Provost AuthorDate: 2021-03-02 15:01:04 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:27 +0000 pf: match keyword support Support the 'match' keyword. Note that support is limited to adding queuing information, so without ALTQ support in the kernel setting match rules is pointless. For the avoidance of doubt: this is NOT full support for the match keyword as found in OpenBSD's pf. That could potentially be built on top of this, but this commit is NOT that. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31115 (cherry picked from commit ef950daa35d43dd396958ca28ce9de0514daf873) --- sbin/pfctl/parse.y | 4 ++- sbin/pfctl/pf_ruleset.c | 1 + sbin/pfctl/pfctl_parser.c | 4 ++- sys/net/pfvar.h | 8 +++++ sys/netpfil/pf/pf.c | 81 +++++++++++++++++++++++++++++++++++++-------- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ruleset.c | 1 + 7 files changed, 85 insertions(+), 17 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 2655a7939503..0320cdc7ec00 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -456,7 +456,7 @@ int parseport(char *, struct range *r, int); %} -%token PASS BLOCK SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS +%token PASS BLOCK MATCH SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS %token RETURNRST RETURNICMP RETURNICMP6 PROTO INET INET6 ALL ANY ICMPTYPE %token ICMP6TYPE CODE KEEP MODULATE STATE PORT RDR NAT BINAT ARROW NODF %token MINTTL ERROR ALLOWOPTS FASTROUTE FILENAME ROUTETO DUPTO REPLYTO NO LABEL @@ -2684,6 +2684,7 @@ action : PASS { $$.w = returnicmpdefault; $$.w2 = returnicmp6default; } + | MATCH { $$.b1 = PF_MATCH; $$.b2 = $$.w = 0; } | BLOCK blockspec { $$ = $2; $$.b1 = PF_DROP; } ; @@ -5619,6 +5620,7 @@ lookup(char *s) { "log", LOG}, { "loginterface", LOGINTERFACE}, { "map-e-portset", MAPEPORTSET}, + { "match", MATCH}, { "max", MAXIMUM}, { "max-mss", MAXMSS}, { "max-src-conn", MAXSRCCONN}, diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index f5cddf481871..480e0f0c9b45 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -106,6 +106,7 @@ pf_get_ruleset_number(u_int8_t action) break; case PF_PASS: case PF_DROP: + case PF_MATCH: return (PF_RULESET_FILTER); break; case PF_NAT: diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 7020a0f6a811..dc2a460a087f 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -713,7 +713,9 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer if (verbose) printf("@%d ", r->nr); - if (r->action > PF_NORDR) + if (r->action == PF_MATCH) + printf("match"); + else if (r->action > PF_NORDR) printf("action(%d)", r->action); else if (anchor_call[0]) { if (anchor_call[0] == '_') { diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 7d31e4ce21a0..35e2f0f717ba 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -339,6 +339,11 @@ struct pf_kpool { u_int8_t opts; }; +struct pf_rule_actions { + u_int32_t qid; + u_int32_t pqid; +}; + union pf_krule_ptr { struct pf_krule *ptr; u_int32_t nr; @@ -625,6 +630,8 @@ struct pf_kstate { u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; + u_int32_t qid; + u_int32_t pqid; u_int16_t tag; u_int8_t log; }; @@ -1068,6 +1075,7 @@ struct pf_pdesc { u_int16_t *sport; u_int16_t *dport; struct pf_mtag *pf_mtag; + struct pf_rule_actions act; u_int32_t p_len; /* total length of payload */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 4127d526f33c..7b2812a952ce 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -252,6 +252,8 @@ static int pf_state_key_attach(struct pf_state_key *, static void pf_state_key_detach(struct pf_kstate *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); +void pf_rule_to_actions(struct pf_krule *, + struct pf_rule_actions *); static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, @@ -3135,6 +3137,15 @@ pf_addr_inc(struct pf_addr *addr, sa_family_t af) } #endif /* INET6 */ +void +pf_rule_to_actions(struct pf_krule *r, struct pf_rule_actions *a) +{ + if (r->qid) + a->qid = r->qid; + if (r->pqid) + a->pqid = r->pqid; +} + int pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) { @@ -3642,10 +3653,20 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, if (r->rtableid >= 0) rtableid = r->rtableid; if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -3664,6 +3685,9 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log || (nr != NULL && nr->log)) { if (rewrite) m_copyback(m, off, hdrlen, pd->hdr.any); @@ -3782,6 +3806,8 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->state_flags |= PFSTATE_SLOPPY; s->log = r->log & PF_LOG_ALL; s->sync_state = PFSYNC_S_NONE; + s->qid = pd->act.qid; + s->pqid = pd->act.pqid; if (nr != NULL) s->log |= nr->log & PF_LOG_ALL; switch (pd->proto) { @@ -4041,10 +4067,20 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, r = TAILQ_NEXT(r, entries); else { if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -4063,6 +4099,9 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log) PFLOG_PACKET(kif, m, af, direction, reason, r, a, ruleset, pd, 1); @@ -6322,7 +6361,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6331,9 +6377,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pqid || (pd.tos & IPTOS_LOWDELAY)) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } @@ -6767,7 +6813,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6776,9 +6829,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pd.tos & IPTOS_LOWDELAY) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 869e8e32eb5c..245d68b4be45 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -49,7 +49,8 @@ enum { PF_INOUT, PF_IN, PF_OUT }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, - PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER }; + PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER, + PF_MATCH }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX }; enum { PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT, diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 227157c2876d..5adc7bfc2bf6 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -95,6 +95,7 @@ pf_get_ruleset_number(u_int8_t action) return (PF_RULESET_SCRUB); break; case PF_PASS: + case PF_MATCH: case PF_DROP: return (PF_RULESET_FILTER); break; From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCBA665C1BA; Sat, 31 Jul 2021 13:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbf2xdNz4Sky; Sat, 31 Jul 2021 13:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BF7E19513; Sat, 31 Jul 2021 13:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3vOh066660; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3vgs066659; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:57 GMT Message-Id: <202107311303.16VD3vgs066659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: adde304e5348 - stable/13 - pf: fix ABI breakage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: adde304e53488bec9ec5ba4d589f365e9e0c4aad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:59 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=adde304e53488bec9ec5ba4d589f365e9e0c4aad commit adde304e53488bec9ec5ba4d589f365e9e0c4aad Author: Kristof Provost AuthorDate: 2021-07-28 09:24:44 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:20 +0000 pf: fix ABI breakage The introduction of synproxy support changed the size of struct pf_status, which in turn broke the userspace ABI. Revert the relevant change. More work is needed on the synproxy code to keep and expose the counters, but in the mean time this restores the ABI. PR: 257469 MFC after: 3 days Sponsored by: Modirum MDPay (cherry picked from commit da8d8b22e69c72f1d001d55b5eff5acbb0265cfc) --- sys/netpfil/pf/pf.h | 3 +-- sys/netpfil/pf/pf_syncookies.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 245d68b4be45..e030f1e59de0 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -160,8 +160,7 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ -#define LCNT_MAX 8 /* total+1 */ +#define LCNT_MAX 7 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 8699ae855ec8..744a12e4e21d 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -275,7 +275,6 @@ pf_syncookie_validate(struct pf_pdesc *pd) if ((ack & ~0xff) != (hash & ~0xff)) return (0); - counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); return (1); } From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61A2F65C484; Sat, 31 Jul 2021 13:03:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbZ0tGJz4SYX; Sat, 31 Jul 2021 13:03:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEB0219499; Sat, 31 Jul 2021 13:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3rv3066485; Sat, 31 Jul 2021 13:03:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3rvd066484; Sat, 31 Jul 2021 13:03:53 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:53 GMT Message-Id: <202107311303.16VD3rvd066484@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 8e1505eed376 - stable/12 - altq: Fix typo in features sysctl description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8e1505eed376267fec4b89f655226c8ef16ab6f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:54 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8e1505eed376267fec4b89f655226c8ef16ab6f0 commit 8e1505eed376267fec4b89f655226c8ef16ab6f0 Author: Kristof Provost AuthorDate: 2021-01-26 15:02:45 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:13:20 +0000 altq: Fix typo in features sysctl description Reported by: Jose Luis Duran (cherry picked from commit 35dabb7b9cff601045b623aeca59ccc68930d520) --- sys/net/altq/altq_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index f28a4383364a..e69fbdf15020 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -127,7 +127,7 @@ SYSCTL_NODE(_kern_features, OID_AUTO, altq, CTLFLAG_RD | CTLFLAG_CAPRD, 0, desc, "feature") #ifdef ALTQ_CBQ -ALTQ_FEATURE(cbq, "ATLQ Class Based Queuing discipline"); +ALTQ_FEATURE(cbq, "ALTQ Class Based Queuing discipline"); #endif #ifdef ALTQ_CODEL ALTQ_FEATURE(codel, "ALTQ Controlled Delay discipline"); From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A91165C46E; Sat, 31 Jul 2021 13:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbZ6Lj7z4SYZ; Sat, 31 Jul 2021 13:03:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B80FB18ECD; Sat, 31 Jul 2021 13:03:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3s9C066509; Sat, 31 Jul 2021 13:03:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3soN066508; Sat, 31 Jul 2021 13:03:54 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:54 GMT Message-Id: <202107311303.16VD3soN066508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 70d4a7a966ef - stable/13 - pf: match keyword support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 70d4a7a966ef083892f055ef56eb14bba10ff5e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:55 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=70d4a7a966ef083892f055ef56eb14bba10ff5e9 commit 70d4a7a966ef083892f055ef56eb14bba10ff5e9 Author: Kristof Provost AuthorDate: 2021-03-02 15:01:04 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:02 +0000 pf: match keyword support Support the 'match' keyword. Note that support is limited to adding queuing information, so without ALTQ support in the kernel setting match rules is pointless. For the avoidance of doubt: this is NOT full support for the match keyword as found in OpenBSD's pf. That could potentially be built on top of this, but this commit is NOT that. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31115 (cherry picked from commit ef950daa35d43dd396958ca28ce9de0514daf873) --- sbin/pfctl/parse.y | 4 ++- sbin/pfctl/pf_ruleset.c | 1 + sbin/pfctl/pfctl_parser.c | 4 ++- sys/net/pfvar.h | 8 +++++ sys/netpfil/pf/pf.c | 81 +++++++++++++++++++++++++++++++++++++-------- sys/netpfil/pf/pf.h | 3 +- sys/netpfil/pf/pf_ruleset.c | 1 + 7 files changed, 85 insertions(+), 17 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 19fb87323060..dbfe299cf34f 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -456,7 +456,7 @@ int parseport(char *, struct range *r, int); %} -%token PASS BLOCK SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS +%token PASS BLOCK MATCH SCRUB RETURN IN OS OUT LOG QUICK ON FROM TO FLAGS %token RETURNRST RETURNICMP RETURNICMP6 PROTO INET INET6 ALL ANY ICMPTYPE %token ICMP6TYPE CODE KEEP MODULATE STATE PORT RDR NAT BINAT ARROW NODF %token MINTTL ERROR ALLOWOPTS FASTROUTE FILENAME ROUTETO DUPTO REPLYTO NO LABEL @@ -2692,6 +2692,7 @@ action : PASS { $$.w = returnicmpdefault; $$.w2 = returnicmp6default; } + | MATCH { $$.b1 = PF_MATCH; $$.b2 = $$.w = 0; } | BLOCK blockspec { $$ = $2; $$.b1 = PF_DROP; } ; @@ -5627,6 +5628,7 @@ lookup(char *s) { "log", LOG}, { "loginterface", LOGINTERFACE}, { "map-e-portset", MAPEPORTSET}, + { "match", MATCH}, { "max", MAXIMUM}, { "max-mss", MAXMSS}, { "max-src-conn", MAXSRCCONN}, diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index f5cddf481871..480e0f0c9b45 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -106,6 +106,7 @@ pf_get_ruleset_number(u_int8_t action) break; case PF_PASS: case PF_DROP: + case PF_MATCH: return (PF_RULESET_FILTER); break; case PF_NAT: diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index e3efd20d3822..8991073ec693 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -713,7 +713,9 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer if (verbose) printf("@%d ", r->nr); - if (r->action > PF_NORDR) + if (r->action == PF_MATCH) + printf("match"); + else if (r->action > PF_NORDR) printf("action(%d)", r->action); else if (anchor_call[0]) { if (anchor_call[0] == '_') { diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index e54e734dcecf..7a244ac13d72 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -339,6 +339,11 @@ struct pf_kpool { u_int8_t opts; }; +struct pf_rule_actions { + u_int32_t qid; + u_int32_t pqid; +}; + union pf_krule_ptr { struct pf_krule *ptr; u_int32_t nr; @@ -625,6 +630,8 @@ struct pf_kstate { u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; + u_int32_t qid; + u_int32_t pqid; u_int16_t tag; u_int8_t log; }; @@ -1068,6 +1075,7 @@ struct pf_pdesc { u_int16_t *sport; u_int16_t *dport; struct pf_mtag *pf_mtag; + struct pf_rule_actions act; u_int32_t p_len; /* total length of payload */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 4005e453cfb7..87912046f8d3 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -251,6 +251,8 @@ static int pf_state_key_attach(struct pf_state_key *, static void pf_state_key_detach(struct pf_kstate *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); +void pf_rule_to_actions(struct pf_krule *, + struct pf_rule_actions *); static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, @@ -3133,6 +3135,15 @@ pf_addr_inc(struct pf_addr *addr, sa_family_t af) } #endif /* INET6 */ +void +pf_rule_to_actions(struct pf_krule *r, struct pf_rule_actions *a) +{ + if (r->qid) + a->qid = r->qid; + if (r->pqid) + a->pqid = r->pqid; +} + int pf_socket_lookup(int direction, struct pf_pdesc *pd, struct mbuf *m) { @@ -3641,10 +3652,20 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, if (r->rtableid >= 0) rtableid = r->rtableid; if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -3663,6 +3684,9 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log || (nr != NULL && nr->log)) { if (rewrite) m_copyback(m, off, hdrlen, pd->hdr.any); @@ -3781,6 +3805,8 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->state_flags |= PFSTATE_SLOPPY; s->log = r->log & PF_LOG_ALL; s->sync_state = PFSYNC_S_NONE; + s->qid = pd->act.qid; + s->pqid = pd->act.pqid; if (nr != NULL) s->log |= nr->log & PF_LOG_ALL; switch (pd->proto) { @@ -4040,10 +4066,20 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, r = TAILQ_NEXT(r, entries); else { if (r->anchor == NULL) { - match = 1; - *rm = r; - *am = a; - *rsm = ruleset; + if (r->action == PF_MATCH) { + counter_u64_add(r->packets[direction == PF_OUT], 1); + counter_u64_add(r->bytes[direction == PF_OUT], pd->tot_len); + pf_rule_to_actions(r, &pd->act); + if (r->log) + PFLOG_PACKET(kif, m, af, + direction, PFRES_MATCH, r, + a, ruleset, pd, 1); + } else { + match = 1; + *rm = r; + *am = a; + *rsm = ruleset; + } if ((*rm)->quick) break; r = TAILQ_NEXT(r, entries); @@ -4062,6 +4098,9 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, REASON_SET(&reason, PFRES_MATCH); + /* apply actions for last matching pass/block rule */ + pf_rule_to_actions(r, &pd->act); + if (r->log) PFLOG_PACKET(kif, m, af, direction, reason, r, a, ruleset, pd, 1); @@ -6237,7 +6276,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6246,9 +6292,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pqid || (pd.tos & IPTOS_LOWDELAY)) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } @@ -6677,7 +6723,14 @@ done: } #ifdef ALTQ - if (action == PF_PASS && r->qid) { + if (s && s->qid) { + pd.act.pqid = s->pqid; + pd.act.qid = s->qid; + } else if (r->qid) { + pd.act.pqid = r->pqid; + pd.act.qid = r->qid; + } + if (action == PF_PASS && pd.act.qid) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6686,9 +6739,9 @@ done: if (s != NULL) pd.pf_mtag->qid_hash = pf_state_hash(s); if (pd.tos & IPTOS_LOWDELAY) - pd.pf_mtag->qid = r->pqid; + pd.pf_mtag->qid = pd.act.pqid; else - pd.pf_mtag->qid = r->qid; + pd.pf_mtag->qid = pd.act.qid; /* Add hints for ecn. */ pd.pf_mtag->hdr = h; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 869e8e32eb5c..245d68b4be45 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -49,7 +49,8 @@ enum { PF_INOUT, PF_IN, PF_OUT }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, - PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER }; + PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER, + PF_MATCH }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX }; enum { PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT, diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index ad1b07f69fe6..c21f4dfdd4a0 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -95,6 +95,7 @@ pf_get_ruleset_number(u_int8_t action) return (PF_RULESET_SCRUB); break; case PF_PASS: + case PF_MATCH: case PF_DROP: return (PF_RULESET_FILTER); break; From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DD4065C493; Sat, 31 Jul 2021 13:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbb1Lwfz4SmN; Sat, 31 Jul 2021 13:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6AD219512; Sat, 31 Jul 2021 13:03:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3spt066533; Sat, 31 Jul 2021 13:03:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3sRB066532; Sat, 31 Jul 2021 13:03:54 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:54 GMT Message-Id: <202107311303.16VD3sRB066532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e02597d7ce67 - stable/12 - altq tests: Basic ALTQ test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e02597d7ce67b109a2e9aa4ee552cc7bc096131e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:55 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e02597d7ce67b109a2e9aa4ee552cc7bc096131e commit e02597d7ce67b109a2e9aa4ee552cc7bc096131e Author: Kristof Provost AuthorDate: 2021-01-23 09:37:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:08 +0000 altq tests: Basic ALTQ test Activate ALTQ_HFSC, crudely check if it really limits bandwidth as we'd expect. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28303 (cherry picked from commit 16b3833344ad04194f10b567bc6fae829a52a850) --- tests/sys/netpfil/pf/Makefile | 3 ++- tests/sys/netpfil/pf/altq.sh | 49 +++++++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/pf/utils.subr | 24 ++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index fde02ea3933b..3882db287f5a 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -5,7 +5,8 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/netpfil/pf TESTS_SUBDIRS+= ioctl -ATF_TESTS_SH+= anchor \ +ATF_TESTS_SH+= altq \ + anchor \ pass_block \ checksum \ forward \ diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh new file mode 100644 index 000000000000..89da4c0deb6f --- /dev/null +++ b/tests/sys/netpfil/pf/altq.sh @@ -0,0 +1,49 @@ +. $(atf_get_srcdir)/utils.subr + +atf_test_case "hfsc" "cleanup" +hfsc_head() +{ + atf_set descr 'Basic HFSC test' + atf_set require.user root +} + +hfsc_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_hfsc ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_hfsc ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_hfsc pfctl -e + pft_set_rules altq_hfsc \ + "altq on ${epair}b bandwidth 100b hfsc queue { default }" \ + "queue default hfsc(default linkshare 80b)" \ + "pass proto icmp " + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +hfsc_cleanup() +{ + altq_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "hfsc" +} + diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr index 62e85d5cc463..d7df2a6747da 100644 --- a/tests/sys/netpfil/pf/utils.subr +++ b/tests/sys/netpfil/pf/utils.subr @@ -79,3 +79,27 @@ pfsynct_cleanup() { pft_cleanup } + +is_altq_supported() +{ + sysctl -q kern.features.altq >/dev/null || \ + atf_skip "Test requires ALTQ" + + while [ -n "$1" ] + do + sysctl -q kern.features.altq.${1} >/dev/null || \ + atf_skip "Test required ALTQ_${1}" + shift + done +} + +altq_init() +{ + pft_init + is_altq_supported +} + +altq_cleanup() +{ + pft_cleanup +} From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D8F565C508; Sat, 31 Jul 2021 13:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbg1lpqz4Sl2; Sat, 31 Jul 2021 13:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 514F218ECF; Sat, 31 Jul 2021 13:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3wov066684; Sat, 31 Jul 2021 13:03:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3wpl066683; Sat, 31 Jul 2021 13:03:58 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:58 GMT Message-Id: <202107311303.16VD3wpl066683@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 5d1a26544c90 - stable/12 - pf.conf.5: Document new 'match' keyword MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5d1a26544c9065075dc0095b9eb356bfc5987986 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:59 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5d1a26544c9065075dc0095b9eb356bfc5987986 commit 5d1a26544c9065075dc0095b9eb356bfc5987986 Author: Kristof Provost AuthorDate: 2021-03-02 19:34:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:36 +0000 pf.conf.5: Document new 'match' keyword Reviewed by: bcr Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31117 (cherry picked from commit 0351b9875a3eb5eb4b502a4106b1917ce954e959) --- share/man/man5/pf.conf.5 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index ca0f0da02047..48902f11cf15 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -1237,8 +1237,10 @@ below. .Xr pf 4 has the ability to .Ar block -and +, .Ar pass +and +.Ar match packets based on attributes of their layer 3 (see .Xr ip 4 and @@ -1254,7 +1256,15 @@ assigned to queues for the purpose of bandwidth control. .Pp For each packet processed by the packet filter, the filter rules are evaluated in sequential order, from first to last. -The last matching rule decides what action is taken. +For +.Ar block +and +.Ar pass +, the last matching rule decides what action is taken. +For +.Ar match +, rules are evaulated every time they match; the pass/block state of a packet +remains unchanged. If no rule matches the packet, the default action is to pass the packet. .Pp @@ -1302,6 +1312,21 @@ packets that match explicit rules is specify a first filter rule of: .Bd -literal -offset indent block all .Ed +.It Ar match +The packet is matched. +This mechanism is used to provide fine grained filtering without altering the +block/pass state of a packet. +.Ar match +rules differ from +.Ar block +and +.Ar pass +rules in that parameters are set every time a packet matches the rule, not only +on the last matching rule. +For the following parameters, this means that the parameter effectively becomes +"sticky" until explicitly overridden: +.Ar queue +. .It Ar pass The packet is passed; state is created unless the From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9404265C0AA; Sat, 31 Jul 2021 13:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbd2g5vz4SbZ; Sat, 31 Jul 2021 13:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CFDD193BE; Sat, 31 Jul 2021 13:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3vrM066636; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3vN4066635; Sat, 31 Jul 2021 13:03:57 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:57 GMT Message-Id: <202107311303.16VD3vN4066635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4f2821ab53db - stable/12 - pf tests: Test the match keyword MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4f2821ab53dbfbe08ecf02caff78afff54bdedaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:58 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2821ab53dbfbe08ecf02caff78afff54bdedaa commit 4f2821ab53dbfbe08ecf02caff78afff54bdedaa Author: Kristof Provost AuthorDate: 2021-03-02 15:57:27 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:31 +0000 pf tests: Test the match keyword The new match keyword can currently only assign queues, so we can only test it with ALTQ. Set up a basic scenario where we use 'match' to assign ICMP traffic to a slow queue, and confirm that it's really getting slowed down. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31116 (cherry picked from commit d363ebc78cbb50bc334d74fb5bb755af53c69ff0) --- tests/sys/netpfil/pf/altq.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh index 89da4c0deb6f..294c01e9f8bd 100644 --- a/tests/sys/netpfil/pf/altq.sh +++ b/tests/sys/netpfil/pf/altq.sh @@ -42,8 +42,53 @@ hfsc_cleanup() altq_cleanup } +atf_test_case "match" "cleanup" +match_head() +{ + atf_set descr 'Basic match keyword test' + atf_set require.user root +} + +match_body() +{ + altq_init + is_altq_supported hfsc + + epair=$(vnet_mkepair) + vnet_mkjail altq_match ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec altq_match ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec altq_match pfctl -e + pft_set_rules altq_match \ + "altq on ${epair}b bandwidth 100000000b hfsc queue { default, slow }" \ + "queue default hfsc(default linkshare 80000000b)" \ + "queue slow hfsc(linkshare 80b upperlimit 80b)" \ + "match proto icmp queue slow" \ + "pass" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # "Saturate the link" + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +match_cleanup() +{ + altq_cleanup +} + atf_init_test_cases() { atf_add_test_case "hfsc" + atf_add_test_case "match" } From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:03:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B6D965C323; Sat, 31 Jul 2021 13:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbd2fdSz4SYj; Sat, 31 Jul 2021 13:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBD7A18ECE; Sat, 31 Jul 2021 13:03:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3uiI066611; Sat, 31 Jul 2021 13:03:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3uqX066610; Sat, 31 Jul 2021 13:03:56 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:56 GMT Message-Id: <202107311303.16VD3uqX066610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 7408fb55f03c - stable/13 - pf.conf.5: Document new 'match' keyword MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7408fb55f03c71f73fca50be36a864c468713293 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:03:58 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7408fb55f03c71f73fca50be36a864c468713293 commit 7408fb55f03c71f73fca50be36a864c468713293 Author: Kristof Provost AuthorDate: 2021-03-02 19:34:41 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 08:12:10 +0000 pf.conf.5: Document new 'match' keyword Reviewed by: bcr Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31117 (cherry picked from commit 0351b9875a3eb5eb4b502a4106b1917ce954e959) --- share/man/man5/pf.conf.5 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 00fbd4421e7f..7b97657d7d1c 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -1236,8 +1236,10 @@ below. .Xr pf 4 has the ability to .Ar block -and +, .Ar pass +and +.Ar match packets based on attributes of their layer 3 (see .Xr ip 4 and @@ -1253,7 +1255,15 @@ assigned to queues for the purpose of bandwidth control. .Pp For each packet processed by the packet filter, the filter rules are evaluated in sequential order, from first to last. -The last matching rule decides what action is taken. +For +.Ar block +and +.Ar pass +, the last matching rule decides what action is taken. +For +.Ar match +, rules are evaulated every time they match; the pass/block state of a packet +remains unchanged. If no rule matches the packet, the default action is to pass the packet. .Pp @@ -1301,6 +1311,21 @@ packets that match explicit rules is specify a first filter rule of: .Bd -literal -offset indent block all .Ed +.It Ar match +The packet is matched. +This mechanism is used to provide fine grained filtering without altering the +block/pass state of a packet. +.Ar match +rules differ from +.Ar block +and +.Ar pass +rules in that parameters are set every time a packet matches the rule, not only +on the last matching rule. +For the following parameters, this means that the parameter effectively becomes +"sticky" until explicitly overridden: +.Ar queue +. .It Ar pass The packet is passed; state is created unless the From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 13:04:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F146C65BA6E; Sat, 31 Jul 2021 13:04:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcPbh0yP3z4SYw; Sat, 31 Jul 2021 13:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7620D1966A; Sat, 31 Jul 2021 13:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VD3x5J066768; Sat, 31 Jul 2021 13:03:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VD3x0c066767; Sat, 31 Jul 2021 13:03:59 GMT (envelope-from git) Date: Sat, 31 Jul 2021 13:03:59 GMT Message-Id: <202107311303.16VD3x0c066767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: bca83d9e7f5b - stable/12 - pf: fix ABI breakage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bca83d9e7f5b7faa925ca7edde6129f57adcd09d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 13:04:01 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bca83d9e7f5b7faa925ca7edde6129f57adcd09d commit bca83d9e7f5b7faa925ca7edde6129f57adcd09d Author: Kristof Provost AuthorDate: 2021-07-28 09:24:44 +0000 Commit: Kristof Provost CommitDate: 2021-07-31 09:14:44 +0000 pf: fix ABI breakage The introduction of synproxy support changed the size of struct pf_status, which in turn broke the userspace ABI. Revert the relevant change. More work is needed on the synproxy code to keep and expose the counters, but in the mean time this restores the ABI. PR: 257469 MFC after: 3 days Sponsored by: Modirum MDPay (cherry picked from commit da8d8b22e69c72f1d001d55b5eff5acbb0265cfc) --- sys/netpfil/pf/pf.h | 3 +-- sys/netpfil/pf/pf_syncookies.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 245d68b4be45..e030f1e59de0 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -160,8 +160,7 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_SRCCONNRATE 4 /* max-src-conn-rate */ #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ -#define LCNT_SYNCOOKIES_VALID 7 /* syncookies validated */ /* XXX TODO: Ensure no API breakage! */ -#define LCNT_MAX 8 /* total+1 */ +#define LCNT_MAX 7 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index bfcc4b3d4e82..a02ab0370204 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -275,7 +275,6 @@ pf_syncookie_validate(struct pf_pdesc *pd) if ((ack & ~0xff) != (hash & ~0xff)) return (0); - counter_u64_add(V_pf_status.lcounters[LCNT_SYNCOOKIES_VALID], 1); return (1); } From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 14:07:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B338365EA1D for ; Sat, 31 Jul 2021 14:07:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcR1S42S3z4Yln for ; Sat, 31 Jul 2021 14:07:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x736.google.com with SMTP id az7so12314431qkb.5 for ; Sat, 31 Jul 2021 07:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WChS9ED6kXrkCAMIJGH1fgBBPx5XGUxS+t+cL48J2p0=; b=DZD1rrtv2W34F8p0Wmj2tv5YGNMGsnaUnaVZioxZZ34r46rby62rAQi3fhZ8tLWo+B ZDKLm1qPxM7q9LiP+yTInjBJjVBRDVhvBjuJ/6kjME1aPD9UnZFDF+zGLAXvP+rS5/dL O/oV7+f8ANq5wjDfw3SlEsZ72KUmxlggPeu6BnXjCpgM3Q8DB0s4JAqN0AuLv9HxXfwm M1d17NLiul7k1buANmrvh56PKEU9+DLqxJw/7mnBpqNhPeH0xw+984G1Rehi4fQo/GOr BjEI1OOF1p+SXG/nDGzdPyZ/Jq3BbIFoNes9/tKT0mpUKG49T1A/qTjwp21bCDB9W5sP oOQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WChS9ED6kXrkCAMIJGH1fgBBPx5XGUxS+t+cL48J2p0=; b=HoEh4aCDCBaaGcEBKv6pzk2Tn3AxYMXE4X6Ma0rXE7uZQAvmnpIFC9AQ9ArwL5UZf3 A6LrPKLyEn6E6p74z7GymXNfnBUefKrLXaVXMrpyr4YR+Zr7nTr607wPkQaZF9M3nQZY RiQYGEvDc4DIlpmTUgeUTLQ8bDIcFhqU1XhJroGO5EVy/M0uLYB6ht723fSAfA2p41LR NH1/7HogS5b3TUdckpBoLK11eAlp5245GO04FsSpgo7G6pPVu4JoTPTvAlMhOtGPgwiz 5UcHELieIO26Rea4K27xg8EVYnL/s/g6c4anl2Om6ZdMpemmmAHlfKr+YigjVK1MgH5O +yZA== X-Gm-Message-State: AOAM5306NGRsUCYTPSOavdDWG4T4jszvG0L5sE/qhAuWZjTDO68JN2O2 PpRqxxPsEOIqtA8ObQ6gy+uUEBTSIgJc2iIDYzMkXg== X-Google-Smtp-Source: ABdhPJwsPLqp5FLdWccCIayLPUi+O5jvZzjsowpftPugCrRdOt58B7ykeqhSD/1tQxRVG9f/vZuh7Vs18UtUT2EW4GU= X-Received: by 2002:a05:620a:45:: with SMTP id t5mr6862413qkt.206.1627740472992; Sat, 31 Jul 2021 07:07:52 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> In-Reply-To: <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> From: Warner Losh Date: Sat, 31 Jul 2021 08:07:42 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4GcR1S42S3z4Yln X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 14:07:56 -0000 On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost wrote: > Hi Warner, > > On 10 Jul 2021, at 19:12, Warner Losh wrote: > > The branch stable/12 has been updated by imp: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38ef= e5b83b0ec > > commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec > Author: Warner Losh > AuthorDate: 2021-07-07 23:30:35 +0000 > Commit: Warner Losh > CommitDate: 2021-07-10 17:11:15 +0000 > > one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs > > Import the latest bsd-features branch of the one-true-awk upstream: > > o Move to bison for $YACC > o Set close-on-exec flag for file and pipe redirects that aren't std* > o lots of little fixes to modernize ocde base > o free sval member before setting it > o fix a bug where a{0,3} could match aaaa > o pull in systime and strftime from NetBSD awk > o pull in fixes from {Net,Free,Open}BSD (normalized our code with them) > o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop) > > Also revert a few of the trivial FreeBSD changes that were done slightly > differently in the upstreaming process. Also, our PR database may have > been mined by upstream for these fixes, and Mikolaj Golub may deserve > credit for some of the fixes in this update. > > Suggested by: Mikolaj Golub > PR: 143363,143365,143368,143369,143373,143375,214782 > Sponsored by: Netflix > > (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) > > I *think* this is the relevant commit, but I=E2=80=99m not 100% sure. > > Anyway, I=E2=80=99ve recently started seeing issues building pfSense for = aarch64. > I=E2=80=99ve finally narrowed it down, and replicated the problem on base= FreeBSD > (stable/12, but I assume other branches are affected too). > > It fails to build proctab.c. This file is generated by maketab, a tool > built as part of the build process. In my case this tool is built for > aarch64, which makes executing it on amd64 less successful than we=E2=80= =99d like. > > This only happens when building with META_MODE though. I do not understan= d > the build system sufficiently to debug why. Hopefully you=E2=80=99ll have= a better > idea. > Generally I do, but this one is a bit weird. Also, the amount of context you've included omits the actual error :( Though I'm guessing it's wrong arch for the build tool... I rarely use meta mode, and understand it not at all, but awk follows the same patterns as /bin/sh and /bin/csh does. Warner This triggers the build failure: > > % cat /usr/src/src_env.conf > WITH_META_MODE=3Dyes > % env SRC_ENV_CONF=3D/usr/src/src_env.conf TARGET_ARCH=3Daarch64 make -j = 8 buildworld > > =E2=80=A6 > --- proctab.c --- > *** [proctab.c] Error code 255 > > make[4]: stopped in /usr/src/usr.bin/awk > .ERROR_TARGET=3D'proctab.c' > .ERROR_META_FILE=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk/proctab.c.= meta' > .MAKE.LEVEL=3D'4' > MAKEFILE=3D'' > .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes silent=3Dyes = verbose' > _ERROR_CMD=3D'./maketab awkgram.h > proctab.c;' > .CURDIR=3D'/usr/src/usr.bin/awk' > .MAKE=3D'make' > .OBJDIR=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk' > .TARGETS=3D'all' > DESTDIR=3D'/usr/obj/usr/src/arm64.aarch64/tmp' > LD_LIBRARY_PATH=3D'' > MACHINE=3D'arm64' > MACHINE_ARCH=3D'aarch64' > MAKEOBJDIRPREFIX=3D'' > MAKESYSPATH=3D'/usr/src/share/mk' > MAKE_VERSION=3D'20200710' > > Further up in the build output: > > --- maketab --- > cc -target aarch64-unknown-freebsd12.2 --sysroot=3D/usr/obj/usr/src/arm64= .aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-co= mmon -DHAS_ISBLANK -I. -I/usr/src/contrib/one-true-awk -DFOPEN_MAX=3D64 -= g -std=3Dgnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-he= aders -Werror -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-u= nused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-paren= theses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local= -typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-kn= r-promoted-parameter -Wno-parentheses -Qunused-arguments /usr/src/contr= ib/one-true-awk/maketab.c -o maketab > > Without META_MODE maketab is built as an amd64 binary, and the entire > build succeeds. > > Best regards, > Kristof > From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 14:15:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CF9565EC52; Sat, 31 Jul 2021 14:15:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcR9g3nzjz4bhT; Sat, 31 Jul 2021 14:15:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A60E1A166; Sat, 31 Jul 2021 14:15:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VEF32E060444; Sat, 31 Jul 2021 14:15:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VEF3T4060443; Sat, 31 Jul 2021 14:15:03 GMT (envelope-from git) Date: Sat, 31 Jul 2021 14:15:03 GMT Message-Id: <202107311415.16VEF3T4060443@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 32d55be1c1c9 - stable/12 - awk: remove proctab.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 32d55be1c1c9ed1bccfce1196e8fbfbbf814f1db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 14:15:03 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=32d55be1c1c9ed1bccfce1196e8fbfbbf814f1db commit 32d55be1c1c9ed1bccfce1196e8fbfbbf814f1db Author: Warner Losh AuthorDate: 2021-07-12 03:26:08 +0000 Commit: Warner Losh CommitDate: 2021-07-31 14:14:08 +0000 awk: remove proctab.c proctab.c is a generated file and never should have been committed to the tree. This file has been added and removed a couple of times, most recently added by me in my 2019 updates. Sponsored by: Netflix (cherry picked from commit 0c92d88c9180bf25187f01f1d7e419edea9a0fef) --- contrib/one-true-awk/proctab.c | 213 ----------------------------------------- 1 file changed, 213 deletions(-) diff --git a/contrib/one-true-awk/proctab.c b/contrib/one-true-awk/proctab.c deleted file mode 100644 index 96fad36e601c..000000000000 --- a/contrib/one-true-awk/proctab.c +++ /dev/null @@ -1,213 +0,0 @@ -#include -#include "awk.h" -#include "awkgram.tab.h" - -static const char * const printname[96] = { - "FIRSTTOKEN", /* 258 */ - "PROGRAM", /* 259 */ - "PASTAT", /* 260 */ - "PASTAT2", /* 261 */ - "XBEGIN", /* 262 */ - "XEND", /* 263 */ - "NL", /* 264 */ - "ARRAY", /* 265 */ - "MATCH", /* 266 */ - "NOTMATCH", /* 267 */ - "MATCHOP", /* 268 */ - "FINAL", /* 269 */ - "DOT", /* 270 */ - "ALL", /* 271 */ - "CCL", /* 272 */ - "NCCL", /* 273 */ - "CHAR", /* 274 */ - "OR", /* 275 */ - "STAR", /* 276 */ - "QUEST", /* 277 */ - "PLUS", /* 278 */ - "EMPTYRE", /* 279 */ - "ZERO", /* 280 */ - "AND", /* 281 */ - "BOR", /* 282 */ - "APPEND", /* 283 */ - "EQ", /* 284 */ - "GE", /* 285 */ - "GT", /* 286 */ - "LE", /* 287 */ - "LT", /* 288 */ - "NE", /* 289 */ - "IN", /* 290 */ - "ARG", /* 291 */ - "BLTIN", /* 292 */ - "BREAK", /* 293 */ - "CLOSE", /* 294 */ - "CONTINUE", /* 295 */ - "DELETE", /* 296 */ - "DO", /* 297 */ - "EXIT", /* 298 */ - "FOR", /* 299 */ - "FUNC", /* 300 */ - "GENSUB", /* 301 */ - "SUB", /* 302 */ - "GSUB", /* 303 */ - "IF", /* 304 */ - "INDEX", /* 305 */ - "LSUBSTR", /* 306 */ - "MATCHFCN", /* 307 */ - "NEXT", /* 308 */ - "NEXTFILE", /* 309 */ - "ADD", /* 310 */ - "MINUS", /* 311 */ - "MULT", /* 312 */ - "DIVIDE", /* 313 */ - "MOD", /* 314 */ - "ASSIGN", /* 315 */ - "ASGNOP", /* 316 */ - "ADDEQ", /* 317 */ - "SUBEQ", /* 318 */ - "MULTEQ", /* 319 */ - "DIVEQ", /* 320 */ - "MODEQ", /* 321 */ - "POWEQ", /* 322 */ - "PRINT", /* 323 */ - "PRINTF", /* 324 */ - "SPRINTF", /* 325 */ - "ELSE", /* 326 */ - "INTEST", /* 327 */ - "CONDEXPR", /* 328 */ - "POSTINCR", /* 329 */ - "PREINCR", /* 330 */ - "POSTDECR", /* 331 */ - "PREDECR", /* 332 */ - "VAR", /* 333 */ - "IVAR", /* 334 */ - "VARNF", /* 335 */ - "CALL", /* 336 */ - "NUMBER", /* 337 */ - "STRING", /* 338 */ - "REGEXPR", /* 339 */ - "GETLINE", /* 340 */ - "RETURN", /* 341 */ - "SPLIT", /* 342 */ - "SUBSTR", /* 343 */ - "WHILE", /* 344 */ - "CAT", /* 345 */ - "NOT", /* 346 */ - "UMINUS", /* 347 */ - "UPLUS", /* 348 */ - "POWER", /* 349 */ - "DECR", /* 350 */ - "INCR", /* 351 */ - "INDIRECT", /* 352 */ - "LASTTOKEN", /* 353 */ -}; - - -Cell *(*proctab[96])(Node **, int) = { - nullproc, /* FIRSTTOKEN */ - program, /* PROGRAM */ - pastat, /* PASTAT */ - dopa2, /* PASTAT2 */ - nullproc, /* XBEGIN */ - nullproc, /* XEND */ - nullproc, /* NL */ - array, /* ARRAY */ - matchop, /* MATCH */ - matchop, /* NOTMATCH */ - nullproc, /* MATCHOP */ - nullproc, /* FINAL */ - nullproc, /* DOT */ - nullproc, /* ALL */ - nullproc, /* CCL */ - nullproc, /* NCCL */ - nullproc, /* CHAR */ - nullproc, /* OR */ - nullproc, /* STAR */ - nullproc, /* QUEST */ - nullproc, /* PLUS */ - nullproc, /* EMPTYRE */ - nullproc, /* ZERO */ - boolop, /* AND */ - boolop, /* BOR */ - nullproc, /* APPEND */ - relop, /* EQ */ - relop, /* GE */ - relop, /* GT */ - relop, /* LE */ - relop, /* LT */ - relop, /* NE */ - instat, /* IN */ - arg, /* ARG */ - bltin, /* BLTIN */ - jump, /* BREAK */ - closefile, /* CLOSE */ - jump, /* CONTINUE */ - awkdelete, /* DELETE */ - dostat, /* DO */ - jump, /* EXIT */ - forstat, /* FOR */ - nullproc, /* FUNC */ - gensub, /* GENSUB */ - sub, /* SUB */ - gsub, /* GSUB */ - ifstat, /* IF */ - sindex, /* INDEX */ - nullproc, /* LSUBSTR */ - matchop, /* MATCHFCN */ - jump, /* NEXT */ - jump, /* NEXTFILE */ - arith, /* ADD */ - arith, /* MINUS */ - arith, /* MULT */ - arith, /* DIVIDE */ - arith, /* MOD */ - assign, /* ASSIGN */ - nullproc, /* ASGNOP */ - assign, /* ADDEQ */ - assign, /* SUBEQ */ - assign, /* MULTEQ */ - assign, /* DIVEQ */ - assign, /* MODEQ */ - assign, /* POWEQ */ - printstat, /* PRINT */ - awkprintf, /* PRINTF */ - awksprintf, /* SPRINTF */ - nullproc, /* ELSE */ - intest, /* INTEST */ - condexpr, /* CONDEXPR */ - incrdecr, /* POSTINCR */ - incrdecr, /* PREINCR */ - incrdecr, /* POSTDECR */ - incrdecr, /* PREDECR */ - nullproc, /* VAR */ - nullproc, /* IVAR */ - getnf, /* VARNF */ - call, /* CALL */ - nullproc, /* NUMBER */ - nullproc, /* STRING */ - nullproc, /* REGEXPR */ - awkgetline, /* GETLINE */ - jump, /* RETURN */ - split, /* SPLIT */ - substr, /* SUBSTR */ - whilestat, /* WHILE */ - cat, /* CAT */ - boolop, /* NOT */ - arith, /* UMINUS */ - arith, /* UPLUS */ - arith, /* POWER */ - nullproc, /* DECR */ - nullproc, /* INCR */ - indirect, /* INDIRECT */ - nullproc, /* LASTTOKEN */ -}; - -const char *tokname(int n) -{ - static char buf[100]; - - if (n < FIRSTTOKEN || n > LASTTOKEN) { - snprintf(buf, sizeof(buf), "token %d", n); - return buf; - } - return printname[n-FIRSTTOKEN]; -} From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 14:15:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08F9965EE0A; Sat, 31 Jul 2021 14:15:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcRBF6rwZz4bsn; Sat, 31 Jul 2021 14:15:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3A631A581; Sat, 31 Jul 2021 14:15:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VEFXvU060589; Sat, 31 Jul 2021 14:15:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VEFX8Z060588; Sat, 31 Jul 2021 14:15:33 GMT (envelope-from git) Date: Sat, 31 Jul 2021 14:15:33 GMT Message-Id: <202107311415.16VEFX8Z060588@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 83dea422ac8d - stable/13 - awk: remove proctab.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 83dea422ac8d4a8323e64203c2eadaa813768717 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 14:15:34 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=83dea422ac8d4a8323e64203c2eadaa813768717 commit 83dea422ac8d4a8323e64203c2eadaa813768717 Author: Warner Losh AuthorDate: 2021-07-12 03:26:08 +0000 Commit: Warner Losh CommitDate: 2021-07-31 14:14:43 +0000 awk: remove proctab.c proctab.c is a generated file and never should have been committed to the tree. This file has been added and removed a couple of times, most recently added by me in my 2019 updates. Sponsored by: Netflix (cherry picked from commit 0c92d88c9180bf25187f01f1d7e419edea9a0fef) --- contrib/one-true-awk/proctab.c | 213 ----------------------------------------- 1 file changed, 213 deletions(-) diff --git a/contrib/one-true-awk/proctab.c b/contrib/one-true-awk/proctab.c deleted file mode 100644 index 96fad36e601c..000000000000 --- a/contrib/one-true-awk/proctab.c +++ /dev/null @@ -1,213 +0,0 @@ -#include -#include "awk.h" -#include "awkgram.tab.h" - -static const char * const printname[96] = { - "FIRSTTOKEN", /* 258 */ - "PROGRAM", /* 259 */ - "PASTAT", /* 260 */ - "PASTAT2", /* 261 */ - "XBEGIN", /* 262 */ - "XEND", /* 263 */ - "NL", /* 264 */ - "ARRAY", /* 265 */ - "MATCH", /* 266 */ - "NOTMATCH", /* 267 */ - "MATCHOP", /* 268 */ - "FINAL", /* 269 */ - "DOT", /* 270 */ - "ALL", /* 271 */ - "CCL", /* 272 */ - "NCCL", /* 273 */ - "CHAR", /* 274 */ - "OR", /* 275 */ - "STAR", /* 276 */ - "QUEST", /* 277 */ - "PLUS", /* 278 */ - "EMPTYRE", /* 279 */ - "ZERO", /* 280 */ - "AND", /* 281 */ - "BOR", /* 282 */ - "APPEND", /* 283 */ - "EQ", /* 284 */ - "GE", /* 285 */ - "GT", /* 286 */ - "LE", /* 287 */ - "LT", /* 288 */ - "NE", /* 289 */ - "IN", /* 290 */ - "ARG", /* 291 */ - "BLTIN", /* 292 */ - "BREAK", /* 293 */ - "CLOSE", /* 294 */ - "CONTINUE", /* 295 */ - "DELETE", /* 296 */ - "DO", /* 297 */ - "EXIT", /* 298 */ - "FOR", /* 299 */ - "FUNC", /* 300 */ - "GENSUB", /* 301 */ - "SUB", /* 302 */ - "GSUB", /* 303 */ - "IF", /* 304 */ - "INDEX", /* 305 */ - "LSUBSTR", /* 306 */ - "MATCHFCN", /* 307 */ - "NEXT", /* 308 */ - "NEXTFILE", /* 309 */ - "ADD", /* 310 */ - "MINUS", /* 311 */ - "MULT", /* 312 */ - "DIVIDE", /* 313 */ - "MOD", /* 314 */ - "ASSIGN", /* 315 */ - "ASGNOP", /* 316 */ - "ADDEQ", /* 317 */ - "SUBEQ", /* 318 */ - "MULTEQ", /* 319 */ - "DIVEQ", /* 320 */ - "MODEQ", /* 321 */ - "POWEQ", /* 322 */ - "PRINT", /* 323 */ - "PRINTF", /* 324 */ - "SPRINTF", /* 325 */ - "ELSE", /* 326 */ - "INTEST", /* 327 */ - "CONDEXPR", /* 328 */ - "POSTINCR", /* 329 */ - "PREINCR", /* 330 */ - "POSTDECR", /* 331 */ - "PREDECR", /* 332 */ - "VAR", /* 333 */ - "IVAR", /* 334 */ - "VARNF", /* 335 */ - "CALL", /* 336 */ - "NUMBER", /* 337 */ - "STRING", /* 338 */ - "REGEXPR", /* 339 */ - "GETLINE", /* 340 */ - "RETURN", /* 341 */ - "SPLIT", /* 342 */ - "SUBSTR", /* 343 */ - "WHILE", /* 344 */ - "CAT", /* 345 */ - "NOT", /* 346 */ - "UMINUS", /* 347 */ - "UPLUS", /* 348 */ - "POWER", /* 349 */ - "DECR", /* 350 */ - "INCR", /* 351 */ - "INDIRECT", /* 352 */ - "LASTTOKEN", /* 353 */ -}; - - -Cell *(*proctab[96])(Node **, int) = { - nullproc, /* FIRSTTOKEN */ - program, /* PROGRAM */ - pastat, /* PASTAT */ - dopa2, /* PASTAT2 */ - nullproc, /* XBEGIN */ - nullproc, /* XEND */ - nullproc, /* NL */ - array, /* ARRAY */ - matchop, /* MATCH */ - matchop, /* NOTMATCH */ - nullproc, /* MATCHOP */ - nullproc, /* FINAL */ - nullproc, /* DOT */ - nullproc, /* ALL */ - nullproc, /* CCL */ - nullproc, /* NCCL */ - nullproc, /* CHAR */ - nullproc, /* OR */ - nullproc, /* STAR */ - nullproc, /* QUEST */ - nullproc, /* PLUS */ - nullproc, /* EMPTYRE */ - nullproc, /* ZERO */ - boolop, /* AND */ - boolop, /* BOR */ - nullproc, /* APPEND */ - relop, /* EQ */ - relop, /* GE */ - relop, /* GT */ - relop, /* LE */ - relop, /* LT */ - relop, /* NE */ - instat, /* IN */ - arg, /* ARG */ - bltin, /* BLTIN */ - jump, /* BREAK */ - closefile, /* CLOSE */ - jump, /* CONTINUE */ - awkdelete, /* DELETE */ - dostat, /* DO */ - jump, /* EXIT */ - forstat, /* FOR */ - nullproc, /* FUNC */ - gensub, /* GENSUB */ - sub, /* SUB */ - gsub, /* GSUB */ - ifstat, /* IF */ - sindex, /* INDEX */ - nullproc, /* LSUBSTR */ - matchop, /* MATCHFCN */ - jump, /* NEXT */ - jump, /* NEXTFILE */ - arith, /* ADD */ - arith, /* MINUS */ - arith, /* MULT */ - arith, /* DIVIDE */ - arith, /* MOD */ - assign, /* ASSIGN */ - nullproc, /* ASGNOP */ - assign, /* ADDEQ */ - assign, /* SUBEQ */ - assign, /* MULTEQ */ - assign, /* DIVEQ */ - assign, /* MODEQ */ - assign, /* POWEQ */ - printstat, /* PRINT */ - awkprintf, /* PRINTF */ - awksprintf, /* SPRINTF */ - nullproc, /* ELSE */ - intest, /* INTEST */ - condexpr, /* CONDEXPR */ - incrdecr, /* POSTINCR */ - incrdecr, /* PREINCR */ - incrdecr, /* POSTDECR */ - incrdecr, /* PREDECR */ - nullproc, /* VAR */ - nullproc, /* IVAR */ - getnf, /* VARNF */ - call, /* CALL */ - nullproc, /* NUMBER */ - nullproc, /* STRING */ - nullproc, /* REGEXPR */ - awkgetline, /* GETLINE */ - jump, /* RETURN */ - split, /* SPLIT */ - substr, /* SUBSTR */ - whilestat, /* WHILE */ - cat, /* CAT */ - boolop, /* NOT */ - arith, /* UMINUS */ - arith, /* UPLUS */ - arith, /* POWER */ - nullproc, /* DECR */ - nullproc, /* INCR */ - indirect, /* INDIRECT */ - nullproc, /* LASTTOKEN */ -}; - -const char *tokname(int n) -{ - static char buf[100]; - - if (n < FIRSTTOKEN || n > LASTTOKEN) { - snprintf(buf, sizeof(buf), "token %d", n); - return buf; - } - return printname[n-FIRSTTOKEN]; -} From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 14:20:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC33265EE45 for ; Sat, 31 Jul 2021 14:20:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcRJK4Vpqz4cJ4 for ; Sat, 31 Jul 2021 14:20:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id t66so12407132qkb.0 for ; Sat, 31 Jul 2021 07:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uGCstSf2y6eKOGdrS6H9f/Q8TVOlsjqs1IjZT7v2xuw=; b=TVkxIKsDZi7NiL/7RQyoosEYd/XqFnjyA0POn3Ts5xwzoBA4AKYuHImjml3qxDoibU 1ppKP9UIOG+jNEH9kcYVSU6LojwIuIEGrSnN48fvF9vgLbl0JsfbaEkc+8HI60FYn9j+ jNMkirdS1G1RiwQGn95xM6sNDSZkb1M42i8plnqXzIaWxZIlJ231CkOE+Slm+LS3l7/n xaB3Aqji9iJcKoEjjNFLPnYKb/M+funplyM2tlbZCX7vJgy56wgxvDJ8ZryV3fumtMWu XW9nwD87yTRFIF5oVZ/I7/DBmq8ML5m3dutrqbzRoxLgqoVJykIQILikkD8CSg3K4fyh Cmqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uGCstSf2y6eKOGdrS6H9f/Q8TVOlsjqs1IjZT7v2xuw=; b=pDqS65GxgJp5/vr0XDBralCI6mMa/a3qUTp7ak8noRihtRHIhFRFuDL7bs0Jve+PIV i6k6CyuarT/PiOcSXFJsyXDsh/+KIZ4z6pBDmGF1oXNw5Y8YALjX5nQgeAj5BkaYOGvt PMhvpka4kW2sYto4/T/zHYHrELzjROl5gh/FF8w94Bh73AclfvoRHAPFjlpgx/EIJiCr 8yj9q/5Fg8XI1oQD1h4qJFx8PE/eybaH54YQ1R93LXWRS3UhEf/Ym+asNvAz7xJ2NfIF Kfp6uWkobAvZ1Jdc6x5XiMa4NfMlFZnF2xDj1FMgiZoyuriRMTQnwmyk2tapQmldOlHE k/gQ== X-Gm-Message-State: AOAM530IJ8RUdPpSiI+9TSCDWBGQ9mmSNS/smwaFrfPezsnvJ62uhrVe oYPh0GDDFJ2ES67pd4Znf9+MFXuKwvGVUaa8sJ5JlA== X-Google-Smtp-Source: ABdhPJxGlDp12C8kJwMVi6AIn4b3NDGGn0vqb5OBt+/QxsQ2EA8caFLWlmznFvsgBvMRxNUS96vcaWyUxnIMZLrNZ6M= X-Received: by 2002:a37:e4f:: with SMTP id 76mr7063468qko.44.1627741249050; Sat, 31 Jul 2021 07:20:49 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Sat, 31 Jul 2021 08:20:39 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4GcRJK4Vpqz4cJ4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=TVkxIKsD; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72d) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.99 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-branches@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.988]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72d:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[dev-commits-src-branches]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 14:20:50 -0000 On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: > > > On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost wrote: > >> Hi Warner, >> >> On 10 Jul 2021, at 19:12, Warner Losh wrote: >> >> The branch stable/12 has been updated by imp: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38e= fe5b83b0ec >> >> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec >> Author: Warner Losh >> AuthorDate: 2021-07-07 23:30:35 +0000 >> Commit: Warner Losh >> CommitDate: 2021-07-10 17:11:15 +0000 >> >> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bug= s >> >> Import the latest bsd-features branch of the one-true-awk upstream: >> >> o Move to bison for $YACC >> o Set close-on-exec flag for file and pipe redirects that aren't std* >> o lots of little fixes to modernize ocde base >> o free sval member before setting it >> o fix a bug where a{0,3} could match aaaa >> o pull in systime and strftime from NetBSD awk >> o pull in fixes from {Net,Free,Open}BSD (normalized our code with them) >> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop) >> >> Also revert a few of the trivial FreeBSD changes that were done slightly >> differently in the upstreaming process. Also, our PR database may have >> been mined by upstream for these fixes, and Mikolaj Golub may deserve >> credit for some of the fixes in this update. >> >> Suggested by: Mikolaj Golub >> PR: 143363,143365,143368,143369,143373,143375,214782 >> Sponsored by: Netflix >> >> (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) >> >> I *think* this is the relevant commit, but I=E2=80=99m not 100% sure. >> >> Anyway, I=E2=80=99ve recently started seeing issues building pfSense for= aarch64. >> I=E2=80=99ve finally narrowed it down, and replicated the problem on bas= e FreeBSD >> (stable/12, but I assume other branches are affected too). >> >> It fails to build proctab.c. This file is generated by maketab, a tool >> built as part of the build process. In my case this tool is built for >> aarch64, which makes executing it on amd64 less successful than we=E2=80= =99d like. >> >> This only happens when building with META_MODE though. I do not >> understand the build system sufficiently to debug why. Hopefully you=E2= =80=99ll >> have a better idea. >> > Generally I do, but this one is a bit weird. Also, the amount of context > you've included omits the actual error :( Though I'm guessing it's wrong > arch for the build tool... > > I rarely use meta mode, and understand it not at all, but awk follows the > same patterns as /bin/sh and /bin/csh does > [[ stupid gmail ]] I've just pushed removal of proctab.c. That may fix this, though I'm not hopeful. I've rarely used metamode, and not for quite some time, but this an extra file that would confuse things so that maketab might not be built during build-tools and instead is built later. Please give that a try, and I'll start a meta build, but that takes a while, not least because I have to re-leran how to do that :) I've also noticed a few things I can do to cleanup the main build to eliminate the awkward symlinks, but I'll do those separately. Warner > Warner > > This triggers the build failure: >> >> % cat /usr/src/src_env.conf >> WITH_META_MODE=3Dyes >> % env SRC_ENV_CONF=3D/usr/src/src_env.conf TARGET_ARCH=3Daarch64 make -j= 8 buildworld >> >> =E2=80=A6 >> --- proctab.c --- >> *** [proctab.c] Error code 255 >> >> make[4]: stopped in /usr/src/usr.bin/awk >> .ERROR_TARGET=3D'proctab.c' >> .ERROR_META_FILE=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk/proctab.c= .meta' >> .MAKE.LEVEL=3D'4' >> MAKEFILE=3D'' >> .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes silent=3Dyes= verbose' >> _ERROR_CMD=3D'./maketab awkgram.h > proctab.c;' >> .CURDIR=3D'/usr/src/usr.bin/awk' >> .MAKE=3D'make' >> .OBJDIR=3D'/usr/obj/usr/src/arm64.aarch64/usr.bin/awk' >> .TARGETS=3D'all' >> DESTDIR=3D'/usr/obj/usr/src/arm64.aarch64/tmp' >> LD_LIBRARY_PATH=3D'' >> MACHINE=3D'arm64' >> MACHINE_ARCH=3D'aarch64' >> MAKEOBJDIRPREFIX=3D'' >> MAKESYSPATH=3D'/usr/src/share/mk' >> MAKE_VERSION=3D'20200710' >> >> Further up in the build output: >> >> --- maketab --- >> cc -target aarch64-unknown-freebsd12.2 --sysroot=3D/usr/obj/usr/src/arm6= 4.aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-c= ommon -DHAS_ISBLANK -I. -I/usr/src/contrib/one-true-awk -DFOPEN_MAX=3D64 = -g -std=3Dgnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-h= eaders -Werror -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-= unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-pare= ntheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-loca= l-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-k= nr-promoted-parameter -Wno-parentheses -Qunused-arguments /usr/src/cont= rib/one-true-awk/maketab.c -o maketab >> >> Without META_MODE maketab is built as an amd64 binary, and the entire >> build succeeds. >> >> Best regards, >> Kristof >> > From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 14:57:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19E7C65F2C4; Sat, 31 Jul 2021 14:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcS6n75N9z4dfs; Sat, 31 Jul 2021 14:57:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB6FD1AAB3; Sat, 31 Jul 2021 14:57:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VEvbRD013899; Sat, 31 Jul 2021 14:57:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VEvbJs013898; Sat, 31 Jul 2021 14:57:37 GMT (envelope-from git) Date: Sat, 31 Jul 2021 14:57:37 GMT Message-Id: <202107311457.16VEvbJs013898@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f4855954c207 - stable/12 - smartpqi: Maintenance commit of Microchip smartpqi MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f4855954c2078cc53ef01cd00e5cf18ef266e441 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 14:57:38 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f4855954c2078cc53ef01cd00e5cf18ef266e441 commit f4855954c2078cc53ef01cd00e5cf18ef266e441 Author: Papani Srikanth AuthorDate: 2021-07-30 23:49:53 +0000 Commit: Warner Losh CommitDate: 2021-07-31 14:55:44 +0000 smartpqi: Maintenance commit of Microchip smartpqi Newly added features and bug fixes in latest Microchip SmartPQI driver. 1) Newly added TMF feature. 2) Added newly Huawei & Inspur PCI ID's 3) Fixed smartpqi driver hangs in Z-Pool while running on FreeBSD12.1 4) Fixed flooding dmesg in kernel while the controller is offline during in ioctls. 5) Avoided unnecessary host memory allocation for rcb sg buffers. 6) Fixed race conditions while accessing internal rcb structure. 7) Fixed where Logical volumes exposing two different names to the OS it's due to the system memory is overwritten with DMA stale data. 8) Fixed dynamically unloading a smartpqi driver. 9) Added device_shutdown callback instead of deprecated shutdown_final kernel event in smartpqi driver. 10) Fixed where Os is crashed during physical drive hot removal during heavy IO. 11) Fixed OS crash during controller lockup/offline during heavy IO. 12) Fixed coverity issues in smartpqi driver 13) Fixed system crash while creating and deleting logical volume in a continuous loop. 14) Fixed where the volume size is not exposing to OS when it expands. 15) Added HC3 pci id's. 16) Fixed compiler issues in 12.2 kernel. Note: this is a direct commit, submitted by the vendor to support stable/12 Reviewed by: imp, Murthy Bhat, Scott Benesh Differential Revision: https://reviews.freebsd.org/D24428 --- sys/dev/smartpqi/smartpqi_cam.c | 599 +++++++++++++++++----------- sys/dev/smartpqi/smartpqi_cmd.c | 13 +- sys/dev/smartpqi/smartpqi_defines.h | 441 ++++++++++++++------- sys/dev/smartpqi/smartpqi_discovery.c | 702 +++++++++++++++++++++------------ sys/dev/smartpqi/smartpqi_event.c | 137 +++---- sys/dev/smartpqi/smartpqi_helper.c | 302 +++++++++++--- sys/dev/smartpqi/smartpqi_includes.h | 6 +- sys/dev/smartpqi/smartpqi_init.c | 483 +++++++++++++++++------ sys/dev/smartpqi/smartpqi_intr.c | 158 ++++---- sys/dev/smartpqi/smartpqi_ioctl.c | 127 +++--- sys/dev/smartpqi/smartpqi_ioctl.h | 24 +- sys/dev/smartpqi/smartpqi_main.c | 251 +++++++----- sys/dev/smartpqi/smartpqi_mem.c | 77 +++- sys/dev/smartpqi/smartpqi_misc.c | 85 ++-- sys/dev/smartpqi/smartpqi_prototypes.h | 63 ++- sys/dev/smartpqi/smartpqi_queue.c | 313 ++++++++------- sys/dev/smartpqi/smartpqi_request.c | 513 ++++++++++++++++++------ sys/dev/smartpqi/smartpqi_response.c | 185 +++++++-- sys/dev/smartpqi/smartpqi_sis.c | 96 +++-- sys/dev/smartpqi/smartpqi_structures.h | 589 +++++++++++++++++---------- sys/dev/smartpqi/smartpqi_tag.c | 123 +++--- 21 files changed, 3490 insertions(+), 1797 deletions(-) diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c index 5e72846d70cd..3d39e1ffbdd4 100644 --- a/sys/dev/smartpqi/smartpqi_cam.c +++ b/sys/dev/smartpqi/smartpqi_cam.c @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2018 Microsemi Corporation. - * All rights reserved. + * Copyright 2016-2021 Microchip Technology, Inc. and/or its subsidiaries. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,11 +33,15 @@ /* * Set cam sim properties of the smartpqi adapter. */ -static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) +static void +update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) { pqisrc_softstate_t *softs = (struct pqisrc_softstate *) cam_sim_softc(sim); + + device_t dev = softs->os_specific.pqi_dev; + DBG_FUNC("IN\n"); cpi->version_num = 1; @@ -50,9 +53,9 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) cpi->max_target = 1088; cpi->maxio = (softs->pqi_cap.max_sg_elem - 1) * PAGE_SIZE; cpi->initiator_id = 255; - strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); - strncpy(cpi->hba_vid, "Microsemi", HBA_IDLEN); - strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); + strlcpy(cpi->hba_vid, "Microsemi", HBA_IDLEN); + strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); cpi->bus_id = cam_sim_bus(sim); cpi->base_transfer_speed = 1200000; /* Base bus speed in KB/sec */ @@ -61,6 +64,11 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) cpi->transport = XPORT_SPI; cpi->transport_version = 2; cpi->ccb_h.status = CAM_REQ_CMP; + cpi->hba_vendor = pci_get_vendor(dev); + cpi->hba_device = pci_get_device(dev); + cpi->hba_subvendor = pci_get_subvendor(dev); + cpi->hba_subdevice = pci_get_subdevice(dev); + DBG_FUNC("OUT\n"); } @@ -68,7 +76,8 @@ static void update_sim_properties(struct cam_sim *sim, struct ccb_pathinq *cpi) /* * Get transport settings of the smartpqi adapter */ -static void get_transport_settings(struct pqisrc_softstate *softs, +static void +get_transport_settings(struct pqisrc_softstate *softs, struct ccb_trans_settings *cts) { struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; @@ -94,8 +103,10 @@ static void get_transport_settings(struct pqisrc_softstate *softs, /* * Add the target to CAM layer and rescan, when a new device is found */ -void os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) { - union ccb *ccb; +void +os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) +{ + union ccb *ccb; DBG_FUNC("IN\n"); @@ -121,8 +132,9 @@ void os_add_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) { /* * Remove the device from CAM layer when deleted or hot removed */ -void os_remove_device(pqisrc_softstate_t *softs, - pqi_scsi_dev_t *device) { +void +os_remove_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) +{ struct cam_path *tmppath; DBG_FUNC("IN\n"); @@ -136,6 +148,7 @@ void os_remove_device(pqisrc_softstate_t *softs, } xpt_async(AC_LOST_DEVICE, tmppath, NULL); xpt_free_path(tmppath); + softs->device_list[device->target][device->lun] = NULL; pqisrc_free_device(softs, device); } @@ -146,7 +159,8 @@ void os_remove_device(pqisrc_softstate_t *softs, /* * Function to release the frozen simq */ -static void pqi_release_camq( rcb_t *rcb ) +static void +pqi_release_camq(rcb_t *rcb) { pqisrc_softstate_t *softs; struct ccb_scsiio *csio; @@ -167,18 +181,12 @@ static void pqi_release_camq( rcb_t *rcb ) DBG_FUNC("OUT\n"); } -/* - * Function to dma-unmap the completed request - */ -static void pqi_unmap_request(void *arg) +static void +pqi_synch_request(rcb_t *rcb) { - pqisrc_softstate_t *softs; - rcb_t *rcb; - - DBG_IO("IN rcb = %p\n", arg); + pqisrc_softstate_t *softs = rcb->softs; - rcb = (rcb_t *)arg; - softs = rcb->softs; + DBG_IO("IN rcb = %p\n", rcb); if (!(rcb->cm_flags & PQI_CMD_MAPPED)) return; @@ -199,9 +207,21 @@ static void pqi_unmap_request(void *arg) if(rcb->sgt && rcb->nseg) os_mem_free(rcb->softs, (void*)rcb->sgt, - rcb->nseg*sizeof(sgt_t)); + rcb->nseg*sizeof(sgt_t)); - pqisrc_put_tag(&softs->taglist, rcb->tag); + DBG_IO("OUT\n"); +} + +/* + * Function to dma-unmap the completed request + */ +static inline void +pqi_unmap_request(rcb_t *rcb) +{ + DBG_IO("IN rcb = %p\n", rcb); + + pqi_synch_request(rcb); + pqisrc_put_tag(&rcb->softs->taglist, rcb->tag); DBG_IO("OUT\n"); } @@ -218,9 +238,12 @@ smartpqi_fix_ld_inquiry(pqisrc_softstate_t *softs, struct ccb_scsiio *csio) DBG_FUNC("IN\n"); + if (pqisrc_ctrl_offline(softs)) + return; + cdb = (csio->ccb_h.flags & CAM_CDB_POINTER) ? (uint8_t *)csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes; - if(cdb[0] == INQUIRY && + if(cdb[0] == INQUIRY && (cdb[1] & SI_EVPD) == 0 && (csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN && csio->dxfer_len >= SHORT_INQUIRY_LENGTH) { @@ -231,49 +254,87 @@ smartpqi_fix_ld_inquiry(pqisrc_softstate_t *softs, struct ccb_scsiio *csio) /* Let the disks be probed and dealt with via CAM. Only for LD let it fall through and inquiry be tweaked */ - if( !device || !pqisrc_is_logical_device(device) || - (device->devtype != DISK_DEVICE) || + if (!device || !pqisrc_is_logical_device(device) || + (device->devtype != DISK_DEVICE) || pqisrc_is_external_raid_device(device)) { return; } - strncpy(inq->vendor, "MSCC", - SID_VENDOR_SIZE); - strncpy(inq->product, - pqisrc_raidlevel_to_string(device->raid_level), - SID_PRODUCT_SIZE); + strncpy(inq->vendor, device->vendor, + SID_VENDOR_SIZE); + strncpy(inq->product, + pqisrc_raidlevel_to_string(device->raid_level), + SID_PRODUCT_SIZE); strncpy(inq->revision, device->volume_offline?"OFF":"OK", - SID_REVISION_SIZE); + SID_REVISION_SIZE); } DBG_FUNC("OUT\n"); } +static void +pqi_complete_scsi_io(struct ccb_scsiio *csio, rcb_t *rcb) +{ + uint32_t release_tag; + pqisrc_softstate_t *softs = rcb->softs; + + DBG_IO("IN scsi io = %p\n", csio); + + pqi_synch_request(rcb); + smartpqi_fix_ld_inquiry(rcb->softs, csio); + pqi_release_camq(rcb); + release_tag = rcb->tag; + os_reset_rcb(rcb); + pqisrc_put_tag(&softs->taglist, release_tag); + xpt_done((union ccb *)csio); + + DBG_FUNC("OUT\n"); +} + /* * Handle completion of a command - pass results back through the CCB */ void os_io_response_success(rcb_t *rcb) { - struct ccb_scsiio *csio; + struct ccb_scsiio *csio; DBG_IO("IN rcb = %p\n", rcb); - if (rcb == NULL) + if (rcb == NULL) panic("rcb is null"); csio = (struct ccb_scsiio *)&rcb->cm_ccb->csio; - - if (csio == NULL) + + if (csio == NULL) panic("csio is null"); rcb->status = REQUEST_SUCCESS; csio->ccb_h.status = CAM_REQ_CMP; - smartpqi_fix_ld_inquiry(rcb->softs, csio); - pqi_release_camq(rcb); - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); + pqi_complete_scsi_io(csio, rcb); + + DBG_IO("OUT\n"); +} + +static void +copy_sense_data_to_csio(struct ccb_scsiio *csio, + uint8_t *sense_data, uint16_t sense_data_len) +{ + DBG_IO("IN csio = %p\n", csio); + + memset(&csio->sense_data, 0, csio->sense_len); + + sense_data_len = (sense_data_len > csio->sense_len) ? + csio->sense_len : sense_data_len; + + if (sense_data) + memcpy(&csio->sense_data, sense_data, sense_data_len); + + if (csio->sense_len > sense_data_len) + csio->sense_resid = csio->sense_len - sense_data_len; + else + csio->sense_resid = 0; DBG_IO("OUT\n"); } @@ -281,7 +342,8 @@ os_io_response_success(rcb_t *rcb) /* * Error response handling for raid IO */ -void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) +void +os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) { struct ccb_scsiio *csio; pqisrc_softstate_t *softs; @@ -295,10 +357,16 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) softs = rcb->softs; - ASSERT(err_info != NULL); - csio->scsi_status = err_info->status; csio->ccb_h.status = CAM_REQ_CMP_ERR; + if (!err_info || !rcb->dvp) { + DBG_ERR("couldn't be accessed! error info = %p, rcb->dvp = %p\n", + err_info, rcb->dvp); + goto error_out; + } + + csio->scsi_status = err_info->status; + if (csio->ccb_h.func_code == XPT_SCSI_IO) { /* * Handle specific SCSI status values. @@ -306,30 +374,18 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) switch(csio->scsi_status) { case PQI_RAID_STATUS_QUEUE_FULL: csio->ccb_h.status = CAM_REQ_CMP; - DBG_ERR("Queue Full error"); + DBG_ERR("Queue Full error\n"); break; /* check condition, sense data included */ case PQI_RAID_STATUS_CHECK_CONDITION: { - uint16_t sense_data_len = - LE_16(err_info->sense_data_len); - uint8_t *sense_data = NULL; - if (sense_data_len) - sense_data = err_info->data; - memset(&csio->sense_data, 0, csio->sense_len); - sense_data_len = (sense_data_len > - csio->sense_len) ? - csio->sense_len : - sense_data_len; - if (sense_data) - memcpy(&csio->sense_data, sense_data, - sense_data_len); - if (csio->sense_len > sense_data_len) - csio->sense_resid = csio->sense_len - - sense_data_len; - else - csio->sense_resid = 0; - csio->ccb_h.status = CAM_SCSI_STATUS_ERROR + uint16_t sense_data_len = + LE_16(err_info->sense_data_len); + uint8_t *sense_data = NULL; + if (sense_data_len) + sense_data = err_info->data; + copy_sense_data_to_csio(csio, sense_data, sense_data_len); + csio->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID | CAM_REQ_CMP_ERR; @@ -338,44 +394,36 @@ void os_raid_response_error(rcb_t *rcb, raid_path_error_info_elem_t *err_info) case PQI_RAID_DATA_IN_OUT_UNDERFLOW: { - uint32_t resid = 0; - resid = rcb->bcount-err_info->data_out_transferred; - csio->resid = resid; - csio->ccb_h.status = CAM_REQ_CMP; - break; + uint32_t resid = 0; + resid = rcb->bcount-err_info->data_out_transferred; + csio->resid = resid; + csio->ccb_h.status = CAM_REQ_CMP; } + break; default: csio->ccb_h.status = CAM_REQ_CMP; break; } } - if (softs->os_specific.pqi_flags & PQI_FLAG_BUSY) { - softs->os_specific.pqi_flags &= ~PQI_FLAG_BUSY; - if (csio->ccb_h.status & CAM_RELEASE_SIMQ) - xpt_release_simq(xpt_path_sim(csio->ccb_h.path), 0); - else - csio->ccb_h.status |= CAM_RELEASE_SIMQ; - } - - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); +error_out: + pqi_complete_scsi_io(csio, rcb); DBG_IO("OUT\n"); } - /* * Error response handling for aio. */ -void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) +void +os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) { struct ccb_scsiio *csio; pqisrc_softstate_t *softs; DBG_IO("IN\n"); - if (rcb == NULL) + if (rcb == NULL) panic("rcb is null"); rcb->status = REQUEST_SUCCESS; @@ -385,6 +433,13 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) softs = rcb->softs; + if (!err_info || !rcb->dvp) { + csio->ccb_h.status = CAM_REQ_CMP_ERR; + DBG_ERR("couldn't be accessed! error info = %p, rcb->dvp = %p\n", + err_info, rcb->dvp); + goto error_out; + } + switch (err_info->service_resp) { case PQI_AIO_SERV_RESPONSE_COMPLETE: csio->ccb_h.status = err_info->status; @@ -405,6 +460,14 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) break; case PQI_AIO_STATUS_AIO_PATH_DISABLED: DBG_WARN_BTL(rcb->dvp,"AIO Path Disabled\n"); + /* Timed out TMF response comes here */ + if (rcb->tm_req) { + rcb->req_pending = false; + rcb->status = REQUEST_SUCCESS; + DBG_ERR("AIO Disabled for TMF\n"); + return; + } + rcb->dvp->aio_enabled = false; rcb->dvp->offload_enabled = false; csio->ccb_h.status |= CAM_REQUEUE_REQ; break; @@ -420,18 +483,24 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) break; case PQI_AIO_SERV_RESPONSE_TMF_COMPLETE: case PQI_AIO_SERV_RESPONSE_TMF_SUCCEEDED: - csio->ccb_h.status = CAM_REQ_CMP; - break; + DBG_ERR("PQI_AIO_SERV_RESPONSE_TMF %s\n", + (err_info->service_resp == PQI_AIO_SERV_RESPONSE_TMF_COMPLETE) ? "COMPLETE" : "SUCCEEDED"); + rcb->status = REQUEST_SUCCESS; + rcb->req_pending = false; + return; case PQI_AIO_SERV_RESPONSE_TMF_REJECTED: case PQI_AIO_SERV_RESPONSE_TMF_INCORRECT_LUN: - DBG_WARN_BTL(rcb->dvp,"TMF rejected/Incorrect Lun\n"); - csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR; - break; + DBG_ERR("PQI_AIO_SERV_RESPONSE_TMF %s\n", + (err_info->service_resp == PQI_AIO_SERV_RESPONSE_TMF_REJECTED) ? "REJECTED" : "INCORRECT LUN"); + rcb->status = REQUEST_FAILED; + rcb->req_pending = false; + return; default: DBG_WARN_BTL(rcb->dvp,"Scsi Status Error\n"); csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR; break; } + if(err_info->data_pres == DATA_PRESENT_SENSE_DATA ) { csio->scsi_status = PQI_AIO_STATUS_CHECK_CONDITION; uint8_t *sense_data = NULL; @@ -440,56 +509,52 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) sense_data = err_info->data; DBG_ERR_BTL(rcb->dvp, "SCSI_STATUS_CHECK_COND sense size %u\n", sense_data_len); - memset(&csio->sense_data, 0, csio->sense_len); - if (sense_data) - memcpy(&csio->sense_data, sense_data, ((sense_data_len > - csio->sense_len) ? csio->sense_len : sense_data_len)); - if (csio->sense_len > sense_data_len) - csio->sense_resid = csio->sense_len - sense_data_len; - else - csio->sense_resid = 0; + copy_sense_data_to_csio(csio, sense_data, sense_data_len); csio->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; } - smartpqi_fix_ld_inquiry(softs, csio); - pqi_release_camq(rcb); - pqi_unmap_request(rcb); - xpt_done((union ccb *)csio); +error_out: + pqi_complete_scsi_io(csio, rcb); DBG_IO("OUT\n"); } +static void +pqi_freeze_ccb(union ccb *ccb) +{ + if ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { + ccb->ccb_h.status |= CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); + } +} + /* * Command-mapping helper function - populate this command's s/g table. */ static void pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - pqisrc_softstate_t *softs; - rcb_t *rcb; - - rcb = (rcb_t *)arg; - softs = rcb->softs; + rcb_t *rcb = (rcb_t *)arg; + pqisrc_softstate_t *softs = rcb->softs; + union ccb *ccb; - if( error || nseg > softs->pqi_cap.max_sg_elem ) - { - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| - CAM_RELEASE_SIMQ); - DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", + if (error || nseg > softs->pqi_cap.max_sg_elem) { + DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", error, nseg, softs->pqi_cap.max_sg_elem); - pqi_unmap_request(rcb); - xpt_done((union ccb *)rcb->cm_ccb); - return; + goto error_io; + } + + rcb->sgt = os_mem_alloc(softs, nseg * sizeof(sgt_t)); + + if (!rcb->sgt) { + DBG_ERR_BTL(rcb->dvp, "os_mem_alloc() failed; nseg = %d\n", nseg); + goto error_io; } - rcb->sgt = os_mem_alloc(softs, nseg * sizeof(rcb_t)); rcb->nseg = nseg; - if (rcb->sgt != NULL) { - for (int i = 0; i < nseg; i++) { - rcb->sgt[i].addr = segs[i].ds_addr; - rcb->sgt[i].len = segs[i].ds_len; - rcb->sgt[i].flags = 0; - } + for (int i = 0; i < nseg; i++) { + rcb->sgt[i].addr = segs[i].ds_addr; + rcb->sgt[i].len = segs[i].ds_len; + rcb->sgt[i].flags = 0; } if (rcb->data_dir == SOP_DATA_DIR_FROM_DEVICE) @@ -506,39 +571,46 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) if (error) { rcb->req_pending = false; - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ - |CAM_RELEASE_SIMQ); DBG_ERR_BTL(rcb->dvp, "Build IO failed, error = %d\n", error); - pqi_unmap_request(rcb); - xpt_done((union ccb *)rcb->cm_ccb); + } else { + /* Successfully IO was submitted to the device. */ return; } + +error_io: + ccb = rcb->cm_ccb; + ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(ccb); + pqi_unmap_request(rcb); + xpt_done(ccb); + return; } /* - * Function to dma-map the request buffer + * Function to dma-map the request buffer */ -static int pqi_map_request( rcb_t *rcb ) +static int +pqi_map_request(rcb_t *rcb) { pqisrc_softstate_t *softs = rcb->softs; - int error = PQI_STATUS_SUCCESS; + int bsd_status = BSD_SUCCESS; union ccb *ccb = rcb->cm_ccb; DBG_FUNC("IN\n"); /* check that mapping is necessary */ if (rcb->cm_flags & PQI_CMD_MAPPED) - return(0); + return BSD_SUCCESS; + rcb->cm_flags |= PQI_CMD_MAPPED; if (rcb->bcount) { - error = bus_dmamap_load_ccb(softs->os_specific.pqi_buffer_dmat, + bsd_status = bus_dmamap_load_ccb(softs->os_specific.pqi_buffer_dmat, rcb->cm_datamap, ccb, pqi_request_map_helper, rcb, 0); - if (error != 0){ - DBG_ERR_BTL(rcb->dvp, "bus_dmamap_load_ccb failed = %d count = %d\n", - error, rcb->bcount); - return error; + if (bsd_status != BSD_SUCCESS && bsd_status != EINPROGRESS) { + DBG_ERR_BTL(rcb->dvp, "bus_dmamap_load_ccb failed, return status = %d transfer length = %d\n", + bsd_status, rcb->bcount); + return bsd_status; } } else { /* @@ -549,19 +621,21 @@ static int pqi_map_request( rcb_t *rcb ) /* Call IO functions depending on pd or ld */ rcb->status = REQUEST_PENDING; - error = pqisrc_build_send_io(softs, rcb); - + if (pqisrc_build_send_io(softs, rcb) != PQI_STATUS_SUCCESS) { + bsd_status = EIO; + } } - DBG_FUNC("OUT error = %d\n", error); + DBG_FUNC("OUT error = %d\n", bsd_status); - return error; + return bsd_status; } /* * Function to clear the request control block */ -void os_reset_rcb( rcb_t *rcb ) +void +os_reset_rcb(rcb_t *rcb) { rcb->error_info = NULL; rcb->req = NULL; @@ -572,7 +646,7 @@ void os_reset_rcb( rcb_t *rcb ) rcb->softs = NULL; rcb->cm_flags = 0; rcb->cm_data = NULL; - rcb->bcount = 0; + rcb->bcount = 0; rcb->nseg = 0; rcb->sgt = NULL; rcb->cm_ccb = NULL; @@ -580,12 +654,14 @@ void os_reset_rcb( rcb_t *rcb ) rcb->ioaccel_handle = 0; rcb->resp_qid = 0; rcb->req_pending = false; + rcb->tm_req = false; } /* * Callback function for the lun rescan */ -static void smartpqi_lunrescan_cb(struct cam_periph *periph, union ccb *ccb) +static void +smartpqi_lunrescan_cb(struct cam_periph *periph, union ccb *ccb) { xpt_free_path(ccb->ccb_h.path); xpt_free_ccb(ccb); @@ -595,16 +671,22 @@ static void smartpqi_lunrescan_cb(struct cam_periph *periph, union ccb *ccb) /* * Function to rescan the lun */ -static void smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, +static void +smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, int lun) { - union ccb *ccb = NULL; - cam_status status = 0; - struct cam_path *path = NULL; + union ccb *ccb = NULL; + cam_status status = 0; + struct cam_path *path = NULL; DBG_FUNC("IN\n"); ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + DBG_ERR("Unable to alloc ccb for lun rescan\n"); + return; + } + status = xpt_create_path(&path, NULL, cam_sim_path(softs->os_specific.sim), target, lun); if (status != CAM_REQ_CMP) { @@ -628,7 +710,8 @@ static void smartpqi_lun_rescan(struct pqisrc_softstate *softs, int target, /* * Function to rescan the lun under each target */ -void smartpqi_target_rescan(struct pqisrc_softstate *softs) +void +smartpqi_target_rescan(struct pqisrc_softstate *softs) { int target = 0, lun = 0; @@ -648,7 +731,8 @@ void smartpqi_target_rescan(struct pqisrc_softstate *softs) /* * Set the mode of tagged command queueing for the current task. */ -uint8_t os_get_task_attr(rcb_t *rcb) +uint8_t +os_get_task_attr(rcb_t *rcb) { union ccb *ccb = rcb->cm_ccb; uint8_t tag_action = SOP_TASK_ATTRIBUTE_SIMPLE; @@ -671,19 +755,24 @@ uint8_t os_get_task_attr(rcb_t *rcb) /* * Complete all outstanding commands */ -void os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) +void +os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) { int tag = 0; + pqi_scsi_dev_t *dvp = NULL; DBG_FUNC("IN\n"); - for (tag = 1; tag < softs->max_outstanding_io; tag++) { + for (tag = 1; tag <= softs->max_outstanding_io; tag++) { rcb_t *prcb = &softs->rcb[tag]; + dvp = prcb->dvp; if(prcb->req_pending && prcb->cm_ccb ) { prcb->req_pending = false; prcb->cm_ccb->ccb_h.status = CAM_REQ_ABORTED | CAM_REQ_CMP; - xpt_done((union ccb *)prcb->cm_ccb); - prcb->cm_ccb = NULL; + pqi_complete_scsi_io(&prcb->cm_ccb->csio, prcb); + if (dvp) + pqisrc_decrement_device_active_io(softs, dvp); + } } @@ -693,21 +782,22 @@ void os_complete_outstanding_cmds_nodevice(pqisrc_softstate_t *softs) /* * IO handling functionality entry point */ -static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) +static int +pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) { rcb_t *rcb; uint32_t tag, no_transfer = 0; pqisrc_softstate_t *softs = (struct pqisrc_softstate *) cam_sim_softc(sim); - int32_t error = PQI_STATUS_FAILURE; + int32_t error; pqi_scsi_dev_t *dvp; DBG_FUNC("IN\n"); - - if( softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun] == NULL ) { + + if (softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun] == NULL) { ccb->ccb_h.status = CAM_DEV_NOT_THERE; DBG_INFO("Device = %d not there\n", ccb->ccb_h.target_id); - return PQI_STATUS_FAILURE; + return ENXIO; } dvp = softs->device_list[ccb->ccb_h.target_id][ccb->ccb_h.target_lun]; @@ -716,40 +806,40 @@ static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) ccb->ccb_h.status = CAM_SCSI_BUS_RESET | CAM_BUSY | CAM_REQ_INPROG; DBG_WARN("Device = %d BUSY/IN_RESET\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } /* Check device state */ if (pqisrc_ctrl_offline(softs) || DEV_GONE(dvp)) { ccb->ccb_h.status = CAM_DEV_NOT_THERE | CAM_REQ_CMP; DBG_WARN("Device = %d GONE/OFFLINE\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } /* Check device reset */ - if (dvp->reset_in_progress) { + if (DEVICE_RESET(dvp)) { ccb->ccb_h.status = CAM_SCSI_BUSY | CAM_REQ_INPROG | CAM_BUSY; DBG_WARN("Device %d reset returned busy\n", ccb->ccb_h.target_id); - return error; + return EBUSY; } if (dvp->expose_device == false) { ccb->ccb_h.status = CAM_DEV_NOT_THERE; DBG_INFO("Device = %d not exposed\n", ccb->ccb_h.target_id); - return error; + return ENXIO; } tag = pqisrc_get_tag(&softs->taglist); - if( tag == INVALID_ELEM ) { + if (tag == INVALID_ELEM) { DBG_ERR("Get Tag failed\n"); xpt_freeze_simq(softs->os_specific.sim, 1); softs->os_specific.pqi_flags |= PQI_FLAG_BUSY; ccb->ccb_h.status |= (CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ); - return PQI_STATUS_FAILURE; + return EIO; } DBG_IO("tag = %d &softs->taglist : %p\n", tag, &softs->taglist); rcb = &softs->rcb[tag]; - os_reset_rcb( rcb ); + os_reset_rcb(rcb); rcb->tag = tag; rcb->softs = softs; rcb->cmdlen = ccb->csio.cdb_len; @@ -786,57 +876,72 @@ static int pqisrc_io_start(struct cam_sim *sim, union ccb *ccb) * if we ever learn a transport layer other than simple, may fail * if the adapter rejects the command). */ - if ((error = pqi_map_request(rcb)) != 0) { - rcb->req_pending = false; + if ((error = pqi_map_request(rcb)) != BSD_SUCCESS) { xpt_freeze_simq(softs->os_specific.sim, 1); - ccb->ccb_h.status |= CAM_RELEASE_SIMQ; if (error == EINPROGRESS) { - DBG_WARN("In Progress on %d\n", ccb->ccb_h.target_id); - error = 0; + /* Release simq in the completion */ + softs->os_specific.pqi_flags |= PQI_FLAG_BUSY; + error = BSD_SUCCESS; } else { - ccb->ccb_h.status |= CAM_REQUEUE_REQ; + rcb->req_pending = false; + ccb->ccb_h.status |= CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; DBG_WARN("Requeue req error = %d target = %d\n", error, ccb->ccb_h.target_id); pqi_unmap_request(rcb); + error = EIO; } } DBG_FUNC("OUT error = %d\n", error); + return error; } +static inline int +pqi_tmf_status_to_bsd_tmf_status(int pqi_status, rcb_t *rcb) +{ + if (PQI_STATUS_SUCCESS == pqi_status && + REQUEST_SUCCESS == rcb->status) + return BSD_SUCCESS; + else + return EIO; +} + /* * Abort a task, task management functionality */ static int pqisrc_scsi_abort_task(pqisrc_softstate_t *softs, union ccb *ccb) { - rcb_t *rcb = ccb->ccb_h.sim_priv.entries[0].ptr; - uint32_t abort_tag = rcb->tag; - uint32_t tag = 0; - int rval = PQI_STATUS_SUCCESS; - uint16_t qid; - - DBG_FUNC("IN\n"); + struct ccb_hdr *ccb_h = &ccb->ccb_h; + rcb_t *rcb = NULL; + rcb_t *prcb = ccb->ccb_h.sim_priv.entries[0].ptr; + uint32_t tag; + int rval; - qid = (uint16_t)rcb->resp_qid; + DBG_FUNC("IN\n"); tag = pqisrc_get_tag(&softs->taglist); rcb = &softs->rcb[tag]; rcb->tag = tag; - rcb->resp_qid = qid; - rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, abort_tag, + if (!rcb->dvp) { + DBG_ERR("dvp is null, tmf type : 0x%x\n", ccb_h->func_code); + rval = ENXIO; + goto error_tmf; + } + + rcb->tm_req = true; + + rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, prcb, SOP_TASK_MANAGEMENT_FUNCTION_ABORT_TASK); - if (PQI_STATUS_SUCCESS == rval) { - rval = rcb->status; - if (REQUEST_SUCCESS == rval) { - ccb->ccb_h.status = CAM_REQ_ABORTED; - } - } - pqisrc_put_tag(&softs->taglist, abort_tag); - pqisrc_put_tag(&softs->taglist,rcb->tag); + if ((rval = pqi_tmf_status_to_bsd_tmf_status(rval, rcb)) == BSD_SUCCESS) + ccb->ccb_h.status = CAM_REQ_ABORTED; + +error_tmf: + os_reset_rcb(rcb); + pqisrc_put_tag(&softs->taglist, tag); DBG_FUNC("OUT rval = %d\n", rval); @@ -849,9 +954,10 @@ pqisrc_scsi_abort_task(pqisrc_softstate_t *softs, union ccb *ccb) static int pqisrc_scsi_abort_task_set(pqisrc_softstate_t *softs, union ccb *ccb) { + struct ccb_hdr *ccb_h = &ccb->ccb_h; rcb_t *rcb = NULL; - uint32_t tag = 0; - int rval = PQI_STATUS_SUCCESS; + uint32_t tag; + int rval; DBG_FUNC("IN\n"); @@ -859,14 +965,22 @@ pqisrc_scsi_abort_task_set(pqisrc_softstate_t *softs, union ccb *ccb) rcb = &softs->rcb[tag]; rcb->tag = tag; - rval = pqisrc_send_tmf(softs, rcb->dvp, rcb, 0, + if (!rcb->dvp) { *** 9666 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 15:37:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD43D65FF50; Sat, 31 Jul 2021 15:37:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcT1L4Gl0z4g3T; Sat, 31 Jul 2021 15:37:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 6184A7A8D; Sat, 31 Jul 2021 15:37:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id AAFA8154AC; Sat, 31 Jul 2021 17:37:56 +0200 (CEST) From: "Kristof Provost" To: "Warner Losh" Cc: "Warner Losh" , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Date: Sat, 31 Jul 2021 17:37:55 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> In-Reply-To: References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 15:37:58 -0000 On 31 Jul 2021, at 16:20, Warner Losh wrote: > On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: > >> >> >> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost = >> wrote: >> >>> Hi Warner, >>> >>> On 10 Jul 2021, at 19:12, Warner Losh wrote: >>> >>> The branch stable/12 has been updated by imp: >>> >>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e= 38efe5b83b0ec >>> >>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec >>> Author: Warner Losh >>> AuthorDate: 2021-07-07 23:30:35 +0000 >>> Commit: Warner Losh >>> CommitDate: 2021-07-10 17:11:15 +0000 >>> >>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of = >>> bugs >>> >>> Import the latest bsd-features branch of the one-true-awk upstream: >>> >>> o Move to bison for $YACC >>> o Set close-on-exec flag for file and pipe redirects that aren't = >>> std* >>> o lots of little fixes to modernize ocde base >>> o free sval member before setting it >>> o fix a bug where a{0,3} could match aaaa >>> o pull in systime and strftime from NetBSD awk >>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with = >>> them) >>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a = >>> nop) >>> >>> Also revert a few of the trivial FreeBSD changes that were done = >>> slightly >>> differently in the upstreaming process. Also, our PR database may = >>> have >>> been mined by upstream for these fixes, and Mikolaj Golub may = >>> deserve >>> credit for some of the fixes in this update. >>> >>> Suggested by: Mikolaj Golub >>> PR: 143363,143365,143368,143369,143373,143375,214782 >>> Sponsored by: Netflix >>> >>> (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) >>> >>> I *think* this is the relevant commit, but I=E2=80=99m not 100% sure.= >>> >>> Anyway, I=E2=80=99ve recently started seeing issues building pfSense = for = >>> aarch64. >>> I=E2=80=99ve finally narrowed it down, and replicated the problem on = base = >>> FreeBSD >>> (stable/12, but I assume other branches are affected too). >>> >>> It fails to build proctab.c. This file is generated by maketab, a = >>> tool >>> built as part of the build process. In my case this tool is built = >>> for >>> aarch64, which makes executing it on amd64 less successful than = >>> we=E2=80=99d like. >>> >>> This only happens when building with META_MODE though. I do not >>> understand the build system sufficiently to debug why. Hopefully = >>> you=E2=80=99ll >>> have a better idea. >>> >> Generally I do, but this one is a bit weird. Also, the amount of = >> context >> you've included omits the actual error :( Though I'm guessing it's = >> wrong >> arch for the build tool... >> >> I rarely use meta mode, and understand it not at all, but awk follows = >> the >> same patterns as /bin/sh and /bin/csh does >> > > [[ stupid gmail ]] > > I've just pushed removal of proctab.c. That may fix this, though I'm = > not > hopeful. Unfortunately that didn=E2=80=99t help. > I've rarely used metamode, and not for quite some time, but this > an extra file that would confuse things so that maketab might not be = > built > during build-tools and instead is built later. Please give that a try, = > and > I'll start a meta build, but that takes a while, not least because I = > have > to re-leran how to do that :) > I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.meta = files = on https://people.freebsd.org/~kp/meta/ I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s in = the meta = file doesn=E2=80=99t seem to match the build command seen in the metamode= =2Elog = file. Best regards, Kristof From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 17:28:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7949B6616E6 for ; Sat, 31 Jul 2021 17:28:39 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcWT32WsDz4mLC for ; Sat, 31 Jul 2021 17:28:39 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf2c.google.com with SMTP id d17so6891038qvn.13 for ; Sat, 31 Jul 2021 10:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZVe9EjNfIuGlRbgqt3pyhcHYsK+8Lz9AFbp1LhKyR+k=; b=piOGmEF7OU0+U1xP7YdobbOrI0qM9GAtvJqxBnW4OEz/TXMl5nWnAPIrIeKNp/BecX FNotTmpfcja4jEG2mPbF4Ybjdl+jxyPypunlZwSRIoDqHlnc6/utZfMS9aJOdn0aRsjE l8qINuV0GlwzFuhd5P2kngpp5T5jlplTgvXAeOOIGidnce0rki7nAAOCiRtTcHiR/oTP OG3noM86I1mnOOagvZxFt9beUBd+yy7AVEn4LRk8pI/2vwS+G4coFkGq5dZmlSTHha5d 1hG1yko3sH0a8Qx98lHI+XY8LcfCG3NRNw2jHwi9eItbkYDNuB+weP3NbBsGzWhqz2SQ XI+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZVe9EjNfIuGlRbgqt3pyhcHYsK+8Lz9AFbp1LhKyR+k=; b=YzxtMkK4cJJY64Fk6P0Ykq8KDOd8bwSOMORja4gurj2QnjzHEudbAAL8W+T3jM4syq 5HhqSaQwPNiXVasSe5WHNKl5y85dHHKcrMNx+ffFNkQFKL0v+Z/KZfB49CGNMJPqYWZS 01nctaYrmSUMzTbxTKysWeBnI96xXBDo6E98lIMZ0Agg2lbug0m5HQkkQUfQp0ohgYAx pI7zGl0PH1rxN1UtI4RIes6JpF6YLygbupnQNzagF2C25dmn+lkesLiEO6Ds5PH4Pvo8 5WDBjyXAgbXecmrRqEVK0KVEQFlfoR7u2MU/NmqSQ6zOchLZ18HC9cCGAGJyaaObyetZ BBCw== X-Gm-Message-State: AOAM532HfNIhOQzbLx22rG7gM9XCEPIRPdlloOrkFi8BFgdgkMNfPB+S iqPKHU4nHsL8QXs06526iDhboaP8CY9ZMtt04j372g== X-Google-Smtp-Source: ABdhPJw/Z2CK47hSZJ+9xuPJ8QbULhlx6X9TiWoAaOkU7FmlJj6pbbWK5RfSOaOu33uPbPg13NFaZPwdv+PGxBd7k14= X-Received: by 2002:a05:6214:17cb:: with SMTP id cu11mr8984194qvb.28.1627752513386; Sat, 31 Jul 2021 10:28:33 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> In-Reply-To: <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> From: Warner Losh Date: Sat, 31 Jul 2021 11:28:22 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4GcWT32WsDz4mLC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 17:28:39 -0000 On Sat, Jul 31, 2021 at 9:37 AM Kristof Provost wrote: > On 31 Jul 2021, at 16:20, Warner Losh wrote: > > On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: > > > >> > >> > >> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost > >> wrote: > >> > >>> Hi Warner, > >>> > >>> On 10 Jul 2021, at 19:12, Warner Losh wrote: > >>> > >>> The branch stable/12 has been updated by imp: > >>> > >>> URL: > >>> > https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38ef= e5b83b0ec > >>> > >>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec > >>> Author: Warner Losh > >>> AuthorDate: 2021-07-07 23:30:35 +0000 > >>> Commit: Warner Losh > >>> CommitDate: 2021-07-10 17:11:15 +0000 > >>> > >>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of > >>> bugs > >>> > >>> Import the latest bsd-features branch of the one-true-awk upstream: > >>> > >>> o Move to bison for $YACC > >>> o Set close-on-exec flag for file and pipe redirects that aren't > >>> std* > >>> o lots of little fixes to modernize ocde base > >>> o free sval member before setting it > >>> o fix a bug where a{0,3} could match aaaa > >>> o pull in systime and strftime from NetBSD awk > >>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with > >>> them) > >>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a > >>> nop) > >>> > >>> Also revert a few of the trivial FreeBSD changes that were done > >>> slightly > >>> differently in the upstreaming process. Also, our PR database may > >>> have > >>> been mined by upstream for these fixes, and Mikolaj Golub may > >>> deserve > >>> credit for some of the fixes in this update. > >>> > >>> Suggested by: Mikolaj Golub > >>> PR: 143363,143365,143368,143369,143373,143375,214782 > >>> Sponsored by: Netflix > >>> > >>> (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) > >>> > >>> I *think* this is the relevant commit, but I=E2=80=99m not 100% sure. > >>> > >>> Anyway, I=E2=80=99ve recently started seeing issues building pfSense = for > >>> aarch64. > >>> I=E2=80=99ve finally narrowed it down, and replicated the problem on = base > >>> FreeBSD > >>> (stable/12, but I assume other branches are affected too). > >>> > >>> It fails to build proctab.c. This file is generated by maketab, a > >>> tool > >>> built as part of the build process. In my case this tool is built > >>> for > >>> aarch64, which makes executing it on amd64 less successful than > >>> we=E2=80=99d like. > >>> > >>> This only happens when building with META_MODE though. I do not > >>> understand the build system sufficiently to debug why. Hopefully > >>> you=E2=80=99ll > >>> have a better idea. > >>> > >> Generally I do, but this one is a bit weird. Also, the amount of > >> context > >> you've included omits the actual error :( Though I'm guessing it's > >> wrong > >> arch for the build tool... > >> > >> I rarely use meta mode, and understand it not at all, but awk follows > >> the > >> same patterns as /bin/sh and /bin/csh does > >> > > > > [[ stupid gmail ]] > > > > I've just pushed removal of proctab.c. That may fix this, though I'm > > not > > hopeful. > Unfortunately that didn=E2=80=99t help. > > > I've rarely used metamode, and not for quite some time, but this > > an extra file that would confuse things so that maketab might not be > > built > > during build-tools and instead is built later. Please give that a try, > > and > > I'll start a meta build, but that takes a while, not least because I > > have > > to re-leran how to do that :) > > > I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.meta = files > on https://people.freebsd.org/~kp/meta/ > > I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s in = the meta > file doesn=E2=80=99t seem to match the build command seen in the metamode= .log > file. > Yea. It's getting confused and rebuilding it bogusly. For the mknodes in sh, we don't see the naked cc command, but we do for maketab. I'm testing a fix right now, though, and we'll see if that fixes things. I think I know what's going on. Warner From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 18:06:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1043F66238E; Sat, 31 Jul 2021 18:06:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcXJd6ngXz4pBn; Sat, 31 Jul 2021 18:06:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D177B1D62E; Sat, 31 Jul 2021 18:06:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VI6PgI066209; Sat, 31 Jul 2021 18:06:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VI6PeP066208; Sat, 31 Jul 2021 18:06:25 GMT (envelope-from git) Date: Sat, 31 Jul 2021 18:06:25 GMT Message-Id: <202107311806.16VI6PeP066208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1dfb6e5d1f46 - stable/12 - awk: merge fixes to metamode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1dfb6e5d1f462af4f4df818ee93766f09f3aa787 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 18:06:26 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1dfb6e5d1f462af4f4df818ee93766f09f3aa787 commit 1dfb6e5d1f462af4f4df818ee93766f09f3aa787 Author: Warner Losh AuthorDate: 2021-07-31 17:57:21 +0000 Commit: Warner Losh CommitDate: 2021-07-31 18:05:34 +0000 awk: merge fixes to metamode This is a partial MFC of c63c5ab001106/r349062. The whole thing doesn't apply cleanly, but this bit, at least, is needed to fix metamode on stable/12 after the changes to awk were merged from head. Rather than risk breaking other things, I'm just merging the bit I know that's needed. All build tools need to be in DEPENDOBJ so the dependency order is correct and they get built with host tools. Reported by: kp Sponsored by: Netflix --- usr.bin/awk/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index d31e811bbec5..82de7d56a415 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -25,6 +25,7 @@ awkgram.tab.h: awkgram.h proctab.c: maketab ${BTOOLSPATH:U.}/maketab awkgram.h > proctab.c +DEPENDOBJS+= maketab build-tools: maketab maketab: awkgram.tab.h maketab.c ${BUILD_TOOLS_META} From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 18:08:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 782326624A9 for ; Sat, 31 Jul 2021 18:08:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcXLh420zz4pCC for ; Sat, 31 Jul 2021 18:08:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72b.google.com with SMTP id 129so12741267qkg.4 for ; Sat, 31 Jul 2021 11:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=X3LmiCM4sHpwWMFEZobq0F67XDchpsF8RWPfdPhJ9fg=; b=piwCWbI+A63tVsHgYAQP/eKD0jDEkEfXv5e7DXVoYOUSmuwlPmJztocDRnizW0c4k2 VDTb85LAnlRti3/eBnzL2j+vU+AFiNjIdvXtLcfZcJEG8vconqrip9jYvW9Je6b14GXF 1t5ORtUrbjIz/sucSqpeyb+iAvy+dEavHzq511/9334mX6MBn0k3jeVkgbR0mJ3sCnj/ bWOk2JcrLcwgfWiuv4lE8FN8VW4d7kpP+c2RR6PlB7vhljXgEMQvOEXHUwvDucvamJwb BUK7MHvG1wtJOLbUyfjrEclv/nnwDigL4WFwFjwVNydjStzIsrwPxzGJEfY7qOhuUtdD wmEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=X3LmiCM4sHpwWMFEZobq0F67XDchpsF8RWPfdPhJ9fg=; b=Wmsw1e3X3briaL/ufT2MfZ2yOw3C8QGJHEl7NdOD0U0Xr1FFPzHYbDPu286q9jQv+u WcmjMWjbFaeLWwXVBGZESpRb9s4IVOgVbkAqR40WgGUHY9ZvQS7jq3EfOi/zXIOp5Yr6 wN1bqqmCDWJ5eI1Y6X3zUwtaAkrFx+hk73vgsqBv1TtaxyrOMUfTkPw3QnYn3ebOnQKn 2PGu5Nir7uUOBJ67py49lv3BrszABB53VNlP7NnjQYa4Ivv8dsw2QY2I4bmXyI/AI+I9 YN1uSyLOzxUvCxM/InoRKi1Uc0yCYU0gQsi04tLiS6JzyKGeLJmNTlTEWtXSuSmBcUGf uAng== X-Gm-Message-State: AOAM530U55J6isGq3izVhzAiO/3u1PzDX6n9/UN9OW1pVSoBz0AbCybE dU+a+7iswFZbhJQh2ngUQUe5KOlfdxQcQTpRyHNLnQ== X-Google-Smtp-Source: ABdhPJyG+p5RGwkOt9CeYKjYu/Ceejo6vjTaPNHa0CzthB39Q2VGRjjm1V3/pNCTjMiW9Q/iO9ELlmz4yU326RzTzxE= X-Received: by 2002:a05:620a:5f6:: with SMTP id z22mr7962507qkg.195.1627754892042; Sat, 31 Jul 2021 11:08:12 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Sat, 31 Jul 2021 12:08:01 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4GcXLh420zz4pCC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=piwCWbI+; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72b) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-branches@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.997]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72b:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[dev-commits-src-branches]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 18:08:14 -0000 On Sat, Jul 31, 2021 at 11:28 AM Warner Losh wrote: > > > On Sat, Jul 31, 2021 at 9:37 AM Kristof Provost wrote: > >> On 31 Jul 2021, at 16:20, Warner Losh wrote: >> > On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: >> > >> >> >> >> >> >> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost >> >> wrote: >> >> >> >>> Hi Warner, >> >>> >> >>> On 10 Jul 2021, at 19:12, Warner Losh wrote: >> >>> >> >>> The branch stable/12 has been updated by imp: >> >>> >> >>> URL: >> >>> >> https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38e= fe5b83b0ec >> >>> >> >>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec >> >>> Author: Warner Losh >> >>> AuthorDate: 2021-07-07 23:30:35 +0000 >> >>> Commit: Warner Losh >> >>> CommitDate: 2021-07-10 17:11:15 +0000 >> >>> >> >>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of >> >>> bugs >> >>> >> >>> Import the latest bsd-features branch of the one-true-awk upstream: >> >>> >> >>> o Move to bison for $YACC >> >>> o Set close-on-exec flag for file and pipe redirects that aren't >> >>> std* >> >>> o lots of little fixes to modernize ocde base >> >>> o free sval member before setting it >> >>> o fix a bug where a{0,3} could match aaaa >> >>> o pull in systime and strftime from NetBSD awk >> >>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with >> >>> them) >> >>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a >> >>> nop) >> >>> >> >>> Also revert a few of the trivial FreeBSD changes that were done >> >>> slightly >> >>> differently in the upstreaming process. Also, our PR database may >> >>> have >> >>> been mined by upstream for these fixes, and Mikolaj Golub may >> >>> deserve >> >>> credit for some of the fixes in this update. >> >>> >> >>> Suggested by: Mikolaj Golub >> >>> PR: 143363,143365,143368,143369,143373,143375,214782 >> >>> Sponsored by: Netflix >> >>> >> >>> (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) >> >>> >> >>> I *think* this is the relevant commit, but I=E2=80=99m not 100% sure= . >> >>> >> >>> Anyway, I=E2=80=99ve recently started seeing issues building pfSense= for >> >>> aarch64. >> >>> I=E2=80=99ve finally narrowed it down, and replicated the problem on= base >> >>> FreeBSD >> >>> (stable/12, but I assume other branches are affected too). >> >>> >> >>> It fails to build proctab.c. This file is generated by maketab, a >> >>> tool >> >>> built as part of the build process. In my case this tool is built >> >>> for >> >>> aarch64, which makes executing it on amd64 less successful than >> >>> we=E2=80=99d like. >> >>> >> >>> This only happens when building with META_MODE though. I do not >> >>> understand the build system sufficiently to debug why. Hopefully >> >>> you=E2=80=99ll >> >>> have a better idea. >> >>> >> >> Generally I do, but this one is a bit weird. Also, the amount of >> >> context >> >> you've included omits the actual error :( Though I'm guessing it's >> >> wrong >> >> arch for the build tool... >> >> >> >> I rarely use meta mode, and understand it not at all, but awk follows >> >> the >> >> same patterns as /bin/sh and /bin/csh does >> >> >> > >> > [[ stupid gmail ]] >> > >> > I've just pushed removal of proctab.c. That may fix this, though I'm >> > not >> > hopeful. >> Unfortunately that didn=E2=80=99t help. >> >> > I've rarely used metamode, and not for quite some time, but this >> > an extra file that would confuse things so that maketab might not be >> > built >> > during build-tools and instead is built later. Please give that a try, >> > and >> > I'll start a meta build, but that takes a while, not least because I >> > have >> > to re-leran how to do that :) >> > >> I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.meta= files >> on https://people.freebsd.org/~kp/meta/ >> >> I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s in= the meta >> file doesn=E2=80=99t seem to match the build command seen in the metamod= e.log >> file. >> > > Yea. It's getting confused and rebuilding it bogusly. For the mknodes in > sh, we don't see the naked cc command, but we do for maketab. > > I'm testing a fix right now, though, and we'll see if that fixes things. = I > think I know what's going on. > I just pushed 1dfb6e5d1f462af4f4df818ee93766f09f3aa787, which fixed the issues I was seeing. Does that do the trick for you as well? Warner From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 18:59:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29521662D8B; Sat, 31 Jul 2021 18:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcYTn5yBvz4rsw; Sat, 31 Jul 2021 18:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4BE41E107; Sat, 31 Jul 2021 18:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16VIxP2h031857; Sat, 31 Jul 2021 18:59:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16VIxDnn031848; Sat, 31 Jul 2021 18:59:13 GMT (envelope-from git) Date: Sat, 31 Jul 2021 18:59:13 GMT Message-Id: <202107311859.16VIxDnn031848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: af732203b8f7 - stable/13 - Merge llvm-project 12.0.1 release and follow-up fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af732203b8f7f006927528db5497f5cbc4c4742a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 18:59:26 -0000 The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=af732203b8f7f006927528db5497f5cbc4c4742a commit af732203b8f7f006927528db5497f5cbc4c4742a Author: Dimitry Andric AuthorDate: 2021-06-13 19:31:46 +0000 Commit: Dimitry Andric CommitDate: 2021-07-31 18:56:55 +0000 Merge llvm-project 12.0.1 release and follow-up fixes Merge llvm-project main llvmorg-12-init-17869-g8e464dd76bef This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12-init-17869-g8e464dd76bef, the last commit before the upstream release/12.x branch was created. PR: 255570 (cherry picked from commit e8d8bef961a50d4dc22501cde4fb9fb0be1b2532) Merge llvm-project 12.0.0 release This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release. PR: 255570 (cherry picked from commit d409305fa3838fb39b38c26fc085fb729b8766d5) Disable strict-fp for powerpcspe, as it does not work properly yet Merge commit 5c18d1136665 from llvm git (by Qiu Chaofan) [SPE] Disable strict-fp for SPE by default As discussed in PR50385, strict-fp on PowerPC SPE has not been handled well. This patch disables it by default for SPE. Reviewed By: nemanjai, vit9696, jhibbits Differential Revision: https://reviews.llvm.org/D103235 PR: 255570 (cherry picked from commit 715df83abc049b23d9acddc81f2480bd4c056d64) Apply upstream libc++ fix to allow building with devel/xxx-xtoolchain-gcc Merge commit 52e9d80d5db2 from llvm git (by Jason Liu): [libc++] add `inline` for __open's definition in ifstream and ofstream Summary: When building with gcc on AIX, it seems that gcc does not like the `always_inline` without the `inline` keyword. So adding the inline keywords in for __open in ifstream and ofstream. That will also make it consistent with __open in basic_filebuf (it seems we added `inline` there before for gcc build as well). Differential Revision: https://reviews.llvm.org/D99422 PR: 255570 (cherry picked from commit d099db25464b826c5724cf2fb5b22292bbe15f6e) Undefine HAVE_(DE)REGISTER_FRAME in llvm's config.h on arm Otherwise, the lli tool (enable by WITH_CLANG_EXTRAS) won't link on arm, stating that __register_frame is undefined. This function is normally provided by libunwind, but explicitly not for the ARM Exception ABI. Reported by: oh PR: 255570 (cherry picked from commit f336b45e943c7f9a90ffcea1a6c4c7039e54c73c) Merge llvm-project 12.0.1 rc2 This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2. PR: 255570 (cherry picked from commit 23408297fbf3089f0388a8873b02fa75ab3f5bb9) Revert libunwind change to fix backtrace segfault on aarch64 Revert commit 22b615a96593 from llvm git (by Daniel Kiss): [libunwind] Support for leaf function unwinding. Unwinding leaf function is useful in cases when the backtrace finds a leaf function for example when it caused a signal. This patch also add the support for the DW_CFA_undefined because it marks the end of the frames. Ryan Prichard provided code for the tests. Reviewed By: #libunwind, mstorsjo Differential Revision: https://reviews.llvm.org/D83573 Reland with limit the test to the x86_64-linux target. Bisection has shown that this particular upstream commit causes programs using backtrace(3) on aarch64 to segfault. This affects the lang/rust port, for instance. Until we can upstream to fix this problem, revert the commit for now. Reported by: mikael PR: 256864 (cherry picked from commit 5866c369e4fd917c0d456f0f10b92ee354b82279) Merge llvm-project 12.0.1 release This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release. PR: 255570 (cherry picked from commit 4652422eb477731f284b1345afeefef7f269da50) compilert-rt: build out-of-line LSE atomics helpers for aarch64 Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for aarch64. This requires a bunch of helper functions in libcompiler_rt.a, to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel". (Note: of course you can use -mno-outline-atomics as a workaround too, but this would negate the potential performance benefit of the faster LSE instructions.) Bump __FreeBSD_version so ports maintainers can easily detect this. PR: 257392 (cherry picked from commit cc55ee8009a550810d38777fd6ace9abf3a2f6b4) --- ObsoleteFiles.inc | 574 +++ contrib/llvm-project/clang/include/clang-c/Index.h | 88 +- .../llvm-project/clang/include/clang-c/Rewrite.h | 63 + .../include/clang/APINotes/APINotesYAMLCompiler.h | 24 + .../clang/include/clang/APINotes/Types.h | 734 +++ .../clang/include/clang/ARCMigrate/FileRemapper.h | 8 + .../llvm-project/clang/include/clang/AST/APValue.h | 163 +- .../clang/include/clang/AST/ASTContext.h | 130 +- .../llvm-project/clang/include/clang/AST/ASTFwd.h | 6 +- .../clang/include/clang/AST/ASTImporter.h | 8 + .../clang/include/clang/AST/ASTNodeTraverser.h | 72 +- .../include/clang/AST/ASTStructuralEquivalence.h | 7 + .../clang/include/clang/AST/ASTTypeTraits.h | 74 +- .../clang/include/clang/AST/AbstractBasicReader.h | 34 + .../clang/include/clang/AST/AbstractBasicWriter.h | 35 + .../llvm-project/clang/include/clang/AST/Attr.h | 39 +- .../clang/include/clang/AST/CXXInheritance.h | 10 - .../clang/AST/CXXRecordDeclDefinitionBits.def | 7 + .../clang/include/clang/AST/CanonicalType.h | 4 +- .../clang/include/clang/AST/CommentLexer.h | 31 +- .../clang/include/clang/AST/ComputeDependence.h | 4 +- .../llvm-project/clang/include/clang/AST/Decl.h | 123 +- .../clang/include/clang/AST/DeclBase.h | 3 +- .../llvm-project/clang/include/clang/AST/DeclCXX.h | 102 +- .../clang/include/clang/AST/DeclObjC.h | 45 +- .../clang/include/clang/AST/DeclOpenMP.h | 246 +- .../clang/include/clang/AST/DeclTemplate.h | 117 +- .../clang/include/clang/AST/DeclarationName.h | 23 +- .../clang/include/clang/AST/DependenceFlags.h | 1 + .../clang/include/clang/AST/DependentDiagnostic.h | 10 +- .../llvm-project/clang/include/clang/AST/Expr.h | 399 +- .../llvm-project/clang/include/clang/AST/ExprCXX.h | 297 +- .../clang/include/clang/AST/ExprConcepts.h | 6 +- .../clang/include/clang/AST/ExprObjC.h | 4 +- .../clang/include/clang/AST/ExternalASTSource.h | 4 - .../clang/include/clang/AST/GlobalDecl.h | 1 + .../clang/include/clang/AST/IgnoreExpr.h | 161 + .../llvm-project/clang/include/clang/AST/Mangle.h | 20 +- .../include/clang/AST/MangleNumberingContext.h | 5 + .../clang/include/clang/AST/NestedNameSpecifier.h | 34 +- .../clang/include/clang/AST/OpenMPClause.h | 494 +- .../clang/include/clang/AST/OperationKinds.def | 11 +- .../clang/include/clang/AST/OptionalDiagnostic.h | 2 +- .../clang/include/clang/AST/ParentMap.h | 4 +- .../clang/include/clang/AST/ParentMapContext.h | 13 +- .../clang/include/clang/AST/PrettyPrinter.h | 40 +- .../clang/include/clang/AST/PropertiesBase.td | 308 ++ .../clang/include/clang/AST/RecordLayout.h | 65 +- .../clang/include/clang/AST/RecursiveASTVisitor.h | 68 +- .../clang/include/clang/AST/Redeclarable.h | 15 + .../llvm-project/clang/include/clang/AST/Stmt.h | 60 +- .../clang/include/clang/AST/StmtIterator.h | 9 +- .../clang/include/clang/AST/StmtOpenMP.h | 1653 +++--- .../clang/include/clang/AST/TemplateBase.h | 72 +- .../clang/include/clang/AST/TemplateName.h | 6 +- .../clang/include/clang/AST/TextNodeDumper.h | 3 + .../llvm-project/clang/include/clang/AST/Type.h | 163 +- .../llvm-project/clang/include/clang/AST/TypeLoc.h | 93 +- .../clang/include/clang/AST/TypeProperties.td | 12 +- .../include/clang/ASTMatchers/ASTMatchFinder.h | 4 + .../clang/include/clang/ASTMatchers/ASTMatchers.h | 574 ++- .../clang/ASTMatchers/ASTMatchersInternal.h | 996 ++-- .../include/clang/ASTMatchers/ASTMatchersMacros.h | 58 +- .../clang/ASTMatchers/Dynamic/VariantValue.h | 40 +- .../clang/Analysis/Analyses/CalledOnceCheck.h | 112 + .../include/clang/Analysis/Analyses/Dominators.h | 70 - .../clang/Analysis/Analyses/LiveVariables.h | 18 +- .../include/clang/Analysis/Analyses/ThreadSafety.h | 8 + .../clang/Analysis/Analyses/ThreadSafetyTIL.h | 4 +- .../clang/include/clang/Analysis/CallGraph.h | 4 +- .../clang/include/clang/Analysis/IssueHash.h | 49 + .../clang/include/clang/Analysis/PathDiagnostic.h | 39 + .../clang/include/clang/Basic/AddressSpaces.h | 2 + .../clang/include/clang/Basic/AlignedAllocation.h | 2 + .../llvm-project/clang/include/clang/Basic/Attr.td | 286 +- .../clang/include/clang/Basic/AttrDocs.td | 1102 +++- .../clang/include/clang/Basic/Builtins.def | 58 + .../clang/include/clang/Basic/BuiltinsAArch64.def | 11 + .../clang/include/clang/Basic/BuiltinsAMDGPU.def | 6 + .../clang/include/clang/Basic/BuiltinsBPF.def | 8 +- .../clang/include/clang/Basic/BuiltinsNVPTX.def | 2 +- .../clang/include/clang/Basic/BuiltinsPPC.def | 236 +- .../include/clang/Basic/BuiltinsWebAssembly.def | 136 +- .../clang/include/clang/Basic/BuiltinsX86.def | 51 +- .../clang/include/clang/Basic/BuiltinsX86_64.def | 11 + .../clang/include/clang/Basic/CodeGenOptions.def | 53 +- .../clang/include/clang/Basic/CodeGenOptions.h | 52 +- .../llvm-project/clang/include/clang/Basic/Cuda.h | 8 + .../clang/include/clang/Basic/DebugInfoOptions.h | 6 +- .../clang/include/clang/Basic/DeclNodes.td | 1 + .../clang/include/clang/Basic/Diagnostic.h | 408 +- .../clang/include/clang/Basic/Diagnostic.td | 10 + .../clang/include/clang/Basic/DiagnosticAST.h | 2 +- .../include/clang/Basic/DiagnosticASTKinds.td | 11 +- .../clang/include/clang/Basic/DiagnosticAnalysis.h | 2 +- .../clang/include/clang/Basic/DiagnosticComment.h | 2 +- .../include/clang/Basic/DiagnosticCommonKinds.td | 6 + .../clang/include/clang/Basic/DiagnosticCrossTU.h | 2 +- .../clang/include/clang/Basic/DiagnosticDriver.h | 2 +- .../include/clang/Basic/DiagnosticDriverKinds.td | 39 +- .../clang/include/clang/Basic/DiagnosticFrontend.h | 2 +- .../include/clang/Basic/DiagnosticFrontendKinds.td | 22 +- .../clang/include/clang/Basic/DiagnosticGroups.td | 46 +- .../clang/include/clang/Basic/DiagnosticIDs.h | 12 +- .../clang/include/clang/Basic/DiagnosticLex.h | 2 +- .../include/clang/Basic/DiagnosticLexKinds.td | 9 +- .../include/clang/Basic/DiagnosticOptions.def | 1 + .../clang/include/clang/Basic/DiagnosticOptions.h | 12 + .../clang/include/clang/Basic/DiagnosticParse.h | 2 +- .../include/clang/Basic/DiagnosticParseKinds.td | 86 +- .../include/clang/Basic/DiagnosticRefactoring.h | 2 +- .../clang/include/clang/Basic/DiagnosticSema.h | 2 +- .../include/clang/Basic/DiagnosticSemaKinds.td | 386 +- .../include/clang/Basic/DiagnosticSerialization.h | 2 +- .../clang/Basic/DiagnosticSerializationKinds.td | 19 +- .../clang/include/clang/Basic/DirectoryEntry.h | 298 ++ .../clang/include/clang/Basic/FPOptions.def | 4 +- .../clang/include/clang/Basic/Features.def | 3 + .../clang/include/clang/Basic/FileEntry.h | 406 ++ .../clang/include/clang/Basic/FileManager.h | 158 +- .../llvm-project/clang/include/clang/Basic/LLVM.h | 1 + .../clang/include/clang/Basic/LangOptions.def | 42 +- .../clang/include/clang/Basic/LangOptions.h | 165 +- .../clang/include/clang/Basic/LangStandard.h | 14 +- .../clang/include/clang/Basic/LangStandards.def | 14 + .../clang/include/clang/Basic/Module.h | 55 +- .../clang/include/clang/Basic/OpenCLExtensions.def | 142 +- .../clang/include/clang/Basic/OpenCLOptions.h | 213 +- .../clang/include/clang/Basic/OpenMPKinds.def | 20 +- .../clang/include/clang/Basic/OpenMPKinds.h | 23 +- .../clang/include/clang/Basic/OperatorKinds.h | 5 + .../clang/include/clang/Basic/PPCTypes.def | 38 + .../clang/include/clang/Basic/PartialDiagnostic.h | 277 +- .../clang/include/clang/Basic/ProfileList.h | 58 + .../clang/include/clang/Basic/Sanitizers.def | 4 +- .../clang/include/clang/Basic/SourceLocation.h | 31 + .../clang/include/clang/Basic/SourceManager.h | 1022 ++-- .../clang/include/clang/Basic/Specifiers.h | 34 +- .../clang/include/clang/Basic/TargetCXXABI.h | 25 +- .../clang/include/clang/Basic/TargetID.h | 56 + .../clang/include/clang/Basic/TargetInfo.h | 78 +- .../clang/include/clang/Basic/TargetOptions.h | 8 +- .../clang/include/clang/Basic/TokenKinds.def | 17 +- .../clang/include/clang/Basic/arm_mve.td | 12 +- .../clang/include/clang/Basic/arm_mve_defs.td | 8 +- .../clang/include/clang/Basic/arm_neon.td | 73 +- .../clang/include/clang/CodeGen/BackendUtil.h | 5 - .../clang/include/clang/CodeGen/CGFunctionInfo.h | 60 +- .../clang/include/clang/Driver/Compilation.h | 17 + .../clang/include/clang/Driver/Distro.h | 17 +- .../clang/include/clang/Driver/Driver.h | 4 +- .../llvm-project/clang/include/clang/Driver/Job.h | 29 +- .../clang/include/clang/Driver/Options.h | 8 +- .../clang/include/clang/Driver/Options.td | 3043 ++++++++---- .../clang/include/clang/Driver/SanitizerArgs.h | 5 +- .../clang/include/clang/Driver/ToolChain.h | 32 +- .../clang/include/clang/Driver/XRayArgs.h | 2 + .../clang/include/clang/Edit/EditedSource.h | 2 +- .../clang/include/clang/Format/Format.h | 1081 +++- .../clang/include/clang/Frontend/ASTUnit.h | 18 +- .../include/clang/Frontend/CompilerInstance.h | 68 +- .../include/clang/Frontend/CompilerInvocation.h | 22 +- .../clang/include/clang/Frontend/FrontendAction.h | 2 +- .../clang/include/clang/Frontend/FrontendActions.h | 2 + .../clang/include/clang/Frontend/FrontendOptions.h | 35 +- .../include/clang/Frontend/PrecompiledPreamble.h | 9 +- .../clang/include/clang/Frontend/Utils.h | 8 +- .../SerializablePathCollection.h | 129 + .../clang/include/clang/Lex/HeaderSearch.h | 34 + .../clang/include/clang/Lex/HeaderSearchOptions.h | 9 +- .../llvm-project/clang/include/clang/Lex/Lexer.h | 10 +- .../clang/include/clang/Lex/ModuleMap.h | 13 +- .../clang/include/clang/Lex/Preprocessor.h | 24 + ...cessorExcludedConditionalDirectiveSkipMapping.h | 3 +- .../clang/include/clang/Lex/PreprocessorOptions.h | 26 +- .../clang/include/clang/Lex/VariadicMacroSupport.h | 10 +- .../clang/include/clang/Parse/Parser.h | 70 +- .../include/clang/Sema/CodeCompleteConsumer.h | 3 - .../clang/include/clang/Sema/DeclSpec.h | 581 +-- .../clang/include/clang/Sema/DelayedDiagnostic.h | 19 +- .../clang/include/clang/Sema/Designator.h | 49 +- .../clang/include/clang/Sema/Initialization.h | 61 +- .../clang/Sema/MultiplexExternalSemaSource.h | 2 - .../clang/include/clang/Sema/Overload.h | 6 + .../clang/include/clang/Sema/Ownership.h | 23 +- .../clang/include/clang/Sema/ParsedAttr.h | 44 +- .../clang/include/clang/Sema/ScopeInfo.h | 15 +- .../llvm-project/clang/include/clang/Sema/Sema.h | 839 ++-- .../clang/include/clang/Sema/Template.h | 2 +- .../include/clang/Serialization/ASTBitCodes.h | 10 +- .../clang/include/clang/Serialization/ASTReader.h | 51 +- .../include/clang/Serialization/ASTRecordReader.h | 6 +- .../include/clang/Serialization/ASTRecordWriter.h | 15 +- .../clang/include/clang/Serialization/ASTWriter.h | 10 + .../clang/include/clang/Serialization/ModuleFile.h | 19 +- .../include/clang/Serialization/ModuleManager.h | 6 +- .../clang/StaticAnalyzer/Checkers/Checkers.td | 16 +- .../clang/StaticAnalyzer/Core/AnalyzerOptions.h | 34 +- .../Core/BugReporter/BugReporterVisitors.h | 5 +- .../include/clang/StaticAnalyzer/Core/IssueHash.h | 50 - .../StaticAnalyzer/Core/PathDiagnosticConsumers.h | 7 +- .../Core/PathSensitive/BasicValueFactory.h | 16 +- .../StaticAnalyzer/Core/PathSensitive/CallEvent.h | 56 +- .../Core/PathSensitive/CheckerContext.h | 20 + .../StaticAnalyzer/Core/PathSensitive/ExprEngine.h | 17 + .../Core/PathSensitive/RangedConstraintManager.h | 22 +- .../Core/PathSensitive/SMTConstraintManager.h | 3 +- .../StaticAnalyzer/Core/PathSensitive/SMTConv.h | 18 +- .../Core/PathSensitive/SValBuilder.h | 2 +- .../StaticAnalyzer/Core/PathSensitive/SVals.h | 14 +- .../StaticAnalyzer/Core/PathSensitive/SymExpr.h | 3 + .../Core/PathSensitive/SymbolManager.h | 12 +- .../clang/include/clang/Testing/TestClangConfig.h | 2 + .../include/clang/Tooling/CompilationDatabase.h | 22 +- .../clang/Tooling/Inclusions/HeaderIncludes.h | 2 - .../clang/Tooling/Inclusions/IncludeStyle.h | 21 +- .../clang/Tooling/{Core => Refactoring}/Lookup.h | 6 +- .../Tooling/Refactoring/RefactoringRuleContext.h | 2 +- .../Tooling/Refactoring/Rename/SymbolOccurrences.h | 13 +- .../clang/include/clang/Tooling/Syntax/BuildTree.h | 35 +- .../clang/include/clang/Tooling/Syntax/Nodes.h | 648 +-- .../clang/include/clang/Tooling/Syntax/Nodes.td | 296 ++ .../clang/include/clang/Tooling/Syntax/Syntax.td | 85 + .../clang/include/clang/Tooling/Syntax/Tokens.h | 12 +- .../clang/include/clang/Tooling/Syntax/Tree.h | 216 +- .../clang/include/clang/Tooling/Tooling.h | 11 - .../clang/Tooling/Transformer/MatchConsumer.h | 6 - .../clang/Tooling/Transformer/RangeSelector.h | 29 +- .../clang/Tooling/Transformer/RewriteRule.h | 290 +- .../include/clang/Tooling/Transformer/Stencil.h | 11 +- .../clang/include/clang/module.modulemap | 1 + .../clang/lib/APINotes/APINotesFormat.h | 255 + .../clang/lib/APINotes/APINotesTypes.cpp | 107 + .../clang/lib/APINotes/APINotesYAMLCompiler.cpp | 598 +++ .../llvm-project/clang/lib/ARCMigrate/ARCMT.cpp | 8 +- .../clang/lib/ARCMigrate/FileRemapper.cpp | 15 + .../llvm-project/clang/lib/ARCMigrate/ObjCMT.cpp | 39 +- .../clang/lib/ARCMigrate/TransGCAttrs.cpp | 22 +- .../clang/lib/ARCMigrate/TransProperties.cpp | 17 +- .../llvm-project/clang/lib/ARCMigrate/Transforms.h | 6 +- contrib/llvm-project/clang/lib/AST/APValue.cpp | 538 +- contrib/llvm-project/clang/lib/AST/ASTContext.cpp | 441 +- .../llvm-project/clang/lib/AST/ASTDiagnostic.cpp | 15 +- contrib/llvm-project/clang/lib/AST/ASTDumper.cpp | 8 +- contrib/llvm-project/clang/lib/AST/ASTImporter.cpp | 563 ++- .../clang/lib/AST/ASTImporterLookupTable.cpp | 14 + .../clang/lib/AST/ASTStructuralEquivalence.cpp | 496 +- .../llvm-project/clang/lib/AST/ASTTypeTraits.cpp | 58 +- contrib/llvm-project/clang/lib/AST/AttrImpl.cpp | 53 +- contrib/llvm-project/clang/lib/AST/CXXABI.h | 5 +- .../llvm-project/clang/lib/AST/CXXInheritance.cpp | 150 +- .../llvm-project/clang/lib/AST/CommentLexer.cpp | 9 +- .../clang/lib/AST/ComparisonCategories.cpp | 2 +- .../clang/lib/AST/ComputeDependence.cpp | 138 +- contrib/llvm-project/clang/lib/AST/Decl.cpp | 306 +- contrib/llvm-project/clang/lib/AST/DeclBase.cpp | 58 +- contrib/llvm-project/clang/lib/AST/DeclCXX.cpp | 145 +- contrib/llvm-project/clang/lib/AST/DeclObjC.cpp | 45 +- contrib/llvm-project/clang/lib/AST/DeclOpenMP.cpp | 112 +- contrib/llvm-project/clang/lib/AST/DeclPrinter.cpp | 28 +- .../llvm-project/clang/lib/AST/DeclTemplate.cpp | 77 +- contrib/llvm-project/clang/lib/AST/Expr.cpp | 482 +- contrib/llvm-project/clang/lib/AST/ExprCXX.cpp | 207 +- .../clang/lib/AST/ExprClassification.cpp | 4 +- .../llvm-project/clang/lib/AST/ExprConstant.cpp | 1535 ++++-- .../llvm-project/clang/lib/AST/Interp/Disasm.cpp | 4 +- .../llvm-project/clang/lib/AST/Interp/State.cpp | 2 +- .../llvm-project/clang/lib/AST/ItaniumCXXABI.cpp | 6 + .../llvm-project/clang/lib/AST/ItaniumMangle.cpp | 1388 +++++- .../llvm-project/clang/lib/AST/JSONNodeDumper.cpp | 8 +- contrib/llvm-project/clang/lib/AST/Linkage.h | 2 + contrib/llvm-project/clang/lib/AST/Mangle.cpp | 72 +- .../llvm-project/clang/lib/AST/MicrosoftCXXABI.cpp | 33 +- .../llvm-project/clang/lib/AST/MicrosoftMangle.cpp | 424 +- contrib/llvm-project/clang/lib/AST/NSAPI.cpp | 3 + .../llvm-project/clang/lib/AST/OpenMPClause.cpp | 178 +- .../clang/lib/AST/ParentMapContext.cpp | 117 +- .../clang/lib/AST/PrintfFormatString.cpp | 3 + .../llvm-project/clang/lib/AST/RecordLayout.cpp | 41 +- .../clang/lib/AST/RecordLayoutBuilder.cpp | 380 +- contrib/llvm-project/clang/lib/AST/Stmt.cpp | 110 +- contrib/llvm-project/clang/lib/AST/StmtOpenMP.cpp | 1135 ++--- contrib/llvm-project/clang/lib/AST/StmtPrinter.cpp | 25 +- contrib/llvm-project/clang/lib/AST/StmtProfile.cpp | 9 +- .../llvm-project/clang/lib/AST/TemplateBase.cpp | 35 +- .../llvm-project/clang/lib/AST/TemplateName.cpp | 18 +- .../llvm-project/clang/lib/AST/TextNodeDumper.cpp | 51 +- contrib/llvm-project/clang/lib/AST/Type.cpp | 108 +- contrib/llvm-project/clang/lib/AST/TypeLoc.cpp | 5 +- contrib/llvm-project/clang/lib/AST/TypePrinter.cpp | 314 +- .../clang/lib/ASTMatchers/ASTMatchFinder.cpp | 471 +- .../clang/lib/ASTMatchers/ASTMatchersInternal.cpp | 152 +- .../clang/lib/ASTMatchers/Dynamic/Marshallers.cpp | 11 +- .../clang/lib/ASTMatchers/Dynamic/Marshallers.h | 208 +- .../clang/lib/ASTMatchers/Dynamic/Registry.cpp | 11 +- .../clang/lib/ASTMatchers/Dynamic/VariantValue.cpp | 30 + .../clang/lib/ASTMatchers/GtestMatchers.cpp | 4 +- .../llvm-project/clang/lib/Analysis/BodyFarm.cpp | 40 +- contrib/llvm-project/clang/lib/Analysis/CFG.cpp | 35 +- .../clang/lib/Analysis/CalledOnceCheck.cpp | 1525 ++++++ .../clang/lib/Analysis/ExprMutationAnalyzer.cpp | 300 +- .../Core => Analysis}/IssueHash.cpp | 41 +- .../clang/lib/Analysis/LiveVariables.cpp | 102 +- .../clang/lib/Analysis/PathDiagnostic.cpp | 46 +- .../clang/lib/Analysis/ThreadSafety.cpp | 29 +- .../clang/lib/Analysis/ThreadSafetyCommon.cpp | 4 +- contrib/llvm-project/clang/lib/Basic/Cuda.cpp | 43 +- .../llvm-project/clang/lib/Basic/Diagnostic.cpp | 35 +- .../llvm-project/clang/lib/Basic/DiagnosticIDs.cpp | 109 +- contrib/llvm-project/clang/lib/Basic/FileEntry.cpp | 24 + .../llvm-project/clang/lib/Basic/FileManager.cpp | 181 +- .../clang/lib/Basic/IdentifierTable.cpp | 5 + .../llvm-project/clang/lib/Basic/LangOptions.cpp | 2 +- contrib/llvm-project/clang/lib/Basic/Module.cpp | 21 +- .../llvm-project/clang/lib/Basic/OpenCLOptions.cpp | 106 + .../llvm-project/clang/lib/Basic/OpenMPKinds.cpp | 50 +- .../llvm-project/clang/lib/Basic/ProfileList.cpp | 114 + .../clang/lib/Basic/SourceLocation.cpp | 21 +- .../llvm-project/clang/lib/Basic/SourceManager.cpp | 506 +- contrib/llvm-project/clang/lib/Basic/TargetID.cpp | 169 + .../llvm-project/clang/lib/Basic/TargetInfo.cpp | 1 + contrib/llvm-project/clang/lib/Basic/Targets.cpp | 51 +- .../clang/lib/Basic/Targets/AArch64.cpp | 48 +- .../llvm-project/clang/lib/Basic/Targets/AArch64.h | 6 + .../clang/lib/Basic/Targets/AMDGPU.cpp | 36 +- .../llvm-project/clang/lib/Basic/Targets/AMDGPU.h | 77 +- .../llvm-project/clang/lib/Basic/Targets/ARM.cpp | 2 + .../llvm-project/clang/lib/Basic/Targets/AVR.cpp | 7 + .../clang/lib/Basic/Targets/Hexagon.cpp | 3 +- .../clang/lib/Basic/Targets/MSP430.cpp | 1 + .../llvm-project/clang/lib/Basic/Targets/Mips.cpp | 1 - .../llvm-project/clang/lib/Basic/Targets/NVPTX.cpp | 8 + .../llvm-project/clang/lib/Basic/Targets/NVPTX.h | 22 +- .../clang/lib/Basic/Targets/OSTargets.h | 76 +- .../llvm-project/clang/lib/Basic/Targets/PPC.cpp | 85 +- contrib/llvm-project/clang/lib/Basic/Targets/PPC.h | 34 +- .../llvm-project/clang/lib/Basic/Targets/RISCV.cpp | 131 +- .../llvm-project/clang/lib/Basic/Targets/RISCV.h | 34 +- .../llvm-project/clang/lib/Basic/Targets/SPIR.h | 6 +- .../llvm-project/clang/lib/Basic/Targets/Sparc.cpp | 23 +- .../llvm-project/clang/lib/Basic/Targets/Sparc.h | 11 +- .../llvm-project/clang/lib/Basic/Targets/SystemZ.h | 4 + contrib/llvm-project/clang/lib/Basic/Targets/TCE.h | 2 + contrib/llvm-project/clang/lib/Basic/Targets/VE.h | 16 +- .../llvm-project/clang/lib/Basic/Targets/X86.cpp | 60 +- contrib/llvm-project/clang/lib/Basic/Targets/X86.h | 36 +- contrib/llvm-project/clang/lib/Basic/Version.cpp | 2 - contrib/llvm-project/clang/lib/Basic/Warnings.cpp | 7 +- contrib/llvm-project/clang/lib/CodeGen/ABIInfo.h | 2 +- .../llvm-project/clang/lib/CodeGen/BackendUtil.cpp | 560 +-- .../llvm-project/clang/lib/CodeGen/CGAtomic.cpp | 60 +- .../llvm-project/clang/lib/CodeGen/CGBlocks.cpp | 17 +- .../llvm-project/clang/lib/CodeGen/CGBuiltin.cpp | 2359 ++++++--- .../llvm-project/clang/lib/CodeGen/CGCUDANV.cpp | 117 +- .../llvm-project/clang/lib/CodeGen/CGCUDARuntime.h | 7 +- .../llvm-project/clang/lib/CodeGen/CGCXXABI.cpp | 26 +- contrib/llvm-project/clang/lib/CodeGen/CGCXXABI.h | 13 +- contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp | 344 +- contrib/llvm-project/clang/lib/CodeGen/CGCall.h | 6 +- contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp | 103 +- contrib/llvm-project/clang/lib/CodeGen/CGCleanup.h | 1 + .../llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp | 269 +- .../llvm-project/clang/lib/CodeGen/CGDebugInfo.h | 14 +- contrib/llvm-project/clang/lib/CodeGen/CGDecl.cpp | 158 +- .../llvm-project/clang/lib/CodeGen/CGDeclCXX.cpp | 113 +- .../llvm-project/clang/lib/CodeGen/CGException.cpp | 28 +- contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp | 244 +- .../llvm-project/clang/lib/CodeGen/CGExprAgg.cpp | 131 +- .../llvm-project/clang/lib/CodeGen/CGExprCXX.cpp | 28 +- .../clang/lib/CodeGen/CGExprComplex.cpp | 11 +- .../clang/lib/CodeGen/CGExprConstant.cpp | 32 +- .../clang/lib/CodeGen/CGExprScalar.cpp | 440 +- .../llvm-project/clang/lib/CodeGen/CGLoopInfo.cpp | 93 +- .../llvm-project/clang/lib/CodeGen/CGLoopInfo.h | 15 +- contrib/llvm-project/clang/lib/CodeGen/CGObjC.cpp | 243 +- .../llvm-project/clang/lib/CodeGen/CGObjCGNU.cpp | 54 +- .../llvm-project/clang/lib/CodeGen/CGObjCMac.cpp | 98 +- .../clang/lib/CodeGen/CGObjCRuntime.cpp | 10 + .../llvm-project/clang/lib/CodeGen/CGObjCRuntime.h | 14 + .../clang/lib/CodeGen/CGOpenMPRuntime.cpp | 1877 ++++--- .../clang/lib/CodeGen/CGOpenMPRuntime.h | 69 +- .../clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp | 60 + .../clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.h | 43 + .../clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp | 4864 ++++++++++++++++++ .../clang/lib/CodeGen/CGOpenMPRuntimeGPU.h | 504 ++ .../clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 5233 +------------------ .../clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h | 465 +- .../clang/lib/CodeGen/CGRecordLayout.h | 17 +- .../clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 187 +- contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp | 301 +- .../clang/lib/CodeGen/CGStmtOpenMP.cpp | 205 +- contrib/llvm-project/clang/lib/CodeGen/CGVTT.cpp | 13 +- .../llvm-project/clang/lib/CodeGen/CGVTables.cpp | 96 +- contrib/llvm-project/clang/lib/CodeGen/CGValue.h | 2 +- .../clang/lib/CodeGen/CodeGenAction.cpp | 220 +- .../clang/lib/CodeGen/CodeGenFunction.cpp | 350 +- .../clang/lib/CodeGen/CodeGenFunction.h | 268 +- .../clang/lib/CodeGen/CodeGenModule.cpp | 410 +- .../llvm-project/clang/lib/CodeGen/CodeGenModule.h | 58 +- .../llvm-project/clang/lib/CodeGen/CodeGenPGO.cpp | 55 +- .../llvm-project/clang/lib/CodeGen/CodeGenPGO.h | 2 +- .../clang/lib/CodeGen/CodeGenTypeCache.h | 3 + .../clang/lib/CodeGen/CodeGenTypes.cpp | 22 +- .../clang/lib/CodeGen/CoverageMappingGen.cpp | 350 +- .../clang/lib/CodeGen/CoverageMappingGen.h | 50 +- .../clang/lib/CodeGen/ItaniumCXXABI.cpp | 183 +- .../clang/lib/CodeGen/MicrosoftCXXABI.cpp | 103 +- .../CodeGen/ObjectFilePCHContainerOperations.cpp | 10 +- .../clang/lib/CodeGen/SwiftCallingConv.cpp | 33 +- .../llvm-project/clang/lib/CodeGen/TargetInfo.cpp | 608 +-- .../llvm-project/clang/lib/CodeGen/TargetInfo.h | 8 +- .../clang/lib/CrossTU/CrossTranslationUnit.cpp | 12 +- .../llvm-project/clang/lib/Driver/Compilation.cpp | 2 + contrib/llvm-project/clang/lib/Driver/Distro.cpp | 180 +- contrib/llvm-project/clang/lib/Driver/Driver.cpp | 347 +- contrib/llvm-project/clang/lib/Driver/Job.cpp | 22 +- .../clang/lib/Driver/SanitizerArgs.cpp | 42 +- .../llvm-project/clang/lib/Driver/ToolChain.cpp | 139 +- .../clang/lib/Driver/ToolChains/AIX.cpp | 62 +- .../llvm-project/clang/lib/Driver/ToolChains/AIX.h | 7 + .../clang/lib/Driver/ToolChains/AMDGPU.cpp | 135 +- .../clang/lib/Driver/ToolChains/AMDGPU.h | 14 +- .../clang/lib/Driver/ToolChains/AVR.cpp | 306 +- .../clang/lib/Driver/ToolChains/Ananas.cpp | 10 +- .../clang/lib/Driver/ToolChains/Arch/AArch64.cpp | 20 +- .../clang/lib/Driver/ToolChains/Arch/ARM.cpp | 261 +- .../clang/lib/Driver/ToolChains/Arch/ARM.h | 2 + .../clang/lib/Driver/ToolChains/Arch/Mips.cpp | 2 - .../clang/lib/Driver/ToolChains/Arch/PPC.cpp | 1 - .../clang/lib/Driver/ToolChains/Arch/RISCV.cpp | 40 +- .../clang/lib/Driver/ToolChains/Arch/VE.cpp | 4 - .../clang/lib/Driver/ToolChains/Arch/VE.h | 2 - .../clang/lib/Driver/ToolChains/Arch/X86.cpp | 29 +- .../clang/lib/Driver/ToolChains/Arch/X86.h | 2 +- .../clang/lib/Driver/ToolChains/BareMetal.cpp | 146 +- .../clang/lib/Driver/ToolChains/BareMetal.h | 15 +- .../clang/lib/Driver/ToolChains/Clang.cpp | 646 ++- .../clang/lib/Driver/ToolChains/CloudABI.cpp | 5 +- .../clang/lib/Driver/ToolChains/CommonArgs.cpp | 249 +- .../clang/lib/Driver/ToolChains/CommonArgs.h | 10 +- .../clang/lib/Driver/ToolChains/CrossWindows.cpp | 15 +- .../clang/lib/Driver/ToolChains/CrossWindows.h | 6 +- .../clang/lib/Driver/ToolChains/Cuda.cpp | 102 +- .../clang/lib/Driver/ToolChains/Cuda.h | 6 +- .../clang/lib/Driver/ToolChains/Darwin.cpp | 132 +- .../clang/lib/Driver/ToolChains/Darwin.h | 21 +- .../clang/lib/Driver/ToolChains/DragonFly.cpp | 16 +- .../clang/lib/Driver/ToolChains/Flang.cpp | 44 +- .../clang/lib/Driver/ToolChains/Flang.h | 9 + .../clang/lib/Driver/ToolChains/FreeBSD.cpp | 18 +- .../clang/lib/Driver/ToolChains/Fuchsia.cpp | 29 +- .../clang/lib/Driver/ToolChains/Fuchsia.h | 6 +- .../clang/lib/Driver/ToolChains/Gnu.cpp | 154 +- .../llvm-project/clang/lib/Driver/ToolChains/Gnu.h | 6 +- .../clang/lib/Driver/ToolChains/HIP.cpp | 56 +- .../clang/lib/Driver/ToolChains/Hexagon.cpp | 10 +- .../clang/lib/Driver/ToolChains/InterfaceStubs.cpp | 2 +- .../clang/lib/Driver/ToolChains/Linux.cpp | 27 +- .../clang/lib/Driver/ToolChains/MSP430.cpp | 159 +- .../clang/lib/Driver/ToolChains/MSP430.h | 13 + .../clang/lib/Driver/ToolChains/MSVC.cpp | 71 +- .../clang/lib/Driver/ToolChains/MinGW.cpp | 25 +- .../clang/lib/Driver/ToolChains/Minix.cpp | 10 +- .../clang/lib/Driver/ToolChains/Myriad.cpp | 10 +- .../clang/lib/Driver/ToolChains/NaCl.cpp | 5 +- .../clang/lib/Driver/ToolChains/NetBSD.cpp | 10 +- .../clang/lib/Driver/ToolChains/OpenBSD.cpp | 11 +- .../clang/lib/Driver/ToolChains/OpenBSD.h | 6 +- .../clang/lib/Driver/ToolChains/PS4CPU.cpp | 47 +- .../clang/lib/Driver/ToolChains/PS4CPU.h | 6 +- .../clang/lib/Driver/ToolChains/RISCVToolchain.cpp | 21 +- .../clang/lib/Driver/ToolChains/RISCVToolchain.h | 1 + .../clang/lib/Driver/ToolChains/ROCm.h | 13 +- .../clang/lib/Driver/ToolChains/Solaris.cpp | 4 +- .../clang/lib/Driver/ToolChains/Solaris.h | 5 + .../clang/lib/Driver/ToolChains/VEToolchain.cpp | 31 +- .../clang/lib/Driver/ToolChains/VEToolchain.h | 1 + .../clang/lib/Driver/ToolChains/WebAssembly.cpp | 28 +- .../clang/lib/Driver/ToolChains/XCore.cpp | 4 +- .../clang/lib/Driver/ToolChains/ZOS.cpp | 33 + .../llvm-project/clang/lib/Driver/ToolChains/ZOS.h | 40 + contrib/llvm-project/clang/lib/Driver/Types.cpp | 4 +- contrib/llvm-project/clang/lib/Driver/XRayArgs.cpp | 26 + .../llvm-project/clang/lib/Edit/EditedSource.cpp | 4 +- .../clang/lib/Edit/RewriteObjCFoundationAPI.cpp | 2 + .../clang/lib/Format/BreakableToken.cpp | 92 +- .../llvm-project/clang/lib/Format/BreakableToken.h | 1 - .../clang/lib/Format/ContinuationIndenter.cpp | 59 +- contrib/llvm-project/clang/lib/Format/Format.cpp | 167 +- .../llvm-project/clang/lib/Format/FormatInternal.h | 1 - .../llvm-project/clang/lib/Format/FormatToken.cpp | 5 +- .../llvm-project/clang/lib/Format/FormatToken.h | 279 +- .../clang/lib/Format/FormatTokenLexer.cpp | 23 +- .../clang/lib/Format/MacroExpander.cpp | 224 + contrib/llvm-project/clang/lib/Format/Macros.h | 141 + .../clang/lib/Format/TokenAnnotator.cpp | 243 +- .../clang/lib/Format/UnwrappedLineFormatter.cpp | 78 +- .../clang/lib/Format/UnwrappedLineParser.cpp | 307 +- .../clang/lib/Format/UnwrappedLineParser.h | 17 +- .../clang/lib/Format/WhitespaceManager.cpp | 86 +- .../llvm-project/clang/lib/Frontend/ASTUnit.cpp | 103 +- .../clang/lib/Frontend/ChainedIncludesSource.cpp | 11 +- .../clang/lib/Frontend/CompilerInstance.cpp | 280 +- .../clang/lib/Frontend/CompilerInvocation.cpp | 2176 +++----- .../Frontend/CreateInvocationFromCommandLine.cpp | 4 +- .../clang/lib/Frontend/DependencyFile.cpp | 17 +- .../clang/lib/Frontend/FrontendAction.cpp | 19 +- .../clang/lib/Frontend/FrontendActions.cpp | 58 +- .../clang/lib/Frontend/FrontendOptions.cpp | 2 +- .../clang/lib/Frontend/InitPreprocessor.cpp | 30 +- .../lib/Frontend/ModuleDependencyCollector.cpp | 52 +- .../clang/lib/Frontend/PrecompiledPreamble.cpp | 51 +- .../clang/lib/Frontend/Rewrite/HTMLPrint.cpp | 2 +- .../lib/Frontend/Rewrite/InclusionRewriter.cpp | 78 +- .../clang/lib/Frontend/Rewrite/RewriteMacros.cpp | 2 +- .../lib/Frontend/Rewrite/RewriteModernObjC.cpp | 57 +- .../clang/lib/Frontend/Rewrite/RewriteObjC.cpp | 47 +- .../clang/lib/Frontend/TextDiagnostic.cpp | 5 +- .../clang/lib/Frontend/TextDiagnosticPrinter.cpp | 8 +- .../lib/Frontend/VerifyDiagnosticConsumer.cpp | 12 +- .../clang/lib/Headers/__clang_cuda_builtin_vars.h | 9 + .../clang/lib/Headers/__clang_cuda_cmath.h | 50 +- .../lib/Headers/__clang_cuda_complex_builtins.h | 30 +- .../clang/lib/Headers/__clang_cuda_math.h | 9 +- .../Headers/__clang_cuda_math_forward_declares.h | 3 + .../lib/Headers/__clang_cuda_runtime_wrapper.h | 28 +- .../clang/lib/Headers/__clang_hip_cmath.h | 664 +++ .../lib/Headers/__clang_hip_libdevice_declares.h | 26 +- .../clang/lib/Headers/__clang_hip_math.h | 1148 +++-- .../lib/Headers/__clang_hip_runtime_wrapper.h | 5 + contrib/llvm-project/clang/lib/Headers/altivec.h | 1037 +++- contrib/llvm-project/clang/lib/Headers/amxintrin.h | 97 +- contrib/llvm-project/clang/lib/Headers/arm_acle.h | 26 + .../llvm-project/clang/lib/Headers/avx512fintrin.h | 165 +- .../clang/lib/Headers/avx512vlvnniintrin.h | 205 +- contrib/llvm-project/clang/lib/Headers/avxintrin.h | 6 +- .../llvm-project/clang/lib/Headers/avxvnniintrin.h | 225 + contrib/llvm-project/clang/lib/Headers/cpuid.h | 8 + .../clang/lib/Headers/cuda_wrappers/algorithm | 2 +- .../clang/lib/Headers/cuda_wrappers/new | 2 +- contrib/llvm-project/clang/lib/Headers/emmintrin.h | 2 +- .../llvm-project/clang/lib/Headers/gfniintrin.h | 181 +- .../llvm-project/clang/lib/Headers/hresetintrin.h | 49 + .../llvm-project/clang/lib/Headers/ia32intrin.h | 97 +- contrib/llvm-project/clang/lib/Headers/immintrin.h | 12 + contrib/llvm-project/clang/lib/Headers/intrin.h | 24 +- .../clang/lib/Headers/keylockerintrin.h | 506 ++ contrib/llvm-project/clang/lib/Headers/mm_malloc.h | 6 + .../llvm-project/clang/lib/Headers/opencl-c-base.h | 18 + contrib/llvm-project/clang/lib/Headers/opencl-c.h | 2 + .../clang/lib/Headers/openmp_wrappers/cmath | 5 +- .../clang/lib/Headers/openmp_wrappers/complex | 25 + .../lib/Headers/openmp_wrappers/complex_cmath.h | 388 ++ .../llvm-project/clang/lib/Headers/popcntintrin.h | 11 +- .../clang/lib/Headers/ppc_wrappers/smmintrin.h | 24 + .../clang/lib/Headers/ppc_wrappers/xmmintrin.h | 9 +- .../llvm-project/clang/lib/Headers/uintrintrin.h | 150 + .../llvm-project/clang/lib/Headers/wasm_simd128.h | 112 +- .../llvm-project/clang/lib/Headers/x86gprintrin.h | 23 + .../clang/lib/Index/FileIndexRecord.cpp | 2 +- contrib/llvm-project/clang/lib/Index/IndexBody.cpp | 4 +- .../clang/lib/Index/IndexTypeSourceInfo.cpp | 21 + .../clang/lib/Index/IndexingAction.cpp | 11 +- .../clang/lib/Index/SimpleFormatContext.h | 72 - .../llvm-project/clang/lib/Index/USRGeneration.cpp | 3 + .../SerializablePathCollection.cpp | 91 + .../llvm-project/clang/lib/Lex/HeaderSearch.cpp | 58 +- contrib/llvm-project/clang/lib/Lex/Lexer.cpp | 49 +- .../llvm-project/clang/lib/Lex/LiteralSupport.cpp | 4 +- contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp | 76 +- .../llvm-project/clang/lib/Lex/PPDirectives.cpp | 12 +- .../llvm-project/clang/lib/Lex/PPLexerChange.cpp | 27 +- .../clang/lib/Lex/PPMacroExpansion.cpp | 31 +- contrib/llvm-project/clang/lib/Lex/Pragma.cpp | 2 +- .../llvm-project/clang/lib/Lex/Preprocessor.cpp | 24 +- .../llvm-project/clang/lib/Lex/ScratchBuffer.cpp | 8 +- .../clang/lib/Parse/ParseCXXInlineMethods.cpp | 23 +- contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp | 303 +- .../llvm-project/clang/lib/Parse/ParseDeclCXX.cpp | 107 +- contrib/llvm-project/clang/lib/Parse/ParseExpr.cpp | 96 +- .../llvm-project/clang/lib/Parse/ParseExprCXX.cpp | 71 +- contrib/llvm-project/clang/lib/Parse/ParseObjc.cpp | 37 +- .../llvm-project/clang/lib/Parse/ParseOpenMP.cpp | 456 +- .../llvm-project/clang/lib/Parse/ParsePragma.cpp | 311 +- contrib/llvm-project/clang/lib/Parse/ParseStmt.cpp | 57 +- .../llvm-project/clang/lib/Parse/ParseStmtAsm.cpp | 2 +- .../llvm-project/clang/lib/Parse/ParseTemplate.cpp | 21 +- .../clang/lib/Parse/ParseTentative.cpp | 13 +- contrib/llvm-project/clang/lib/Parse/Parser.cpp | 66 +- .../llvm-project/clang/lib/Rewrite/HTMLRewrite.cpp | 22 +- .../llvm-project/clang/lib/Rewrite/Rewriter.cpp | 8 +- .../clang/lib/Rewrite/TokenRewriter.cpp | 2 +- .../clang/lib/Sema/AnalysisBasedWarnings.cpp | 102 +- .../clang/lib/Sema/CodeCompleteConsumer.cpp | 6 +- contrib/llvm-project/clang/lib/Sema/DeclSpec.cpp | 167 +- .../clang/lib/Sema/JumpDiagnostics.cpp | 17 + .../clang/lib/Sema/MultiplexExternalSemaSource.cpp | 7 - contrib/llvm-project/clang/lib/Sema/ScopeInfo.cpp | 1 + contrib/llvm-project/clang/lib/Sema/Sema.cpp | 190 +- contrib/llvm-project/clang/lib/Sema/SemaAccess.cpp | 3 +- contrib/llvm-project/clang/lib/Sema/SemaAttr.cpp | 345 +- contrib/llvm-project/clang/lib/Sema/SemaCUDA.cpp | 103 +- contrib/llvm-project/clang/lib/Sema/SemaCast.cpp | 81 +- .../llvm-project/clang/lib/Sema/SemaChecking.cpp | 1022 +++- .../clang/lib/Sema/SemaCodeComplete.cpp | 109 +- .../llvm-project/clang/lib/Sema/SemaConcept.cpp | 23 +- .../llvm-project/clang/lib/Sema/SemaCoroutine.cpp | 100 +- contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp | 1142 +++-- .../llvm-project/clang/lib/Sema/SemaDeclAttr.cpp | 1054 +++- .../llvm-project/clang/lib/Sema/SemaDeclCXX.cpp | 225 +- .../llvm-project/clang/lib/Sema/SemaDeclObjC.cpp | 76 +- .../clang/lib/Sema/SemaExceptionSpec.cpp | 4 +- contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp | 1004 ++-- .../llvm-project/clang/lib/Sema/SemaExprCXX.cpp | 176 +- .../llvm-project/clang/lib/Sema/SemaExprMember.cpp | 119 +- .../llvm-project/clang/lib/Sema/SemaExprObjC.cpp | 88 +- contrib/llvm-project/clang/lib/Sema/SemaInit.cpp | 356 +- contrib/llvm-project/clang/lib/Sema/SemaLambda.cpp | 152 +- contrib/llvm-project/clang/lib/Sema/SemaLookup.cpp | 371 +- contrib/llvm-project/clang/lib/Sema/SemaModule.cpp | 2 +- .../clang/lib/Sema/SemaObjCProperty.cpp | 14 +- contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp | 1056 ++-- .../llvm-project/clang/lib/Sema/SemaOverload.cpp | 978 ++-- contrib/llvm-project/clang/lib/Sema/SemaSYCL.cpp | 20 +- contrib/llvm-project/clang/lib/Sema/SemaStmt.cpp | 217 +- .../llvm-project/clang/lib/Sema/SemaStmtAsm.cpp | 6 +- .../llvm-project/clang/lib/Sema/SemaStmtAttr.cpp | 78 +- .../llvm-project/clang/lib/Sema/SemaTemplate.cpp | 636 ++- .../clang/lib/Sema/SemaTemplateDeduction.cpp | 372 +- .../clang/lib/Sema/SemaTemplateInstantiate.cpp | 187 +- .../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 403 +- .../clang/lib/Sema/SemaTemplateVariadic.cpp | 60 +- contrib/llvm-project/clang/lib/Sema/SemaType.cpp | 1104 +++-- .../llvm-project/clang/lib/Sema/TreeTransform.h | 212 +- .../clang/lib/Serialization/ASTCommon.cpp | 6 + .../clang/lib/Serialization/ASTReader.cpp | 422 +- .../clang/lib/Serialization/ASTReaderDecl.cpp | 157 +- .../clang/lib/Serialization/ASTReaderStmt.cpp | 365 +- .../clang/lib/Serialization/ASTWriter.cpp | 178 +- .../clang/lib/Serialization/ASTWriterDecl.cpp | 59 +- .../clang/lib/Serialization/ASTWriterStmt.cpp | 158 +- .../clang/lib/Serialization/GlobalModuleIndex.cpp | 7 +- .../clang/lib/Serialization/ModuleManager.cpp | 61 +- .../Checkers/BasicObjCFoundationChecks.cpp | 3 +- .../StaticAnalyzer/Checkers/CastValueChecker.cpp | 4 +- .../StaticAnalyzer/Checkers/CheckObjCDealloc.cpp | 2 +- .../lib/StaticAnalyzer/Checkers/DebugCheckers.cpp | 10 +- .../StaticAnalyzer/Checkers/DereferenceChecker.cpp | 69 +- .../Checkers/ExprInspectionChecker.cpp | 4 +- .../Checkers/FuchsiaHandleChecker.cpp | 312 +- .../Checkers/GenericTaintChecker.cpp | 5 +- .../StaticAnalyzer/Checkers/IteratorModeling.cpp | 103 +- .../Checkers/IteratorRangeChecker.cpp | 2 + .../Checkers/LocalizationChecker.cpp | 7 +- .../Checkers/MacOSKeychainAPIChecker.cpp | 2 +- .../lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 15 +- .../lib/StaticAnalyzer/Checkers/MoveChecker.cpp | 4 +- .../StaticAnalyzer/Checkers/OSObjectCStyleCast.cpp | 21 +- .../Checkers/ObjCMissingSuperCallChecker.cpp | 7 +- .../lib/StaticAnalyzer/Checkers/PaddingChecker.cpp | 5 +- .../StaticAnalyzer/Checkers/PthreadLockChecker.cpp | 271 +- .../RetainCountChecker/RetainCountDiagnostics.cpp | 4 +- .../Checkers/ReturnPointerRangeChecker.cpp | 7 +- .../clang/lib/StaticAnalyzer/Checkers/SmartPtr.h | 2 + .../StaticAnalyzer/Checkers/SmartPtrChecker.cpp | 48 +- .../StaticAnalyzer/Checkers/SmartPtrModeling.cpp | 514 +- .../Checkers/StdLibraryFunctionsChecker.cpp | 2058 +++++--- .../lib/StaticAnalyzer/Checkers/StreamChecker.cpp | 70 +- .../clang/lib/StaticAnalyzer/Checkers/Taint.cpp | 2 +- .../StaticAnalyzer/Checkers/UndefBranchChecker.cpp | 7 +- .../StaticAnalyzer/Checkers/VirtualCallChecker.cpp | 4 +- .../StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp | 4 +- .../Checkers/WebKit/NoUncountedMembersChecker.cpp | 7 +- .../Checkers/WebKit/PtrTypesSemantics.cpp | 58 +- .../Checkers/WebKit/PtrTypesSemantics.h | 23 +- .../WebKit/RefCntblBaseVirtualDtorChecker.cpp | 12 +- .../Checkers/WebKit/UncountedCallArgsChecker.cpp | 3 +- .../WebKit/UncountedLambdaCapturesChecker.cpp | 107 + .../Checkers/WebKit/UncountedLocalVarsChecker.cpp | 251 + .../lib/StaticAnalyzer/Core/AnalyzerOptions.cpp | 2 +- .../lib/StaticAnalyzer/Core/BasicValueFactory.cpp | 25 +- .../clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 13 +- .../StaticAnalyzer/Core/BugReporterVisitors.cpp | 7 +- .../clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 2 +- .../lib/StaticAnalyzer/Core/CheckerContext.cpp | 2 +- .../clang/lib/StaticAnalyzer/Core/Environment.cpp | 21 +- .../clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 153 +- .../clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 7 +- .../lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 26 +- .../Core/ExprEngineCallAndReturn.cpp | 14 +- .../lib/StaticAnalyzer/Core/ExprEngineObjC.cpp | 13 +- .../lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | 47 +- .../lib/StaticAnalyzer/Core/PlistDiagnostics.cpp | 400 +- .../clang/lib/StaticAnalyzer/Core/ProgramState.cpp | 3 - .../StaticAnalyzer/Core/RangeConstraintManager.cpp | 1114 ++++- .../Core/RangedConstraintManager.cpp | 41 +- .../clang/lib/StaticAnalyzer/Core/SValBuilder.cpp | 23 +- .../clang/lib/StaticAnalyzer/Core/SVals.cpp | 48 +- .../lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | 16 +- .../Core/SimpleConstraintManager.cpp | 4 +- .../lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp | 19 +- .../lib/StaticAnalyzer/Core/SymbolManager.cpp | 28 +- .../lib/StaticAnalyzer/Core/TextDiagnostics.cpp | 49 +- .../StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 4 +- .../clang/lib/Tooling/AllTUsExecution.cpp | 2 +- .../clang/lib/Tooling/ArgumentsAdjusters.cpp | 34 +- .../clang/lib/Tooling/CompilationDatabase.cpp | 58 +- .../clang/lib/Tooling/Core/Replacement.cpp | 2 +- .../DependencyScanningFilesystem.cpp | 20 +- .../DependencyScanningWorker.cpp | 24 +- .../DependencyScanning/ModuleDepCollector.cpp | 13 +- .../clang/lib/Tooling/FileMatchTrie.cpp | 14 +- .../lib/Tooling/Inclusions/HeaderIncludes.cpp | 52 +- .../clang/lib/Tooling/Inclusions/IncludeStyle.cpp | 1 + .../clang/lib/Tooling/JSONCompilationDatabase.cpp | 48 +- .../clang/lib/Tooling/Refactoring/ASTSelection.cpp | 2 +- .../lib/Tooling/{Core => Refactoring}/Lookup.cpp | 2 +- .../lib/Tooling/Refactoring/RefactoringActions.cpp | 4 +- .../Refactoring/Rename/SymbolOccurrences.cpp | 5 +- .../lib/Tooling/Refactoring/Rename/USRFinder.cpp | 4 +- .../Refactoring/Rename/USRFindingAction.cpp | 52 +- .../Tooling/Refactoring/Rename/USRLocFinder.cpp | 2 +- .../clang/lib/Tooling/Syntax/BuildTree.cpp | 819 ++- .../lib/Tooling/Syntax/ComputeReplacements.cpp | 15 +- .../clang/lib/Tooling/Syntax/Mutations.cpp | 36 +- .../clang/lib/Tooling/Syntax/Nodes.cpp | 604 +-- .../clang/lib/Tooling/Syntax/Synthesis.cpp | 224 +- .../clang/lib/Tooling/Syntax/Tokens.cpp | 89 +- .../llvm-project/clang/lib/Tooling/Syntax/Tree.cpp | 412 +- contrib/llvm-project/clang/lib/Tooling/Tooling.cpp | 71 +- .../clang/lib/Tooling/Transformer/Parsing.cpp | 8 +- .../lib/Tooling/Transformer/RangeSelector.cpp | 26 +- .../clang/lib/Tooling/Transformer/RewriteRule.cpp | 262 +- .../clang/lib/Tooling/Transformer/Stencil.cpp | 77 +- .../clang/lib/Tooling/Transformer/Transformer.cpp | 42 +- .../clang/tools/clang-format/ClangFormat.cpp | 32 +- .../llvm-project/clang/tools/driver/cc1_main.cpp | 10 +- .../llvm-project/clang/tools/driver/cc1as_main.cpp | 29 +- contrib/llvm-project/clang/tools/driver/driver.cpp | 7 + .../utils/TableGen/ClangASTPropertiesEmitter.cpp | 12 +- .../clang/utils/TableGen/ClangAttrEmitter.cpp | 56 +- .../utils/TableGen/ClangDiagnosticsEmitter.cpp | 5 + .../clang/utils/TableGen/ClangOptionDocEmitter.cpp | 2 - .../clang/utils/TableGen/ClangSyntaxEmitter.cpp | 236 + .../clang/utils/TableGen/NeonEmitter.cpp | 25 +- .../clang/utils/TableGen/SveEmitter.cpp | 20 +- .../llvm-project/clang/utils/TableGen/TableGen.cpp | 12 + .../clang/utils/TableGen/TableGenBackends.h | 8 +- contrib/llvm-project/compiler-rt/.clang-tidy | 2 + .../include/fuzzer/FuzzedDataProvider.h | 9 + .../compiler-rt/include/profile/InstrProfData.inc | 139 +- .../compiler-rt/include/sanitizer/asan_interface.h | 16 +- .../include/sanitizer/common_interface_defs.h | 9 +- .../include/sanitizer/dfsan_interface.h | 8 +- .../include/sanitizer/hwasan_interface.h | 3 + .../include/sanitizer/memprof_interface.h | 65 + .../compiler-rt/include/sanitizer/msan_interface.h | 3 + .../include/sanitizer/netbsd_syscall_hooks.h | 213 +- .../compiler-rt/lib/asan/asan_allocator.cpp | 479 +- .../compiler-rt/lib/asan/asan_allocator.h | 11 +- .../compiler-rt/lib/asan/asan_flags.cpp | 10 +- .../compiler-rt/lib/asan/asan_fuchsia.cpp | 35 +- .../compiler-rt/lib/asan/asan_interceptors.cpp | 41 +- .../compiler-rt/lib/asan/asan_interceptors.h | 22 +- .../compiler-rt/lib/asan/asan_interceptors_vfork.S | 3 +- .../compiler-rt/lib/asan/asan_interface_internal.h | 4 +- .../compiler-rt/lib/asan/asan_internal.h | 2 - .../compiler-rt/lib/asan/asan_linux.cpp | 45 +- .../llvm-project/compiler-rt/lib/asan/asan_mac.cpp | 48 +- .../compiler-rt/lib/asan/asan_malloc_linux.cpp | 10 +- .../compiler-rt/lib/asan/asan_malloc_local.h | 2 +- .../compiler-rt/lib/asan/asan_mapping.h | 21 + .../compiler-rt/lib/asan/asan_poisoning.cpp | 6 - .../compiler-rt/lib/asan/asan_premap_shadow.cpp | 18 +- .../compiler-rt/lib/asan/asan_report.cpp | 5 +- .../compiler-rt/lib/asan/asan_rtems.cpp | 6 + .../llvm-project/compiler-rt/lib/asan/asan_rtl.cpp | 5 +- .../compiler-rt/lib/asan/asan_shadow_setup.cpp | 45 +- .../llvm-project/compiler-rt/lib/asan/asan_stack.h | 5 - .../compiler-rt/lib/asan/asan_thread.cpp | 27 +- .../compiler-rt/lib/asan/asan_thread.h | 7 +- .../llvm-project/compiler-rt/lib/asan/asan_win.cpp | 19 +- .../compiler-rt/lib/builtins/README.txt | 2 + .../compiler-rt/lib/builtins/aarch64/lse.S | 236 + .../compiler-rt/lib/builtins/assembly.h | 93 +- .../llvm-project/compiler-rt/lib/builtins/atomic.c | 93 +- .../compiler-rt/lib/builtins/clear_cache.c | 10 +- .../compiler-rt/lib/builtins/cpu_model.c | 63 +- .../llvm-project/compiler-rt/lib/builtins/divdf3.c | 189 +- .../llvm-project/compiler-rt/lib/builtins/divdi3.c | 15 +- .../compiler-rt/lib/builtins/divmoddi4.c | 13 +- .../compiler-rt/lib/builtins/divmodsi4.c | 13 +- .../compiler-rt/lib/builtins/divmodti4.c | 32 + .../llvm-project/compiler-rt/lib/builtins/divsf3.c | 174 +- .../llvm-project/compiler-rt/lib/builtins/divsi3.c | 25 +- .../llvm-project/compiler-rt/lib/builtins/divtf3.c | 203 +- .../llvm-project/compiler-rt/lib/builtins/divti3.c | 15 +- .../llvm-project/compiler-rt/lib/builtins/emutls.c | 7 +- .../compiler-rt/lib/builtins/extendhfsf2.c | 6 +- .../compiler-rt/lib/builtins/extendhftf2.c | 23 + .../compiler-rt/lib/builtins/fp_div_impl.inc | 419 ++ .../compiler-rt/lib/builtins/fp_extend.h | 4 + .../llvm-project/compiler-rt/lib/builtins/fp_lib.h | 7 + .../compiler-rt/lib/builtins/fp_trunc.h | 4 + .../compiler-rt/lib/builtins/int_div_impl.inc | 25 + .../compiler-rt/lib/builtins/int_mulo_impl.inc | 49 + .../compiler-rt/lib/builtins/int_mulv_impl.inc | 47 + .../compiler-rt/lib/builtins/int_util.h | 16 + .../llvm-project/compiler-rt/lib/builtins/moddi3.c | 16 +- .../llvm-project/compiler-rt/lib/builtins/modti3.c | 16 +- .../compiler-rt/lib/builtins/mulodi4.c | 33 +- .../compiler-rt/lib/builtins/mulosi4.c | 33 +- .../compiler-rt/lib/builtins/muloti4.c | 33 +- .../compiler-rt/lib/builtins/mulvdi3.c | 33 +- .../compiler-rt/lib/builtins/mulvsi3.c | 33 +- .../compiler-rt/lib/builtins/mulvti3.c | 33 +- .../compiler-rt/lib/builtins/os_version_check.c | 108 +- .../compiler-rt/lib/builtins/paritydi2.c | 6 +- .../compiler-rt/lib/builtins/parityti2.c | 8 +- .../lib/builtins/riscv/int_mul_impl.inc | 6 +- .../compiler-rt/lib/builtins/truncdfhf2.c | 4 +- .../compiler-rt/lib/builtins/truncsfhf2.c | 6 +- .../compiler-rt/lib/builtins/trunctfhf2.c | 23 + contrib/llvm-project/compiler-rt/lib/cfi/cfi.cpp | 2 +- .../llvm-project/compiler-rt/lib/crt/crtbegin.c | 8 + .../llvm-project/compiler-rt/lib/dfsan/dfsan.cpp | 100 +- .../compiler-rt/lib/dfsan/dfsan_custom.cpp | 201 +- .../compiler-rt/lib/dfsan/dfsan_flags.inc | 4 - .../compiler-rt/lib/dfsan/dfsan_interceptors.cpp | 41 +- .../compiler-rt/lib/dfsan/done_abilist.txt | 85 + .../compiler-rt/lib/fuzzer/FuzzerCorpus.h | 62 +- .../compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.cpp | 2 +- .../compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 91 +- .../lib/fuzzer/FuzzerExtFunctionsWeak.cpp | 2 +- .../compiler-rt/lib/fuzzer/FuzzerExtraCounters.cpp | 2 +- .../compiler-rt/lib/fuzzer/FuzzerFlags.def | 37 +- .../compiler-rt/lib/fuzzer/FuzzerFork.cpp | 14 +- .../compiler-rt/lib/fuzzer/FuzzerIO.cpp | 45 + .../llvm-project/compiler-rt/lib/fuzzer/FuzzerIO.h | 6 + .../compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp | 8 +- .../compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp | 14 +- .../compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp | 253 + .../compiler-rt/lib/fuzzer/FuzzerInternal.h | 4 +- .../compiler-rt/lib/fuzzer/FuzzerLoop.cpp | 69 +- .../compiler-rt/lib/fuzzer/FuzzerMutate.cpp | 40 +- *** 884946 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 19:21:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 399CC66353F; Sat, 31 Jul 2021 19:21:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcYzS165Rz4tDk; Sat, 31 Jul 2021 19:21:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id D27C9982A; Sat, 31 Jul 2021 19:21:39 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 29483157D7; Sat, 31 Jul 2021 21:21:38 +0200 (CEST) From: "Kristof Provost" To: "Warner Losh" Cc: "Warner Losh" , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Date: Sat, 31 Jul 2021 21:21:37 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 19:21:40 -0000 On 31 Jul 2021, at 20:08, Warner Losh wrote: > On Sat, Jul 31, 2021 at 11:28 AM Warner Losh wrote: > >> >> >> On Sat, Jul 31, 2021 at 9:37 AM Kristof Provost = >> wrote: >> >>> On 31 Jul 2021, at 16:20, Warner Losh wrote: >>>> On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: >>>> >>>>> >>>>> >>>>> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost >>>>> wrote: >>>>> >>>>>> Hi Warner, >>>>>> >>>>>> On 10 Jul 2021, at 19:12, Warner Losh wrote: >>>>>> >>>>>> The branch stable/12 has been updated by imp: >>>>>> >>>>>> URL: >>>>>> >>> https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e= 38efe5b83b0ec >>>>>> >>>>>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec >>>>>> Author: Warner Losh >>>>>> AuthorDate: 2021-07-07 23:30:35 +0000 >>>>>> Commit: Warner Losh >>>>>> CommitDate: 2021-07-10 17:11:15 +0000 >>>>>> >>>>>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number = >>>>>> of >>>>>> bugs >>>>>> >>>>>> Import the latest bsd-features branch of the one-true-awk = >>>>>> upstream: >>>>>> >>>>>> o Move to bison for $YACC >>>>>> o Set close-on-exec flag for file and pipe redirects that aren't >>>>>> std* >>>>>> o lots of little fixes to modernize ocde base >>>>>> o free sval member before setting it >>>>>> o fix a bug where a{0,3} could match aaaa >>>>>> o pull in systime and strftime from NetBSD awk >>>>>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with >>>>>> them) >>>>>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly = >>>>>> a >>>>>> nop) >>>>>> >>>>>> Also revert a few of the trivial FreeBSD changes that were done >>>>>> slightly >>>>>> differently in the upstreaming process. Also, our PR database may >>>>>> have >>>>>> been mined by upstream for these fixes, and Mikolaj Golub may >>>>>> deserve >>>>>> credit for some of the fixes in this update. >>>>>> >>>>>> Suggested by: Mikolaj Golub >>>>>> PR: 143363,143365,143368,143369,143373,143375,214782 >>>>>> Sponsored by: Netflix >>>>>> >>>>>> (cherry picked from commit = >>>>>> f39dd6a9784467f0db5886012b3f4b13899be6b8) >>>>>> >>>>>> I *think* this is the relevant commit, but I=E2=80=99m not 100% su= re. >>>>>> >>>>>> Anyway, I=E2=80=99ve recently started seeing issues building pfSen= se = >>>>>> for >>>>>> aarch64. >>>>>> I=E2=80=99ve finally narrowed it down, and replicated the problem = on = >>>>>> base >>>>>> FreeBSD >>>>>> (stable/12, but I assume other branches are affected too). >>>>>> >>>>>> It fails to build proctab.c. This file is generated by maketab, a >>>>>> tool >>>>>> built as part of the build process. In my case this tool is built >>>>>> for >>>>>> aarch64, which makes executing it on amd64 less successful than >>>>>> we=E2=80=99d like. >>>>>> >>>>>> This only happens when building with META_MODE though. I do not >>>>>> understand the build system sufficiently to debug why. Hopefully >>>>>> you=E2=80=99ll >>>>>> have a better idea. >>>>>> >>>>> Generally I do, but this one is a bit weird. Also, the amount of >>>>> context >>>>> you've included omits the actual error :( Though I'm guessing it's >>>>> wrong >>>>> arch for the build tool... >>>>> >>>>> I rarely use meta mode, and understand it not at all, but awk = >>>>> follows >>>>> the >>>>> same patterns as /bin/sh and /bin/csh does >>>>> >>>> >>>> [[ stupid gmail ]] >>>> >>>> I've just pushed removal of proctab.c. That may fix this, though = >>>> I'm >>>> not >>>> hopeful. >>> Unfortunately that didn=E2=80=99t help. >>> >>>> I've rarely used metamode, and not for quite some time, but this >>>> an extra file that would confuse things so that maketab might not = >>>> be >>>> built >>>> during build-tools and instead is built later. Please give that a = >>>> try, >>>> and >>>> I'll start a meta build, but that takes a while, not least because = >>>> I >>>> have >>>> to re-leran how to do that :) >>>> >>> I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.m= eta = >>> files >>> on https://people.freebsd.org/~kp/meta/ >>> >>> I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s= in the = >>> meta >>> file doesn=E2=80=99t seem to match the build command seen in the = >>> metamode.log >>> file. >>> >> >> Yea. It's getting confused and rebuilding it bogusly. For the mknodes = >> in >> sh, we don't see the naked cc command, but we do for maketab. >> >> I'm testing a fix right now, though, and we'll see if that fixes = >> things. I >> think I know what's going on. >> > > I just pushed 1dfb6e5d1f462af4f4df818ee93766f09f3aa787, which fixed = > the > issues I was seeing. Does that do the trick for you as well? > Unfortunately that doesn=E2=80=99t appear to have worked. I=E2=80=99ve uploaded the log of this build run (after I=E2=80=99d delete= d = everything in /usr/obj) here: = https://people.freebsd.org/~kp/meta/metamode_1dfb6e5d1f462af.log Best regards, Kristof From owner-dev-commits-src-branches@freebsd.org Sat Jul 31 19:31:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65C60662FFD for ; Sat, 31 Jul 2021 19:31:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GcZCF1WFLz4tyM for ; Sat, 31 Jul 2021 19:31:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82e.google.com with SMTP id h27so8941260qtu.9 for ; Sat, 31 Jul 2021 12:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xEP1g0PublskGl+FMV1aIVA4/AT0BW0l/VYSZV+SkUk=; b=Tj/hUru4ayg+8FsbjrkmG2mfn4uDQiWj5UMJxVkL4CXRidXzQyHccBTy4xiWjzG6yT zvvB3XaV937nYRaBbNwmAhUDVkUz5eDLWDNIwBxXQ05huEp9o2LmCPNxYuOtQXCadeFd r+aKuUdp1I72evkNpfyBkS8BZTOfLGkGSZxgqBW9+9v95nzWDTenVhtNNfFFQt+pkQRF yU5i8UHGySrFi/wGHJ9O+vpj90v+bEXOKk/D/7u28RLXf7srwPdLr/EsOARP9mfBEsPn 9rI3YlPPdJPS91RLpAukuFZltRamM3P2Gvu355pbSd8yOvFB2x/seiz2cyJvfLSF2NO0 YClg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xEP1g0PublskGl+FMV1aIVA4/AT0BW0l/VYSZV+SkUk=; b=mni2EVqEtfQ7fvrYzWyDO+81T80fOwN20p/j4E00wP/5acTRXEy7OBX/Bx9bN7nmYN yWOf+WeePEpZBcvPzan5GEgV+EXiOkO1N7hUPkLvevrOF0/7GJUH4nbKrJXXVdHY7ekw BX8Dl3Yy8ldyL6flVE7a0VMnWWKR1hPUzepdy9JD6Hp9A++FrxI3+DLwSLpKDdRQAMYO +ziCxOL9Yq6sW568FccIXTHzu6gk2CWGRo/DJE8pc0+hi1AnTmPIg5fNjVM5BxjeXBNr qo8Bb8+9xBm75N2d4Or9Kn5FA6mTeHVFnO2S7eQDkyX6Cbrzfpq8Qt56oj5QbbsBVTm4 5TFA== X-Gm-Message-State: AOAM531+dIvmLAqYKmn7YM67eFzKLiECZgOy8rMo1h8K7bqiNYkcbCdB nCXKAgRkkM7DyQKcvmsizr3XR2/A+FLf7LgWLMd28w== X-Google-Smtp-Source: ABdhPJzNNxpZis6KqSPGbsqbXs/3A8IxOplwTJsK+obXxQNdaCaUd5WCrKBoxdGFKVjYAEC3kc4D1713AEED+xcyRwo= X-Received: by 2002:ac8:734a:: with SMTP id q10mr7719576qtp.73.1627759912705; Sat, 31 Jul 2021 12:31:52 -0700 (PDT) MIME-Version: 1.0 References: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> <4AD3AB8C-A960-43BE-A89B-5D9C4CD077DD@FreeBSD.org> <8300183E-DD11-4C2F-AE5A-0B6FDE6E9E8F@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Sat, 31 Jul 2021 13:31:41 -0600 Message-ID: Subject: Re: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs To: Kristof Provost Cc: Warner Losh , src-committers , "" , dev-commits-src-branches@freebsd.org Content-Type: multipart/mixed; boundary="00000000000060b43f05c87063d3" X-Rspamd-Queue-Id: 4GcZCF1WFLz4tyM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 19:31:53 -0000 --00000000000060b43f05c87063d3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hmmm, maketab keeps getting rebuilt, which is the issue. It looks like it has extra depends that don't trip up -current but do trip up stable/12. I've enclosed a patch that seems to work for me as well. It looks like the earlier patch moved the race for me, but maketab was still built twice, like your logs show (the 2nd time was after proctab.c was built in my logs, a detail I didn't notice until now). Please try the attached patch. Warner On Sat, Jul 31, 2021 at 1:21 PM Kristof Provost wrote: > On 31 Jul 2021, at 20:08, Warner Losh wrote: > > On Sat, Jul 31, 2021 at 11:28 AM Warner Losh wrote: > > > >> > >> > >> On Sat, Jul 31, 2021 at 9:37 AM Kristof Provost > >> wrote: > >> > >>> On 31 Jul 2021, at 16:20, Warner Losh wrote: > >>>> On Sat, Jul 31, 2021 at 8:07 AM Warner Losh wrote: > >>>> > >>>>> > >>>>> > >>>>> On Sat, Jul 31, 2021 at 3:11 AM Kristof Provost > >>>>> wrote: > >>>>> > >>>>>> Hi Warner, > >>>>>> > >>>>>> On 10 Jul 2021, at 19:12, Warner Losh wrote: > >>>>>> > >>>>>> The branch stable/12 has been updated by imp: > >>>>>> > >>>>>> URL: > >>>>>> > >>> > https://cgit.FreeBSD.org/src/commit/?id=3D6edf5082bab71cf923efff9f18e38ef= e5b83b0ec > >>>>>> > >>>>>> commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec > >>>>>> Author: Warner Losh > >>>>>> AuthorDate: 2021-07-07 23:30:35 +0000 > >>>>>> Commit: Warner Losh > >>>>>> CommitDate: 2021-07-10 17:11:15 +0000 > >>>>>> > >>>>>> one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number > >>>>>> of > >>>>>> bugs > >>>>>> > >>>>>> Import the latest bsd-features branch of the one-true-awk > >>>>>> upstream: > >>>>>> > >>>>>> o Move to bison for $YACC > >>>>>> o Set close-on-exec flag for file and pipe redirects that aren't > >>>>>> std* > >>>>>> o lots of little fixes to modernize ocde base > >>>>>> o free sval member before setting it > >>>>>> o fix a bug where a{0,3} could match aaaa > >>>>>> o pull in systime and strftime from NetBSD awk > >>>>>> o pull in fixes from {Net,Free,Open}BSD (normalized our code with > >>>>>> them) > >>>>>> o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly > >>>>>> a > >>>>>> nop) > >>>>>> > >>>>>> Also revert a few of the trivial FreeBSD changes that were done > >>>>>> slightly > >>>>>> differently in the upstreaming process. Also, our PR database may > >>>>>> have > >>>>>> been mined by upstream for these fixes, and Mikolaj Golub may > >>>>>> deserve > >>>>>> credit for some of the fixes in this update. > >>>>>> > >>>>>> Suggested by: Mikolaj Golub > >>>>>> PR: 143363,143365,143368,143369,143373,143375,214782 > >>>>>> Sponsored by: Netflix > >>>>>> > >>>>>> (cherry picked from commit > >>>>>> f39dd6a9784467f0db5886012b3f4b13899be6b8) > >>>>>> > >>>>>> I *think* this is the relevant commit, but I=E2=80=99m not 100% su= re. > >>>>>> > >>>>>> Anyway, I=E2=80=99ve recently started seeing issues building pfSen= se > >>>>>> for > >>>>>> aarch64. > >>>>>> I=E2=80=99ve finally narrowed it down, and replicated the problem = on > >>>>>> base > >>>>>> FreeBSD > >>>>>> (stable/12, but I assume other branches are affected too). > >>>>>> > >>>>>> It fails to build proctab.c. This file is generated by maketab, a > >>>>>> tool > >>>>>> built as part of the build process. In my case this tool is built > >>>>>> for > >>>>>> aarch64, which makes executing it on amd64 less successful than > >>>>>> we=E2=80=99d like. > >>>>>> > >>>>>> This only happens when building with META_MODE though. I do not > >>>>>> understand the build system sufficiently to debug why. Hopefully > >>>>>> you=E2=80=99ll > >>>>>> have a better idea. > >>>>>> > >>>>> Generally I do, but this one is a bit weird. Also, the amount of > >>>>> context > >>>>> you've included omits the actual error :( Though I'm guessing it's > >>>>> wrong > >>>>> arch for the build tool... > >>>>> > >>>>> I rarely use meta mode, and understand it not at all, but awk > >>>>> follows > >>>>> the > >>>>> same patterns as /bin/sh and /bin/csh does > >>>>> > >>>> > >>>> [[ stupid gmail ]] > >>>> > >>>> I've just pushed removal of proctab.c. That may fix this, though > >>>> I'm > >>>> not > >>>> hopeful. > >>> Unfortunately that didn=E2=80=99t help. > >>> > >>>> I've rarely used metamode, and not for quite some time, but this > >>>> an extra file that would confuse things so that maketab might not > >>>> be > >>>> built > >>>> during build-tools and instead is built later. Please give that a > >>>> try, > >>>> and > >>>> I'll start a meta build, but that takes a while, not least because > >>>> I > >>>> have > >>>> to re-leran how to do that :) > >>>> > >>> I=E2=80=99ve posted my build log and the proctab.c.meta and maketab.m= eta > >>> files > >>> on https://people.freebsd.org/~kp/meta/ > >>> > >>> I=E2=80=99m a little confused by maketab.meta, because what=E2=80=99s= in the > >>> meta > >>> file doesn=E2=80=99t seem to match the build command seen in the > >>> metamode.log > >>> file. > >>> > >> > >> Yea. It's getting confused and rebuilding it bogusly. For the mknodes > >> in > >> sh, we don't see the naked cc command, but we do for maketab. > >> > >> I'm testing a fix right now, though, and we'll see if that fixes > >> things. I > >> think I know what's going on. > >> > > > > I just pushed 1dfb6e5d1f462af4f4df818ee93766f09f3aa787, which fixed > > the > > issues I was seeing. Does that do the trick for you as well? > > > Unfortunately that doesn=E2=80=99t appear to have worked. > > I=E2=80=99ve uploaded the log of this build run (after I=E2=80=99d delete= d > everything in /usr/obj) here: > https://people.freebsd.org/~kp/meta/metamode_1dfb6e5d1f462af.log > > Best regards, > Kristof > --00000000000060b43f05c87063d3 Content-Type: application/octet-stream; name="awk-fix.diff" Content-Disposition: attachment; filename="awk-fix.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_krs65uar0 L2hvbWUvaW1wL2dpdC9zdGFibGUtMTIK --00000000000060b43f05c87063d3--