From nobody Mon Dec 2 01:56:31 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y1n2R6FtJz5fLrk; Mon, 02 Dec 2024 01:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1n2R5kbmz4kg7; Mon, 2 Dec 2024 01:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733104591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=INesOiZE9YhZx4kzRm57x7pN1USHevHdz+faS5IOuuQ=; b=v7C43rlFEBJDLfj+yiAGTIybVux7t6oB8by9EEOvjvcaoXjre+QFxzn2JBGIbTOWC2Gaq3 G/NxXSpL+Q8WSEQ0thhjFIpYPv38Z3IoD8zia+vn+5tT0h2TiWLpme0MNokwUcplkv047k DOOEj0cko8v2IaPRTbR+J6UI52VzhYbvaN8bXfxVcTfylQwZ//AOrqxdL6Plas5Iv/svhO rxY0NDqU61WoCGRtxdl/a6uix/TpbFsGmLtzVOFLW2nPMhYCYPuRT9SgvxnvjplRyVqVyT Mholwg17xADiOnCH9xWG6R0+I+IjIeRc6WR5Ug9S3JbPEfIQip5kCsndZDW6uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733104591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=INesOiZE9YhZx4kzRm57x7pN1USHevHdz+faS5IOuuQ=; b=PRSnaVQorImr5fwd0ZLJpDW/jNmbDS0ZI1wAXCRoOKi7k0StuaWydhbquZkxcSompNUbAx 7934dy5oVGz4cV2PY1QEGNNxPlZfOrjhmsML0UP55ERwm2TMYuLZAGKkZgpRSyRn/i9vhK RXpISbFd9oA6cxzfO7qUXYkTD8ow64iwCMkiRUuR0qcL5Z3r62ZzvVY3RY54KDahQBAG1t Hn58+uQklR0ldhRWkc8+cP6NanD69webM1hWi8V3IOd/XVlEXRat/ZzWJiG+72VQZpfz59 62mYoJlfqGt/kI3Uki4sA1k1t6ZxYfpJP6eoaL3u7EeVRVuaRPfAYGfKpUhi0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733104591; a=rsa-sha256; cv=none; b=JobU+nLvI1UL1OmuCan0MZ12hNLrWfQuCRmN0/P2iKod3gif/lN8BZlfY/L+JCFGCtgnaT 2k8cqdiBAyRKqtgQ/2oOwg00smGASXY8nd0p72WI34thj6ZExQWENKjEExS7qpItsgus2B cPpgYkAWdfh1aJ2od5MmJwRY+8y2Fyg5s4ryShwOcjYtUoqgNSwWUJjdjtgeXsIgRLTMpO 5H2er60kCyj0dstj8Zui0Yjs+6607W4DLJTMBtqdQ5hck1uhG8GzpCa3CFaL9bbdyxDm9C y0B+JHC37jpSaFR4h+/gdIGNc0gEcFMNHQuzYZfrfqM5xwqOv9Dkn6jKRJP2ew== 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 4Y1n2R4vBfzJGy; Mon, 2 Dec 2024 01:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B21uV0U045793; Mon, 2 Dec 2024 01:56:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B21uVn1045790; Mon, 2 Dec 2024 01:56:31 GMT (envelope-from git) Date: Mon, 2 Dec 2024 01:56:31 GMT Message-Id: <202412020156.4B21uVn1045790@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a0e45db6f6eb - main - contrib/wpa: pass IFM_IEEE80211_VHT5G if vht_enabled on the channel List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a0e45db6f6eb6660e78921bbd5307fa7fc13d0a9 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a0e45db6f6eb6660e78921bbd5307fa7fc13d0a9 commit a0e45db6f6eb6660e78921bbd5307fa7fc13d0a9 Author: Bjoern A. Zeeb AuthorDate: 2022-11-09 16:41:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-12-02 01:54:05 +0000 contrib/wpa: pass IFM_IEEE80211_VHT5G if vht_enabled on the channel Set media mode correctly to IFM_IEEE80211_VHT5G if vht_enabled is set on the channel. Otherwise we'll end up setting 11NA. Not a problem on first sight given net80211 does the upgrade to VHT for us. But we would not set iv_des_mode ("desired mode") on the vap. Setting this will put a contraint on/help scanning for our desired (VHT) channels to my understanding of the code. Sponsored by: The FreeBSD Foundation MFC after: 6 weeks Reviewed by: cy, adrian Differential Revision: https://reviews.freebsd.org/D35978 --- contrib/wpa/src/drivers/driver_bsd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/wpa/src/drivers/driver_bsd.c b/contrib/wpa/src/drivers/driver_bsd.c index 712446a62fe4..fc9a44743d7d 100644 --- a/contrib/wpa/src/drivers/driver_bsd.c +++ b/contrib/wpa/src/drivers/driver_bsd.c @@ -631,6 +631,7 @@ bsd_set_freq(void *priv, struct hostapd_freq_params *freq) mode = IFM_IEEE80211_11B; } else { mode = + freq->vht_enabled ? IFM_IEEE80211_VHT5G : freq->ht_enabled ? IFM_IEEE80211_11NA : IFM_IEEE80211_11A; } From nobody Mon Dec 2 04:42:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y1rjj2GhQz5fYwh; Mon, 02 Dec 2024 04:42: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1rjj1hv7z4vNw; Mon, 2 Dec 2024 04:42:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733114537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nelYh2PPgSPe5qIY5d5HBDJ5qGCfgQeWZJ15923mBj4=; b=G5xtyqOY0KtYSDYfHj8HNfr6sWsXv4myLrmyQ/jTvcfZXeCenD8ohRZtdFo32YDNcdJPnT iCSdzRocjl5C54mXOPCDEsOC5ONJniirsyL0QeZv3cOuR3oTV/VkysmCSQ7m+kB9WHuFPW 27uCmY7EqpfHj/5U77C2E1nlakFn8r4q1BcutDiRCBFgk+u7ExKpIlnotXRgfr56vutW+q AltnjBwmTaIgM0jszOgoryljllSfA8YC3jPBXDfMSxlne3qRYxzkqRWY58+fhIqcSYAkDd zFBTMOJXpmg3fW8FF/yF0F68HFED/Larzw//b/i7gfctb0cf4uIaOzwJACF41w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733114537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nelYh2PPgSPe5qIY5d5HBDJ5qGCfgQeWZJ15923mBj4=; b=MSsgIBE1xaOgCuCZBl3CD8J0znVDCgLXi15rlxHWe/4LSJDzZ0GbVy++q+snoN/PiVQ+/X MB/wKY6ilHjdSOGhei/ThlH8AcscGYWi2K4oA06N7XdX3HGCQhaXhe5JRqbgv9P0XPpoT2 BG3FjPQdxScLVMMKdjBarjFfaKs0c2rOD+hL82lWsR3CVXDUkUQ99po/ONJ2CzVr/Go6c8 EwXUtH2d09I+I5pVBa4GdnVYahzudmlREH0sd2li2/LHP022dfJO+BsrD/uozVXhY1uVLk 4PniBRcB1k3KXZI1if8SBP2I23IPewiLORMGph2uErI3fcYES3XPtO+YZyhQAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733114537; a=rsa-sha256; cv=none; b=DjjtumL9LUrnsbrIrh9dwqkYuELBql+C3CFwWB6A4zW1riTItSO2hwTyj1PlqRjw5L10zK 8v+KkczOumCuZ+DAknl34gyYMcq9KZ4fBS9C1wPa/iishtUqwgpwjf9JrUeA2rvT4d/WWd 11TEHxK9V9dzq7NtVMVrkiIWS4RMyMsKcfYswS+V9gmM/vsbqRLAff8DRdPyehXEpVDM3V 0td++wv6RTEkG/i/nit3NwCbarNoaDLmtw4ca5Hd+0BNlcU4SskEJy8UwseIXzgPUpP+Vl X3tr84mmHn+vvpkitHoGUqTo+uxLmevXOtEfTSem2tbb7+UlchG1Fqon7dBAqw== 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 4Y1rjj1JSjzNWZ; Mon, 2 Dec 2024 04:42:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B24gHtG060204; Mon, 2 Dec 2024 04:42:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B24gHFi060189; Mon, 2 Dec 2024 04:42:17 GMT (envelope-from git) Date: Mon, 2 Dec 2024 04:42:17 GMT Message-Id: <202412020442.4B24gHFi060189@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Enji Cooper Subject: git: 991bd461625a - main - lib/libsbuf/tests: reformat with `clang-format` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ngie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 991bd461625a2c521d5be4fd6938deed57f60972 Auto-Submitted: auto-generated The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=991bd461625a2c521d5be4fd6938deed57f60972 commit 991bd461625a2c521d5be4fd6938deed57f60972 Author: Enji Cooper AuthorDate: 2024-12-02 04:39:52 +0000 Commit: Enji Cooper CommitDate: 2024-12-02 04:39:52 +0000 lib/libsbuf/tests: reformat with `clang-format` This change is being done first so any functional changes from the tests will be clearer to reviewers. No functional change intended. MFC after: 2 weeks Ref: https://reviews.freebsd.org/D47826 --- lib/libsbuf/tests/sbuf_core_test.c | 32 +++++++++---------- lib/libsbuf/tests/sbuf_stdio_test.c | 21 ++++++------- lib/libsbuf/tests/sbuf_string_test.c | 60 +++++++++++++++++++----------------- 3 files changed, 58 insertions(+), 55 deletions(-) diff --git a/lib/libsbuf/tests/sbuf_core_test.c b/lib/libsbuf/tests/sbuf_core_test.c index 117f178968ff..14bbc475043a 100644 --- a/lib/libsbuf/tests/sbuf_core_test.c +++ b/lib/libsbuf/tests/sbuf_core_test.c @@ -25,6 +25,8 @@ #include #include + +#include #include #include #include @@ -32,12 +34,10 @@ #include #include -#include - #include "sbuf_test_common.h" -static char test_string[] = "this is a test string"; -#define TEST_STRING_CHOP_COUNT 5 +static char test_string[] = "this is a test string"; +#define TEST_STRING_CHOP_COUNT 5 _Static_assert(nitems(test_string) > TEST_STRING_CHOP_COUNT, "test_string is too short"); @@ -75,8 +75,8 @@ ATF_TC_BODY(sbuf_clear_test, tc) buf_len = sbuf_len(sb); ATF_REQUIRE_MSG(buf_len == 0, "sbuf_len (%zd) != 0", buf_len); - ATF_REQUIRE_STREQ_MSG(sbuf_data(sb), "", - "sbuf (\"%s\") was not empty", sbuf_data(sb)); + ATF_REQUIRE_STREQ_MSG(sbuf_data(sb), "", "sbuf (\"%s\") was not empty", + sbuf_data(sb)); sbuf_delete(sb); } @@ -103,7 +103,6 @@ ATF_TC_BODY(sbuf_done_and_sbuf_finish_test, tc) static int drain_ret0(void *arg, const char *data, int len) { - (void)arg; (void)data; (void)len; @@ -144,10 +143,11 @@ ATF_TC_BODY(sbuf_len_test, tc) buf_len = sbuf_len(sb); ATF_REQUIRE_MSG(buf_len == (ssize_t)(i * test_string_len), "sbuf_len (%zd) != %zu", buf_len, i * test_string_len); - ATF_REQUIRE_MSG(sbuf_cat(sb, test_string) == 0, "sbuf_cat failed"); + ATF_REQUIRE_MSG(sbuf_cat(sb, test_string) == 0, + "sbuf_cat failed"); } -#ifdef HAVE_SBUF_SET_FLAGS +#ifdef HAVE_SBUF_SET_FLAGS sbuf_set_flags(sb, SBUF_INCLUDENUL); ATF_REQUIRE_MSG((ssize_t)(i * test_string_len + 1) == sbuf_len(sb), "sbuf_len(..) didn't report the NUL char"); @@ -172,8 +172,8 @@ ATF_TC_BODY(sbuf_new_fixedlen, tc) child_proc = atf_utils_fork(); if (child_proc == 0) { - ATF_REQUIRE_EQ_MSG(0, sbuf_finish(&sb), "sbuf_finish failed: %s", - strerror(errno)); + ATF_REQUIRE_EQ_MSG(0, sbuf_finish(&sb), + "sbuf_finish failed: %s", strerror(errno)); sbuf_putbuf(&sb); exit(0); @@ -182,7 +182,8 @@ ATF_TC_BODY(sbuf_new_fixedlen, tc) sbuf_putc(&sb, ' '); - ATF_CHECK_EQ_MSG(-1, sbuf_finish(&sb), "failed to return error on overflow"); + ATF_CHECK_EQ_MSG(-1, sbuf_finish(&sb), + "failed to return error on overflow"); sbuf_delete(&sb); } @@ -243,7 +244,6 @@ ATF_TC_BODY(sbuf_setpos_test, tc) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, sbuf_clear_test); ATF_TP_ADD_TC(tp, sbuf_done_and_sbuf_finish_test); ATF_TP_ADD_TC(tp, sbuf_drain_ret0_test); @@ -251,15 +251,15 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, sbuf_new_fixedlen); #if 0 /* TODO */ -#ifdef HAVE_SBUF_CLEAR_FLAGS +#ifdef HAVE_SBUF_CLEAR_FLAGS ATF_TP_ADD_TC(tp, sbuf_clear_flags_test); #endif -#ifdef HAVE_SBUF_GET_FLAGS +#ifdef HAVE_SBUF_GET_FLAGS ATF_TP_ADD_TC(tp, sbuf_get_flags_test); #endif ATF_TP_ADD_TC(tp, sbuf_new_positive_test); ATF_TP_ADD_TC(tp, sbuf_new_negative_test); -#ifdef HAVE_SBUF_SET_FLAGS +#ifdef HAVE_SBUF_SET_FLAGS ATF_TP_ADD_TC(tp, sbuf_set_flags_test); #endif #endif diff --git a/lib/libsbuf/tests/sbuf_stdio_test.c b/lib/libsbuf/tests/sbuf_stdio_test.c index ee68c6c5a51d..8d8e01a962b9 100644 --- a/lib/libsbuf/tests/sbuf_stdio_test.c +++ b/lib/libsbuf/tests/sbuf_stdio_test.c @@ -25,6 +25,8 @@ #include #include + +#include #include #include #include @@ -32,17 +34,15 @@ #include #include -#include - #include "sbuf_test_common.h" -static char test_string[] = "this is a test string"; +static char test_string[] = "this is a test string"; -#define MESSAGE_FORMAT "message: %s\n" -#define MESSAGE_SEPARATOR ';' +#define MESSAGE_FORMAT "message: %s\n" +#define MESSAGE_SEPARATOR ';' static int -sbuf_vprintf_helper(struct sbuf *sb, const char * restrict format, ...) +sbuf_vprintf_helper(struct sbuf *sb, const char *restrict format, ...) { va_list ap; int rc; @@ -116,8 +116,8 @@ ATF_TC_BODY(sbuf_printf_test, tc) struct sbuf *sb; char *test_string_tmp; - asprintf(&test_string_tmp, "%s%c" MESSAGE_FORMAT, - test_string, MESSAGE_SEPARATOR, test_string); + asprintf(&test_string_tmp, "%s%c" MESSAGE_FORMAT, test_string, + MESSAGE_SEPARATOR, test_string); ATF_REQUIRE_MSG(test_string_tmp != NULL, "asprintf failed"); sb = sbuf_new_auto(); @@ -176,8 +176,8 @@ ATF_TC_BODY(sbuf_vprintf_test, tc) char *test_string_tmp; int rc; - asprintf(&test_string_tmp, "%s%c" MESSAGE_FORMAT, - test_string, MESSAGE_SEPARATOR, test_string); + asprintf(&test_string_tmp, "%s%c" MESSAGE_FORMAT, test_string, + MESSAGE_SEPARATOR, test_string); ATF_REQUIRE_MSG(test_string_tmp != NULL, "asprintf failed"); sb = sbuf_new_auto(); @@ -203,7 +203,6 @@ ATF_TC_BODY(sbuf_vprintf_test, tc) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, sbuf_printf_drain_null_test); ATF_TP_ADD_TC(tp, sbuf_printf_drain_test); ATF_TP_ADD_TC(tp, sbuf_printf_test); diff --git a/lib/libsbuf/tests/sbuf_string_test.c b/lib/libsbuf/tests/sbuf_string_test.c index 37c1c1805b7b..fddaaac9886a 100644 --- a/lib/libsbuf/tests/sbuf_string_test.c +++ b/lib/libsbuf/tests/sbuf_string_test.c @@ -25,28 +25,33 @@ #include #include + +#include #include #include #include #include #include -#include - #include "sbuf_test_common.h" -static char test_string[] = "this is a test string"; -static char test_whitespace_string[] = " \f\n\r\t\v "; -static int test_buffer[] = { 0, 1, 2, 3, 4, 5, }; +static char test_string[] = "this is a test string"; +static char test_whitespace_string[] = " \f\n\r\t\v "; +static int test_buffer[] = { + 0, + 1, + 2, + 3, + 4, + 5, +}; static void check_buffers_equal(const void *sb_buf, const void *test_buf, size_t len) { - if (memcmp(sb_buf, test_buf, len) != 0) { printf("sbuf:\n"); - hexdump(sb_buf, len, NULL, 0), - printf("test_buf:\n"); + hexdump(sb_buf, len, NULL, 0), printf("test_buf:\n"); hexdump(test_buf, len, NULL, 0); atf_tc_fail("contents of sbuf didn't match test_buf contents"); } @@ -75,16 +80,16 @@ ATF_TC_BODY(sbuf_bcat_test, tc) test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(test_sbuf_len == (ssize_t)sizeof(test_buffer), - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, sizeof(test_buffer)); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + sizeof(test_buffer)); ATF_CHECK_MSG(sbuf_bcat(sb, test_buffer, sizeof(test_buffer)) == 0, "sbuf_bcat failed"); test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(test_sbuf_len == (ssize_t)(2 * sizeof(test_buffer)), - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, 2 * sizeof(test_buffer)); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + 2 * sizeof(test_buffer)); ATF_REQUIRE_MSG(sbuf_finish(sb) == 0, "sbuf_finish failed: %s", strerror(errno)); @@ -112,16 +117,16 @@ ATF_TC_BODY(sbuf_bcpy_test, tc) test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(test_sbuf_len == (ssize_t)sizeof(test_buffer), - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, sizeof(test_buffer)); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + sizeof(test_buffer)); ATF_CHECK_MSG(sbuf_bcpy(sb, test_buffer, sizeof(test_buffer)) == 0, "sbuf_bcpy failed"); test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(test_sbuf_len == (ssize_t)sizeof(test_buffer), - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, sizeof(test_buffer)); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + sizeof(test_buffer)); ATF_REQUIRE_MSG(sbuf_finish(sb) == 0, "sbuf_finish failed: %s", strerror(errno)); @@ -149,15 +154,15 @@ ATF_TC_BODY(sbuf_cat_test, tc) test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(test_sbuf_len == (ssize_t)strlen(test_string), - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, sizeof(test_string)); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + sizeof(test_string)); ATF_CHECK_MSG(sbuf_cat(sb, test_string) == 0, "sbuf_cat failed"); test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(test_sbuf_len == (ssize_t)strlen(test_string_tmp), - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, strlen(test_string_tmp)); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + strlen(test_string_tmp)); ATF_REQUIRE_MSG(sbuf_finish(sb) == 0, "sbuf_finish failed: %s", strerror(errno)); @@ -185,15 +190,15 @@ ATF_TC_BODY(sbuf_cpy_test, tc) test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(test_sbuf_len == (ssize_t)strlen(test_string), - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, strlen(test_string)); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + strlen(test_string)); ATF_CHECK_MSG(sbuf_cpy(sb, test_string) == 0, "sbuf_cpy failed"); test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(test_sbuf_len == (ssize_t)strlen(test_string), - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, strlen(test_string)); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + strlen(test_string)); ATF_REQUIRE_MSG(sbuf_finish(sb) == 0, "sbuf_finish failed: %s", strerror(errno)); @@ -216,7 +221,7 @@ ATF_TC_BODY(sbuf_putc_test, tc) ATF_REQUIRE_MSG(sb != NULL, "sbuf_new_auto failed: %s", strerror(errno)); - for (i = 0; i <= strlen(test_string); i++) { /* Include the NUL */ + for (i = 0; i <= strlen(test_string); i++) { /* Include the NUL */ ATF_REQUIRE_MSG(sbuf_putc(sb, test_string[i]) == 0, "sbuf_putc failed"); @@ -256,8 +261,8 @@ ATF_TC_BODY(sbuf_trim_test, tc) strlen(test_whitespace_string)); test_sbuf_len = sbuf_len(sb); ATF_REQUIRE_MSG(exp_sbuf_len == test_sbuf_len, - "sbuf_len(..) => %zd (actual) != %zu (expected)", - test_sbuf_len, exp_sbuf_len); + "sbuf_len(..) => %zd (actual) != %zu (expected)", test_sbuf_len, + exp_sbuf_len); ATF_REQUIRE_MSG(sbuf_trim(sb) == 0, "sbuf_trim failed"); @@ -273,7 +278,6 @@ ATF_TC_BODY(sbuf_trim_test, tc) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, sbuf_bcat_test); ATF_TP_ADD_TC(tp, sbuf_bcpy_test); ATF_TP_ADD_TC(tp, sbuf_cat_test); From nobody Mon Dec 2 09:11:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y1ygy4srvz5fvQ8; Mon, 02 Dec 2024 09:11: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1ygy4QKvz4GfC; Mon, 2 Dec 2024 09:11:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733130670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=acOMu0gb+eoyDqgUayL4KQqJ2UVmyNK8FDY+KEoEK8s=; b=tlDYGQYdVZ4DC0SbuXWHmNO2C+Ia8bLbFFRM3LsH7AWK1+m+BRwgfKYHVapk9U784rWDhM F1e7TU0w8CUtUs+95IpTX8u9AKX6ybTXHtCDxKEft9FLLf9mdB5aJTtme71h9hjk9kJBkO +ziwlSJGzp5KGoMCCl58jnF9WTipc9dGuNyzSOpF1aLoxGCssYuDgw7SqenUB+YTEo3FrQ yW8HRoR+nSVQickQ9X7VsNSZwxEm9XqwvKDld1+95QrodbpNwOeUQT2B7tpBi5D2E/+nVI uBcMvwMQc19ioRLeNv6RaAfSSddQ14DuA63rvaF2DjU8VHXRHuS85VIDRI1BAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733130670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=acOMu0gb+eoyDqgUayL4KQqJ2UVmyNK8FDY+KEoEK8s=; b=onVqvAgt+UAouwniivT5wDnxtVSUDG56et6uHyrH9SHpQjmFRGrhyVAxS/D20Q7OyVd9Nl MByUI3vZc7MY/dgKWvw6Mijs+dPX5eHtP0GiKZJ89LePBVmkzcjCAYXb73QtCoxtOm3Xf3 eWzJKr/rzLjlR9QxrqmQ90iNm5H7Sv8csXAr9lY+KefTTO8Qxf1zmF99hW0UpNQoS0eu3O 4a72haEMOyZRgScthKULbh77zp+2YYmQLLn0/poY2cbcrY18qcsfxnwsreg9PGohUZhOi2 Tk+gGuy9oey1FdoE+aUmGnTk0SINeuVVFG1fVRW8dMRDKR1MiZicYcoq7lko0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733130670; a=rsa-sha256; cv=none; b=FyvuaabWYz8Vp3bNAXkX0ZQgu01PPNob89/4J0mzyg4MFZl1yAnq9Dt3dkFEUISyu5lb3j fiePUz7TPk173tZYq3UkijpdeVGcqTg8R4tp3yMfuQq/xKMtEs7WLNDdr9RIOecScDmSiB 1rH1DgIPoGaRMFaCJr5YLGWWu1Ea+IZvtUDfUpteFq6teYteZxP42ZyjwnyFMPbwHTkVer 1CP7mUaSdlQTGgXmOzNoaLLWhvFHoFIg58kug1nlNEmyq0GpPakYKLDz50GI8gLH8Cr/rK SitkqUyfNRNLB4MMmbF8xmTPtwTQ/8tITmIYYCqCrgdxXBh6llBM9WBxQ1D9Jg== 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 4Y1ygy3xMDzXP2; Mon, 2 Dec 2024 09:11:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B29BA0R059522; Mon, 2 Dec 2024 09:11:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B29BADA059519; Mon, 2 Dec 2024 09:11:10 GMT (envelope-from git) Date: Mon, 2 Dec 2024 09:11:10 GMT Message-Id: <202412020911.4B29BADA059519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 0482974b2c02 - main - sfxge: defer ether_ifattach to when ifmedia_init is done List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 0482974b2c021a8abbc044d3e2b1240250f791e7 Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=0482974b2c021a8abbc044d3e2b1240250f791e7 commit 0482974b2c021a8abbc044d3e2b1240250f791e7 Author: Franco Fichtner AuthorDate: 2024-11-29 20:36:43 +0000 Commit: Kevin Bowling CommitDate: 2024-12-02 09:09:24 +0000 sfxge: defer ether_ifattach to when ifmedia_init is done Otherwise the ifmedia subsystem may call unguarded NULL function pointers. Same issue that was fixed for cxgb(4) in f2daf8995. Also see: https://github.com/opnsense/src/issues/228 MFC after: 1 week --- sys/dev/sfxge/sfxge.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c index 5fb3a3e74c2e..7d3217fb50de 100644 --- a/sys/dev/sfxge/sfxge.c +++ b/sys/dev/sfxge/sfxge.c @@ -611,8 +611,6 @@ sfxge_ifnet_init(if_t ifp, struct sfxge_softc *sc) if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | CSUM_TCP_IPV6 | CSUM_UDP_IPV6, 0); - ether_ifattach(ifp, encp->enc_mac_addr); - if_settransmitfn(ifp, sfxge_if_transmit); if_setqflushfn(ifp, sfxge_if_qflush); @@ -620,13 +618,11 @@ sfxge_ifnet_init(if_t ifp, struct sfxge_softc *sc) DBGPRINT(sc->dev, "ifmedia_init"); if ((rc = sfxge_port_ifmedia_init(sc)) != 0) - goto fail; + return (rc); - return (0); + ether_ifattach(ifp, encp->enc_mac_addr); -fail: - ether_ifdetach(sc->ifnet); - return (rc); + return (0); } void From nobody Mon Dec 2 09:44:02 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y1zPv3tbYz5fxvc; Mon, 02 Dec 2024 09:44: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1zPv3KX7z4LWx; Mon, 2 Dec 2024 09:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733132643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IYBnFhFtn/1ZjRczYqdPCI+SrRTluqhwbBi70xPaPq4=; b=iCn98bDfOYjCjnulscRRtY7YTtPEaiahzgniOjtehOm/lksf2V3kmK59K5K/hThXYNjI/f BAK5zVz2/5WlQRNXO+rtNGgMDwLNxe02TtLfc5Uxo36AOaXi/6BUzvWSiW4dBUY0JrdsmX w6UdD2quNcBfsbL6jbAxwuRSYG7ZY6q/tLFRCWphnkaN9YkDKoP8yZn3toyEtqEw2Q1K4R 8aR1RtS1fbJWONqPLiYHw0nphT7+ablCRK0oEqJoBNBdkiueRfbPnStNclpHmy8DEv5m/l p8YNDBrSyLluIE/RCp8U6ZaspuYBtcxpvxGa3NAW1pUx8RkL8OnLEP+tiM6E/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733132643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IYBnFhFtn/1ZjRczYqdPCI+SrRTluqhwbBi70xPaPq4=; b=SlRQVHdsLqMcehbpAFJBk+NE7Oo6uEfZc+FFqs6tblmy62HaByr2LUbUZDI2NYirdJJlxW 3M6nfUF9Dvj12KX6ePAvGaTbXCxAzr77EhhSWYbQeZ292XbQdP3+nNumrRkl1eFfy8PcLx JvkOPkhv9wJj05JQfkElZhvycEw8IYyenB1SKLV4nJjTPgsIeSZCTFNSZdWsZi+9xHBur9 wKWXf6nLTXUnuWAh8Ixz9qJq5tT0mziVPFlIQw/3jcUKIdrWevCRmJES2h9NVMi7OrrkQe uKJbR/rMSMLk5bvrR4WtNNg/xebwuDCjFhXhN0Bg4aFfNUMzYXqpPAeXpxeKvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733132643; a=rsa-sha256; cv=none; b=HsGvSduqbGlPmKSDtvusIE+l14Anj23PPQKvYUycRl/YukRA7p1uc0lq6niUqBOl1LMPOi xgvVfxO76wg5y1leoxQvFq3FQz1VtL7Cl+bNdMpT9fmOu0FNE/1BqIZ58NEgvqUz+7ohk8 emAbRa/vczB3z/Rdro8mY1FhMq0oduqTe13ld5h2xsOebbQ6Pb+JVyrJDc3Uc7hWNldUIj oYkRoSgUrDaONuGxTNJKr15D5q0kONbnxBaM1hcad5VlfbwpC0d+rnJgeRwZwj+uvBOD/X ZHshytvVd9bMwC5S8xhkvNBPpRBuIvlpLziBpucBKvpGJlEDdN4D4FYuqzYLhQ== 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 4Y1zPv2mTpzXYC; Mon, 2 Dec 2024 09:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B29i2Ti021574; Mon, 2 Dec 2024 09:44:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B29i2Um021571; Mon, 2 Dec 2024 09:44:02 GMT (envelope-from git) Date: Mon, 2 Dec 2024 09:44:02 GMT Message-Id: <202412020944.4B29i2Um021571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: ff1aec7ccb54 - main - ipfw: do not reset fwmark when one_pass is disabled. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff1aec7ccb547b778c7fb2263ecb50ceeea971f5 Auto-Submitted: auto-generated The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=ff1aec7ccb547b778c7fb2263ecb50ceeea971f5 commit ff1aec7ccb547b778c7fb2263ecb50ceeea971f5 Author: Andrey V. Elsukov AuthorDate: 2024-12-02 09:41:11 +0000 Commit: Andrey V. Elsukov CommitDate: 2024-12-02 09:41:11 +0000 ipfw: do not reset fwmark when one_pass is disabled. Fixes: fc727ad63d3f8 MFC after: 1 week --- sys/netpfil/ipfw/ip_fw_pfil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_fw_pfil.c b/sys/netpfil/ipfw/ip_fw_pfil.c index 4dae28aa0544..ddd8e00316b8 100644 --- a/sys/netpfil/ipfw/ip_fw_pfil.c +++ b/sys/netpfil/ipfw/ip_fw_pfil.c @@ -127,6 +127,7 @@ ipfw_check_packet(struct mbuf **m0, struct ifnet *ifp, int flags, int ipfw; args.flags = (flags & PFIL_IN) ? IPFW_ARGS_IN : IPFW_ARGS_OUT; + args.rule.pkt_mark = 0; again: /* * extract and remove the tag if present. If we are left @@ -144,7 +145,6 @@ again: args.m = *m0; args.ifp = ifp; args.inp = inp; - args.rule.pkt_mark = 0; ipfw = ipfw_chk(&args); *m0 = args.m; From nobody Mon Dec 2 10:51:05 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y20vF3Fg1z5fYCH; Mon, 02 Dec 2024 10:51: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y20vF2mgTz4Sd4; Mon, 2 Dec 2024 10:51:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733136665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Po8x40QJXSCxcDvhkdAewT7LgsEglIIfIok/cncaoVE=; b=Lmpq7gDV37uqQePBAtq4y17iuMO6Aqtvx9jpsb9I61Ep+YqhoRP4GvpfmCEddXOwbtLwhM 8XLRbFU99jFsR51heP3V0Gb932ocBhSd2z41YegDqVRNC2Ux+N4N2la780xJxk4nM78f+Z E1yoRRbhHnc+HA1whEVBaMIaFWKig3GiC70GHwtPV+QslpKGIukTtkMeqlDQqiv+p1LWwF lBlePZybnb0tSOm0zj9FGD6htWXc//yShJOct69js27EelYADUsuIuzKxqOfq7e+DpboAX BorDLi3f1zZccnJFs+khBzWcstDQrbswhZabZHx89g2SC98dhjnHupHy5mT/Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733136665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Po8x40QJXSCxcDvhkdAewT7LgsEglIIfIok/cncaoVE=; b=GnEBD6guWcdFGxKIF7qXhgOlgrOwmGQfOrg7OP6v1vc93xos0fmFF/QQbbeSU5apU64P9m puaUGgKkq5xW4deE6kMJczmufUffK2msRYwgq1wI7TiZ0d56x/EDn0Y/3CC0Rfs9fIBJwn s0uDqSPHvr6JE7rX6DoEWiwj452YjAQThLmi6cG1CU7Jzq8OTab19H+VkaP0TGBjb7s9rc aBtbOLtfMlKSV1c1Edv5y3YasYDfG2aRjzdmgl7GA+qKf4qzSn7eceyZUyIDE15v/IwjhA R4HZE24Bjpm2/NPmIqYmjdtMalglpcO+igPac/WmhFI5+RQWHxBIVIhLt1KCMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733136665; a=rsa-sha256; cv=none; b=drRQFCaT+TDIvc9hD8+e8LR6xNRTHgeXMOfJY2wskb15ZWauUcHmgg6F1Fn2sSp4srJzad aUEDcf74QnhqXRFVdNAb4cTi/zJ9AuxwzW4y0xaWD+DAT1DdGptkQtij+lvgcsQ4QqVlEk 4DTZKp386hEh7A1uNWCdHzUoPXPazDZmRctHtPW9Wi+TuVV8NlKHPtbf25NZ3jMRvlV0Ij 3zYJKL+ld6I5Gvf4O1C7eho327HiPoJyhz7evGbbo5cu9gwuJL8tQFBaKxA3BTjFD8Bdh1 tMJIxIje4kq5mgZ3ylVFfodFP/3WPn7T1bq9J5My/UBy88X5F0MIX4b6RdOGUg== 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 4Y20vF2DlrzZR4; Mon, 2 Dec 2024 10:51:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2Ap5uL043955; Mon, 2 Dec 2024 10:51:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2Ap5N6043952; Mon, 2 Dec 2024 10:51:05 GMT (envelope-from git) Date: Mon, 2 Dec 2024 10:51:05 GMT Message-Id: <202412021051.4B2Ap5N6043952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: 127709d30a2b - main - lib/libc/gen: use Lemire's algorithm for arc4random_uniform(). List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 127709d30a2b8a38be995dc5053390947895a723 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=127709d30a2b8a38be995dc5053390947895a723 commit 127709d30a2b8a38be995dc5053390947895a723 Author: Robert Clausecker AuthorDate: 2024-11-18 12:30:55 +0000 Commit: Robert Clausecker CommitDate: 2024-12-02 10:41:11 +0000 lib/libc/gen: use Lemire's algorithm for arc4random_uniform(). Daniel Lemire has published a more efficient range reduction algorithm for finding a random number in a given range without bias, reducing the number of divisions to none in the common case and 1 in case the initial sample is rejected. This speeds up performance by 22% on amd64, 15% on i386, and 70% on armv7. os: FreeBSD arch: amd64 cpu: Intel(R) Core(TM) i7-4910MQ CPU @ 2.90GHz │ benchmark.out │ │ sec/op │ Arc4random_uniform 56.53n ± 0% Fast_uniform 44.00n ± 0% geomean 49.87n Reviewed by: cem Approved by: emaste Differential Revision: https://reviews.freebsd.org/D47659 --- lib/libc/gen/arc4random.3 | 13 ++++++- lib/libc/gen/arc4random_uniform.c | 71 +++++++++++++++++---------------------- 2 files changed, 43 insertions(+), 41 deletions(-) diff --git a/lib/libc/gen/arc4random.3 b/lib/libc/gen/arc4random.3 index 1d5b3b9f43cb..1b042f15f000 100644 --- a/lib/libc/gen/arc4random.3 +++ b/lib/libc/gen/arc4random.3 @@ -30,7 +30,7 @@ .\" .\" Manual page, using -mandoc macros .\" -.Dd April 13, 2020 +.Dd November 18, 2024 .Dt ARC4RANDOM 3 .Os .Sh NAME @@ -129,6 +129,17 @@ functions using .%O Document ID: 4027b5256e17b9796842e6d0f68b0b5e .%U http://cr.yp.to/papers.html#chacha .Re +.Rs +.%A Daniel Lemire +.%T Fast Random Integer Generation in an Interval +.%D January 2019 +.%J ACM Trans. Model. Comput. Simul. +.%I Association for Computing Machinery +.%C New York, NY, USA +.%V vol. 29 +.%N no. 1 +.%P pp. 1\(en12 +.Re .Sh HISTORY These functions first appeared in .Ox 2.1 . diff --git a/lib/libc/gen/arc4random_uniform.c b/lib/libc/gen/arc4random_uniform.c index 06cd29c6dbe4..23455e545899 100644 --- a/lib/libc/gen/arc4random_uniform.c +++ b/lib/libc/gen/arc4random_uniform.c @@ -1,56 +1,47 @@ -/* $OpenBSD: arc4random_uniform.c,v 1.3 2019/01/20 02:59:07 bcook Exp $ */ - -/* - * Copyright (c) 2008, Damien Miller +/*- + * SPDX-License-Identifier: 0BSD * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. + * Copyright (c) Robert Clausecker + * Based on a publication by Daniel Lemire. + * Public domain where applicable. * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, 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. + * Daniel Lemire, "Fast Random Integer Generation in an Interval", + * Association for Computing Machinery, ACM Trans. Model. Comput. Simul., + * no. 1, vol. 29, pp. 1--12, New York, NY, USA, January 2019. */ #include #include -/* - * Calculate a uniformly distributed random number less than upper_bound - * avoiding "modulo bias". - * - * Uniformity is achieved by generating new random numbers until the one - * returned is outside the range [0, 2**32 % upper_bound). This - * guarantees the selected random number will be inside - * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound) - * after reduction modulo upper_bound. - */ uint32_t arc4random_uniform(uint32_t upper_bound) { - uint32_t r, min; - - if (upper_bound < 2) - return 0; - - /* 2**32 % x == (2**32 - x) % x */ - min = -upper_bound % upper_bound; + uint64_t product; /* - * This could theoretically loop forever but each retry has - * p > 0.5 (worst case, usually far better) of selecting a - * number inside the range we need, so it should rarely need - * to re-roll. + * The paper uses these variable names: + * + * L -- log2(UINT32_MAX+1) + * s -- upper_bound + * x -- arc4random() return value + * m -- product + * l -- (uint32_t)product + * t -- threshold */ - for (;;) { - r = arc4random(); - if (r >= min) - break; + + if (upper_bound <= 1) + return (0); + + product = upper_bound * (uint64_t)arc4random(); + + if ((uint32_t)product < upper_bound) { + uint32_t threshold; + + /* threshold = (2**32 - upper_bound) % upper_bound */ + threshold = -upper_bound % upper_bound; + while ((uint32_t)product < threshold) + product = upper_bound * (uint64_t)arc4random(); } - return r % upper_bound; + return (product >> 32); } From nobody Mon Dec 2 10:51:06 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y20vG5bw0z5fYdV; Mon, 02 Dec 2024 10:51: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y20vG43Fgz4SQP; Mon, 2 Dec 2024 10:51:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733136666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NjgGl713Pp/23lwV1h2ZRjyBL7q7qrtF+E8FrSXKyHo=; b=ntLb9nHSuV1tDZndgHJMmJnI+TYXmxD7FqkIV6fGg1RPWXA3o2H6Hh0rnlW7B9I5DXV4NQ UrkAVHZAWPGi4X8AEmkNwSbT6ZG3hXSrOZEFvd/e3D7bhbNL0SOkA5xaj9g+83ydYEBlFN eWyE6wU71I2B3WT4LDq0XZlrR6lPksUM6MSvkP8ijvOLOortz8zW6yvwT72Ignid8Jw8X0 RuGrXfDZsJcxU1iBi4Xz4JEfAGZYH6hL5iyGaNrv/aMVj1pfHNCbl8WVQGHG40MhUya9cQ 0ZUI61s3j/4IOJD/c3o8AR3WRg+I1r5fxMDMTBigqKcHHVofgRW47yw7ti2YPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733136666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NjgGl713Pp/23lwV1h2ZRjyBL7q7qrtF+E8FrSXKyHo=; b=IZJQK+uQtDX8/FuU/uE4x75aecpXQ9dVNjmnr79w4BvxfSqrrr+R0REYN6LX49j2wA8iCC vHrVYhhCm0ZWRbBlgJ1q/ZZRBFc9Oa8OkIX+dDG3a3nBis/r/WyF0vB2G0tmxdXiBkcZcs nsHsOW+7BnSft+6EcjxDRgvs5AlmKu4v/ypJxbDAecPp4AGb7nlzAGOb6841Apg3PpNfoo 4Ee+ty1elKh3muyottUKhSMoeYmVNZP9C7TUZKVdk6nH98Csw26yAzsrdsVVNUoBYTBlsD YiksKHszNjBJdfWXLnxzrHLuA1pySiRvXVfdvw30SmkL8bVJ2XphmvjWAqtTrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733136666; a=rsa-sha256; cv=none; b=c62IizAj7r1agQ2Dg8Dc5+kPT5dO1wQp3TJ0a/LxuOzJJCrYDPNaO/36/0xg7yqanewsqu EIWygUjmmnobUmMeyMuAh+FaTz3b70HRm3feZz0/tY9ifws+/RbZLTZ3jNb+4u35RQwQM0 FUEc12SG3UHtx7HflI3uVLRLHhb71ycLzQNXpkjQzN2eGi8RT6Xh8XoIaoyoJF8tbYuF3D st8mw3DdQei0DUfQqq5X7F/iD2gpx/SkZCbXGKI+uef86HJ0jTWJ3VllPetNqtpQw3WTH5 O3Zu5UIAdtYHuZc8qN6UVRXeso8E0TIaUAFbIxCWAJAKn/w6WatDGsKdGungYA== 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 4Y20vG3DW4zZTy; Mon, 2 Dec 2024 10:51:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2Ap6iQ044007; Mon, 2 Dec 2024 10:51:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2Ap6rn044004; Mon, 2 Dec 2024 10:51:06 GMT (envelope-from git) Date: Mon, 2 Dec 2024 10:51:06 GMT Message-Id: <202412021051.4B2Ap6rn044004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: 1730b5c7916e - main - lib/libc/tests: add unit test for arc4random_uniform() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1730b5c7916ed249ddc97ebe51117899f9323fbc Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=1730b5c7916ed249ddc97ebe51117899f9323fbc commit 1730b5c7916ed249ddc97ebe51117899f9323fbc Author: Robert Clausecker AuthorDate: 2024-11-18 12:46:16 +0000 Commit: Robert Clausecker CommitDate: 2024-12-02 10:41:11 +0000 lib/libc/tests: add unit test for arc4random_uniform() The new unit test validates that the range reduction works correctly. We do not currently validate that there is no bias as that would take too much time and memory for a unit test. Reviewed by: cem Approved by: emaste Differential Revision: https://reviews.freebsd.org/D47659 --- lib/libc/tests/gen/arc4random_test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/libc/tests/gen/arc4random_test.c b/lib/libc/tests/gen/arc4random_test.c index e96ebdc6c6ca..79139f29f8fa 100644 --- a/lib/libc/tests/gen/arc4random_test.c +++ b/lib/libc/tests/gen/arc4random_test.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 David Schultz + * Copyright (c) 2024 Robert Clausecker * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -77,10 +79,34 @@ ATF_TC_BODY(test_arc4random, tc) "sequences are the same"); } +/* + * Test whether arc4random_uniform() returns a number below the given threshold. + * Test with various thresholds. + */ +ATF_TC_WITHOUT_HEAD(test_arc4random_uniform); +ATF_TC_BODY(test_arc4random_uniform, tc) +{ + size_t i, j; + static const uint32_t thresholds[] = { + 1, 2, 3, 4, 5, 10, 100, 1000, + INT32_MAX, (uint32_t)INT32_MAX + 1, + UINT32_MAX - 1000000000, UINT32_MAX - 1000000, UINT32_MAX - 1, 0 + }; + + for (i = 0; thresholds[i] != 0; i++) + for (j = 0; j < 10000; j++) + ATF_CHECK(arc4random_uniform(thresholds[i]) < thresholds[i]); + + /* for a threshold of zero, just check that we get zero every time */ + for (j = 0; j < 1000; j++) + ATF_CHECK_EQ(0, arc4random_uniform(0)); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, test_arc4random); + ATF_TP_ADD_TC(tp, test_arc4random_uniform); return (atf_no_error()); } From nobody Mon Dec 2 10:51:07 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y20vH5zzTz5fYdX; Mon, 02 Dec 2024 10:51: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y20vH4c8zz4Sb0; Mon, 2 Dec 2024 10:51:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733136667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A2otp5rdooh9czx+Ey39CZQ5RqWlDg9RrT0EMCHlmXE=; b=XgH8KgCDy4YtM0dF+RMuy0JzggX8QtDSjlahF7pg0bic1yIiZfsqtXgoUci3KvUbAZQw0I wDbSTYuj6b9fZtndBvFXptiJzibe458PGLXt9qMCa4+XvJCP03hrdgfLec0ZkbJqlisLd6 Kpde79Xz00+EzouhMfDyxbCP+vl49sJTWMljryGEMAEZmINvddG3W9pRay4PXGNFWIJKdD puaozDmWmODN7CAwI5Bn/SU3sDgRWlG9QVNJL5U5La0OHW50kAQikM5ONtsSwxT2NEtYK8 7IbHKzyJJp7Xgvaw979jlI0Js07W9zFw1KC7ycPalqJV2wbwZ5uxnw74rpDb1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733136667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=A2otp5rdooh9czx+Ey39CZQ5RqWlDg9RrT0EMCHlmXE=; b=IjD7r3N4fv65G3iWtIQ1xxpsDvymFY2m+r5/ip9X08mmRNCjIwJQE6X7hm0dd1nAXiTJXl 669F8l/kUmw6OqKyl1F3ZZq3D5/ou9eTmCpQwrVGMmz8E79/m8w/QZVZUG19CinDeyQK7x bvGr/KR4LlSoQfhM9nN3qcj6C1OLKqLH8zaB5MbbG7MFml5otODSX2DIBzuUTZF21nH9E1 DkVAKLDUNK+0Em03tTcaz9z7OaAI4sKfNR9y+sTS4itF5kLklPYjeJCoRAPqhc/0U2YS+Q bM0xLARisaUbuEON9+jNGADs6cRa3qduOJQYZPtE7jhqFSzE16s+QEgZdnaHpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733136667; a=rsa-sha256; cv=none; b=HtFHph8LiOSoZUPD0kVHv934UNfMEz7eA/pXzF2RfZB+PoyxgC4i8bV+nHpe6QgGkXNQQ5 cg1z6Ikt6DI9e6HGAOS1HK6ARJdi3LRx+nxX+NH/pK+btOCwTJPxaf77xKnthlpoiR/ijh i6NUV+ir+J4gpv+p6y6dYplQMH0lRTXHu95GX+q8UYqXJQMklnpVpcSXEVtvV6EXv/dRwr Y8IV0bEoghOy5FqzgRKkUxxjszSlb1jtTtF7mKNcst4xaaVg8jYPG1gjbBowCSTmtsZrLD wXSCm6XDLcVPIAbDrRy9DCRJ0QfNUmG5fkEBE74rIETobvxtrmQtOIWw31ZfcQ== 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 4Y20vH4CyxzZwl; Mon, 2 Dec 2024 10:51:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2Ap7EX044062; Mon, 2 Dec 2024 10:51:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2Ap7Ml044059; Mon, 2 Dec 2024 10:51:07 GMT (envelope-from git) Date: Mon, 2 Dec 2024 10:51:07 GMT Message-Id: <202412021051.4B2Ap7Ml044059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: 4a0fc138e5eb - main - tools: add arc4random_uniform() bias test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a0fc138e5eb343e45388e66698a4765b308a622 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=4a0fc138e5eb343e45388e66698a4765b308a622 commit 4a0fc138e5eb343e45388e66698a4765b308a622 Author: Robert Clausecker AuthorDate: 2024-11-27 17:37:58 +0000 Commit: Robert Clausecker CommitDate: 2024-12-02 10:41:11 +0000 tools: add arc4random_uniform() bias test This test program executed arc4random_uniform() repeatedly and analyzes the distribution of return values, showing how similar the parameters of the observed outcome are to the expected parameters of an equidistribution. This cannot be a unit test as it takes quite a while to run and lots of memory (~3 GB) to execute. Reviewed by: cem Approved by: emaste Differential Revision: https://reviews.freebsd.org/D47659 --- tools/test/README | 2 +- tools/test/arc4random/biastest.c | 216 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 217 insertions(+), 1 deletion(-) diff --git a/tools/test/README b/tools/test/README index a54964621cd8..894aa051c6c1 100644 --- a/tools/test/README +++ b/tools/test/README @@ -1,4 +1,3 @@ - This directory is for standalone test programs. For the FreeBSD Test Suite, which uses Kyua, please see /usr/src/tests/ @@ -7,6 +6,7 @@ and either tries to break it or measures its performance. Please make a subdir per program, and add a brief description to this file. +arc4random Bias test for arc4random_uniform() auxinfo Return information on page sizes, CPUs, and OS release date. devrandom Programs to test /dev/*random. gpioevents Test delivery of gpio pin-change events to userland. diff --git a/tools/test/arc4random/biastest.c b/tools/test/arc4random/biastest.c new file mode 100644 index 000000000000..2fd4363b7869 --- /dev/null +++ b/tools/test/arc4random/biastest.c @@ -0,0 +1,216 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Robert Clausecker + * + * biastest.c -- bias test for arc4random_uniform(). + * + * The default configuration of this test has an upper bound of + * (3/4) * UINT32_MAX, which should give a high amount of bias in + * an incorrect implementation. If the range reduction is + * implemented correctly, the parameters of the statistic should + * closely match the expected values. If not, they'll differ. + * + * For memory usage reasons, we use an uchar to track the number of + * observations per bucket. If the number of tries is much larger + * than upper_bound, the buckets likely overflow. This is detected + * by the test, but will lead to incorrect results. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void collect_sample(unsigned char *, long long, uint32_t); +static void analyze_sample(const unsigned char *, long long, uint32_t); + +static atomic_bool complete = false; +static long long tries = 5ULL << 32; +static atomic_llong tries_done = 0; + +static void +usage(const char *argv0) +{ + fprintf(stderr, "usage: %s [-n tries] [-t upper_bound]\n", argv0); + exit(EXIT_FAILURE); +} + +int +main(int argc, char *argv[]) +{ + uint32_t threshold = 3UL << 30; + int ch; + unsigned char *sample; + + while (ch = getopt(argc, argv, "n:t:"), ch != EOF) + switch (ch) { + case 'n': + tries = atoll(optarg); + break; + + case 't': + threshold = (uint32_t)atoll(optarg); + break; + + default: + usage(argv[0]); + } + + if (optind != argc) + usage(argv[0]); + + if (threshold == 0) { + fprintf(stderr, "threshold must be between 1 and %lu\n", (unsigned long)UINT32_MAX); + exit(EXIT_FAILURE); + } + + sample = calloc(threshold, 1); + if (sample == NULL) { + perror("calloc(threshold, 1)"); + return (EXIT_FAILURE); + } + + collect_sample(sample, tries, threshold); + analyze_sample(sample, tries, threshold); +} + +static void +progress(int signo) +{ + (void)signo; + + if (!complete) { + fprintf(stderr, "\r%10lld of %10lld samples taken (%5.2f%% done)", + tries_done, tries, (tries_done * 100.0) / tries); + + signal(SIGALRM, progress); + alarm(1); + } +} + +static void +collect_sample(unsigned char *sample, long long tries, uint32_t threshold) +{ + long long i; + uint32_t x; + bool overflowed = false; + + progress(SIGALRM); + + for (i = 0; i < tries; i++) { + x = arc4random_uniform(threshold); + tries_done++; + assert(x < threshold); + + if (sample[x] == UCHAR_MAX) { + if (!overflowed) { + printf("sample table overflow, results will be incorrect\n"); + overflowed = true; + } + } else + sample[x]++; + } + + progress(SIGALRM); + complete = true; + fputc('\n', stderr); +} + +static void +analyze_sample(const unsigned char *sample, long long tries, uint32_t threshold) +{ + double discrepancy, average, variance, total; + long long histogram[UCHAR_MAX + 1] = { 0 }, sum, n, median; + uint32_t i, i_min, i_max; + int min, max; + + printf("distribution properties:\n"); + + /* find median, average, deviation, smallest, and largest bucket */ + total = 0.0; + for (i = 0; i < threshold; i++) { + histogram[sample[i]]++; + total += (double)i * sample[i]; + } + + average = total / tries; + + variance = 0.0; + median = threshold; + n = 0; + i_min = 0; + i_max = 0; + min = sample[i_min]; + max = sample[i_max]; + + for (i = 0; i < threshold; i++) { + discrepancy = i - average; + variance += sample[i] * discrepancy * discrepancy; + + n += sample[i]; + if (median == threshold && n > tries / 2) + median = i; + + if (sample[i] < min) { + i_min = i; + min = sample[i_min]; + } else if (sample[i] > max) { + i_max = i; + max = sample[i_max]; + } + } + + variance /= tries; + assert(median < threshold); + + printf("\tthreshold: %lu\n", (unsigned long)threshold); + printf("\tobservations: %lld\n", tries); + printf("\tleast common: %lu (%d observations)\n", (unsigned long)i_min, min); + printf("\tmost common: %lu (%d observations)\n", (unsigned long)i_max, max); + printf("\tmedian: %lld (expected %lu)\n", median, (unsigned long)threshold / 2); + printf("\taverage: %f (expected %f)\n", average, 0.5 * (threshold - 1)); + printf("\tdeviation: %f (expected %f)\n\n", sqrt(variance), + sqrt(((double)threshold * threshold - 1.0) / 12)); + + /* build histogram and analyze it */ + printf("sample properties:\n"); + + /* find median, average, and deviation */ + average = (double)tries / threshold; + + variance = 0.0; + for (i = 0; i < UCHAR_MAX; i++) { + discrepancy = i - average; + variance += histogram[i] * discrepancy * discrepancy; + } + + variance /= threshold; + + n = 0; + median = UCHAR_MAX + 1; + for (i = 0; i <= UCHAR_MAX; i++) { + n += histogram[i]; + if (n >= threshold / 2) { + median = i; + break; + } + } + + assert(median <= UCHAR_MAX); /* unreachable */ + + printf("\tmedian: %lld\n", median); + printf("\taverage: %f\n", average); + printf("\tdeviation: %f (expected %f)\n\n", sqrt(variance), sqrt(average * (1.0 - 1.0 / threshold))); + + printf("histogram:\n"); + for (i = 0; i < 256; i++) + if (histogram[i] != 0) + printf("\t%3d:\t%lld\n", (int)i, histogram[i]); +} From nobody Mon Dec 2 14:20:04 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y25XN6BH7z5ft7G; Mon, 02 Dec 2024 14:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y25XN5dNVz4FF2; Mon, 2 Dec 2024 14:20:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733149204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QYEe78+pzNUb1yn1yqaoSY5HYTovTT0mF/K4UhKTMHc=; b=qwS1zLrynIKndpCVLyvFfVGyelqoP9tw5uLAXtmc8QXH4cz33jvjMX/6syYuGQ0puyuqYl RU204JwLFctG1tbkTGZeABnEzVHEzVihjCtlD8j7Kfea6DBU4IHkLNyPODZyYmY1KpP9VF xBsKAAEjsLiWJnQK2RWZfdQe9xtJdICUj4KoekGoywhLvW7CQWHeTewaj7DDBsCowUD7im SfNgS6pE3i6Jo036PTIVhB9JzmW1XuWO/WZEyyQW39BbjZBQCkW5/+FUPXGrqBoM0H8cvr fk2bwv7m4wwDEgAtZ/RbI2nQJDSFhFUknbZxJ77f9huG81x00qUhpK5o22PYYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733149204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QYEe78+pzNUb1yn1yqaoSY5HYTovTT0mF/K4UhKTMHc=; b=pTPzG8PxylKjHIjaS5qpXpvzly3D0hKUIz4i149a2RBGlA/T7i3pK0jlLeQCl06XfjBul2 t16t4Qu16v1INOcmCFwN3SoyL/j9UJaiFBPx6R8XB17XVcCu/C/z6jVVttDi1iRjDZvyNq IxGCJDCiS1zprfxYPpAV6uYfrReF+qQd99j+g+rWwsJuwYi9UDre4X28qVIzAEzJt+ij6X zUvySxKzF/t1hP04OADboXe7VOd4mmC281cjwMjnLm6rqVJfhk5g0M8uB6aNfpxcyVe48X PO2j2YxWbgm5rZbJ/YwyGNGRz8b1U9gYSyDep7KOCcXro8tCgreEbd+MjFQxRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733149204; a=rsa-sha256; cv=none; b=NB6umPVK5B3DGj8lSqINklAOZERcrz93Pn4thqtE71PIxpe3ObuT3x2MiyoULMRys5+VbR Eq5eJ02CeLAuoy87I5EIeZrSue5isEM1BgQEE5QpgunjHGVCnEh6bPl05Z0NiD0js5xJZj X6iT9j47aE1LEfsqO9RorI+Y0PWseEYbxytd6kDnRCKDXwdsDixSJKpSwCJ9sS/L0KZoiz OPFLXTlf1SWZda3zT9qAlZYcVuHNSK/r82uVsJwFfT/Dr1LHXumJTKQGF0u+R1SblR5D7/ zpAqNYpGDoqvh6yOqPKJXdzeb6aT3n7Ivq6FHH4DLB0LAHyyPYrHdK3hKiWriw== 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 4Y25XN5DJlzgj1; Mon, 2 Dec 2024 14:20:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2EK4fj030802; Mon, 2 Dec 2024 14:20:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2EK4Tj030797; Mon, 2 Dec 2024 14:20:04 GMT (envelope-from git) Date: Mon, 2 Dec 2024 14:20:04 GMT Message-Id: <202412021420.4B2EK4Tj030797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 2bb61497ca76 - main - elf_common.h: Add definitions for LoongArch ELF files List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 2bb61497ca76646c92f25127b8d4d64281123400 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2bb61497ca76646c92f25127b8d4d64281123400 commit 2bb61497ca76646c92f25127b8d4d64281123400 Author: Haowu Ge AuthorDate: 2024-12-02 11:36:28 +0000 Commit: Ed Maste CommitDate: 2024-12-02 14:19:33 +0000 elf_common.h: Add definitions for LoongArch ELF files Including e_machine, e_flags and relocation types. References: Loongson documentation: https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc LLVM reviews / commits: https://reviews.llvm.org/D134601 https://reviews.llvm.org/D115859 https://reviews.llvm.org/D131467 https://reviews.llvm.org/D152184 https://github.com/llvm/llvm-project/pull/73345 https://github.com/llvm/llvm-project/pull/77039 Binutils commits: 6d13722a97cee3fd397e116bde3bcedbb1e220be 9801120721c3a702ce3bd50433ef920f92a83502 57a930e3bfe4b2c7fd6463ed39311e1938513138 Reviewed by: markj, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1532 --- sys/sys/elf_common.h | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h index ec5bbbf9f0e6..766ff6ede51b 100644 --- a/sys/sys/elf_common.h +++ b/sys/sys/elf_common.h @@ -306,6 +306,7 @@ typedef struct { and MPRC of Peking University */ #define EM_AARCH64 183 /* AArch64 (64-bit ARM) */ #define EM_RISCV 243 /* RISC-V */ +#define EM_LOONGARCH 258 /* Loongson LoongArch */ /* Non-standard or deprecated. */ #define EM_486 6 /* Intel i486. */ @@ -382,6 +383,25 @@ typedef struct { #define EF_RISCV_RVE 0x00000008 #define EF_RISCV_TSO 0x00000010 +/* + * Loongson LoongArch Specific e_flags + * + * Definitions from LoongArch ELF psABI v2.01. + * Reference: https://github.com/loongson/LoongArch-Documentation + * (commit hash 296de4def055c871809068e0816325a4ac04eb12) + */ + +/* LoongArch Base ABI Modifiers */ +#define EF_LOONGARCH_ABI_SOFT_FLOAT 0x00000001 +#define EF_LOONGARCH_ABI_SINGLE_FLOAT 0x00000002 +#define EF_LOONGARCH_ABI_DOUBLE_FLOAT 0x00000003 +#define EF_LOONGARCH_ABI_MODIFIER_MASK 0x00000007 + +/* LoongArch Object file ABI versions */ +#define EF_LOONGARCH_OBJABI_V0 0x00000000 +#define EF_LOONGARCH_OBJABI_V1 0x00000040 +#define EF_LOONGARCH_OBJABI_MASK 0x000000C0 + #define EF_SPARC_EXT_MASK 0x00ffff00 #define EF_SPARC_32PLUS 0x00000100 #define EF_SPARC_SUN_US1 0x00000200 @@ -1380,6 +1400,162 @@ typedef struct { #define R_RISCV_32_PCREL 57 #define R_RISCV_IRELATIVE 58 +/* + * Loongson LoongArch relocation types. + * + * LoongArch ELF psABI: https://github.com/loongson/LoongArch-Documentation + * (commit hash 9b3bd9f4a497115913c22f1a2a47863798fbc02a) + */ + +/* Relocation types used by the dynamic linker */ +#define R_LARCH_NONE 0 +#define R_LARCH_32 1 +#define R_LARCH_64 2 +#define R_LARCH_RELATIVE 3 +#define R_LARCH_COPY 4 +#define R_LARCH_JUMP_SLOT 5 +#define R_LARCH_TLS_DTPMOD32 6 +#define R_LARCH_TLS_DTPMOD64 7 +#define R_LARCH_TLS_DTPREL32 8 +#define R_LARCH_TLS_DTPREL64 9 +#define R_LARCH_TLS_TPREL32 10 +#define R_LARCH_TLS_TPREL64 11 +#define R_LARCH_IRELATIVE 12 +#define R_LARCH_MARK_LA 20 +#define R_LARCH_MARK_PCREL 21 +#define R_LARCH_SOP_PUSH_PCREL 22 +#define R_LARCH_SOP_PUSH_ABSOLUTE 23 +#define R_LARCH_SOP_PUSH_DUP 24 +#define R_LARCH_SOP_PUSH_GPREL 25 +#define R_LARCH_SOP_PUSH_TLS_TPREL 26 +#define R_LARCH_SOP_PUSH_TLS_GOT 27 +#define R_LARCH_SOP_PUSH_TLS_GD 28 +#define R_LARCH_SOP_PUSH_PLT_PCREL 29 +#define R_LARCH_SOP_ASSERT 30 +#define R_LARCH_SOP_NOT 31 +#define R_LARCH_SOP_SUB 32 +#define R_LARCH_SOP_SL 33 +#define R_LARCH_SOP_SR 34 +#define R_LARCH_SOP_ADD 35 +#define R_LARCH_SOP_AND 36 +#define R_LARCH_SOP_IF_ELSE 37 +#define R_LARCH_SOP_POP_32_S_10_5 38 +#define R_LARCH_SOP_POP_32_U_10_12 39 +#define R_LARCH_SOP_POP_32_S_10_12 40 +#define R_LARCH_SOP_POP_32_S_10_16 41 +#define R_LARCH_SOP_POP_32_S_10_16_S2 42 +#define R_LARCH_SOP_POP_32_S_5_20 43 +#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44 +#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45 +#define R_LARCH_SOP_POP_32_U 46 +#define R_LARCH_ADD8 47 +#define R_LARCH_ADD16 48 +#define R_LARCH_ADD24 49 +#define R_LARCH_ADD32 50 +#define R_LARCH_ADD64 51 +#define R_LARCH_SUB8 52 +#define R_LARCH_SUB16 53 +#define R_LARCH_SUB24 54 +#define R_LARCH_SUB32 55 +#define R_LARCH_SUB64 56 +#define R_LARCH_GNU_VTINHERIT 57 +#define R_LARCH_GNU_VTENTRY 58 + +/* + * Relocs whose processing do not require a stack machine. + * + * Spec addition: https://github.com/loongson/LoongArch-Documentation/pull/57 + */ +#define R_LARCH_B16 64 +#define R_LARCH_B21 65 +#define R_LARCH_B26 66 +#define R_LARCH_ABS_HI20 67 +#define R_LARCH_ABS_LO12 68 +#define R_LARCH_ABS64_LO20 69 +#define R_LARCH_ABS64_HI12 70 +#define R_LARCH_PCALA_HI20 71 +#define R_LARCH_PCALA_LO12 72 +#define R_LARCH_PCALA64_LO20 73 +#define R_LARCH_PCALA64_HI12 74 +#define R_LARCH_GOT_PC_HI20 75 +#define R_LARCH_GOT_PC_LO12 76 +#define R_LARCH_GOT64_PC_LO20 77 +#define R_LARCH_GOT64_PC_HI12 78 +#define R_LARCH_GOT_HI20 79 +#define R_LARCH_GOT_LO12 80 +#define R_LARCH_GOT64_LO20 81 +#define R_LARCH_GOT64_HI12 82 +#define R_LARCH_TLS_LE_HI20 83 +#define R_LARCH_TLS_LE_LO12 84 +#define R_LARCH_TLS_LE64_LO20 85 +#define R_LARCH_TLS_LE64_HI12 86 +#define R_LARCH_TLS_IE_PC_HI20 87 +#define R_LARCH_TLS_IE_PC_LO12 88 +#define R_LARCH_TLS_IE64_PC_LO20 89 +#define R_LARCH_TLS_IE64_PC_HI12 90 +#define R_LARCH_TLS_IE_HI20 91 +#define R_LARCH_TLS_IE_LO12 92 +#define R_LARCH_TLS_IE64_LO20 93 +#define R_LARCH_TLS_IE64_HI12 94 +#define R_LARCH_TLS_LD_PC_HI20 95 +#define R_LARCH_TLS_LD_HI20 96 +#define R_LARCH_TLS_GD_PC_HI20 97 +#define R_LARCH_TLS_GD_HI20 98 +#define R_LARCH_32_PCREL 99 +#define R_LARCH_RELAX 100 + +/* + * Relocs added in ELF for the LoongArch™ Architecture v20230519, part of the + * v2.10 LoongArch ABI specs. + * + * Spec addition: https://github.com/loongson/la-abi-specs/pull/1 + * + * Note that the 101 and 104 relocation numbers are defined as R_LARCH_DELETE + * and R_LARCH_CFA respectively in psABI 2.10. But they are marked as reserved + * in psABI v2.20 because they were proved not necessary to be exposed outside + * of the linker. + */ +#define R_LARCH_ALIGN 102 +#define R_LARCH_PCREL20_S2 103 +#define R_LARCH_ADD6 105 +#define R_LARCH_SUB6 106 +#define R_LARCH_ADD_ULEB128 107 +#define R_LARCH_SUB_ULEB128 108 +#define R_LARCH_64_PCREL 109 + +/* + * Relocs added in ELF for the LoongArch™ Architecture v20231102, part of the + * v2.20 LoongArch ABI specs. + * + * Spec addition: https://github.com/loongson/la-abi-specs/pull/4 + */ +#define R_LARCH_CALL36 110 + +/* + * Relocs added in ELF for the LoongArch™ Architecture v20231219, part of the + * v2.30 LoongArch ABI specs. + * + * Spec addition: https://github.com/loongson/la-abi-specs/pull/5 + */ +#define R_LARCH_TLS_DESC32 13 +#define R_LARCH_TLS_DESC64 14 +#define R_LARCH_TLS_DESC_PC_HI20 111 +#define R_LARCH_TLS_DESC_PC_LO12 112 +#define R_LARCH_TLS_DESC64_PC_LO20 113 +#define R_LARCH_TLS_DESC64_PC_HI12 114 +#define R_LARCH_TLS_DESC_HI20 115 +#define R_LARCH_TLS_DESC_LO12 116 +#define R_LARCH_TLS_DESC64_LO20 117 +#define R_LARCH_TLS_DESC64_HI12 118 +#define R_LARCH_TLS_DESC_LD 119 +#define R_LARCH_TLS_DESC_CALL 120 +#define R_LARCH_TLS_LE_HI20_R 121 +#define R_LARCH_TLS_LE_ADD_R 122 +#define R_LARCH_TLS_LE_LO12_R 123 +#define R_LARCH_TLS_LD_PCREL20_S2 124 +#define R_LARCH_TLS_GD_PCREL20_S2 125 +#define R_LARCH_TLS_DESC_PCREL20_S2 126 + #define R_SPARC_NONE 0 #define R_SPARC_8 1 #define R_SPARC_16 2 From nobody Mon Dec 2 16:27:20 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y28MD2dfTz5g534; Mon, 02 Dec 2024 16:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y28MD1qQ2z4Tch; Mon, 2 Dec 2024 16:27:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xJbpZ1RHlrxW2ca1Bryeqjv6OSnHURFw/JHjNIh8h+k=; b=sTiztGF6RZT89k2I9oCx0hCVyYbXJktw+IhQQxON/f4adw/Fgz1/MdtA4Vd5Fafc6zbErP 3YrNfsza4QgqkJuYXBAikwJN/h38deX2uP2Ed/a31cC8SFKjDsslKs1y/+PKSTAF33fRfw udCX8/gVFlaP+HIkgeUhFraslh2GNcbM5E2bYcMAT4u7dfIFy9pTCryJpRRqiBO/X0BbA+ HK1qcXzhKtn3WBpKONbQuLEpYQ1IPvg6eJOsS4Vc/86TPJxJedi5m0PqJRzg7BQkMFyHgy CAgCdRcvn6RJz3iTl+4ZPfq9vnqFPHUydMrz/S7dpzLMyIGaww0wjifwZa4epg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xJbpZ1RHlrxW2ca1Bryeqjv6OSnHURFw/JHjNIh8h+k=; b=Q4M17v5TqTn95O3iT/A8/XlqVS/ZWYMtJH5Nl6O2hbLaGTraAhxU/C0hqTMTm7LMl2E4ZB kC5Sd5hk+qPErQTD8Fzm7apOUvPwc4nDT4vxrSXMR5KyLlvDtXyusuJWmqUvGeWMJc3/WW DiyRs9sNFGWo1ROAs24F9QCjF/mpstMNH+TZZbmY49C9vidBrqAa+q61WQ+6T4uhjLiTA+ 0n1yUZV4K97aWWdPgtAqRoR0NxGVX+eRif4Gq93ikENzgjh3vwHHUmn8PNu4eL9aDZVwEU 4dHvqgH+Yf8VtzGNfgNaUcamQyiM281fpPw+3zU7Idm1SVlmFVR5GyC9zhnD9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733156840; a=rsa-sha256; cv=none; b=SvnxWU056jUDzJEiJOnXtCnNlHBKK6Unpd4T2mNSpHWzGNiLx7lFEtS97G02l0hBeuwg84 918VA+lJhvA/082o+hQuqsCsp6/sR0IPHVPIV/yVfY8fr6yH0YVItNbq9raRKxnBSXxC/Y M1vH06JzrWgfXmIttVBMjopGAD+x5i7E4PMkh4oiZE7zzNfslEfIbWoHhng44oQOMt6zzA ZyHK9LuyaaBQ7NFd8J1ryTCVotJE/dzNyotxgO/HSj2HaH5hyK7QZaqe4gJvEHJZDK2YAL h7Ww7IqaKn94A9yN9riLvxpaWXNjHk+qCC5kpHWLwLtjwi892xIrV0jyEzNYEg== 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 4Y28MD1J4PzlMy; Mon, 2 Dec 2024 16:27:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2GRKC7070685; Mon, 2 Dec 2024 16:27:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2GRK6E070682; Mon, 2 Dec 2024 16:27:20 GMT (envelope-from git) Date: Mon, 2 Dec 2024 16:27:20 GMT Message-Id: <202412021627.4B2GRK6E070682@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 0b4e32912566 - main - sound: Merge ac97 and ac97_patch List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b4e32912566d802c7a6501d9ce8119f04dbc2fb Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=0b4e32912566d802c7a6501d9ce8119f04dbc2fb commit 0b4e32912566d802c7a6501d9ce8119f04dbc2fb Author: Christos Margiolis AuthorDate: 2024-12-02 16:26:20 +0000 Commit: Christos Margiolis CommitDate: 2024-12-02 16:26:20 +0000 sound: Merge ac97 and ac97_patch No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47732 --- sys/conf/files | 1 - sys/dev/sound/pcm/ac97.c | 96 +++++++++++++++++++++++++++++++- sys/dev/sound/pcm/ac97_patch.c | 117 --------------------------------------- sys/dev/sound/pcm/ac97_patch.h | 35 ------------ sys/modules/sound/sound/Makefile | 2 +- 5 files changed, 96 insertions(+), 155 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 9b50c4e08274..5b05caddde08 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3132,7 +3132,6 @@ dev/sound/pci/hdspe.c optional snd_hdspe pci dev/sound/pci/hdspe-pcm.c optional snd_hdspe pci dev/sound/pcm/ac97.c optional sound dev/sound/pcm/ac97_if.m optional sound -dev/sound/pcm/ac97_patch.c optional sound dev/sound/pcm/buffer.c optional sound \ dependency "snd_fxdiv_gen.h" dev/sound/pcm/channel.c optional sound diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index d04ec2d8271c..71eb387afa1b 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -32,7 +32,6 @@ #include #include -#include #include @@ -40,6 +39,8 @@ static MALLOC_DEFINE(M_AC97, "ac97", "ac97 codec"); +typedef void (*ac97_patch)(struct ac97_info *); + struct ac97mixtable_entry { int reg; /* register index */ /* reg < 0 if inverted polarity */ @@ -133,6 +134,12 @@ static const struct ac97_vendorid ac97vendorid[] = { { 0x00000000, NULL } }; +static void ad1886_patch(struct ac97_info *); +static void ad198x_patch(struct ac97_info *); +static void ad1981b_patch(struct ac97_info *); +static void cmi9739_patch(struct ac97_info *); +static void alc655_patch(struct ac97_info *); + static struct ac97_codecid ac97codecid[] = { { 0x41445303, 0x00, 0, "AD1819", 0 }, { 0x41445340, 0x00, 0, "AD1881", 0 }, @@ -872,6 +879,93 @@ ac97_getflags(struct ac97_info *codec) return codec->flags; } +static void +ad1886_patch(struct ac97_info *codec) +{ +#define AC97_AD_JACK_SPDIF 0x72 + /* + * Presario700 workaround + * for Jack Sense/SPDIF Register misetting causing + * no audible output + * by Santiago Nullo 04/05/2002 + */ + ac97_wrcd(codec, AC97_AD_JACK_SPDIF, 0x0010); +} + +static void +ad198x_patch(struct ac97_info *codec) +{ + switch (ac97_getsubvendor(codec)) { + case 0x11931043: /* Not for ASUS A9T (probably else too). */ + break; + default: + ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420); + break; + } +} + +static void +ad1981b_patch(struct ac97_info *codec) +{ + /* + * Enable headphone jack sensing. + */ + switch (ac97_getsubvendor(codec)) { + case 0x02d91014: /* IBM Thinkcentre */ + case 0x099c103c: /* HP nx6110 */ + ac97_wrcd(codec, AC97_AD_JACK_SPDIF, + ac97_rdcd(codec, AC97_AD_JACK_SPDIF) | 0x0800); + break; + default: + break; + } +} + +static void +cmi9739_patch(struct ac97_info *codec) +{ + /* + * Few laptops need extra register initialization + * to power up the internal speakers. + */ + switch (ac97_getsubvendor(codec)) { + case 0x18431043: /* ASUS W1000N */ + ac97_wrcd(codec, AC97_REG_POWER, 0x000f); + ac97_wrcd(codec, AC97_MIXEXT_CLFE, 0x0000); + ac97_wrcd(codec, 0x64, 0x7110); + break; + default: + break; + } +} + +static void +alc655_patch(struct ac97_info *codec) +{ + /* + * MSI (Micro-Star International) specific EAPD quirk. + */ + switch (ac97_getsubvendor(codec)) { + case 0x00611462: /* MSI S250 */ + case 0x01311462: /* MSI S270 */ + case 0x01611462: /* LG K1 Express */ + case 0x03511462: /* MSI L725 */ + ac97_wrcd(codec, 0x7a, ac97_rdcd(codec, 0x7a) & 0xfffd); + break; + case 0x10ca1734: + /* + * Amilo Pro V2055 with ALC655 has phone out by default + * disabled (surround on), leaving us only with internal + * speakers. This should really go to mixer. We write the + * Data Flow Control reg. + */ + ac97_wrcd(codec, 0x6a, ac97_rdcd(codec, 0x6a) | 0x0001); + break; + default: + break; + } +} + /* -------------------------------------------------------------------- */ static int diff --git a/sys/dev/sound/pcm/ac97_patch.c b/sys/dev/sound/pcm/ac97_patch.c deleted file mode 100644 index 671b6598f51a..000000000000 --- a/sys/dev/sound/pcm/ac97_patch.c +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2002 Orion Hodson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY 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. - */ - -#ifdef HAVE_KERNEL_OPTION_HEADERS -#include "opt_snd.h" -#endif - -#include -#include -#include - -void ad1886_patch(struct ac97_info* codec) -{ -#define AC97_AD_JACK_SPDIF 0x72 - /* - * Presario700 workaround - * for Jack Sense/SPDIF Register misetting causing - * no audible output - * by Santiago Nullo 04/05/2002 - */ - ac97_wrcd(codec, AC97_AD_JACK_SPDIF, 0x0010); -} - -void ad198x_patch(struct ac97_info* codec) -{ - switch (ac97_getsubvendor(codec)) { - case 0x11931043: /* Not for ASUS A9T (probably else too). */ - break; - default: - ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420); - break; - } -} - -void ad1981b_patch(struct ac97_info* codec) -{ - /* - * Enable headphone jack sensing. - */ - switch (ac97_getsubvendor(codec)) { - case 0x02d91014: /* IBM Thinkcentre */ - case 0x099c103c: /* HP nx6110 */ - ac97_wrcd(codec, AC97_AD_JACK_SPDIF, - ac97_rdcd(codec, AC97_AD_JACK_SPDIF) | 0x0800); - break; - default: - break; - } -} - -void cmi9739_patch(struct ac97_info* codec) -{ - /* - * Few laptops need extra register initialization - * to power up the internal speakers. - */ - switch (ac97_getsubvendor(codec)) { - case 0x18431043: /* ASUS W1000N */ - ac97_wrcd(codec, AC97_REG_POWER, 0x000f); - ac97_wrcd(codec, AC97_MIXEXT_CLFE, 0x0000); - ac97_wrcd(codec, 0x64, 0x7110); - break; - default: - break; - } -} - -void alc655_patch(struct ac97_info* codec) -{ - /* - * MSI (Micro-Star International) specific EAPD quirk. - */ - switch (ac97_getsubvendor(codec)) { - case 0x00611462: /* MSI S250 */ - case 0x01311462: /* MSI S270 */ - case 0x01611462: /* LG K1 Express */ - case 0x03511462: /* MSI L725 */ - ac97_wrcd(codec, 0x7a, ac97_rdcd(codec, 0x7a) & 0xfffd); - break; - case 0x10ca1734: - /* - * Amilo Pro V2055 with ALC655 has phone out by default - * disabled (surround on), leaving us only with internal - * speakers. This should really go to mixer. We write the - * Data Flow Control reg. - */ - ac97_wrcd(codec, 0x6a, ac97_rdcd(codec, 0x6a) | 0x0001); - break; - default: - break; - } -} diff --git a/sys/dev/sound/pcm/ac97_patch.h b/sys/dev/sound/pcm/ac97_patch.h deleted file mode 100644 index 997b10dbd02c..000000000000 --- a/sys/dev/sound/pcm/ac97_patch.h +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2003 Orion Hodson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY 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. - */ - -typedef void (*ac97_patch)(struct ac97_info*); - -void ad1886_patch(struct ac97_info*); -void ad198x_patch(struct ac97_info*); -void ad1981b_patch(struct ac97_info*); -void cmi9739_patch(struct ac97_info*); -void alc655_patch(struct ac97_info*); diff --git a/sys/modules/sound/sound/Makefile b/sys/modules/sound/sound/Makefile index f31a751b3f29..d2cfed2f4b6a 100644 --- a/sys/modules/sound/sound/Makefile +++ b/sys/modules/sound/sound/Makefile @@ -15,7 +15,7 @@ SRCS+= feeder_matrix.c feeder_mixer.c SRCS+= feeder_eq_gen.h feeder_rate_gen.h snd_fxdiv_gen.h SRCS+= mpu_if.h mpufoi_if.h synth_if.h SRCS+= mpu_if.c mpufoi_if.c synth_if.c -SRCS+= ac97.c ac97_patch.c buffer.c channel.c dsp.c +SRCS+= ac97.c buffer.c channel.c dsp.c SRCS+= mixer.c sndstat.c sound.c vchan.c SRCS+= midi.c mpu401.c sequencer.c From nobody Mon Dec 2 16:27:21 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y28MF309Gz5g4vP; Mon, 02 Dec 2024 16:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y28MF2Rcnz4THk; Mon, 2 Dec 2024 16:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IZkciBZ9ydHkWv5ESbBoJoN2n10HlKQUZp3RShYAV+8=; b=tKm1IBeCBDYUIHd1ViC3+eeSZ8o13J/eUbB91qvYX9x7EPUvnObFJ8yQyONWpgTPbgegch TIhOHpEdp/igmkOO/KNxbTzTyP4Gth4Y/IYlQDmdc5Qgoveee7pk8cpqFyIfxn4pQvo8gq 6GbG8FPBYVMmgIKJ1gVweOzZ5CGlB5oLEpqhCfA1mVlRVITg+FZc1mGdRv7MmgxeORtxFX /wCX5hMs0PrfuYoOVG/fs/MiFLEgL6dv3EK2xFQWdyLkhRJVGDlI26KkIKyJ1GvTW1c289 I3zMRIdsF3vDHz6s4a8u70Z6ETp+/Bqu1UhjALEvq3o1eXVEz8ecJhxsQ7GyLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IZkciBZ9ydHkWv5ESbBoJoN2n10HlKQUZp3RShYAV+8=; b=NogTbgZdwOua4NazNZo6UPWaj6n2jky7xfdGtmgl4DWlteBH8seUy2Czmk6V4TInmoPET0 fk5c0wWJ3ulps0JJg6QlMCUqAX0RyUizqVZnGdrm5xoyxaKjlhPAxpRLYaBQvxy67Qu90e 1mR5PRaDU6ONa+GFhG4xllaYtLjVgvMAFJK4DlGOc9rNeT/db3irbbwmOZXzXkHQYJkhhU 0sAAzqpNfsIyE8qGTzDxVBFOXkRRYtJOo61rzpndzvYroQMwEr0l94RdIv2ILqQeGqNPXw wth1mhGJIZZSZbU2jpllkOWyoX+3e0eA2dytThyHZD1SQw1Tlml2m0MPGOzotA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733156841; a=rsa-sha256; cv=none; b=R482fVfqShvi0wVt/EsMY4E5RHKQwnIkl74W6W/xW+nvnnpQdd9FAgWavgY6ud+yG9Fi3R WgmK7NfkqlWbIkz3lDVtEJh3z8dHXZytvvU6+ieD0EpCgtfCu/yA2B3cTUkctOPUI2MO+D P/ibt7e1iPyOz3kYj/uMGe85I6SNrlYcixxZUzOcvWD+0L0op/hEdmmfIJ0ddcReoPMOhD yVSQFmUh52RNkymANQh47BJYb0uNCikh4IeryhV/VdlOP5e7i3N3l8VMN9AjCpk4YmTcxk mTjDFra0PAtEboHnBDMA963kDpP3PrPwgpdWJYoKD6X9L8Vwv28rodhAfPKTdg== 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 4Y28MF22WLzlLc; Mon, 2 Dec 2024 16:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2GRLnZ070732; Mon, 2 Dec 2024 16:27:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2GRLsu070729; Mon, 2 Dec 2024 16:27:21 GMT (envelope-from git) Date: Mon, 2 Dec 2024 16:27:21 GMT Message-Id: <202412021627.4B2GRLsu070729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 00731aaaed76 - main - sound: Remove dead code from pcm/ List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00731aaaed76785af8befe13e9a4e85b3554b3f5 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=00731aaaed76785af8befe13e9a4e85b3554b3f5 commit 00731aaaed76785af8befe13e9a4e85b3554b3f5 Author: Christos Margiolis AuthorDate: 2024-12-02 16:26:27 +0000 Commit: Christos Margiolis CommitDate: 2024-12-02 16:26:27 +0000 sound: Remove dead code from pcm/ No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D47733 --- sys/dev/sound/pcm/ac97.c | 23 ------------------ sys/dev/sound/pcm/buffer.c | 9 ------- sys/dev/sound/pcm/channel.c | 53 ----------------------------------------- sys/dev/sound/pcm/dsp.c | 22 ----------------- sys/dev/sound/pcm/feeder.h | 26 -------------------- sys/dev/sound/pcm/feeder_rate.c | 21 ---------------- 6 files changed, 154 deletions(-) diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index 71eb387afa1b..f5ca06cd3942 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -322,12 +322,6 @@ ac97_rdcd(struct ac97_info *codec, int reg) i[1] = AC97_READ(codec->methods, codec->devinfo, reg); while (i[0] != i[1] && j) i[j-- & 1] = AC97_READ(codec->methods, codec->devinfo, reg); -#if 0 - if (j < 100) { - device_printf(codec->dev, "%s(): Inconsistent register value at" - " 0x%08x (retry: %d)\n", __func__, reg, 100 - j); - } -#endif return i[!(j & 1)]; } return AC97_READ(codec->methods, codec->devinfo, reg); @@ -512,9 +506,6 @@ ac97_setmixer(struct ac97_info *codec, unsigned channel, unsigned left, unsigned snd_mtxunlock(codec->lock); return left | (right << 8); } else { -#if 0 - printf("ac97_setmixer: reg=%d, bits=%d, enable=%d\n", e->reg, e->bits, e->enable); -#endif return -1; } } @@ -737,10 +728,6 @@ ac97_initmixer(struct ac97_info *codec) for (j = 0; k >> j; j++) ; if (j != 0) { -#if 0 - device_printf(codec->dev, "%2d: [ac97_rdcd() = %d] [Testbit = %d] %d -> %d\n", - i, k, bit, codec->mix[i].bits, j); -#endif codec->mix[i].enable = 1; codec->mix[i].bits = j; } else if (reg == AC97_MIX_BEEP) { @@ -756,9 +743,6 @@ ac97_initmixer(struct ac97_info *codec) codec->mix[i].enable = 0; ac97_wrcd(codec, reg, old); } -#if 0 - printf("mixch %d, en=%d, b=%d\n", i, codec->mix[i].enable, codec->mix[i].bits); -#endif } device_printf(codec->dev, "<%s>\n", @@ -1097,13 +1081,6 @@ ac97mix_init(struct snd_mixer *m) if (pcm_getflags(codec->dev) & SD_F_SOFTPCMVOL) ac97_wrcd(codec, AC97_MIX_PCM, 0); -#if 0 - /* XXX For the sake of debugging purposes */ - mix_setparentchild(m, SOUND_MIXER_VOLUME, - SOUND_MASK_PCM | SOUND_MASK_CD); - mix_setrealdev(m, SOUND_MIXER_VOLUME, SOUND_MIXER_NONE); - ac97_wrcd(codec, AC97_MIX_MASTER, 0); -#endif mask = 0; for (i = 0; i < AC97_MIXER_SIZE; i++) diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c index afb4b95e357a..8bf3631afb7a 100644 --- a/sys/dev/sound/pcm/buffer.c +++ b/sys/dev/sound/pcm/buffer.c @@ -356,15 +356,6 @@ sndbuf_setfmt(struct snd_dbuf *b, u_int32_t fmt) b->fmt = fmt; b->bps = AFMT_BPS(b->fmt); b->align = AFMT_ALIGN(b->fmt); -#if 0 - b->bps = AFMT_CHANNEL(b->fmt); - if (b->fmt & AFMT_16BIT) - b->bps <<= 1; - else if (b->fmt & AFMT_24BIT) - b->bps *= 3; - else if (b->fmt & AFMT_32BIT) - b->bps <<= 2; -#endif return 0; } diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index f619ddd4bc35..728284b055e5 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -405,23 +405,6 @@ chn_wrfeed(struct pcm_channel *c) chn_wakeup(c); } -#if 0 -static void -chn_wrupdate(struct pcm_channel *c) -{ - - CHN_LOCKASSERT(c); - KASSERT(c->direction == PCMDIR_PLAY, ("%s(): bad channel", __func__)); - - if ((c->flags & (CHN_F_MMAP | CHN_F_VIRTUAL)) || CHN_STOPPED(c)) - return; - chn_dmaupdate(c); - chn_wrfeed(c); - /* tell the driver we've updated the primary buffer */ - chn_trigger(c, PCMTRIG_EMLDMAWR); -} -#endif - static void chn_wrintr(struct pcm_channel *c) { @@ -535,22 +518,6 @@ chn_rdfeed(struct pcm_channel *c) chn_wakeup(c); } -#if 0 -static void -chn_rdupdate(struct pcm_channel *c) -{ - - CHN_LOCKASSERT(c); - KASSERT(c->direction == PCMDIR_REC, ("chn_rdupdate on bad channel")); - - if ((c->flags & (CHN_F_MMAP | CHN_F_VIRTUAL)) || CHN_STOPPED(c)) - return; - chn_trigger(c, PCMTRIG_EMLDMARD); - chn_dmaupdate(c); - chn_rdfeed(c); -} -#endif - /* read interrupt routine. Must be called with interrupts blocked. */ static void chn_rdintr(struct pcm_channel *c) @@ -1980,12 +1947,6 @@ chn_resizebuf(struct pcm_channel *c, int latency, hblksz -= hblksz % sndbuf_getalign(b); -#if 0 - hblksz = sndbuf_getmaxsize(b) >> 1; - hblksz -= hblksz % sndbuf_getalign(b); - hblkcnt = 2; -#endif - CHN_UNLOCK(c); if (chn_usefrags == 0 || CHANNEL_SETFRAGMENTS(c->methods, c->devinfo, @@ -2016,14 +1977,6 @@ chn_resizebuf(struct pcm_channel *c, int latency, if (limit > CHN_2NDBUFMAXSIZE) limit = CHN_2NDBUFMAXSIZE; -#if 0 - while (limit > 0 && (sblksz * sblkcnt) > limit) { - if (sblkcnt < 4) - break; - sblkcnt >>= 1; - } -#endif - while ((sblksz * sblkcnt) < limit) sblkcnt <<= 1; @@ -2140,12 +2093,6 @@ chn_setspeed(struct pcm_channel *c, uint32_t speed) uint32_t oldformat, oldspeed, format; int ret; -#if 0 - /* XXX force 48k */ - if (c->format & AFMT_PASSTHROUGH) - speed = AFMT_PASSTHROUGH_RATE; -#endif - oldformat = c->format; oldspeed = c->speed; format = oldformat; diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index ccf240681a25..dcbdd581c82a 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -1257,7 +1257,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct snd_dbuf *bs = wrch->bufsoft; CHN_LOCK(wrch); - /* XXX abusive DMA update: chn_wrupdate(wrch); */ a->bytes = sndbuf_getfree(bs); a->fragments = a->bytes / sndbuf_getblksz(bs); a->fragstotal = sndbuf_getblkcnt(bs); @@ -1275,7 +1274,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct snd_dbuf *bs = rdch->bufsoft; CHN_LOCK(rdch); - /* XXX abusive DMA update: chn_rdupdate(rdch); */ a->bytes = sndbuf_gettotal(bs); a->blocks = sndbuf_getblocks(bs) - rdch->blocks; a->ptr = sndbuf_getfreeptr(bs); @@ -1293,7 +1291,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct snd_dbuf *bs = wrch->bufsoft; CHN_LOCK(wrch); - /* XXX abusive DMA update: chn_wrupdate(wrch); */ a->bytes = sndbuf_gettotal(bs); a->blocks = sndbuf_getblocks(bs) - wrch->blocks; a->ptr = sndbuf_getreadyptr(bs); @@ -1385,7 +1382,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct snd_dbuf *bs = wrch->bufsoft; CHN_LOCK(wrch); - /* XXX abusive DMA update: chn_wrupdate(wrch); */ *arg_i = sndbuf_getready(bs); CHN_UNLOCK(wrch); } else @@ -1582,14 +1578,8 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, CHN_LOCK(chn); bs = chn->bufsoft; -#if 0 - tmp = (sndbuf_getsize(b) + chn_getptr(chn) - sndbuf_gethwptr(b)) % sndbuf_getsize(b); - oc->samples = (sndbuf_gettotal(b) + tmp) / sndbuf_getalign(b); - oc->fifo_samples = (sndbuf_getready(b) - tmp) / sndbuf_getalign(b); -#else oc->samples = sndbuf_gettotal(bs) / sndbuf_getalign(bs); oc->fifo_samples = sndbuf_getready(bs) / sndbuf_getalign(bs); -#endif CHN_UNLOCK(chn); } break; @@ -1738,18 +1728,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, case SNDCTL_SETNAME: ret = dsp_oss_setname(wrch, rdch, (oss_longname_t *)arg); break; -#if 0 - /** - * @note The S/PDIF interface ioctls, @c SNDCTL_DSP_READCTL and - * @c SNDCTL_DSP_WRITECTL have been omitted at the suggestion of - * 4Front Technologies. - */ - case SNDCTL_DSP_READCTL: - case SNDCTL_DSP_WRITECTL: - ret = EINVAL; - break; -#endif /* !0 (explicitly omitted ioctls) */ - #endif /* !OSSV4_EXPERIMENT */ case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index 1e240d934e94..60b8280e59ef 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -167,32 +167,6 @@ int feeder_matrix_oss_get_channel_order(struct pcmchan_matrix *, int feeder_matrix_oss_set_channel_order(struct pcmchan_matrix *, unsigned long long *); -#if 0 -/* feeder_matrix */ -enum { - FEEDMATRIX_TYPE, - FEEDMATRIX_RESET, - FEEDMATRIX_CHANNELS_IN, - FEEDMATRIX_CHANNELS_OUT, - FEEDMATRIX_SET_MAP -}; - -enum { - FEEDMATRIX_TYPE_NONE, - FEEDMATRIX_TYPE_AUTO, - FEEDMATRIX_TYPE_2X1, - FEEDMATRIX_TYPE_1X2, - FEEDMATRIX_TYPE_2X2 -}; - -#define FEEDMATRIX_TYPE_STEREO_TO_MONO FEEDMATRIX_TYPE_2X1 -#define FEEDMATRIX_TYPE_MONO_TO_STEREO FEEDMATRIX_TYPE_1X2 -#define FEEDMATRIX_TYPE_SWAP_STEREO FEEDMATRIX_TYPE_2X2 -#define FEEDMATRIX_MAP(x, y) ((((x) & 0x3f) << 6) | ((y) & 0x3f)) -#define FEEDMATRIX_MAP_SRC(x) ((x) & 0x3f) -#define FEEDMATRIX_MAP_DST(x) (((x) >> 6) & 0x3f) -#endif - /* * By default, various feeders only deal with sign 16/32 bit native-endian * since it should provide the fastest processing path. Processing 8bit samples diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c index 77de21e7a31a..40e5d3018ab4 100644 --- a/sys/dev/sound/pcm/feeder_rate.c +++ b/sys/dev/sound/pcm/feeder_rate.c @@ -431,11 +431,6 @@ z_roundpow2(int32_t v) static void z_feed_zoh(struct z_info *info, uint8_t *dst) { -#if 0 - z_copy(info->z_delay + - (info->z_start * info->channels * info->bps), dst, - info->channels * info->bps); -#else uint32_t cnt; uint8_t *src; @@ -449,7 +444,6 @@ z_feed_zoh(struct z_info *info, uint8_t *dst) do { *dst++ = *src++; } while (--cnt != 0); -#endif } /* @@ -1171,14 +1165,6 @@ z_setup_adaptive_sinc: info->z_scale = Z_ONE; } -#if 0 -#define Z_SCALE_DIV 10000 -#define Z_SCALE_LIMIT(s, v) \ - ((((uint64_t)(s) * (v)) + (Z_SCALE_DIV >> 1)) / Z_SCALE_DIV) - - info->z_scale = Z_SCALE_LIMIT(info->z_scale, 9780); -#endif - /* Smallest drift increment. */ info->z_dx = info->z_dy / info->z_gy; @@ -1672,12 +1658,6 @@ z_resampler_feed_internal(struct pcm_feeder *f, struct pcm_channel *c, */ do { info->z_resample(info, dst); -#if 0 - startdrift = z_gy2gx(info, 1); - alphadrift = z_drift(info, startdrift, 1); - info->z_start += startdrift; - info->z_alpha += alphadrift; -#else info->z_alpha += alphadrift; if (info->z_alpha < info->z_gy) info->z_start += startdrift; @@ -1685,7 +1665,6 @@ z_resampler_feed_internal(struct pcm_feeder *f, struct pcm_channel *c, info->z_start += startdrift - 1; info->z_alpha -= info->z_gy; } -#endif dst += align; #ifdef Z_DIAGNOSTIC info->z_cycle++; From nobody Mon Dec 2 16:27:22 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y28MG55Bbz5g4xg; Mon, 02 Dec 2024 16:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y28MG3Tnsz4TX0; Mon, 2 Dec 2024 16:27:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MSQ9AyblEAbUgc9i+qalwtNMkScHkFvIR4ZnJwvVSmk=; b=YAPY8X4ARHQCXzr0edeJyM24gAJROITpkxhxpX3GC4L9nWJmg19WlcDYVds7gIt38ARsuE KFmNWgxLrLqT8ieIUZInmxYbaK0Npc/mbRo232je5nQHPTb/r8B3x340ATnfW0YIZA3sgU R0MjxS1yxH2nPN4hDxL7AmtELLafRl7nTGt2NP89grPsEhnv9XBH3v9E5UxqVtur0egV40 P+H7jjGBeiW9ALgchzDhxVch+XRzZbPrQyBiAzexmbNGAeu73LXp4DgNZspCw4EfNglMEv QfmennDmwnm8gJz1iwofMGY8Jdg3brrDcphLbbL1jWIcYgn2rDNGL79ljN+JKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MSQ9AyblEAbUgc9i+qalwtNMkScHkFvIR4ZnJwvVSmk=; b=a4ibkjnF9KgLluTZ/V/lFdKsQP6xxtIcYJ+0XPvhJ9ezP444uDMGOzvShjDB77Vh9uUzcv qUBcrJwas0DPixtLZv9tgau4lFLIAUzcyaaPcIEoS9I0p6A/RqbctnqLjTEssIh2ijGrc6 6fvAoAKX3VMwS2OVKSbCPnIGL8gNPLjOmsNdIf5KFYXhJcgEWMhaxmusu3DLZ+c06+nEPs og78AuQPazYhPg0f7CRTWWTqZ/RWenwVBKJpK+UmCvSbklrO4XSK2QS20B7/uHxSHzIJda 45clsqosqYr86wiVL4cJrG0j2ALKpzQBiLGtcFO2Np4wkGbsvFwFeTIdtnkT3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733156842; a=rsa-sha256; cv=none; b=PJxDfDn/hsQ5R1wNfF0b1OwJwzNI82WWW8626MeuSfIPVdpfzXBJNH2Si0kLpw4K90KIjZ gIVokJiD85HkB7B0zXeofKgxyER5gSvqzP1LrfokpDOqbyMToA2gyMsIAAuNPXVA4S1b0j ueH2hODdxmz+FQO8D9H8CSrDa4UvvdePfjA1FsLUJiEbZZiVtCSKBsXoeoponTKPiAygC4 Up6ndILHD/E53pkEhOtt9daFIrnvEkfMK0klrdm/m3JKX1ZUwV+G+WLEMXNvElp5alK1N/ YxPz+ms490SIWMI6j8MhM2ISeK5q9Xpfju0rBivP5EbvMDF7dDRdrjYy5TfZRw== 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 4Y28MG32JSzlN0; Mon, 2 Dec 2024 16:27:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2GRMh2070786; Mon, 2 Dec 2024 16:27:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2GRMZJ070783; Mon, 2 Dec 2024 16:27:22 GMT (envelope-from git) Date: Mon, 2 Dec 2024 16:27:22 GMT Message-Id: <202412021627.4B2GRMZJ070783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: b88225120412 - main - sound: Remove unused code from pcm/g711.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b882251204128388eb2f8e4f74e83ff1ca7863c4 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=b882251204128388eb2f8e4f74e83ff1ca7863c4 commit b882251204128388eb2f8e4f74e83ff1ca7863c4 Author: Christos Margiolis AuthorDate: 2024-12-02 16:26:32 +0000 Commit: Christos Margiolis CommitDate: 2024-12-02 16:26:32 +0000 sound: Remove unused code from pcm/g711.h These routines are already implemented in pcm/intpcm.h. No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D47734 --- sys/dev/sound/pcm/g711.h | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/sys/dev/sound/pcm/g711.h b/sys/dev/sound/pcm/g711.h index fe9ddb651c8b..b7a57dd17a6b 100644 --- a/sys/dev/sound/pcm/g711.h +++ b/sys/dev/sound/pcm/g711.h @@ -187,37 +187,4 @@ static const struct { \ U8_TO_ULAW, U8_TO_ALAW \ } -#define G711_DECLARE_OP(t) \ -static __inline intpcm_t \ -pcm_read_ulaw(uint8_t v) \ -{ \ - \ - return (_G711_TO_INTPCM((t).ulaw_to_u8, v)); \ -} \ - \ -static __inline intpcm_t \ -pcm_read_alaw(uint8_t v) \ -{ \ - \ - return (_G711_TO_INTPCM((t).alaw_to_u8, v)); \ -} \ - \ -static __inline void \ -pcm_write_ulaw(uint8_t *dst, intpcm_t v) \ -{ \ - \ - *dst = _INTPCM_TO_G711((t).u8_to_ulaw, v); \ -} \ - \ -static __inline void \ -pcm_write_alaw(uint8_t *dst, intpcm_t v) \ -{ \ - \ - *dst = _INTPCM_TO_G711((t).u8_to_alaw, v); \ -} - -#define G711_DECLARE(t) \ - G711_DECLARE_TABLE(t); \ - G711_DECLARE_OP(t) - #endif /* !_SND_G711_H_ */ From nobody Mon Dec 2 16:27:23 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y28MH69vJz5g57S; Mon, 02 Dec 2024 16:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y28MH44dSz4TJ3; Mon, 2 Dec 2024 16:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5W26RDxotGSKY6WACUXlBVoweyZLKH4EkdFx/vJGyj8=; b=dZPQrFvV/Bz7K3XNtX1x9oVqARKeK122zeSiV4jtWTsL9klO9b4mvum4MbRvApT2sI3m1A ixYnYboK5AxNAgfP+9DqKhK9VpjA3KxP1Tp41wDXAJBZvpeqtMzCLLmXFRkYfD+N6JzUvQ EDaOMLPLvHo6//XgJ0rndde8reoSJAJMdU3ZUrf/UwOCFXBDCeYSXnZ0xQuhRKLuE2R0/f ZrUuRCl9Nehgi0Jyi8cCXmMu1LHaLSVer1PQ4hL0R/ZpyZ6p/Ge5bvQOpO3SnM7do+Xd4h WLZWMiaF31bCJbmCWjIRr5Ye1gv3jlfeLBtwMeK4HJQbOYtTyMIDQu7UVuQ/Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5W26RDxotGSKY6WACUXlBVoweyZLKH4EkdFx/vJGyj8=; b=Hq7HAgkG2FwCxGQdrfViyV+OZKh2uRCzmsi4lUrHeQhUXStK9dAl7/M0mtL78hNzZ/9pPq XC5LIwVhIn4eorA0d/qe+zE6mKYxHwqeCptnS7c4Wy/EwXQZwFp0u5VrWgk4TxXkv5QqRj VSI9mA34YblkgooxkyqW9ZBSEk85dNpvQ9pXs63d4R/PltWRyaFIAnPSdlGJIROtZgr8yc j91hH+amtCTBw9Tk9ydqrvhQzOTMaMelt4z6rRoKrZWQD0q9J0LFoQW67Ulv1S7vqRAWKF mZKyyKxugBtry72+ToJOmqab/7TU/GIEOrO29Hwhb/Uh2DK5Z5UHqhFOj/hcbw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733156843; a=rsa-sha256; cv=none; b=FMJ9SQ+q/lIn0BrjKt5G+oe2/ryYh+RT9I8lY/3n47qsEp8vnDKe/Q/I4BJM7bgJbiH5xh MQCSNbnd8eMQ8p6Dgt87c47IWh1rHkMR0LIJRhSRCWJnCltjXDPCtdYZVxpx3y7i78+zAs a0/upTR+iMqBow5XLmn4UtlmaLjoD5Z4h+BMgLfA+06sc4p/XQLh7btS+ZVUVR3uvDAPlD dIu/wjSFYTrasBWoZqSLeMJ0af6TSe8pQ4kbKC4yULiIriT5yyIfIHFcV/C7W7CTZMXaOl TqLZ20ZYnEJcqoUAWjXdDlbeFgqV2mqaE0o2Ejt/djMfb8WvTkPik3AQlug4Gw== 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 4Y28MH3gl5zlrY; Mon, 2 Dec 2024 16:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2GRNjU070828; Mon, 2 Dec 2024 16:27:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2GRNiM070825; Mon, 2 Dec 2024 16:27:23 GMT (envelope-from git) Date: Mon, 2 Dec 2024 16:27:23 GMT Message-Id: <202412021627.4B2GRNiM070825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 88eaa1504d12 - main - sound: Dissolve pcm/intpcm.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88eaa1504d12c82a36d83c16e9fd6c41175d2e0a Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=88eaa1504d12c82a36d83c16e9fd6c41175d2e0a commit 88eaa1504d12c82a36d83c16e9fd6c41175d2e0a Author: Christos Margiolis AuthorDate: 2024-12-02 16:26:38 +0000 Commit: Christos Margiolis CommitDate: 2024-12-02 16:26:38 +0000 sound: Dissolve pcm/intpcm.h Part of a series of patches to cleanup/simplify pcm/. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47736 --- sys/dev/sound/pcm/feeder.h | 7 ++ sys/dev/sound/pcm/feeder_format.c | 106 ++++++++++++++++++++++++++++-- sys/dev/sound/pcm/g711.h | 11 ---- sys/dev/sound/pcm/intpcm.h | 135 -------------------------------------- sys/dev/sound/pcm/sound.h | 1 + 5 files changed, 109 insertions(+), 151 deletions(-) diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index 60b8280e59ef..bd0d9dcb8f9c 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -161,6 +161,13 @@ int feeder_matrix_setup(struct pcm_feeder *, struct pcmchan_matrix *, struct pcmchan_matrix *); int feeder_matrix_compare(struct pcmchan_matrix *, struct pcmchan_matrix *); +/* feeder_format */ +typedef intpcm_t intpcm_read_t(uint8_t *); +typedef void intpcm_write_t(uint8_t *, intpcm_t); + +intpcm_read_t *feeder_format_read_op(uint32_t); +intpcm_write_t *feeder_format_write_op(uint32_t); + /* 4Front OSS stuffs */ int feeder_matrix_oss_get_channel_order(struct pcmchan_matrix *, unsigned long long *); diff --git a/sys/dev/sound/pcm/feeder_format.c b/sys/dev/sound/pcm/feeder_format.c index 3bdd808df0ee..53c7d3768a32 100644 --- a/sys/dev/sound/pcm/feeder_format.c +++ b/sys/dev/sound/pcm/feeder_format.c @@ -36,9 +36,7 @@ #include "opt_snd.h" #endif #include -#include #include -#include #include "feeder_if.h" #define SND_USE_FXDIV @@ -47,8 +45,6 @@ #define FEEDFORMAT_RESERVOIR (SND_CHN_MAX * PCM_32_BPS) -INTPCM_DECLARE(intpcm_conv_tables) - struct feed_format_info { uint32_t ibps, obps; uint32_t ialign, oalign, channels; @@ -57,6 +53,107 @@ struct feed_format_info { uint8_t reservoir[FEEDFORMAT_RESERVOIR]; }; +#define INTPCM_DECLARE_OP_WRITE(SIGN, BIT, ENDIAN, SHIFT) \ +static __inline void \ +intpcm_write_##SIGN##BIT##ENDIAN(uint8_t *dst, intpcm_t v) \ +{ \ + \ + _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, v >> SHIFT); \ +} + +#define INTPCM_DECLARE_OP_8(SIGN, ENDIAN) \ +static __inline intpcm_t \ +intpcm_read_##SIGN##8##ENDIAN(uint8_t *src) \ +{ \ + \ + return (_PCM_READ_##SIGN##8##_##ENDIAN(src) << 24); \ +} \ +INTPCM_DECLARE_OP_WRITE(SIGN, 8, ENDIAN, 24) + +#define INTPCM_DECLARE_OP_16(SIGN, ENDIAN) \ +static __inline intpcm_t \ +intpcm_read_##SIGN##16##ENDIAN(uint8_t *src) \ +{ \ + \ + return (_PCM_READ_##SIGN##16##_##ENDIAN(src) << 16); \ +} \ +INTPCM_DECLARE_OP_WRITE(SIGN, 16, ENDIAN, 16) + +#define INTPCM_DECLARE_OP_24(SIGN, ENDIAN) \ +static __inline intpcm_t \ +intpcm_read_##SIGN##24##ENDIAN(uint8_t *src) \ +{ \ + \ + return (_PCM_READ_##SIGN##24##_##ENDIAN(src) << 8); \ +} \ +INTPCM_DECLARE_OP_WRITE(SIGN, 24, ENDIAN, 8) + +#define INTPCM_DECLARE_OP_32(SIGN, ENDIAN) \ +static __inline intpcm_t \ +intpcm_read_##SIGN##32##ENDIAN(uint8_t *src) \ +{ \ + \ + return (_PCM_READ_##SIGN##32##_##ENDIAN(src)); \ +} \ + \ +static __inline void \ +intpcm_write_##SIGN##32##ENDIAN(uint8_t *dst, intpcm_t v) \ +{ \ + \ + _PCM_WRITE_##SIGN##32##_##ENDIAN(dst, v); \ +} + +INTPCM_DECLARE_OP_8(S, NE) +INTPCM_DECLARE_OP_16(S, LE) +INTPCM_DECLARE_OP_16(S, BE) +INTPCM_DECLARE_OP_24(S, LE) +INTPCM_DECLARE_OP_24(S, BE) +INTPCM_DECLARE_OP_32(S, LE) +INTPCM_DECLARE_OP_32(S, BE) +INTPCM_DECLARE_OP_8(U, NE) +INTPCM_DECLARE_OP_16(U, LE) +INTPCM_DECLARE_OP_16(U, BE) +INTPCM_DECLARE_OP_24(U, LE) +INTPCM_DECLARE_OP_24(U, BE) +INTPCM_DECLARE_OP_32(U, LE) +INTPCM_DECLARE_OP_32(U, BE) + +static const struct { + const uint8_t ulaw_to_u8[G711_TABLE_SIZE]; + const uint8_t alaw_to_u8[G711_TABLE_SIZE]; + const uint8_t u8_to_ulaw[G711_TABLE_SIZE]; + const uint8_t u8_to_alaw[G711_TABLE_SIZE]; +} xlaw_conv_tables = { + ULAW_TO_U8, + ALAW_TO_U8, + U8_TO_ULAW, + U8_TO_ALAW +}; + +static __inline intpcm_t +intpcm_read_ulaw(uint8_t *src) +{ + return (_G711_TO_INTPCM(xlaw_conv_tables.ulaw_to_u8, *src) << 24); +} + +static __inline intpcm_t +intpcm_read_alaw(uint8_t *src) +{ + return (_G711_TO_INTPCM(xlaw_conv_tables.alaw_to_u8, *src) << 24); +} + +static __inline void +intpcm_write_ulaw(uint8_t *dst, intpcm_t v) +{ + *dst = _INTPCM_TO_G711(xlaw_conv_tables.u8_to_ulaw, v >> 24); +} + +static __inline void +intpcm_write_alaw(uint8_t *dst, intpcm_t v) +{ + *dst = _INTPCM_TO_G711(xlaw_conv_tables.u8_to_alaw, v >> 24); +} + /* * dummy ac3/dts passthrough, etc. * XXX assume as s16le. @@ -269,7 +366,6 @@ static kobj_method_t feeder_format_methods[] = { FEEDER_DECLARE(feeder_format, NULL); -/* Extern */ intpcm_read_t * feeder_format_read_op(uint32_t format) { diff --git a/sys/dev/sound/pcm/g711.h b/sys/dev/sound/pcm/g711.h index b7a57dd17a6b..481ef368e144 100644 --- a/sys/dev/sound/pcm/g711.h +++ b/sys/dev/sound/pcm/g711.h @@ -176,15 +176,4 @@ #define _INTPCM_TO_G711(t, v) ((t)[(uint8_t)((v) ^ 0x80)]) -#define G711_DECLARE_TABLE(t) \ -static const struct { \ - const uint8_t ulaw_to_u8[G711_TABLE_SIZE]; \ - const uint8_t alaw_to_u8[G711_TABLE_SIZE]; \ - const uint8_t u8_to_ulaw[G711_TABLE_SIZE]; \ - const uint8_t u8_to_alaw[G711_TABLE_SIZE]; \ -} t = { \ - ULAW_TO_U8, ALAW_TO_U8, \ - U8_TO_ULAW, U8_TO_ALAW \ -} - #endif /* !_SND_G711_H_ */ diff --git a/sys/dev/sound/pcm/intpcm.h b/sys/dev/sound/pcm/intpcm.h deleted file mode 100644 index 1e85535feec1..000000000000 --- a/sys/dev/sound/pcm/intpcm.h +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2008-2009 Ariff Abdullah - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY 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. - */ - -#ifndef _SND_INTPCM_H_ -#define _SND_INTPCM_H_ - -typedef intpcm_t intpcm_read_t(uint8_t *); -typedef void intpcm_write_t(uint8_t *, intpcm_t); - -extern intpcm_read_t *feeder_format_read_op(uint32_t); -extern intpcm_write_t *feeder_format_write_op(uint32_t); - -#define INTPCM_DECLARE_OP_WRITE(SIGN, BIT, ENDIAN, SHIFT) \ -static __inline void \ -intpcm_write_##SIGN##BIT##ENDIAN(uint8_t *dst, intpcm_t v) \ -{ \ - \ - _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, v >> SHIFT); \ -} - -#define INTPCM_DECLARE_OP_8(SIGN, ENDIAN) \ -static __inline intpcm_t \ -intpcm_read_##SIGN##8##ENDIAN(uint8_t *src) \ -{ \ - \ - return (_PCM_READ_##SIGN##8##_##ENDIAN(src) << 24); \ -} \ -INTPCM_DECLARE_OP_WRITE(SIGN, 8, ENDIAN, 24) - -#define INTPCM_DECLARE_OP_16(SIGN, ENDIAN) \ -static __inline intpcm_t \ -intpcm_read_##SIGN##16##ENDIAN(uint8_t *src) \ -{ \ - \ - return (_PCM_READ_##SIGN##16##_##ENDIAN(src) << 16); \ -} \ -INTPCM_DECLARE_OP_WRITE(SIGN, 16, ENDIAN, 16) - -#define INTPCM_DECLARE_OP_24(SIGN, ENDIAN) \ -static __inline intpcm_t \ -intpcm_read_##SIGN##24##ENDIAN(uint8_t *src) \ -{ \ - \ - return (_PCM_READ_##SIGN##24##_##ENDIAN(src) << 8); \ -} \ -INTPCM_DECLARE_OP_WRITE(SIGN, 24, ENDIAN, 8) - -#define INTPCM_DECLARE_OP_32(SIGN, ENDIAN) \ -static __inline intpcm_t \ -intpcm_read_##SIGN##32##ENDIAN(uint8_t *src) \ -{ \ - \ - return (_PCM_READ_##SIGN##32##_##ENDIAN(src)); \ -} \ - \ -static __inline void \ -intpcm_write_##SIGN##32##ENDIAN(uint8_t *dst, intpcm_t v) \ -{ \ - \ - _PCM_WRITE_##SIGN##32##_##ENDIAN(dst, v); \ -} - -#define INTPCM_DECLARE(t) \ - \ -G711_DECLARE_TABLE(t); \ - \ -static __inline intpcm_t \ -intpcm_read_ulaw(uint8_t *src) \ -{ \ - \ - return (_G711_TO_INTPCM((t).ulaw_to_u8, *src) << 24); \ -} \ - \ -static __inline intpcm_t \ -intpcm_read_alaw(uint8_t *src) \ -{ \ - \ - return (_G711_TO_INTPCM((t).alaw_to_u8, *src) << 24); \ -} \ - \ -static __inline void \ -intpcm_write_ulaw(uint8_t *dst, intpcm_t v) \ -{ \ - \ - *dst = _INTPCM_TO_G711((t).u8_to_ulaw, v >> 24); \ -} \ - \ -static __inline void \ -intpcm_write_alaw(uint8_t *dst, intpcm_t v) \ -{ \ - \ - *dst = _INTPCM_TO_G711((t).u8_to_alaw, v >> 24); \ -} \ - \ -INTPCM_DECLARE_OP_8(S, NE) \ -INTPCM_DECLARE_OP_16(S, LE) \ -INTPCM_DECLARE_OP_16(S, BE) \ -INTPCM_DECLARE_OP_24(S, LE) \ -INTPCM_DECLARE_OP_24(S, BE) \ -INTPCM_DECLARE_OP_32(S, LE) \ -INTPCM_DECLARE_OP_32(S, BE) \ -INTPCM_DECLARE_OP_8(U, NE) \ -INTPCM_DECLARE_OP_16(U, LE) \ -INTPCM_DECLARE_OP_16(U, BE) \ -INTPCM_DECLARE_OP_24(U, LE) \ -INTPCM_DECLARE_OP_24(U, BE) \ -INTPCM_DECLARE_OP_32(U, LE) \ -INTPCM_DECLARE_OP_32(U, BE) - -#endif /* !_SND_INTPCM_H_ */ diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index f1d435369d36..ff2b618adff8 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -85,6 +85,7 @@ struct snd_mixer; #include #include #include +#include #include #include #include From nobody Mon Dec 2 16:27:24 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y28MK2TxKz5g4vR; Mon, 02 Dec 2024 16:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y28MJ4ly0z4Tgc; Mon, 2 Dec 2024 16:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z/Fs1M28xJ9Ebje168k7+izJj8oXOaDodRng340a0+I=; b=jTvsRy3eSUW7qKMNyGUgfl9TzkSEUZ8VtLga5vVjD04HLGg2mi9c+t2V7JH7YoN2qvB5vb q3bSM4+6tr4aZHtWlB6kWAzkNpyEFFnAA2nvsH+TvK8eIfZOlYMCikoNdA4qCwGheRA3Wh BZDVTNo6E7t6CR50vGbPlSBGwxD0uw2SjN2p5BwJnokPfxxrcTm21RVTODUZrJnmnfvf7G +3kU4yDEvc9H/W976HW9KGF9lkge1YyHz63meo6k2uy3+HPkDittFulysB3/oa3V0moYR9 fHv6RABOdcZgcFwVyNSGsQO9pwA9v22rA3l/6NmEaFapu2Qza4PR7JzgJOqh7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z/Fs1M28xJ9Ebje168k7+izJj8oXOaDodRng340a0+I=; b=gK09iYArbUwqps7+sVKH+RVA2XMUqiVDWOiqd6CuaxohMW3L5cSWZiGwlLZJfEsaBAxzoz spZZ/VlvhnAedRp7SHkBHlgS/0qj5nw7SqYjsoKwksYWZcl4sP1+ev5H7J+WOdEqf0/HEf nmVVV8fpZ74tcUeG4XuufNuZ/MUvb9QZK2KzzAVsyDEsBmVr+3mba0fDHPjtttt2al2/wF ymqzK6xyi2eNWlRS8EyoeVe11J3QRFD1Mg554LUxFJVUIxM3Ygob7GcLz996cKYkzc8XBA 7+nYVIv4IfXWbCX7UjndJ9vvUHjIimGdWxpwDK0S/XeGEM5lUoPVSYaBj3x/pQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733156844; a=rsa-sha256; cv=none; b=ecEhmb7E02Z9lyt2pgVrET+ccKmSomWeXOLQtuyyV1KaRW2m6VSCWnhs55aPABfhQFfTcr F5fc1wZ2R2NULDNi53DsqsQJi72B7H1+mIcM191iAwEafJ9a4Xohbmcn8muvlpcClCrc2q 7Hwe4QMnqjNMra6VvYhjnWxyDpp5nGfeex8/eJRof30tOj9Ll2FPcB5QbHg5u/DezEf546 uMg1mEtkSSk9BkjGqKDQIoC4ttdYSWngKbLxswSp91VTacWnpu5XfBdq2JQje2krQj22JP RL5bCynKZLiJdgGl3NEXNbr0QajL8bG2Yxlc7+qQAmA5kZn85ZiMfCxTVAvEEg== 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 4Y28MJ41zXzllN; Mon, 2 Dec 2024 16:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2GROIp070870; Mon, 2 Dec 2024 16:27:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2GROM4070867; Mon, 2 Dec 2024 16:27:24 GMT (envelope-from git) Date: Mon, 2 Dec 2024 16:27:24 GMT Message-Id: <202412021627.4B2GROM4070867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 5a217a8d7d2a - main - sound: Merge pcm/matrix_map.h with pcm/matrix.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a217a8d7d2a0dc19eb5d7bb1bd0f21116fbcf69 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5a217a8d7d2a0dc19eb5d7bb1bd0f21116fbcf69 commit 5a217a8d7d2a0dc19eb5d7bb1bd0f21116fbcf69 Author: Christos Margiolis AuthorDate: 2024-12-02 16:26:43 +0000 Commit: Christos Margiolis CommitDate: 2024-12-02 16:26:43 +0000 sound: Merge pcm/matrix_map.h with pcm/matrix.h No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D47737 --- sys/dev/sound/pcm/matrix.h | 640 +++++++++++++++++++++++++++++++++++++++ sys/dev/sound/pcm/matrix_map.h | 672 ----------------------------------------- sys/dev/sound/pcm/sound.h | 1 - 3 files changed, 640 insertions(+), 673 deletions(-) diff --git a/sys/dev/sound/pcm/matrix.h b/sys/dev/sound/pcm/matrix.h index 14f3a3410a70..e2798c651536 100644 --- a/sys/dev/sound/pcm/matrix.h +++ b/sys/dev/sound/pcm/matrix.h @@ -217,4 +217,644 @@ (x)[SND_VOL_C_MASTER][z]) / \ (x)[SND_VOL_C_MASTER][SND_CHN_T_VOL_0DB]) \ +/* + * Standard matrix maps: + * + * struct pcmchan_matrix { + * .id = Matrix identity (see matrix.h). Custom defined should use + * one of SND_CHN_MATRIX_MISC (for whatever purposes) or + * SND_CHN_MATRIX_DRV (hardware driver). + * .channels = Total number of channels, including whatever 'extended' + * (the X.ext notions, mostly LFE). + * .ext = Total number of extended channels (LFE). + * .map = { + * Sequences of channel type and interleave structure. + * [interleave offset] = { + * .type = channel type (see matrix.h). + * .members = Masks of channels that is acceptable as a + * member of this channel type. + * }, + * [total channels] = { + * .type = Maximum channels marker (SND_CHN_T_MAX). + * .members = 0 (no channels allowed here). + * }, + * }, + * .mask = Mask of channels that exist in this map. + * .offset = { + * channel offset that directly translate to the above interleave + * offset according to SND_CHN_T_* definitions. + * } + * }; + * + * Rule of thumb: Avoid using SND_CHN_T_* that is marked with XXX (matrix.h), + * or be prepared for the horror to come. + * + */ + +#define SND_CHN_MATRIX_MAP_1_0 { \ + .id = SND_CHN_MATRIX_1_0, \ + .channels = 1, \ + .ext = 0, \ + .map = { \ + /* Mono, center, etc. */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_FC | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SL | \ + SND_CHN_T_MASK_SR \ + }, \ + [1] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_FC, \ + .offset = { 0, 0, 0, 0, 0, 0, -1, -1, 0, \ + 0, 0, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_2_0 { \ + .id = SND_CHN_MATRIX_2_0, \ + .channels = 2, \ + .ext = 0, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BL | \ + SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SR \ + }, \ + [2] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR, \ + .offset = { 0, 1, -1, -1, -1, -1, -1, -1, -1, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_2_1 { \ + .id = SND_CHN_MATRIX_2_1, \ + .channels = 3, \ + .ext = 1, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_SR \ + }, \ + /* LFE */ \ + [2] = { \ + .type = SND_CHN_T_LF, \ + .members = SND_CHN_T_MASK_LF \ + }, \ + [3] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_LF, \ + .offset = { 0, 1, -1, 2, -1, -1, -1, -1, -1, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_3_0 { /* 3 channels default */ \ + .id = SND_CHN_MATRIX_3_0, \ + .channels = 3, \ + .ext = 0, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_SR \ + }, \ + /* Rear Center */ \ + [2] = { \ + .type = SND_CHN_T_BC, \ + .members = \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BL | \ + SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR \ + }, \ + [3] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BC, \ + .offset = { 0, 1, -1, -1, -1, -1, -1, -1, 2, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_3_1 { \ + .id = SND_CHN_MATRIX_3_1, \ + .channels = 4, \ + .ext = 1, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_SR \ + }, \ + /* LFE */ \ + [2] = { \ + .type = SND_CHN_T_LF, \ + .members = SND_CHN_T_MASK_LF \ + }, \ + /* Rear Center */ \ + [3] = { \ + .type = SND_CHN_T_BC, \ + .members = \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR \ + }, \ + [4] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BC, \ + .offset = { 0, 1, -1, 2, -1, -1, -1, -1, 3, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_4_0 { \ + .id = SND_CHN_MATRIX_4_0, \ + .channels = 4, \ + .ext = 0, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_SR \ + }, \ + /* Rear Left */ \ + [2] = { \ + .type = SND_CHN_T_BL, \ + .members = \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BL | \ + SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SL \ + }, \ + /* Rear Right */ \ + [3] = { \ + .type = SND_CHN_T_BR, \ + .members = \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SR \ + }, \ + [4] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR, \ + .offset = { 0, 1, -1, -1, 2, 3, -1, -1, -1, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_4_1 { \ + .id = SND_CHN_MATRIX_4_1, \ + .channels = 5, \ + .ext = 1, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_SR \ + }, \ + /* Rear Left */ \ + [2] = { \ + .type = SND_CHN_T_BL, \ + .members = \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_SL \ + }, \ + /* Rear Right */ \ + [3] = { \ + .type = SND_CHN_T_BR, \ + .members = \ + SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_SR \ + }, \ + /* LFE */ \ + [4] = { \ + .type = SND_CHN_T_LF, \ + .members = SND_CHN_T_MASK_LF \ + }, \ + [5] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_LF, \ + .offset = { 0, 1, -1, 4, 2, 3, -1, -1, -1, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_5_0 { /* 5 channels default */ \ + .id = SND_CHN_MATRIX_5_0, \ + .channels = 5, \ + .ext = 0, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_SR \ + }, \ + /* Rear Left */ \ + [2] = { \ + .type = SND_CHN_T_BL, \ + .members = \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BL | \ + SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SL \ + }, \ + /* Rear Right */ \ + [3] = { \ + .type = SND_CHN_T_BR, \ + .members = \ + SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SR \ + }, \ + /* Center */ \ + [4] = { \ + .type = SND_CHN_T_FC, \ + .members = SND_CHN_T_MASK_FC \ + }, \ + [5] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_FC, \ + .offset = { 0, 1, 4, -1, 2, 3, -1, -1, -1, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_5_1 { /* 6 channels default */ \ + .id = SND_CHN_MATRIX_5_1, \ + .channels = 6, \ + .ext = 1, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_SR \ + }, \ + /* Rear Left */ \ + [2] = { \ + .type = SND_CHN_T_BL, \ + .members = \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_SL \ + }, \ + /* Rear Right */ \ + [3] = { \ + .type = SND_CHN_T_BR, \ + .members = \ + SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_SR \ + }, \ + /* Center */ \ + [4] = { \ + .type = SND_CHN_T_FC, \ + .members = SND_CHN_T_MASK_FC \ + }, \ + /* LFE */ \ + [5] = { \ + .type = SND_CHN_T_LF, \ + .members = SND_CHN_T_MASK_LF \ + }, \ + [6] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_FC | SND_CHN_T_MASK_LF, \ + .offset = { 0, 1, 4, 5, 2, 3, -1, -1, -1, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_6_0 { \ + .id = SND_CHN_MATRIX_6_0, \ + .channels = 6, \ + .ext = 0, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_SR \ + }, \ + /* Rear Left */ \ + [2] = { \ + .type = SND_CHN_T_BL, \ + .members = \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_SL \ + }, \ + /* Rear Right */ \ + [3] = { \ + .type = SND_CHN_T_BR, \ + .members = \ + SND_CHN_T_MASK_BR | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_SR \ + }, \ + /* Center */ \ + [4] = { \ + .type = SND_CHN_T_FC, \ + .members = SND_CHN_T_MASK_FC \ + }, \ + /* Rear Center */ \ + [5] = { \ + .type = SND_CHN_T_BC, \ + .members = SND_CHN_T_MASK_BC \ + }, \ + [6] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_FC | SND_CHN_T_MASK_BC, \ + .offset = { 0, 1, 4, -1, 2, 3, -1, -1, 5, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_6_1 { \ + .id = SND_CHN_MATRIX_6_1, \ + .channels = 7, \ + .ext = 1, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_SL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_SR \ + }, \ + /* Rear Left */ \ + [2] = { \ + .type = SND_CHN_T_BL, \ + .members = \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_SL \ + }, \ + /* Rear Right */ \ + [3] = { \ + .type = SND_CHN_T_BR, \ + .members = \ + SND_CHN_T_MASK_BR | SND_CHN_T_MASK_SR \ + }, \ + /* Center */ \ + [4] = { \ + .type = SND_CHN_T_FC, \ + .members = SND_CHN_T_MASK_FC \ + }, \ + /* LFE */ \ + [5] = { \ + .type = SND_CHN_T_LF, \ + .members = SND_CHN_T_MASK_LF \ + }, \ + /* Rear Center */ \ + [6] = { \ + .type = SND_CHN_T_BC, \ + .members = SND_CHN_T_MASK_BC \ + }, \ + [7] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_FC | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_BC, \ + .offset = { 0, 1, 4, 5, 2, 3, -1, -1, 6, \ + -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_7_0 { \ + .id = SND_CHN_MATRIX_7_0, \ + .channels = 7, \ + .ext = 0, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = \ + SND_CHN_T_MASK_FL | SND_CHN_T_MASK_LF \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = \ + SND_CHN_T_MASK_FR | SND_CHN_T_MASK_LF \ + }, \ + /* Rear Left */ \ + [2] = { \ + .type = SND_CHN_T_BL, \ + .members = \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_LF \ + }, \ + /* Rear Right */ \ + [3] = { \ + .type = SND_CHN_T_BR, \ + .members = \ + SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC | \ + SND_CHN_T_MASK_LF \ + }, \ + /* Center */ \ + [4] = { \ + .type = SND_CHN_T_FC, \ + .members = \ + SND_CHN_T_MASK_FC | SND_CHN_T_MASK_LF \ + }, \ + /* Side Left */ \ + [5] = { \ + .type = SND_CHN_T_SL, \ + .members = \ + SND_CHN_T_MASK_SL | SND_CHN_T_MASK_LF \ + }, \ + /* Side Right */ \ + [6] = { \ + .type = SND_CHN_T_SR, \ + .members = \ + SND_CHN_T_MASK_SR | SND_CHN_T_MASK_LF \ + }, \ + [7] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_FC | \ + SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR, \ + .offset = { 0, 1, 4, -1, 2, 3, -1, -1, -1, \ + 5, 6, -1, -1, -1, -1, -1, -1, -1 } \ +} + +#define SND_CHN_MATRIX_MAP_7_1 { \ + .id = SND_CHN_MATRIX_7_1, \ + .channels = 8, \ + .ext = 1, \ + .map = { \ + /* Left */ \ + [0] = { \ + .type = SND_CHN_T_FL, \ + .members = SND_CHN_T_MASK_FL \ + }, \ + /* Right */ \ + [1] = { \ + .type = SND_CHN_T_FR, \ + .members = SND_CHN_T_MASK_FR \ + }, \ + /* Rear Left */ \ + [2] = { \ + .type = SND_CHN_T_BL, \ + .members = \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BC \ + }, \ + /* Rear Right */ \ + [3] = { \ + .type = SND_CHN_T_BR, \ + .members = \ + SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC \ + }, \ + /* Center */ \ + [4] = { \ + .type = SND_CHN_T_FC, \ + .members = SND_CHN_T_MASK_FC \ + }, \ + /* LFE */ \ + [5] = { \ + .type = SND_CHN_T_LF, \ + .members = SND_CHN_T_MASK_LF \ + }, \ + /* Side Left */ \ + [6] = { \ + .type = SND_CHN_T_SL, \ + .members = SND_CHN_T_MASK_SL \ + }, \ + /* Side Right */ \ + [7] = { \ + .type = SND_CHN_T_SR, \ + .members = SND_CHN_T_MASK_SR \ + }, \ + [8] = { \ + .type = SND_CHN_T_MAX, \ + .members = 0 \ + } \ + }, \ + .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ + SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ + SND_CHN_T_MASK_FC | SND_CHN_T_MASK_LF | \ + SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR, \ + .offset = { 0, 1, 4, 5, 2, 3, -1, -1, -1, \ + 6, 7, -1, -1, -1, -1, -1, -1, -1 } \ +} + #endif /* !_SND_MATRIX_H_ */ diff --git a/sys/dev/sound/pcm/matrix_map.h b/sys/dev/sound/pcm/matrix_map.h deleted file mode 100644 index ec0619614273..000000000000 --- a/sys/dev/sound/pcm/matrix_map.h +++ /dev/null @@ -1,672 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2009 Ariff Abdullah - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY 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. - */ - -#ifndef _SND_MATRIX_MAP_H_ -#define _SND_MATRIX_MAP_H_ - -/* - * Standard matrix maps: - * - * struct pcmchan_matrix { - * .id = Matrix identity (see matrix.h). Custom defined should use - * one of SND_CHN_MATRIX_MISC (for whatever purposes) or - * SND_CHN_MATRIX_DRV (hardware driver). - * .channels = Total number of channels, including whatever 'extended' - * (the X.ext notions, mostly LFE). - * .ext = Total number of extended channels (LFE). - * .map = { - * Sequences of channel type and interleave structure. - * [interleave offset] = { - * .type = channel type (see matrix.h). - * .members = Masks of channels that is acceptable as a - * member of this channel type. - * }, - * [total channels] = { - * .type = Maximum channels marker (SND_CHN_T_MAX). - * .members = 0 (no channels allowed here). - * }, - * }, - * .mask = Mask of channels that exist in this map. - * .offset = { - * channel offset that directly translate to the above interleave - * offset according to SND_CHN_T_* definitions. - * } - * }; - * - * Rule of thumb: Avoid using SND_CHN_T_* that is marked with XXX (matrix.h), - * or be prepared for the horror to come. - * - */ - -#define SND_CHN_MATRIX_MAP_1_0 { \ - .id = SND_CHN_MATRIX_1_0, \ - .channels = 1, \ - .ext = 0, \ - .map = { \ - /* Mono, center, etc. */ \ - [0] = { \ - .type = SND_CHN_T_FL, \ - .members = \ - SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ - SND_CHN_T_MASK_FC | SND_CHN_T_MASK_LF | \ - SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ - SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SL | \ - SND_CHN_T_MASK_SR \ - }, \ - [1] = { \ - .type = SND_CHN_T_MAX, \ - .members = 0 \ - } \ - }, \ - .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ - SND_CHN_T_MASK_FC, \ - .offset = { 0, 0, 0, 0, 0, 0, -1, -1, 0, \ - 0, 0, -1, -1, -1, -1, -1, -1, -1 } \ -} - -#define SND_CHN_MATRIX_MAP_2_0 { \ - .id = SND_CHN_MATRIX_2_0, \ - .channels = 2, \ - .ext = 0, \ - .map = { \ - /* Left */ \ - [0] = { \ - .type = SND_CHN_T_FL, \ - .members = \ - SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BL | \ - SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SL \ - }, \ - /* Right */ \ - [1] = { \ - .type = SND_CHN_T_FR, \ - .members = \ - SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BR | \ - SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SR \ - }, \ - [2] = { \ - .type = SND_CHN_T_MAX, \ - .members = 0 \ - } \ - }, \ - .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR, \ - .offset = { 0, 1, -1, -1, -1, -1, -1, -1, -1, \ - -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ -} - -#define SND_CHN_MATRIX_MAP_2_1 { \ - .id = SND_CHN_MATRIX_2_1, \ - .channels = 3, \ - .ext = 1, \ - .map = { \ - /* Left */ \ - [0] = { \ - .type = SND_CHN_T_FL, \ - .members = \ - SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BC | \ - SND_CHN_T_MASK_SL \ - }, \ - /* Right */ \ - [1] = { \ - .type = SND_CHN_T_FR, \ - .members = \ - SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC | \ - SND_CHN_T_MASK_SR \ - }, \ - /* LFE */ \ - [2] = { \ - .type = SND_CHN_T_LF, \ - .members = SND_CHN_T_MASK_LF \ - }, \ - [3] = { \ - .type = SND_CHN_T_MAX, \ - .members = 0 \ - } \ - }, \ - .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ - SND_CHN_T_MASK_LF, \ - .offset = { 0, 1, -1, 2, -1, -1, -1, -1, -1, \ - -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ -} - -#define SND_CHN_MATRIX_MAP_3_0 { /* 3 channels default */ \ - .id = SND_CHN_MATRIX_3_0, \ - .channels = 3, \ - .ext = 0, \ - .map = { \ - /* Left */ \ - [0] = { \ - .type = SND_CHN_T_FL, \ - .members = \ - SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_SL \ - }, \ - /* Right */ \ - [1] = { \ - .type = SND_CHN_T_FR, \ - .members = \ - SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_SR \ - }, \ - /* Rear Center */ \ - [2] = { \ - .type = SND_CHN_T_BC, \ - .members = \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BL | \ - SND_CHN_T_MASK_BR | SND_CHN_T_MASK_BC | \ - SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR \ - }, \ - [3] = { \ - .type = SND_CHN_T_MAX, \ - .members = 0 \ - } \ - }, \ - .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ - SND_CHN_T_MASK_BC, \ - .offset = { 0, 1, -1, -1, -1, -1, -1, -1, 2, \ - -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ -} - -#define SND_CHN_MATRIX_MAP_3_1 { \ - .id = SND_CHN_MATRIX_3_1, \ - .channels = 4, \ - .ext = 1, \ - .map = { \ - /* Left */ \ - [0] = { \ - .type = SND_CHN_T_FL, \ - .members = \ - SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_SL \ - }, \ - /* Right */ \ - [1] = { \ - .type = SND_CHN_T_FR, \ - .members = \ - SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_SR \ - }, \ - /* LFE */ \ - [2] = { \ - .type = SND_CHN_T_LF, \ - .members = SND_CHN_T_MASK_LF \ - }, \ - /* Rear Center */ \ - [3] = { \ - .type = SND_CHN_T_BC, \ - .members = \ - SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR | \ - SND_CHN_T_MASK_BC | \ - SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR \ - }, \ - [4] = { \ - .type = SND_CHN_T_MAX, \ - .members = 0 \ - } \ - }, \ - .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BC, \ - .offset = { 0, 1, -1, 2, -1, -1, -1, -1, 3, \ - -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ -} - -#define SND_CHN_MATRIX_MAP_4_0 { \ - .id = SND_CHN_MATRIX_4_0, \ - .channels = 4, \ - .ext = 0, \ - .map = { \ - /* Left */ \ - [0] = { \ - .type = SND_CHN_T_FL, \ - .members = \ - SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_SL \ - }, \ - /* Right */ \ - [1] = { \ - .type = SND_CHN_T_FR, \ - .members = \ - SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_SR \ - }, \ - /* Rear Left */ \ - [2] = { \ - .type = SND_CHN_T_BL, \ - .members = \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BL | \ - SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SL \ - }, \ - /* Rear Right */ \ - [3] = { \ - .type = SND_CHN_T_BR, \ - .members = \ - SND_CHN_T_MASK_LF | SND_CHN_T_MASK_BR | \ - SND_CHN_T_MASK_BC | SND_CHN_T_MASK_SR \ - }, \ - [4] = { \ - .type = SND_CHN_T_MAX, \ - .members = 0 \ - } \ - }, \ - .mask = SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FR | \ - SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR, \ - .offset = { 0, 1, -1, -1, 2, 3, -1, -1, -1, \ - -1, -1, -1, -1, -1, -1, -1, -1, -1 } \ -} - -#define SND_CHN_MATRIX_MAP_4_1 { \ - .id = SND_CHN_MATRIX_4_1, \ - .channels = 5, \ - .ext = 1, \ - .map = { \ - /* Left */ \ - [0] = { \ - .type = SND_CHN_T_FL, \ - .members = \ - SND_CHN_T_MASK_FL | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_SL \ - }, \ - /* Right */ \ - [1] = { \ - .type = SND_CHN_T_FR, \ - .members = \ - SND_CHN_T_MASK_FR | SND_CHN_T_MASK_FC | \ - SND_CHN_T_MASK_SR \ - }, \ - /* Rear Left */ \ - [2] = { \ - .type = SND_CHN_T_BL, \ - .members = \ *** 377 LINES SKIPPED *** From nobody Mon Dec 2 16:27:25 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y28ML0GrCz5g53C; Mon, 02 Dec 2024 16:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y28MK5PQyz4TdX; Mon, 2 Dec 2024 16:27:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iFmTDsq2KixURaqe8fPR7tkSv8EPdfiPEYiTWz1SFAU=; b=SOiyGWBHzaQIq0qGOKmvdZNPyEys1cQxdl+PcaK2fhzF0IrunPK9lb9XpBH/F/UpNv173M wTEA00IJ/MVD7HaDK8nHmGKI6C0yI7Qm8/c7Ck6w9U0msL4rB4wj27n8UwKaMgdaZgWIi2 hSLKHzhtofRIyMY7VT1kYaXCq9YtIEpVhjUpl9bUh8hk2tsNTBguloqsURo6vig2uz7bWX w+HGPT8T0TYBH7HrAhhdREx6RiNfpn9RH9AQFszuGEvBcR7mkPxf7ahQLyXKAueTrU++yK IP6nBAc+pS0hvb/WqoLz1XiAjCYM8XxdVBZsJeMF2JZUV/TZXJoSKBT7MHVtEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iFmTDsq2KixURaqe8fPR7tkSv8EPdfiPEYiTWz1SFAU=; b=kTXrPdxLRgjT6D5W4PAVX/i0swcT5qF5KO/vcrmcb28tQje9f1iMhS0Kwz19Gq9dzp15G3 FwudaE9/X0CcIx+SC75fS1nEmS8WwKxqvpuhHfnW0TjvqH2tIupEEZ2VENoF9LCePQL5OA 5CzYYKW1skk437rQvdW6NzScXooaDnZ7HHz1U8GWNbgXT5U2CXN8j/kl/M0y0vPPaYfl/Y Mk+wIoBjGj7rbQjkGrsscX9zUbSYR8pdT0cIQ/8igQPLShX2ckVMZCgtoZHXyeCAgDLfgA rWkSXHfNsirqXRK98n6YnGztwrrjTz6xiedwsqekSd16ugDSBpqsB9BQn0QsEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733156845; a=rsa-sha256; cv=none; b=QHGHaz7Vqg53zGOTzliAU9B166Lgw2u0raqlR5Ae6Fkh0hw+ISeW3UAJEmrelb8CAmY1ti OT6I8mFWUWtlWVCm/PiT2WeNfQJjGWKqcFDW212a0uQCVzJR3d8foWjDAGyBYJaY+OT/0A 1GZz3kkrxMVEd+buOwzdY3UFis9z2zpO0ky5wLALPBVuSI40kPvdIe3iN8I84gQefbLl7Q ZGQ90bQSmvSjVEgxGbcDr89iWhkDERM1zFFnyhZpV3k1LUYA3+N+evMhf97edV9wI3hQmb uoMTQ9syOEUJNaKZ/yoycmQMZkwRskpx2FUo4qiiNK+ek4NVR8dbrvT91HgYYA== 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 4Y28MK51YWzlp0; Mon, 2 Dec 2024 16:27:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2GRPEb070912; Mon, 2 Dec 2024 16:27:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2GRPU6070909; Mon, 2 Dec 2024 16:27:25 GMT (envelope-from git) Date: Mon, 2 Dec 2024 16:27:25 GMT Message-Id: <202412021627.4B2GRPU6070909@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 29ba0cc4d919 - main - sound: Fix mis-sorted CHN_F_BITS line List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29ba0cc4d919243436f1bf73a22a554fa5073a44 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=29ba0cc4d919243436f1bf73a22a554fa5073a44 commit 29ba0cc4d919243436f1bf73a22a554fa5073a44 Author: Christos Margiolis AuthorDate: 2024-12-02 16:26:50 +0000 Commit: Christos Margiolis CommitDate: 2024-12-02 16:26:50 +0000 sound: Fix mis-sorted CHN_F_BITS line Fixes: 5317480967bf ("sound: Remove CHN_F_SLEEPING") Reported by: jhb Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: jhb, emaste Differential Revision: https://reviews.freebsd.org/D47781 --- sys/dev/sound/pcm/channel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index cef8aa4e86e5..47089aca0745 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -381,8 +381,8 @@ enum { "\002ABORTING" \ "\003RUNNING" \ "\004TRIGGERED" \ - /* \006 */ \ "\005NOTRIGGER" \ + /* \006 */ \ "\007NBIO" \ "\010MMAP" \ "\011BUSY" \ From nobody Mon Dec 2 16:27:26 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y28MM1DRzz5g53F; Mon, 02 Dec 2024 16:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y28ML6NZgz4Tds; Mon, 2 Dec 2024 16:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eYr0q8A3Y8zIpyhc0/mKxsC3GlM1EjPvfsT1fNsKHnA=; b=GF2BsmRxIxLW9VpjNM88f2+vEqATf+bIRnA/LMGr1A99bNVw38zwGw4m9rE3TWbgV2aPNS hy9VOpohEBPIq0BKP2g1dSaLOv39ZW7BKP2YjqVXdZfhVuL9YA/yLHlK+BQJ9rdpWSsBhl 0G8GdSDg70QjVEcZA9H0RzllkveTdMSo0+zz35vwmWq6pftoRQcrlzVEcZZ8fGcpT7yfna 2BS1dI+ez0+O2YMOzBEYmGeA3h6a/mAEEkMEP3MaA8B0DWPCWwXr+m/ofcCWC8bIsWqSpH jc5NE9UnIxvlkh7SNOogepzagwD9kwGjQenufmQqxT/y6IgWofhdEyQfKv4gSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733156846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eYr0q8A3Y8zIpyhc0/mKxsC3GlM1EjPvfsT1fNsKHnA=; b=fuLo1+l1HP1p566kKLHiSg5I99690L+fvwNTAeIvB8eNCbxNSZZ/SK7EptMTFZT1q1NpNg 2mfQGcDopfH1DfEuMvatMlyaustKBLOr1VtLz5WTn24lu8eYP9DxPBiqz+ebsZFIn912iD JkxMAt7/mmU0VWK9TVjAaVj/QJcbT5iCWFC0LpFUoSJcQ9HpdIidj/tkPr44runX2HO1l7 IKtqFMr3g68F3Ndn/9dwRb4Lpz3HtQeEU5S5q99dOy2FaNveRaWiPojLeIIn04FBlzDCMs pj5TSVNzqGuD++RX+HWfZL/MINp6LLclQsd6b7PC3rO2jd2kR6GspzBwg4GlIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733156846; a=rsa-sha256; cv=none; b=LupKkA4INqFqfd05n+7J28D9+RR09NOqfCEEpLt77eoaz6kcLwp7Pya+qZDL+WGClIcM4G dev5UMrogB8d+7HxSe6/PDCJflIwq+xkr1xPd47pqDn8mUj9uFLch3Fw4lTEPeR3mGpHHu Bs7EgF7DAc9dlTeyfaygp7erVcOrcHEr2djwnYRKxavhEWFwxSFED5QP+2pwI8G6Q61YHE hdSBKNiE9Igk3TuIY825SOGHTLe0kC9YDmpmfUeTewQfDyrBkyI9tRZwxsrKKVtC6Du+JO A5DMLxAuoAGAv5VovN8NSoSWZVjMXzx5Rm6zC6ke0TJHJ+wuKX9o+7Dr1D54RQ== 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 4Y28ML60sdzlR0; Mon, 2 Dec 2024 16:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2GRQHS070954; Mon, 2 Dec 2024 16:27:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2GRQhd070951; Mon, 2 Dec 2024 16:27:26 GMT (envelope-from git) Date: Mon, 2 Dec 2024 16:27:26 GMT Message-Id: <202412021627.4B2GRQhd070951@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 46a97b9cd6fd - main - sound: Do not access cv_waiters List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46a97b9cd6fd4415270afe4070082ae69ee21035 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=46a97b9cd6fd4415270afe4070082ae69ee21035 commit 46a97b9cd6fd4415270afe4070082ae69ee21035 Author: Christos Margiolis AuthorDate: 2024-12-02 16:26:58 +0000 Commit: Christos Margiolis CommitDate: 2024-12-02 16:26:58 +0000 sound: Do not access cv_waiters Remove uses of cv_waiters in PCM_RELEASE and CHN_BROADCAST, and also use a counter around cv_timedwait_sig() in chn_sleep(), which is checked in pcm_killchans(), as opposed to reading cv_waiters directly, which is a layering violation. While here, move CHN_BROADCAST below the channel lock operations. Reported by: avg, jhb, markj Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, avg Differential Revision: https://reviews.freebsd.org/D47780 --- sys/dev/sound/pcm/channel.c | 2 ++ sys/dev/sound/pcm/channel.h | 9 ++++----- sys/dev/sound/pcm/sound.c | 4 ++-- sys/dev/sound/pcm/sound.h | 13 ++----------- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 728284b055e5..925a82bb170f 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -329,7 +329,9 @@ chn_sleep(struct pcm_channel *c, int timeout) if (c->flags & CHN_F_DEAD) return (EINVAL); + c->sleeping++; ret = cv_timedwait_sig(&c->intr_cv, c->lock, timeout); + c->sleeping--; return ((c->flags & CHN_F_DEAD) ? EINVAL : ret); } diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 47089aca0745..67f5019f4727 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -117,6 +117,8 @@ struct pcm_channel { * lock. */ unsigned int inprog; + /* Incrememnt/decrement around cv_timedwait_sig() in chn_sleep(). */ + unsigned int sleeping; /** * Special channel operations should examine @c inprog after acquiring * lock. If zero, operations may continue. Else, thread should @@ -242,11 +244,6 @@ struct pcm_channel { (x)->parentchannel->bufhard != NULL) ? \ (x)->parentchannel->bufhard : (y)) -#define CHN_BROADCAST(x) do { \ - if ((x)->cv_waiters != 0) \ - cv_broadcastpri(x, PRIBIO); \ -} while (0) - #include "channel_if.h" int chn_reinit(struct pcm_channel *c); @@ -320,6 +317,8 @@ int chn_getpeaks(struct pcm_channel *c, int *lpeak, int *rpeak); #define CHN_LOCKASSERT(c) mtx_assert((c)->lock, MA_OWNED) #define CHN_UNLOCKASSERT(c) mtx_assert((c)->lock, MA_NOTOWNED) +#define CHN_BROADCAST(x) cv_broadcastpri(x, PRIBIO) + int snd_fmtvalid(uint32_t fmt, uint32_t *fmtlist); uint32_t snd_str2afmt(const char *); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 218147b73db0..2d57852e036d 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -221,8 +221,8 @@ pcm_killchans(struct snddev_info *d) /* Make sure all channels are stopped. */ CHN_FOREACH(ch, d, channels.pcm) { CHN_LOCK(ch); - if (ch->intr_cv.cv_waiters == 0 && CHN_STOPPED(ch) && - ch->inprog == 0) { + if (ch->inprog == 0 && ch->sleeping == 0 && + CHN_STOPPED(ch)) { CHN_UNLOCK(ch); continue; } diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index abbfc1111805..fe04898c17a5 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -359,15 +359,7 @@ int sound_oss_card_info(oss_card_info *); __func__, __LINE__); \ if ((x)->flags & SD_F_BUSY) { \ (x)->flags &= ~SD_F_BUSY; \ - if ((x)->cv.cv_waiters != 0) { \ - if ((x)->cv.cv_waiters > 1 && snd_verbose > 3) \ - device_printf((x)->dev, \ - "%s(%d): [PCM RELEASE] " \ - "cv_waiters=%d > 1!\n", \ - __func__, __LINE__, \ - (x)->cv.cv_waiters); \ - cv_broadcast(&(x)->cv); \ - } \ + cv_broadcast(&(x)->cv); \ } else \ panic("%s(%d): [PCM RELEASE] Releasing non-BUSY cv!", \ __func__, __LINE__); \ @@ -459,8 +451,7 @@ int sound_oss_card_info(oss_card_info *); ("%s(%d): [PCM RELEASE] Releasing non-BUSY cv!", \ __func__, __LINE__)); \ (x)->flags &= ~SD_F_BUSY; \ - if ((x)->cv.cv_waiters != 0) \ - cv_broadcast(&(x)->cv); \ + cv_broadcast(&(x)->cv); \ } while (0) /* Quick version, for shorter path. */ From nobody Mon Dec 2 19:39:04 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2DcS61tyz5gKKX; Mon, 02 Dec 2024 19:39: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2DcS5Rpjz4p7h; Mon, 2 Dec 2024 19:39:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733168344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=08m2JzxIlAZyJMNgFGE6GRw8E3mTe+RFywcQ5ain2Ao=; b=d+LwjpwTI21IiRVIGE4HoPLmb4IsSYO7k+MwfU5OVy7eUUpZQb5TLSr7kim/LQagto+xwd +HDdSZ6KjbLx+Yf1zb/OS/Zf771kxkJp7Nz3wwZ3gVZvGzBLJdNPatlMuYWOlK5DLZQkEB jDnCdcPQ9jToCs7nwgZmB6lyCHFnUTF39A2nhRZMCKxtOZ5lQMEPh/r4cXi5p/uS6vCiUI 2KscAB47wQUslv/uHJVywbzb08/gWrywjotlw5U8rWRgJDudciRYcVlSlitp44QQ+j00AU oc7FrbWJbRyJaGVLqBNYGyejl4CmXiZycIr2VQuiSSWVRYddfXfE2uF2bhdBSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733168344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=08m2JzxIlAZyJMNgFGE6GRw8E3mTe+RFywcQ5ain2Ao=; b=DR0pNf5WvJ8W+6SYpDKT51ohp3MnnHZQdUi9lsBPBv2xnlILsvBIg4Gv7eQzJJMz5DFQh0 Wkwwjgd45Y0bJ4oulQeXcjIV6hAZqZgNiYcmxmS/29hkBtS+VtIPJqjO6TiV0yNg/ESn2q ot07uDHl3gz5dut2IaNRygbaDYcCsyg8Vo5nAkNGVtUGWzLTFiEruokbPRQm0UxHbEjjqN MW+QLXdG1UKv/ON8RiolAvYyDKnX3ALbmkhzUrrcO3IzmWy+LCIWFRMMLZEpNrXSFu9Zeq x4dG3yKnb8s06ssY0RO5N5SpipcIh81JPA/Bv3oNgQKF1LgSc4PqSt7S0BP15Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733168344; a=rsa-sha256; cv=none; b=yKN+3T+v5tPzQ4SVdHtcu2q3LfvSksQti9AHGRr/Ac1Vfv+cZjpEQ5IcgB5V5lYEzwECUw a5QL+gRPxNZP48bVwyAcuOMdv7SdKBXqvUX1msLCMeP6mH+Mv8dHFGmZUY6ILA2yo95RhT uLxDhhXhMDIjDvLXp/3KoMUjdrcwu3hsmQUWB20C257qVsh9yxKjKYgb54Poc8PvKo6Eam qPGAxtZ8uMcuivah/YeGlZJGWfT15KIuJplYQn/48IlFjr+LVZPZbiJaMw44eUlvamql1U 4vKTEJa4LdIEQUsa3ct/ll5AZEmeW5Yf29RdYI/tXdblDcAHNkEKTmrhwXxQew== 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 4Y2DcS4tfCzr4D; Mon, 2 Dec 2024 19:39:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2Jd4Uf025023; Mon, 2 Dec 2024 19:39:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2Jd4r7025020; Mon, 2 Dec 2024 19:39:04 GMT (envelope-from git) Date: Mon, 2 Dec 2024 19:39:04 GMT Message-Id: <202412021939.4B2Jd4r7025020@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 928864a93594 - main - fix build with LOCK_PROFILING but without KDTRACE_HOOKS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 928864a93594eddbf5bf67310bb0f5c684350dc6 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=928864a93594eddbf5bf67310bb0f5c684350dc6 commit 928864a93594eddbf5bf67310bb0f5c684350dc6 Author: Kristof Provost AuthorDate: 2024-11-27 17:06:41 +0000 Commit: Kristof Provost CommitDate: 2024-12-02 19:36:35 +0000 fix build with LOCK_PROFILING but without KDTRACE_HOOKS Reviewed by: kib, markj Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D47822 --- sys/kern/kern_rwlock.c | 10 ++++------ sys/kern/kern_sx.c | 10 +++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 3286fce76d96..03d59d613e74 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -461,9 +461,9 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, uintptr_t v u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; + uintptr_t state = 0; #endif #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) - uintptr_t state = 0; int doing_lockprof = 0; #endif @@ -473,12 +473,11 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, uintptr_t v goto out_lockstat; doing_lockprof = 1; all_time -= lockstat_nsecs(&rw->lock_object); - state = v; } + state = v; #endif #ifdef LOCK_PROFILING doing_lockprof = 1; - state = v; #endif if (SCHEDULER_STOPPED()) @@ -936,9 +935,9 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOCK_FILE_LINE_ARG_DEF) u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; + uintptr_t state = 0; #endif #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) - uintptr_t state = 0; int doing_lockprof = 0; #endif int extra_work = 0; @@ -955,13 +954,12 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOCK_FILE_LINE_ARG_DEF) extra_work = 1; doing_lockprof = 1; all_time -= lockstat_nsecs(&rw->lock_object); - state = v; } + state = v; #endif #ifdef LOCK_PROFILING extra_work = 1; doing_lockprof = 1; - state = v; #endif if (SCHEDULER_STOPPED()) diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 4cc8ac8ce106..952cfae7c977 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -582,9 +582,9 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LOCK_FILE_LINE_ARG_DEF) u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; + uintptr_t state = 0; #endif #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) - uintptr_t state = 0; int doing_lockprof = 0; #endif int extra_work = 0; @@ -600,13 +600,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LOCK_FILE_LINE_ARG_DEF) extra_work = 1; doing_lockprof = 1; all_time -= lockstat_nsecs(&sx->lock_object); - state = x; } + state = x; #endif #ifdef LOCK_PROFILING extra_work = 1; doing_lockprof = 1; - state = x; #endif if (SCHEDULER_STOPPED()) @@ -1034,8 +1033,6 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LOCK_FILE_LINE_ARG_DEF) u_int sleep_cnt = 0; int64_t sleep_time = 0; int64_t all_time = 0; -#endif -#if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) uintptr_t state = 0; #endif int extra_work __sdt_used = 0; @@ -1048,12 +1045,11 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LOCK_FILE_LINE_ARG_DEF) goto out_lockstat; extra_work = 1; all_time -= lockstat_nsecs(&sx->lock_object); - state = x; } + state = x; #endif #ifdef LOCK_PROFILING extra_work = 1; - state = x; #endif if (SCHEDULER_STOPPED()) From nobody Mon Dec 2 19:39:05 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2DcV0H3Hz5gKND; Mon, 02 Dec 2024 19:39: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2DcT6smPz4pR5; Mon, 2 Dec 2024 19:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733168346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k7BWCkghn1ZiSdvhBbFi9YjdyQKvKKAnNqwg75mGvzc=; b=mtM94BsmBPj7r0gtH/KpF4wy6RDP7LNAd5uk+SL80eQjmYuMtKT7F+Q42CiwcB8o9R/DgM OrrVP1asdhxMA2MOMWw0UEw9IfMIZCRijqJ7wwQQsNaeqyJOtKTMEov8k8UqkGG0qq4Bk9 LdtOuHlO8Q1YjB88bU39GVVCk6OqOL1C1Mhk09XoEsjnaaGuM8zJlzUWGh0Eyr/bBtA2xp d9Up6k0GpZvl32y/OaDIpEU8ufnT4gv1EgZZ7Hoi+sZs/CToMOCmyfxbpKyszcdKRyztne NImDXQl9vUQm59gVKR8dxuD08HhJgPPHevnU3tFK1/T2hDvLBaV5FfW62qyXmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733168346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k7BWCkghn1ZiSdvhBbFi9YjdyQKvKKAnNqwg75mGvzc=; b=D2c7CoW7hYdjWF3vVSUnHKMfbVv0dH2vzF2CN3qkjb+p1wlcBhJgjUaXIknIgDWJaatPzw uIDEoEblQXJJS157gg5YhfHB9TJJ2lacupA16w0gJ0YwFsokyu/tCEhaFnHWoZJ42vhPwe yvqSwXSykE7pZAZWuFkUdAeSkPuVmm2w8cHFCLwpTD1sM6sCxSziI8itiDS95kEKwcNBk8 CkENQgdD0KArWuntYhjxX94Cb6R3GHKGvHp4eT0ozgLLH2MeI2uE50aFSGgBM6gBOcXaPJ xrjcG9djIOBxcOr8fx2DO4TGHdRB5AmvYatMzVOvx/T6Ka4nKXc5sO92bm5KcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733168346; a=rsa-sha256; cv=none; b=LTCDekH63JtlEsu94ApFZiNCA57JSGO/8O+JfqpB8OHYxQNW07qpaks3XpeS6kVGRfpp7R VsqYgeFdwXlQ0JKVl79BsTYQGVwBjaEfpHRcPfSMuJe8etROArvsueceTXUbeQVWp1xee4 vwefkUfMmYQpUKM1Rn3tIkWwCcsLyQwmL2th41bo4d1JaYGGdgyBdj4RaTeCG2AxXap/XS DdRrIM01JTBciJXAherFaBVTZd3bdGGttrCMS5GpLF4E/050fISDIIHQ5Ugj7NUC4SjDXN 8LZmrpRfsDdJzD2LH+rACeMhBGRtKF6DTjqxRw8h5lShcJNg0bafM6ueSIdUog== 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 4Y2DcT69vXzr4F; Mon, 2 Dec 2024 19:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2Jd5nx025069; Mon, 2 Dec 2024 19:39:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2Jd5Oh025066; Mon, 2 Dec 2024 19:39:05 GMT (envelope-from git) Date: Mon, 2 Dec 2024 19:39:05 GMT Message-Id: <202412021939.4B2Jd5Oh025066@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 2f915345634e - main - LINT: Remove DTrace support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 2f915345634e9e0f809f79581359190268908ba9 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2f915345634e9e0f809f79581359190268908ba9 commit 2f915345634e9e0f809f79581359190268908ba9 Author: Kristof Provost AuthorDate: 2024-11-27 16:57:08 +0000 Commit: Kristof Provost CommitDate: 2024-12-02 19:36:35 +0000 LINT: Remove DTrace support Ensure we have at least one commonly built kernel config that does not include DTrace. This is intended to help detect issues such as 45d108ee14 where a variable is only used for static probe point, resulting in build failures when DTrace is disabled. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D47821 --- sys/x86/conf/NOTES | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/x86/conf/NOTES b/sys/x86/conf/NOTES index ffd90c06b516..bb45d4ecbf92 100644 --- a/sys/x86/conf/NOTES +++ b/sys/x86/conf/NOTES @@ -2,12 +2,6 @@ # Common NOTES between i386 and amd64 -# -# Enable the kernel DTrace hooks which are required to load the DTrace -# kernel modules. -# -options KDTRACE_HOOKS - # DTrace core # NOTE: introduces CDDL-licensed components into the kernel #device dtrace From nobody Mon Dec 2 19:57:26 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2F1f71xrz5gLvd; Mon, 02 Dec 2024 19:57: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2F1f6SXBz4rQx; Mon, 2 Dec 2024 19:57:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733169446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kdxPvf76/+9cRuzaIQgBthe0c4jPRyzirjW8J/iBs0M=; b=aif25XKv7QKsf6NJTzhcpHg8dT0fpp5I/cEGjYIoNASssr/jK8aWmynFaGYYow9Ss1Ux9F MXow/xSs+Pj/jKRAb34q3iVqeehgOQ0y+D4RkWwIuXMK9ZuEHjdhuVJXpOSYsBAxtOle1/ pImqp2uLqkqt1ahP7ZyBP5lFb0opMP9rdJx/hGaXDBJNYGvD8gc7sZXPjV/OqXcdPEtXIs glIEemWjxE5CmW3skQkytfJerRdIS01azTE1Mi5b6O6/Q34weh5BjhlWJTfdAh9E9zUENf hVco05t5kOHsqFGfwz9CBnOhIsYNtbLDPG2ZY7cPPNGRcUdPoCj1SLTH5L3E/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733169446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kdxPvf76/+9cRuzaIQgBthe0c4jPRyzirjW8J/iBs0M=; b=ZZrsTVJGbXebVJ3vfrOMDb3uB6io4TEvrEmkJHCxkpmZgaBW86/wK4O/QSJ3d5arh0P0G5 fcsd3byZkwulcHP7Rj8fJeA1CcmDzNE7t6uHvCmVzqXw8GJujNQ0tteLIOJ7wpVo2BX27x PrwCeTXi9d0bYinqmtIw5cqkENVfjShxDyT2Fr87auLCNFRHN15ZLk83T2TyHPogOwQm9N oTYRovUN2gwqyLncwB0bPEKOfXoXhpkZHFhyMKfklmQN/9MVlkg/rAF+1cwziH3v+P+hxj LwL2yXbsejc735787x6LtOCnt6zhLswDcB1+jOx30qacknWybbhybhDD3TSvTA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733169446; a=rsa-sha256; cv=none; b=QxUlbkps3Ym3uiItoNXsf+zpVbWCi8KxaPpTBBcLECs+jiZVzkhJwHYzJnoQfkOdVEBThB j0VCO6aUocrie/WSBVpOAH7y95OWplVN/sAHNva/yCyaHohs9T14PjgetUfzuZQIUeTkaI xz+lBB1WI/Ldn/u5ZbXyl6yzXtXYHXFd5vYKr36A7KvRrX8nN38NhdtUWTbgd2IXAa5aIM 9BjEdjXmqD+pQ7vyPOWW75sVc+2k856IGM2wgEd3xPLuUM1yDMXw+n4P7wOpS2BCyqcIB1 RqEKEHswehme1nv9YCBzkOE4lX7I+NX468nr2QI9DFjiLB+9df7yFVTLOLluQg== 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 4Y2F1f5lktzrQ7; Mon, 2 Dec 2024 19:57:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2JvQ86061229; Mon, 2 Dec 2024 19:57:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2JvQ4D061226; Mon, 2 Dec 2024 19:57:26 GMT (envelope-from git) Date: Mon, 2 Dec 2024 19:57:26 GMT Message-Id: <202412021957.4B2JvQ4D061226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 91629228e3df - main - comsat: move uid/gid setting earlier List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 91629228e3df14997df12ffc6e7be6b9964e5463 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=91629228e3df14997df12ffc6e7be6b9964e5463 commit 91629228e3df14997df12ffc6e7be6b9964e5463 Author: Ed Maste AuthorDate: 2024-12-01 20:43:10 +0000 Commit: Ed Maste CommitDate: 2024-12-02 19:57:13 +0000 comsat: move uid/gid setting earlier It's good to reduce privilege as early as possible. Suggested by: jlduran Reviewed by: jlduran Obtained from: NetBSD Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47869 --- libexec/comsat/comsat.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c index e2aea1b709b6..d5d1eedeb5f3 100644 --- a/libexec/comsat/comsat.c +++ b/libexec/comsat/comsat.c @@ -59,7 +59,7 @@ static int debug = 0; static char hostname[MAXHOSTNAMELEN]; -static void jkfprintf(FILE *, char[], char[], off_t); +static void jkfprintf(FILE *, char[], off_t); static void mailfor(char *); static void notify(struct utmpx *, char[], off_t, int); static void reapchildren(int); @@ -147,6 +147,7 @@ notify(struct utmpx *utp, char file[], off_t offset, int folder) FILE *tp; struct stat stb; struct termios tio; + struct passwd *p; char tty[20]; const char *s = utp->ut_line; @@ -180,6 +181,14 @@ notify(struct utmpx *utp, char file[], off_t offset, int folder) } (void)tcgetattr(fileno(tp), &tio); cr = ((tio.c_oflag & (OPOST|ONLCR)) == (OPOST|ONLCR)) ? "\n" : "\n\r"; + + /* Set uid/gid/groups to user's in case mail drop is on nfs */ + if ((p = getpwnam(utp->ut_user)) == NULL || + initgroups(p->pw_name, p->pw_gid) == -1 || + setgid(p->pw_gid) == -1 || + setuid(p->pw_uid) == -1) + return; + switch (stb.st_mode & (S_IXUSR | S_IXGRP)) { case S_IXUSR: case (S_IXUSR | S_IXGRP): @@ -188,7 +197,7 @@ notify(struct utmpx *utp, char file[], off_t offset, int folder) cr, utp->ut_user, (int)sizeof(hostname), hostname, folder ? cr : "", folder ? "to " : "", folder ? file : "", cr, cr); - jkfprintf(tp, utp->ut_user, file, offset); + jkfprintf(tp, file, offset); break; case S_IXGRP: (void)fprintf(tp, "\007"); @@ -204,21 +213,13 @@ notify(struct utmpx *utp, char file[], off_t offset, int folder) } static void -jkfprintf(FILE *tp, char user[], char file[], off_t offset) +jkfprintf(FILE *tp, char file[], off_t offset) { unsigned char *cp, ch; FILE *fi; int linecnt, charcnt, inheader; - struct passwd *p; unsigned char line[BUFSIZ]; - /* Set uid/gid/groups to user's in case mail drop is on nfs */ - if ((p = getpwnam(user)) == NULL || - initgroups(p->pw_name, p->pw_gid) == -1 || - setgid(p->pw_gid) == -1 || - setuid(p->pw_uid) == -1) - return; - if ((fi = fopen(file, "r")) == NULL) return; From nobody Mon Dec 2 20:37:57 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2FwP1Srzz5gPRY; Mon, 02 Dec 2024 20:37: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2FwP10mMz3wvV; Mon, 2 Dec 2024 20:37:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733171877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ftysO0ev+gRr5qKhQkpxTHkGo3kErpkNKCCj5vwfvPs=; b=gUi9FMoyTEKc1APw/ZV9zPy8TimRy+yHVGKdfITJXNpYa1yX+dIXJ9cjx9Bvg+gfaE97V2 XX0cnK17bAgqRYUHFZT2KMl3TQHlh/BdhAyKdCc30U5rJ/aUD7OO5tab6YXLppAxp62/z2 Gt7PAPtjBoPsvlR0481fYvOb+moXwve4G/gIFbECynxXt5glr0HYIELkQVoww54YiE9sMo tYL0MhTC+P33vA2UumneHoAJ2VuB58J83T4Z+Hz2ffTwIkk8QAKhrs2mzLG73Y8LXEe05d qugfGJNZORrr8xy1KRMr5VknAe1HX2a7YWvcg6L2THeHDY/i+bk1+ydyzeLuqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733171877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ftysO0ev+gRr5qKhQkpxTHkGo3kErpkNKCCj5vwfvPs=; b=Et6jnu84FcPZRrXAajIQ2IE6j4wTW8XJO80q0OLsoasp+kjenBCCnEvrayV1rk9qxP1jBd qRHf5w9VDkvSgryG0Dhttt5Xq0AWBwBEVIJN9uS6a7LTFGhWbzMAZpsQQm9aPbM2JV5fdN m6h42PotLOLMYP72CQlWYGoT+fWzeUg7F3XYms/b2KI7rB+iythqwXw/7QWcgwSMLeazoE Ii4l/Bb3Ca77yekLwvqq73u8on7BV3ztiFD0KZ5yJWtEDdquaEWaOJ12+0LbtK9axXGTwH u2uOWOEZiQWAV6V61ZFR0n6EiUfA3khNrwhxNEVYnMOCTEUrr7BOw+FQjw2jeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733171877; a=rsa-sha256; cv=none; b=qtbk246oEhs9DUVg3JsxezCIM93wRAfXF4YXM73qyev2Knvh6++hFCn31JVh5X0yKhcFv5 6x7wdT4rpWPirHNETNYWkaaF/v1M7xXeqlaHf7hG4FhTdwjXdf/93Z9c5IOgSIJtRrpfy6 b6OfZ1ueNC418bkDH+Jx3LI6pRGglFClEFHrweFjzbHuUaSZMpxS6uYvFqMpC8HHPKVxJR vUkEurt+QMxsruv7D93aJaTRUYdYdF0/RW4er3Q99zM2tHw3Kgrjl+JWokIUmwNcupLuci mpwK1bPTYVecubQ/ckJp6lt0kkUbWTb/+pLqfbWLzuC/K82FbA2RoV0qxl0wfw== 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 4Y2FwP0cZxzsgN; Mon, 2 Dec 2024 20:37:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2Kbvoe036948; Mon, 2 Dec 2024 20:37:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2KbvJ4036945; Mon, 2 Dec 2024 20:37:57 GMT (envelope-from git) Date: Mon, 2 Dec 2024 20:37:57 GMT Message-Id: <202412022037.4B2KbvJ4036945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 3505e0d6675b - main - cap_rights_is_empty: add MLINK List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 3505e0d6675b332c154e01110456d767e222c5d6 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3505e0d6675b332c154e01110456d767e222c5d6 commit 3505e0d6675b332c154e01110456d767e222c5d6 Author: Ed Maste AuthorDate: 2024-12-02 20:35:10 +0000 Commit: Ed Maste CommitDate: 2024-12-02 20:35:40 +0000 cap_rights_is_empty: add MLINK Fixes: a7100ae23aca ("capsicum: introduce cap_rights_is_empty Function") Sponsored by: The FreeBSD Foundation --- lib/libc/capability/Makefile.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/capability/Makefile.inc b/lib/libc/capability/Makefile.inc index e4c2350a7318..845f8f172bb8 100644 --- a/lib/libc/capability/Makefile.inc +++ b/lib/libc/capability/Makefile.inc @@ -9,6 +9,7 @@ MAN+= cap_rights_init.3 MLINKS+=cap_rights_init.3 cap_rights_set.3 MLINKS+=cap_rights_init.3 cap_rights_clear.3 +MLINKS+=cap_rights_init.3 cap_rights_is_empty.3 MLINKS+=cap_rights_init.3 cap_rights_is_set.3 MLINKS+=cap_rights_init.3 cap_rights_is_valid.3 MLINKS+=cap_rights_init.3 cap_rights_merge.3 From nobody Mon Dec 2 21:13:00 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2Ghr5Wp6z5gRnw; Mon, 02 Dec 2024 21:13: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2Ghr518Nz43W2; Mon, 2 Dec 2024 21:13:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733173980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lcbrwYL7tf3br+W0QeMojHkyZkVdIljHG6tiz8ZEvLg=; b=Bl2It8nvUYwqxZk+fJ7PxLi+O+7EU0bVR1n6efrbrdHkaVgnrETZCMNPJNZ2xTrMc5SSCH o6fdfv6+sfT/T424q6hn+N+MSw0XSTWpxLCW1OzKvx0NVSNd9BGamDf17yKE/hH2EP544n J/odM9LTW8eBfTZemgV0bNPmXEAjMhCN8E21rYqZEMZwt/CZn/RjbjoernpEG+LzRElXP8 B0akwmXf9mbDkiZp4pR0QLq55eT8l9JisrVb+kiDZECurIRCDrp5FCKpmaFJdJXDaBLJsW rKO1YOxeseIH7ny94AppU+oCeohqJnIsHpb9Y5+jDySbNcQr3ZVE1x1GgeJ1Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733173980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lcbrwYL7tf3br+W0QeMojHkyZkVdIljHG6tiz8ZEvLg=; b=Qm1sp13ZTj7pHhHYx1lilZyycWB5Fq422lGN+NxVT0x5BzhLDntrzykcZNMPbL9h0CHldj HPxyGW5l0BOjV/s8SOfi91ponxtaVsxuXFWJQXhKAm4KS2L7ZC3rguaLeDRpLLqoIt9ZOc TkNVZzGnJO1gznG61Yd2ibucE1DLrTlU2baubh/A+9Tf2PgZTtEHRF5jtDZ+HAOcTSBT7a pOSIAtid6oiVQbKcTDHzHgGDURhK0m6oC6/YXfedPUWy1Oy/3syFXUO9N6L7APE/m7N2Qe egQKjNhg5Uk4cqwRHcm3Sml+FhdJ3gx0WvRnCZej5NEOZzgFaQ2TfIHXJ5aU6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733173980; a=rsa-sha256; cv=none; b=m8IWgxDdadKcxv9VF94wDYkqoxfHIx/yqjzTmcppK9kC7SG3jC9xK1ypKMqCQVpzd5G+BI 5atnE/jKk7L3SKXaYTfVlmzrpzu1T+1fj0uIOHDTlLtr/26aoaHB0IKwaB1LL00DM1omq5 DsPHg8uB/FYkYdrRLjf9hxm3eMQhypvQUI5/B8nhzi6nICwYPboKvhjkyZ1qHj1AxOteCy NzjJZgcma3R9Jnyvj7o9qxoEfzYQHmb0e2JpnlQyrh+ngY0MPCKsd60qbNsuR8nG6dSAsv 5BENkDyo2ouSvrDm7q2piaF4U77ku5L/kxw4mBxfNjvwcEfApU3Y1SFM1wYLcQ== 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 4Y2Ghr4cRRztrG; Mon, 2 Dec 2024 21:13:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B2LD0hc010929; Mon, 2 Dec 2024 21:13:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2LD0mt010926; Mon, 2 Dec 2024 21:13:00 GMT (envelope-from git) Date: Mon, 2 Dec 2024 21:13:00 GMT Message-Id: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: b5a8abe9502e - main - How to show interface traffic in bits per second List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5a8abe9502e781598dc052698fe7fa5830f59ee Auto-Submitted: auto-generated The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=b5a8abe9502e781598dc052698fe7fa5830f59ee commit b5a8abe9502e781598dc052698fe7fa5830f59ee Author: Poul-Henning Kamp AuthorDate: 2024-12-02 21:12:27 +0000 Commit: Poul-Henning Kamp CommitDate: 2024-12-02 21:12:27 +0000 How to show interface traffic in bits per second --- usr.bin/fortune/datfiles/freebsd-tips | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index c0807405005e..1e9501e3a6fb 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -856,3 +856,7 @@ $ fc-list ':charset=0x1F4A1' $ pkg which /usr/local/share/fonts/noto/NotoColorEmoji.ttf /usr/local/share/fonts/noto/NotoColorEmoji.ttf was installed by package noto-emoji-2.042 % +When netstat reports every 8 seconds, it tells traffic in bits per second: + +$ netstat -I bge0 8 +% From nobody Tue Dec 3 00:45:47 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2MQM2ct7z5fGVP; Tue, 03 Dec 2024 00:45: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2MQM1svyz4ScQ; Tue, 3 Dec 2024 00:45:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733186747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R5Wi2Yxl3e66km8wq3ATkHk6CoDzHGVc6v3mfn94D6Y=; b=YHgy/vy1LN19to4omMbbfIpYofWd77UqSD349TlHU7fTfjofJ6mZ0HuDotyXb621VFKlC3 BVJ43L+D4+UKHrsfe/4u1U7qjNPNc++mAjoJPFpuMLbt6EJUq8NZAAFIo0JLtiIzVJEd5V UPj57+EDw4JYUF0fQQ1uusmMGJx6wtQmyd1qs4Cj4fWIP2x8NWNZoQba/VdmnJmXIDfbOv DnYLLoTxPYNRTsaIvVIXoDpi9I7KZxdTw0h4yyH2rTm3uR5qdW8BcwJe5+1XSFYA8/yj2l wgLei3zgjvYOKayaqcoL1lh6sR6yVx8qZPMtRaEOse9qcMMy8nAQfcq3DRuVVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733186747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R5Wi2Yxl3e66km8wq3ATkHk6CoDzHGVc6v3mfn94D6Y=; b=uNh/SyH+H3MMTq8XHGeZHtBtqIoeOLAU8XNcSyEmkuRvALnNnlbD/iESGNezC7GZ7VkukM kSpPKerJ/zzDK/wGygmkQEt7UE6+ItiE7EkWXWLvxXhRYamNmJ/2JVWgI4rZyLv78WNwvV wWYQw/FygSf6ZS76+ans64DtTCmqldrvWHUIALJT+pHaLtEPp4zrzQTRrpCaUKpaGd95O0 Pwp1VeczP4xRYPxDAmOrLNkkmIbibrNWo9or3JsHlPtezJ3YuE9n7G+9MQZHQr8kg4kDSy xGkAEymZsrl8wVQgr9BuG/9no4VJtv0xOZLHAXoufeOQTsDVoAQ/Z+ZS/yx87w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733186747; a=rsa-sha256; cv=none; b=t2hgUO9mHMX3RNisc8w0XzHGt70BVzENcm/PZ8gXqfxKs7FmJKLQTg5jA/CQBPDUtAQEUi /UkOZbOI7wQoN67h6OdgqaUNLAuDpZyuHkuvUOVQwkrcwGfLbJ8Y/DkFiUc4dbq+sryafM m4PQM41Tbo5iNyHtCeQ766h69euc5uyC/ahPG17nYWv9P2GeCL6FT/BUTGB256NoAYwbx8 u6SNSeFuDsPPUsnLSGc13uDQ2OgR2o6hVmgijU2dk4X3as6vtp2c/tkUL3CzeNXM/XtNAw IBkD3wJZPIUKa9SH3Hnw13rThGNzpXGCIbpv1MXoDedLj7NeAF9bTNDoeFyQ9g== 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 4Y2MQM1LZ0z11RT; Tue, 3 Dec 2024 00:45:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B30jlTB000462; Tue, 3 Dec 2024 00:45:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B30jlkE000459; Tue, 3 Dec 2024 00:45:47 GMT (envelope-from git) Date: Tue, 3 Dec 2024 00:45:47 GMT Message-Id: <202412030045.4B30jlkE000459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 850f78d5a191 - main - igc.4: Add I226 and other additions to supported list List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 850f78d5a191d0058fcd20beb8b1309b795ecdbd Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=850f78d5a191d0058fcd20beb8b1309b795ecdbd commit 850f78d5a191d0058fcd20beb8b1309b795ecdbd Author: Kevin Bowling AuthorDate: 2024-12-03 00:43:17 +0000 Commit: Kevin Bowling CommitDate: 2024-12-03 00:43:17 +0000 igc.4: Add I226 and other additions to supported list MFC after: 3 days --- share/man/man4/igc.4 | 20 ++++++++++++++++++-- sys/dev/igc/if_igc.c | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/share/man/man4/igc.4 b/share/man/man4/igc.4 index f9bca716f7fe..a67ed1c15ee8 100644 --- a/share/man/man4/igc.4 +++ b/share/man/man4/igc.4 @@ -81,13 +81,29 @@ driver supports the following models: .Pp .Bl -bullet -compact .It +I220-V +.It +I221-V +.It I225-LM .It +I225-LMvP(2) +.It I225-V .It -I225-IT +I225-IT, I225-IT(2) +.It +I225-K, I225-K(2) +.It +I226-LM +.It +I226-LMvP +.It +I226-V +.It +I226-IT .It -I225-K +I226-K .El .Sh LOADER TUNABLES Tunables can be set at the diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index 154c25a5a624..7402f89d56ff 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -56,7 +56,7 @@ static const pci_vendor_info_t igc_vendor_info_array[] = PVID(0x8086, IGC_DEV_ID_I225_K, "Intel(R) Ethernet Controller I225-K"), PVID(0x8086, IGC_DEV_ID_I225_I, - "Intel(R) Ethernet Controller I225-I"), + "Intel(R) Ethernet Controller I225-IT"), PVID(0x8086, IGC_DEV_ID_I220_V, "Intel(R) Ethernet Controller I220-V"), PVID(0x8086, IGC_DEV_ID_I225_K2, From nobody Tue Dec 3 03:52:44 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2RZD5gbqz5fcDK; Tue, 03 Dec 2024 03:52:52 +0000 (UTC) (envelope-from zlei@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2RZD3Rhmz4sj2; Tue, 3 Dec 2024 03:52:52 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733197972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XmnlCWM6eHzWyilPMwASIgPnso3ljnjkhRvHxoy7Wcg=; b=Hwn8/ntSOPyKx6qpQEplp6cbYGzixaLive9rvQzholnE5pcmqMeV+Y8sQufY9NDttMk5Hy vmopcMW9MMfq76Jo0JdQIjQYQQoX7YfpFLCEVoqu4ucPa3KvSiEkyt7bBfm8XSwfueQvVr +bvEJAwzK2S2DRSbRWtgMoE+8eKKRykWr0YYs03HiBxRkp1+HzbU3nDV2YGmJnqBpQR2WU 2foz1oNGDZdIM9W8LiNLi2Ym245BRdAsT2FtRIIZyzOADGF+ff1Z059+Th1zqGAwlGb1u8 0JDnv7PL9qQMjd53XnQ1doe+6S0bQnw/xXs9b0ngflpF+Q8tpVl7PGjsXyGlow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733197972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XmnlCWM6eHzWyilPMwASIgPnso3ljnjkhRvHxoy7Wcg=; b=MOLu4WkS7aOAfry5PJWvHOl5m9cneYjey2iE+ammeaxTaDBYz2rhSxCskoQvlyyoKaQ5Qw ODcFec7Yeb8HP6f567lbLvXUa4l0+TZ/sNuCkdUzehhpAnHQ+0IwPaWxJ+dgAlrcT4DIEx hpu8hDoHtBiUHE7CxmJOeH7v68fgTHh3AWsLKq7rxGKiS4JLsicE3pUVbK8BjBfXGnaW5P +S7dlimke67v0X5NR8BhMTutCcz6P8Qru7JU9DSTSxx1s0ZVN/zOkJWMUD5LyAzal2RC0e qFrdZOoLrCxkOPU0K+CB2aGGKRhmw5E3GWqp7a1RdSIrfeUh+zmiGbJFzpZQbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733197972; a=rsa-sha256; cv=none; b=Ovn5DMb9TZtr0uKaaDMPsbWszLT6SdBcr/15U0AtlGCcWhwiZuMKcQqdLZZjxiCovN6SK9 Wq5RjKfWFoi0ui84215RJP9qDQihWAHTBkVW/GO83cotH6JPy/jAyyM2SmX4LiEREjKFhr vMHCsPBL1nIeFv3DPrbtrI+oeUU3uUiRiKeDWszXtQlSMJjvHuXufi7EsHOphnxRJV/ACt IcVu2HN8TOEgZQQeTiuxnRcuw4wStzT7irq238+1ElfZNoa234+fbJa6jF46+pER+2E1N/ azRj05pfEzrk3EVZkF0fsi2ZWcokuWgKb6RmiN2t2Q6D5RJpcKh5Tk9R4eK98g== Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Y2RZC03NCz1Nl7; Tue, 3 Dec 2024 03:52:50 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Content-Type: text/plain; charset=us-ascii List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: git: b5a8abe9502e - main - How to show interface traffic in bits per second From: Zhenlei Huang In-Reply-To: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> Date: Tue, 3 Dec 2024 11:52:44 +0800 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <043A2EA2-647F-4B04-B6AA-A3E6B001B741@FreeBSD.org> References: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> To: Poul-Henning Kamp X-Mailer: Apple Mail (2.3696.120.41.1.10) > On Dec 3, 2024, at 5:13 AM, Poul-Henning Kamp wrote: >=20 > The branch main has been updated by phk: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db5a8abe9502e781598dc052698fe7fa5= 830f59ee >=20 > commit b5a8abe9502e781598dc052698fe7fa5830f59ee > Author: Poul-Henning Kamp > AuthorDate: 2024-12-02 21:12:27 +0000 > Commit: Poul-Henning Kamp > CommitDate: 2024-12-02 21:12:27 +0000 >=20 > How to show interface traffic in bits per second > --- > usr.bin/fortune/datfiles/freebsd-tips | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/usr.bin/fortune/datfiles/freebsd-tips = b/usr.bin/fortune/datfiles/freebsd-tips > index c0807405005e..1e9501e3a6fb 100644 > --- a/usr.bin/fortune/datfiles/freebsd-tips > +++ b/usr.bin/fortune/datfiles/freebsd-tips > @@ -856,3 +856,7 @@ $ fc-list ':charset=3D0x1F4A1' > $ pkg which /usr/local/share/fonts/noto/NotoColorEmoji.ttf > /usr/local/share/fonts/noto/NotoColorEmoji.ttf was installed by = package noto-emoji-2.042 > % > +When netstat reports every 8 seconds, it tells traffic in bits per = second: > + > +$ netstat -I bge0 8 Ahh, too stupid to be smart ! Best regards, Zhenlei > +% From nobody Tue Dec 3 04:41:12 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2Sf93l6bz5fhRD; Tue, 03 Dec 2024 04:41:21 +0000 (UTC) (envelope-from zlei@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2Sf93Fj0z41Nc; Tue, 3 Dec 2024 04:41:21 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733200881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=n3l/2ItwqM4YrqaJZHF7r1FiF+iSl0P4LLgrWdtod1M=; b=JDvmD/G7sEm+EdozfoxJGg5SdJZNFbqWCpBXsV7Dy3lg3K/yxMXLhNLUjjZozjUh/K2HdU eXEM3CmUJlE7u2ALFETA1O3Jdvv5dsYv/BzhbjVYizsRCMGYdZliImGV0DDxU4ZXmbDVxB fZZJLeGt/T1I2o0lIPNVwN+Jn5MxRLmY2woXWLsR2wF6i1CRce2BIheZf6njU/9oicXc1s h6X5lXiV6fqyFp34iboLTmGBpO39IsJQdbSimj0hTMXebmuoZSkUvCWCLzx7dWijyGmt63 J0a9c1fXEmPvZ1JwvftVVHFKxYSkweBBU/ea8miLHOqHn3iiYz4f9EWC7x//JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733200881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=n3l/2ItwqM4YrqaJZHF7r1FiF+iSl0P4LLgrWdtod1M=; b=XpKk/mOpYb+SkfrgnhIzOQMY0zKy5wKG/yVldrtEUVO+sgDPvEaBmrfujTU2JhSIZqk6QY Udl8bHwyG9ng/Zf+rGvivVdOvd9DkqJyOCvndfQK2l1yA03MtEMszr65oPzsCN3GPIHvTa Z27vQcBPWt1YE1CfKrw4TiCudcJfOsS6ypftsTLSgNhCp8PzCEEHpBWAW8aMoWSRzfhSbd EJ1sIDZUde7NHWzqOlbVEFyY9Df2q8arzTFNcpS2c44inqOHNsZxPPgKB/Ul2jVPcF9qs6 e9In3B0RD4g0a8TUPQPQIoPBI7DHAqk6B4j2NfGpHQfxJYsHLR1ilIQlY1tpEg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733200881; a=rsa-sha256; cv=none; b=f9B9k5kj0ocn8d86wm8SGCPWQ/qPB4p5STZQvXwbQsiUUd2l9nXQf8fESefh03OSYaQ57V d0v5Rvuji+hG/3iCJvrJrUmMaBmh7h68Nb0/IY7K4Hijvl9UhyuUTdHpCLMJweSHmJCtnb jYK3H4Tl0dd7g0vtI6LnbQmGHSl3gciIWJe28/dvz0OcI7Dqrq520w7baiFts6PqvkQ2cq 5cfIBkLgHZOOp28+47TjzxeKVjgd3kFGRBdN50wRnbGFt56drJgMHq4y2aZNkLzxo7CkDM QyYdvgRbM3NdSPbxCByTiW/CPcQz8EaISTahP5UC7uMz/aJTLeFm31b565Q8Uw== Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Y2Sf73qHCz1NmV; Tue, 3 Dec 2024 04:41:19 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_4503F562-A192-44F2-BE83-30F8C9B1D736" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: git: b5a8abe9502e - main - How to show interface traffic in bits per second Date: Tue, 3 Dec 2024 12:41:12 +0800 In-Reply-To: <043A2EA2-647F-4B04-B6AA-A3E6B001B741@FreeBSD.org> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Poul-Henning Kamp References: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> <043A2EA2-647F-4B04-B6AA-A3E6B001B741@FreeBSD.org> X-Mailer: Apple Mail (2.3696.120.41.1.10) --Apple-Mail=_4503F562-A192-44F2-BE83-30F8C9B1D736 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Dec 3, 2024, at 11:52 AM, Zhenlei Huang wrote: >=20 >=20 >=20 >> On Dec 3, 2024, at 5:13 AM, Poul-Henning Kamp = wrote: >>=20 >> The branch main has been updated by phk: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db5a8abe9502e781598dc052698fe7fa5= 830f59ee >>=20 >> commit b5a8abe9502e781598dc052698fe7fa5830f59ee >> Author: Poul-Henning Kamp >> AuthorDate: 2024-12-02 21:12:27 +0000 >> Commit: Poul-Henning Kamp >> CommitDate: 2024-12-02 21:12:27 +0000 >>=20 >> How to show interface traffic in bits per second >> --- >> usr.bin/fortune/datfiles/freebsd-tips | 4 ++++ >> 1 file changed, 4 insertions(+) >>=20 >> diff --git a/usr.bin/fortune/datfiles/freebsd-tips = b/usr.bin/fortune/datfiles/freebsd-tips >> index c0807405005e..1e9501e3a6fb 100644 >> --- a/usr.bin/fortune/datfiles/freebsd-tips >> +++ b/usr.bin/fortune/datfiles/freebsd-tips >> @@ -856,3 +856,7 @@ $ fc-list ':charset=3D0x1F4A1' >> $ pkg which /usr/local/share/fonts/noto/NotoColorEmoji.ttf >> /usr/local/share/fonts/noto/NotoColorEmoji.ttf was installed by = package noto-emoji-2.042 >> % >> +When netstat reports every 8 seconds, it tells traffic in bits per = second: >> + >> +$ netstat -I bge0 8 >=20 > Ahh, too stupid to be smart ! Emm, I was wrong. When netstat reports every 8 seconds, you're gonna get `8 * bytes per 8 = seconds`, so you still get `bytes per second` but not `bits per second` = ... >=20 > Best regards, > Zhenlei >=20 >> +% --Apple-Mail=_4503F562-A192-44F2-BE83-30F8C9B1D736 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On Dec 3, 2024, at 11:52 AM, Zhenlei Huang <zlei@FreeBSD.org> = wrote:



On Dec 3, 2024, at 5:13 AM, = Poul-Henning Kamp <phk@FreeBSD.org> wrote:

The= branch main has been updated by phk:

URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db5a8abe9502e781598dc0= 52698fe7fa5830f59ee

commit = b5a8abe9502e781598dc052698fe7fa5830f59ee
Author: =     Poul-Henning Kamp <phk@FreeBSD.org>
AuthorDate: 2024-12-02 21:12:27 +0000
Commit: =     Poul-Henning Kamp <phk@FreeBSD.org>
CommitDate: 2024-12-02 21:12:27 +0000

  How to show interface traffic in bits per = second
---
usr.bin/fortune/datfiles/freebsd-tips | 4 ++++
1 = file changed, 4 insertions(+)

diff --git = a/usr.bin/fortune/datfiles/freebsd-tips = b/usr.bin/fortune/datfiles/freebsd-tips
index = c0807405005e..1e9501e3a6fb 100644
--- = a/usr.bin/fortune/datfiles/freebsd-tips
+++ = b/usr.bin/fortune/datfiles/freebsd-tips
@@ -856,3 +856,7 = @@ $ fc-list ':charset=3D0x1F4A1'
$ pkg which = /usr/local/share/fonts/noto/NotoColorEmoji.ttf
/usr/local/share/fonts/noto/NotoColorEmoji.ttf was installed = by package noto-emoji-2.042
%
+When netstat = reports every 8 seconds, it tells traffic in bits per second:
+
+$ netstat -I bge0 8

Ahh, too stupid to be smart !

Emm, I was wrong.

When netstat reports every 8 seconds, you're gonna = get `8 * bytes per 8 seconds`, so you still get `bytes per second` but = not `bits per second` ...


Best regards,
Zhenlei

+%



= --Apple-Mail=_4503F562-A192-44F2-BE83-30F8C9B1D736-- From nobody Tue Dec 3 05:32:34 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2TnG6Z40z5fnPH; Tue, 03 Dec 2024 05:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2TnG66n3z468P; Tue, 3 Dec 2024 05:32:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=35rAvdL+jMnXufQWILsas7IILAvBMsonK1OR51Wh4xQ=; b=tLpNfzB5CbKNS9/B55ifas+cK9Rh3Wx7GJ8oy+R1ot54icv/0gg6aK/2MLA0TwIeCuMfyH qi1IQ2hK+pthtbFonrLnDqgp7HgbAIQb53Y1aCGLIcOomgrFdPBh4b01ItXtEHlP+bMTzk IvFjfY7nU2HfRO8TqqBeOLRQQXvsvHiPu4ArFF+kBd2v7N+67J9WRn0QwvuknD44OnpYY/ euXK4LEvj1MvJZGpLA7WGvsuftHevkfgFP2RKz02XfOkM6qzSxvFsh3s99rCJhwwNTnaOu TRc+wQ/bXQhly4wG9vUju/xRLmeA++VMWj5WlFTv5LpGcfDyHwSToL/XZTGl2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=35rAvdL+jMnXufQWILsas7IILAvBMsonK1OR51Wh4xQ=; b=ERtE+owLL8uy8ePatkKH0GJaKhZWqztnbQ8/r5eiSlzu3NlrNT2V0P3D0ga+YDq48jqs+Y sUzncdo8o6Vb3pOjbQeQm7KDS57jFNdgjADuAI24StuIBFnnBBqpbpKiYaoRqots83jQP9 Gck6+7gfk88guuXRG6+kadVxlAJsNiN/kSrvi46sz4DMDMbU0roV601VjSAXCd4nIa0qvD xjRCVdXFTqBrqSri6/4HpHb26XPbaEOtOQyJh9eig8apDFTsoAJlRwy+AlXvVSaLx8mmwq tzCVHUuzC76Ci+xOMwpYA+cTkiPFTSRm2R8NAVoHIpsJ3b1eC5qR5I7+p01Svw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733203954; a=rsa-sha256; cv=none; b=ksDvd1/fQwbamAthXBfH/RJ1fEHS86UfHvQY0k1suqWSuXs1HDVujAwuReVQCqxvhbpFwZ 2sb4gEkOCxdK98JOwtRnNisvlDlbtSO2H/d3DQPiHgOZZtsheNpCif/UF7C5VuTy7SKYiV mLUEgc3GH3o+iErQuOHW2YprhiOLoxl08aVABG5/AbQeVbiVhLTHrALn7RrNy2uFdEkwNJ H5zIR7tGJiXFGL934K/ZSfQYKuJ1prky0GS/zMaa3U8y0gRqGJ/ysNBLczKucjiDWoAFV3 0TZXuFGixduStpdTu+xEiGC9KNeqkuU1l/2LWUipFeflePtovkBxtevp6PDZlA== 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 4Y2TnG5k1tz18gF; Tue, 3 Dec 2024 05:32:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B35WYRY041954; Tue, 3 Dec 2024 05:32:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B35WYLH041951; Tue, 3 Dec 2024 05:32:34 GMT (envelope-from git) Date: Tue, 3 Dec 2024 05:32:34 GMT Message-Id: <202412030532.4B35WYLH041951@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: c6b44f64c330 - main - net80211: add helper functions for determining HT transmit parameters List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6b44f64c33010501aee2fd99016aeca54a09a1e Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=c6b44f64c33010501aee2fd99016aeca54a09a1e commit c6b44f64c33010501aee2fd99016aeca54a09a1e Author: Adrian Chadd AuthorDate: 2024-11-25 23:00:24 +0000 Commit: Adrian Chadd CommitDate: 2024-12-03 05:30:45 +0000 net80211: add helper functions for determining HT transmit parameters This adds helper functions to determine a variety of HT related transmit parameters: * AMPDU density and size; * short-GI for 20 and 40MHz; * Whether 40MHz transmit is allowed; * Whether HT rates have been negotiated for transmit. It should be done here rather than drivers having to re-invent the wheel each time. This is doubly important for AP modes where each node will hvae different supported features and this needs to be used when assembling transmit frames / configuring transmit parameters. Differential Revision: https://reviews.freebsd.org/D47747 Reviewed by: bz --- sys/net80211/ieee80211_ht.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ sys/net80211/ieee80211_ht.h | 6 ++ 2 files changed, 146 insertions(+) diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c index 28c329ce3d32..1f97b7b9927a 100644 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -3604,3 +3604,143 @@ ieee80211_add_htinfo_vendor(uint8_t *frm, struct ieee80211_node *ni) frm[5] = BCM_OUI_HTINFO; return ieee80211_add_htinfo_body(frm + 6, ni); } + +/* + * Get the HT density for the given 802.11n node. + * + * Take into account the density advertised from the peer. + * Larger values are longer A-MPDU density spacing values, and + * we want to obey them per station if we get them. + */ +int +ieee80211_ht_get_node_ampdu_density(const struct ieee80211_node *ni) +{ + struct ieee80211vap *vap; + int peer_mpdudensity; + + vap = ni->ni_vap; + peer_mpdudensity = + _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY); + if (vap->iv_ampdu_density > peer_mpdudensity) + peer_mpdudensity = vap->iv_ampdu_density; + return (peer_mpdudensity); +} + +/* + * Get the transmit A-MPDU limit for the given 802.11n node. + * + * Take into account the limit advertised from the peer. + * Smaller values indicate smaller maximum A-MPDU sizes, and + * should be used when forming an A-MPDU to the given peer. + */ +int +ieee80211_ht_get_node_ampdu_limit(const struct ieee80211_node *ni) +{ + struct ieee80211vap *vap; + int peer_mpdulimit; + + vap = ni->ni_vap; + peer_mpdulimit = + _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU); + + return (MIN(vap->iv_ampdu_limit, peer_mpdulimit)); +} + +/* + * Return true if short-GI is available when transmitting to + * the given node at 20MHz. + * + * Ensure it's configured and available in the VAP / driver as + * well as the node. + */ +bool +ieee80211_ht_check_tx_shortgi_20(const struct ieee80211_node *ni) +{ + const struct ieee80211vap *vap; + const struct ieee80211com *ic; + + if (! ieee80211_ht_check_tx_ht(ni)) + return (false); + + vap = ni->ni_vap; + ic = ni->ni_ic; + + return ((ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20) && + (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) && + (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20)); +} + +/* + * Return true if short-GI is available when transmitting to + * the given node at 40MHz. + * + * Ensure it's configured and available in the VAP / driver as + * well as the node and BSS. + */ +bool +ieee80211_ht_check_tx_shortgi_40(const struct ieee80211_node *ni) +{ + const struct ieee80211vap *vap; + const struct ieee80211com *ic; + + if (! ieee80211_ht_check_tx_ht40(ni)) + return (false); + + vap = ni->ni_vap; + ic = ni->ni_ic; + + return ((ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40) && + (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) && + (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40)); +} + +/* + * Return true if HT rates can be used for the given node. + * + * There are some situations seen in the wild, wild past where + * HT APs would announce HT but no HT rates. + */ +bool +ieee80211_ht_check_tx_ht(const struct ieee80211_node *ni) +{ + const struct ieee80211vap *vap; + const struct ieee80211_channel *bss_chan; + + if (ni == NULL || ni->ni_chan == IEEE80211_CHAN_ANYC || + ni->ni_vap == NULL || ni->ni_vap->iv_bss == NULL) + return (false); + + vap = ni->ni_vap; + bss_chan = vap->iv_bss->ni_chan; + + if (bss_chan == IEEE80211_CHAN_ANYC) + return (false); + + if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && + ni->ni_htrates.rs_nrates == 0) + return (false); + return (IEEE80211_IS_CHAN_HT(ni->ni_chan)); +} + +/* + * Return true if HT40 rates can be transmitted to the given node. + * + * This verifies that the BSS is HT40 capable and the current + * node channel width is 40MHz. + */ +bool +ieee80211_ht_check_tx_ht40(const struct ieee80211_node *ni) +{ + struct ieee80211vap *vap; + struct ieee80211_channel *bss_chan; + + if (! ieee80211_ht_check_tx_ht(ni)) + return (false); + + vap = ni->ni_vap; + bss_chan = vap->iv_bss->ni_chan; + + return (IEEE80211_IS_CHAN_HT40(bss_chan) && + IEEE80211_IS_CHAN_HT40(ni->ni_chan) && + (ni->ni_chw == 40)); +} diff --git a/sys/net80211/ieee80211_ht.h b/sys/net80211/ieee80211_ht.h index 6ba791065d15..0f4c1025695e 100644 --- a/sys/net80211/ieee80211_ht.h +++ b/sys/net80211/ieee80211_ht.h @@ -240,5 +240,11 @@ int ieee80211_ampdu_tx_request_ext(struct ieee80211_node *ni, int tid); int ieee80211_ampdu_tx_request_active_ext(struct ieee80211_node *ni, int tid, int status); void ieee80211_htinfo_notify(struct ieee80211vap *vap); +int ieee80211_ht_get_node_ampdu_density(const struct ieee80211_node *ni); +int ieee80211_ht_get_node_ampdu_limit(const struct ieee80211_node *ni); +bool ieee80211_ht_check_tx_shortgi_20(const struct ieee80211_node *ni); +bool ieee80211_ht_check_tx_shortgi_40(const struct ieee80211_node *ni); +bool ieee80211_ht_check_tx_ht40(const struct ieee80211_node *ni); +bool ieee80211_ht_check_tx_ht(const struct ieee80211_node *ht); #endif /* _NET80211_IEEE80211_HT_H_ */ From nobody Tue Dec 3 05:32:35 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2TnJ1hx3z5fnDg; Tue, 03 Dec 2024 05:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2TnJ03wqz46Qs; Tue, 3 Dec 2024 05:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BkMZ7cbGScA3+TGq9qx0Tw3aYaAjYDgCZ1xC3DwLUH0=; b=C/QM3cr1Asj/b7L6V/Qo/SXzmgIDzfpq1oTmEZ25TDSxuF4sN2SHI89eZ9aKslYkpmqa7K +KEgOQ198oc3FyqCgkbyVaEYwXvKuOX+o7Es3XLPSrPh4I4I1pExcRJYL366nbI+Z9lgCp wKUkRlDVAFzAN2II79UcChuFiEzaWd/kyasJUS/BWMV9/x+zbyuITM9lUiWn+1i5EIFrS6 mcGqmEoLb6kbMkYaZEjVf3gwiM30oc6jujiu6gXps+f480tZHyy+NnHdc+T4K881zZ25YZ 8+ujXKkbRN1YGwIsq649flv5XPJdqyQCiTaV+FbHc8lsJoPYsy7JQ7qzgUYAvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BkMZ7cbGScA3+TGq9qx0Tw3aYaAjYDgCZ1xC3DwLUH0=; b=AHjyjTooND5g6GYQxns0cq1B+Zsh84CHWoIeSZgvkYNFDXbKGQaz4n8MbxFguboaqKanSu ZcRYoieRobb+KUu/mwxstStlCToG3dsgjgcjik6twE3b+46hd6dKRG6XilB2DeoS3zcsfy RPIpI/LKVWt/ihP39vI4G0gk5AvbkuWgp0knL4s+1vg4vIOCogFcnQc4W6GyrEbIIY5z+X lVL2/sG5YWmX3P9oERCNVDTRF1hzPl2Kaf8+MZ/QxDUs1sWWb8zLSBjn1rPkNjc3kWeguD xrUq/xvBjLevBPLnrOJt0CmHD3XkxM7+cXykSPXvtrMGX7Jh9gHNqV5MwtvHQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733203956; a=rsa-sha256; cv=none; b=Ehanbo2ypM1ty3SJfAbzeEGFmYktKZGcupmhzA1F40sijDJ4m8v+kyK4SJlJaM340BBNVT HcOZl9ZABxWiAhF0VsI+HIfry0pLJGFLkHMzrzkBqiIWLpmpYSyeH0sJYIVWVXQ+oW4Hr/ OqoEhOd/GyKYpevOIZiOYaj7TXbrK6k+cYfNaJuFMVyBwzWc6i5Wm7tV0jyBEmBFNqZLlo 4N/a5OMU/bwzFXvMxE6f3KkNtIWVngD+BhBcwzim3MKEeVu9JCmXM1xcuBkNhzRz0nLrrh R32w0kUZU77Vu8OIqDUuaEO0U2xJRCl7RXA9XhUGAKKmstsUnssDySqN8mNoPw== 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 4Y2TnH6VPBz18Sk; Tue, 3 Dec 2024 05:32:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B35WZlY042014; Tue, 3 Dec 2024 05:32:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B35WZTw042011; Tue, 3 Dec 2024 05:32:35 GMT (envelope-from git) Date: Tue, 3 Dec 2024 05:32:35 GMT Message-Id: <202412030532.4B35WZTw042011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 3d54d9e364f8 - main - ath: use the new net80211 methods for AMPDU density/limit, short-GI List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d54d9e364f88117fa9f7126ef0184c6da5069fc Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=3d54d9e364f88117fa9f7126ef0184c6da5069fc commit 3d54d9e364f88117fa9f7126ef0184c6da5069fc Author: Adrian Chadd AuthorDate: 2024-11-25 23:02:26 +0000 Commit: Adrian Chadd CommitDate: 2024-12-03 05:31:05 +0000 ath: use the new net80211 methods for AMPDU density/limit, short-GI Now that net80211 has this code, just leverage it instead of rolling our own. Differential Revision: https://reviews.freebsd.org/D47748 Reviewed by: bz --- sys/dev/ath/if_ath_tx_ht.c | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c index ca69d4558d76..9558b7c9e696 100644 --- a/sys/dev/ath/if_ath_tx_ht.c +++ b/sys/dev/ath/if_ath_tx_ht.c @@ -222,7 +222,6 @@ void ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf) { struct ieee80211_node *ni = bf->bf_node; - struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; const HAL_RATE_TABLE *rt = sc->sc_currates; struct ath_rc_series *rc = bf->bf_state.bfs_rc; @@ -297,17 +296,13 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf) * we are always "out" by some amount. */ if (ni->ni_chw == 40 && - ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40 && - ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40 && - vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40 && + ieee80211_ht_check_tx_shortgi_40(ni) && (bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) { rc[i].flags |= ATH_RC_SGI_FLAG; } if (ni->ni_chw == 20 && - ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20 && - ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20 && - vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20 && + ieee80211_ht_check_tx_shortgi_20(ni) && (bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) { rc[i].flags |= ATH_RC_SGI_FLAG; } @@ -406,7 +401,6 @@ ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf, { const HAL_RATE_TABLE *rt = sc->sc_currates; struct ieee80211_node *ni = first_bf->bf_node; - struct ieee80211vap *vap = ni->ni_vap; int ndelim, mindelim = 0; int mpdudensity; /* in 1/100'th of a microsecond */ int peer_mpdudensity; /* net80211 value */ @@ -418,17 +412,7 @@ ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf, /* * Get the advertised density from the node. */ - peer_mpdudensity = - _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY); - - /* - * vap->iv_ampdu_density is a net80211 value, rather than the actual - * density. Larger values are longer A-MPDU density spacing values, - * and we want to obey larger configured / negotiated density values - * per station if we get it. - */ - if (vap->iv_ampdu_density > peer_mpdudensity) - peer_mpdudensity = vap->iv_ampdu_density; + peer_mpdudensity = ieee80211_ht_get_node_ampdu_density(ni); /* * Convert the A-MPDU density net80211 value to a 1/100 microsecond @@ -563,8 +547,6 @@ static int ath_get_aggr_limit(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf) { - struct ieee80211vap *vap = ni->ni_vap; - int amin = ATH_AGGR_MAXSIZE; int i; @@ -572,15 +554,9 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80211_node *ni, if (sc->sc_aggr_limit > 0 && sc->sc_aggr_limit < ATH_AGGR_MAXSIZE) amin = sc->sc_aggr_limit; - /* Check the vap configured transmit limit */ - amin = MIN(amin, ath_rx_ampdu_to_byte(vap->iv_ampdu_limit)); - - /* - * Check the HTCAP field for the maximum size the node has - * negotiated. If it's smaller than what we have, cap it there. - */ - amin = MIN(amin, ath_rx_ampdu_to_byte( - _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU))); + /* Check the vap and node configured transmit limit */ + amin = MIN(amin, + ath_rx_ampdu_to_byte(ieee80211_ht_get_node_ampdu_limit(ni))); for (i = 0; i < ATH_RC_NUM; i++) { if (bf->bf_state.bfs_rc[i].tries == 0) @@ -593,7 +569,7 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80211_node *ni, "peer maxrxampdu=%d, max frame len=%d\n", __func__, sc->sc_aggr_limit, - vap->iv_ampdu_limit, + ni->ni_vap->iv_ampdu_limit, _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU), amin); From nobody Tue Dec 3 05:32:36 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2TnK49Ljz5fnDk; Tue, 03 Dec 2024 05:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2TnK2qy1z46T1; Tue, 3 Dec 2024 05:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xzywvnNkdj/pMzjF30SekkUBVOq7mZo4BV416FkMZsg=; b=aEfNry364oyEv4w+/FapF3M9Bri+g2XGbV/tctGXDbCQbNHzEXTQHxeBYKs432MPvf6XE8 8pxIDxsmPn6MFvQcsa9GJrbbAg1p1MTatMEGJadJnAeuInBt5fos2vTqCK3/jQpqeg0wM6 k+DERT6XKzbFIiyCdoGekHyael8Mhrz8md0xqkS6xSjs4nSObBGuERXVXyqRgD/cpEwfFC 6izgmhHigbAvAp/VdQ9hHDSmU9YQ5qQN5NfHtERW72LeBpQ6XHopTmM22okuexn8ngPpGK dmibrHk9nChNsy3YzwjpEt9P4+Jxv0//AVl0fBhMHRZiDKgLFgUxwmBvnhKNFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xzywvnNkdj/pMzjF30SekkUBVOq7mZo4BV416FkMZsg=; b=jqyMuTYr/7A8Slhc/PCBOcTCmtp58eVjtsPUalO8dggKQrCZGK5qUjabUpA2CjDAIw6xBp mtEBrJk4oHRCgKuoJbkWZb1yYRANrlgvDHXezeLOvjtyo0Lqu/UB5KTLnQ65IsaNkJ0H8T nSuloiA2Z1EmvOvPCLOkhvf38cagACVZqqCzTNTLK5D6222ORzmSoCfMn2ro5pKIxkzKIU R5WltjOnR9l162OzdRUNK2vL0IdxI66z5W1O7X0JqyXR+uU71IzE0DYSalb1SoYxLOFB2T r1f8/dWEzRLEtEDe1iFPTJCToxTTUOORnQD4aysgA3NoYoPO+r5XJbxYD7R23g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733203957; a=rsa-sha256; cv=none; b=tsRUx0RdKHzEsP9qPVzdAEJ8MoDTcQhIRr1Y3ykYIwELKVv96oFU1PhstieELe6VlFzDyz xBgFMyCCL49Smk00em9jrLbN2DC4dPEKpwNeaPRqbY61FfDdB5HRYuLC/2pAuhgsQqslMY 0dHMh3HaJyR0yeQ1+fIm2PtrfkSo2dXB5lzjLXEzJnxr0LK6U6gCmtY9+ulGWfarHKFhEJ yufWRvGi23N2FCrfXnDHSsnhCJPzQMIxFE9qxdAJUQjkAHDt93TD22jYPzhA87bWYYJp3J vUf88iHcpcwyqGFHdGAekfEuN0odoHO7cVnyTyuPKyB20VuuW65hb4M6AS21tg== 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 4Y2TnK0QnZz18gG; Tue, 3 Dec 2024 05:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B35WaOO042056; Tue, 3 Dec 2024 05:32:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B35WaaS042053; Tue, 3 Dec 2024 05:32:36 GMT (envelope-from git) Date: Tue, 3 Dec 2024 05:32:36 GMT Message-Id: <202412030532.4B35WaaS042053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 3f62f8ef5e40 - main - iwn: use ieee80211_ht_check_tx_shortgi_20() and ieee80211_ht_check_tx_shortgi_40() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f62f8ef5e4001ba7a2a9324e10a508eea15b68c Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=3f62f8ef5e4001ba7a2a9324e10a508eea15b68c commit 3f62f8ef5e4001ba7a2a9324e10a508eea15b68c Author: Adrian Chadd AuthorDate: 2024-11-25 23:13:32 +0000 Commit: Adrian Chadd CommitDate: 2024-12-03 05:31:39 +0000 iwn: use ieee80211_ht_check_tx_shortgi_20() and ieee80211_ht_check_tx_shortgi_40() Use the new net80211 routines to check the node width and the local / node flags. This should be "more" correct than the previous code. Differential Revision: https://reviews.freebsd.org/D47750 Reviewed by: bz --- sys/dev/iwn/if_iwn.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index 50d50fdc473c..db3eb37ced9e 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -2812,23 +2812,18 @@ iwn_rate_to_plcp(struct iwn_softc *sc, struct ieee80211_node *ni, */ plcp = IEEE80211_RV(rate) | IWN_RFLAG_MCS; - /* - * XXX the following should only occur if both - * the local configuration _and_ the remote node - * advertise these capabilities. Thus this code - * may need fixing! - */ - /* * Set the channel width and guard interval. + * + * Take into account the local configuration and + * the node/peer advertised abilities. */ if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { plcp |= IWN_RFLAG_HT40; - if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) + if (ieee80211_ht_check_tx_shortgi_40(ni)) plcp |= IWN_RFLAG_SGI; - } else if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) { + } else if (ieee80211_ht_check_tx_shortgi_20(ni)) plcp |= IWN_RFLAG_SGI; - } /* * Ensure the selected rate matches the link quality From nobody Tue Dec 3 05:32:38 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2TnM0fCRz5fnPL; Tue, 03 Dec 2024 05:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2TnL2zgFz46CK; Tue, 3 Dec 2024 05:32:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tgv8AC8xF8nvQQpc5me+NNhNl+SP1v4+on8IwPSEHKs=; b=VFoVUnsbTdKh5Dr1jY75WQenRYcTX0AmpPKTf44gyJCsdAI/2utIgCBPYPM7St3eIdxUpo rxweOJqLOdXG+ojDrKCejbOVah6ckSZgRwaKm8IXT15O/6mnDrpA9QGNyxCcmhCw+VuC1b UeODsDGY8JdjqE08QWRZZt8i8NB6Bxt3YsiHAtfgZJLQi1uuBOdWt9NbgTLbJ2fpUFnuWL U9BFMo5fNRrBWhtqqW2gz9xx2KD5BEl0sDfmQl/eUkLbPzEVemw0Eo0rg6iPuXYZ4urCzP KQNaztdzr4D0hPz7In35is+2zvClbaDBDmJxTRSuGOzBwYatkE2LBcdY+9FNMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tgv8AC8xF8nvQQpc5me+NNhNl+SP1v4+on8IwPSEHKs=; b=SjDrrmVx+39sFJIXG+CgE3/lLgseiPSV0E+PdX6xKlq7iQ7LMn8y61LnDqL7fAiAieNC9a EwFc7x2zwYfwdH5HaApQPjqVHjAYVw35lZAPD6KT2YBkTAZIWThjKJI41fQuqzSNLsMmnT kEaWiUW1g+RG2jT/3XO1lcSuLWJqSq3/pIi1/uOvWnkxJQv/wFSaha11lgrOP20SHvr7AW GuwzjBKGIsSQ+Lv8zKBWS2mTKqcsetFqr3YV4Cahn8rnA3Taxk5u4wkHs7OAEr+Kz//CtG eMzmR6MmVJJbFlaR/F4FdOKnWrzRmlzT/0p3chO/Cv4BEOJH0cEiJMcp/Yj4og== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733203958; a=rsa-sha256; cv=none; b=HWH9O2GmGv+mTbmrAC1Y9UQ8v5QxqwaOSCVlPo8+mvGbgM97I1Mjuyl4u00ZHId51KG+vZ PYb7ny29oVSMWqpaQr0n7XaJTkCp/DMHFQMHL4aAIXLAVkfR4WCAm3bwsO3JNHVLIlEYft ToJt2oVXE6STIA9WxJSMOW2iT1vkYDzPd30ETo22FhAr3B8OvDRjeFXESN2LX02B5fJEAg ouED5srxZ06shykX91hdwY4IZbnG4wzd6WH3fWKaR8wPKctXKHEdykD1TtIfcobNFAqO7O t7mdO8Q8IgO75bJLDbMigwVPGmVMWQcNIWzml9hOj9KPWlYrNfq+Ba0UlmyRIA== 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 4Y2TnL1RGhz193k; Tue, 3 Dec 2024 05:32:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B35Wcpf042103; Tue, 3 Dec 2024 05:32:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B35WchN042100; Tue, 3 Dec 2024 05:32:38 GMT (envelope-from git) Date: Tue, 3 Dec 2024 05:32:38 GMT Message-Id: <202412030532.4B35WchN042100@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 2014462da5b3 - main - amrr: remove duplicate logic, use ieee80211_ht_check_tx_ht() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2014462da5b3e630cdbf687d918bbfc0c3a344a4 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=2014462da5b3e630cdbf687d918bbfc0c3a344a4 commit 2014462da5b3e630cdbf687d918bbfc0c3a344a4 Author: Adrian Chadd AuthorDate: 2024-11-26 01:40:12 +0000 Commit: Adrian Chadd CommitDate: 2024-12-03 05:32:08 +0000 amrr: remove duplicate logic, use ieee80211_ht_check_tx_ht() This uses the new net80211 helper function to indicate that nodes can actually receive transmitted HT rates. Differential Revision: https://reviews.freebsd.org/D47754 Reviewed by: bz --- sys/net80211/ieee80211_amrr.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index 461554d75ea1..386a3de92a74 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -138,25 +138,6 @@ amrr_deinit(struct ieee80211vap *vap) nrefs--; /* XXX locking */ } -/* - * Return whether 11n rates are possible. - * - * Some 11n devices may return HT information but no HT rates. - * Thus, we shouldn't treat them as an 11n node. - */ -static int -amrr_node_is_11n(struct ieee80211_node *ni) -{ - - if (ni->ni_chan == NULL) - return (0); - if (ni->ni_chan == IEEE80211_CHAN_ANYC) - return (0); - if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && ni->ni_htrates.rs_nrates == 0) - return (0); - return (IEEE80211_IS_CHAN_HT(ni->ni_chan)); -} - static void amrr_node_init(struct ieee80211_node *ni) { @@ -189,7 +170,7 @@ amrr_node_init(struct ieee80211_node *ni) amn->amn_success_threshold = amrr->amrr_min_success_threshold; /* 11n or not? Pick the right rateset */ - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { /* XXX ew */ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "%s: 11n node", __func__); @@ -204,7 +185,7 @@ amrr_node_init(struct ieee80211_node *ni) rate = rs->rs_rates[0]; /* XXX clear the basic rate flag if it's not 11n */ - if (! amrr_node_is_11n(ni)) + if (! ieee80211_ht_check_tx_ht(ni)) rate &= IEEE80211_RATE_VAL; /* pick initial rate from the rateset - HT or otherwise */ @@ -213,7 +194,7 @@ amrr_node_init(struct ieee80211_node *ni) amn->amn_rix--) { /* legacy - anything < 36mbit, stop searching */ /* 11n - stop at MCS4 */ - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { if ((rs->rs_rates[amn->amn_rix] & 0x1f) < 4) break; } else if ((rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL) <= 72) @@ -222,7 +203,7 @@ amrr_node_init(struct ieee80211_node *ni) rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; /* if the rate is an 11n rate, ensure the MCS bit is set */ - if (amrr_node_is_11n(ni)) + if (ieee80211_ht_check_tx_ht(ni)) rate |= IEEE80211_RATE_MCS; /* Assign initial rate from the rateset */ @@ -234,7 +215,7 @@ amrr_node_init(struct ieee80211_node *ni) IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "AMRR: nrates=%d, initial rate %s%d", rs->rs_nrates, - amrr_node_is_11n(ni) ? "MCS " : "", + ieee80211_ht_check_tx_ht(ni) ? "MCS " : "", rate & IEEE80211_RATE_VAL); } @@ -254,7 +235,7 @@ amrr_update(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, KASSERT(is_enough(amn), ("txcnt %d", amn->amn_txcnt)); /* 11n or not? Pick the right rateset */ - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { /* XXX ew */ rs = (struct ieee80211_rateset *) &ni->ni_htrates; } else { @@ -347,7 +328,7 @@ amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) amrr = amn->amn_amrr; /* 11n or not? Pick the right rateset */ - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { /* XXX ew */ rs = (struct ieee80211_rateset *) &ni->ni_htrates; } else { @@ -360,7 +341,7 @@ amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) /* update public rate */ ni->ni_txrate = rs->rs_rates[rix]; /* XXX strip basic rate flag from txrate, if non-11n */ - if (amrr_node_is_11n(ni)) + if (ieee80211_ht_check_tx_ht(ni)) ni->ni_txrate |= IEEE80211_RATE_MCS; else ni->ni_txrate &= IEEE80211_RATE_VAL; @@ -482,7 +463,7 @@ amrr_print_node_rate(struct ieee80211_amrr_node *amn, int rate; struct ieee80211_rateset *rs; - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { rs = (struct ieee80211_rateset *) &ni->ni_htrates; rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; sbuf_printf(s, "rate: MCS %d\n", rate); From nobody Tue Dec 3 05:32:39 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2TnM4kc0z5fn1d; Tue, 03 Dec 2024 05:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2TnM2ys0z46CT; Tue, 3 Dec 2024 05:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=77QqagvbLojaCYZjISuZjhuNy0McKcNd+qJVuCvDj6s=; b=OJAqLjj4eN342fsAOl+Lr9XDrQQ7jtbMIb0okk0S9wtQxJExzvoUpZk1WH6+Ry5k2BGKSh lORVEdfVEp5rDxWtK+mCNN2L0U8VoTxWpPGrKW+CU+eh7b7r29PsPI17Cra4p0UlwIXvA6 dtTgqDrI/24fR1lrW+AwGUpe93FqBy1/snnT2qJ+SkNljmucH10lf1jCTGyonEqhR/Y57U 7G9ElFbVB0rxAiYlnOpmRUVQ4S1FcT7t/PuBK2m7AaGuaiOnaSS1HliLkFe/cNOmy5YPFl tB1x0fnGmUBKUoW2Zs9pN790avjXtgwGGgGD3xTmUPwX/gM9JMqshtq9cvn88Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733203959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=77QqagvbLojaCYZjISuZjhuNy0McKcNd+qJVuCvDj6s=; b=N88af5wfNr/F2OFHq5GCCgNdG0wVRnD8a9VAyQnu3oXl6X48r7DDxDhDnrF3TF3CjglLDF wzSc+u0p7z2w2L/MBCA4lpctgAxboCK1pY9ZKV05uE/z1V7CQfg6r/bUdksv1K0NQWTOB2 +2OWwcC+MxTNwbgFB2Jr49nWDauWLs/6nxQe1ZMOF8FrfoTNHqQ1UGnMkhaTm3kkzu+6Qx A1UkJ3X4SwooVNlc4v16zVQpduWZzlkWwN0b+pzBiQy3e21xZS9JgtAxHuwypGtzQ+JO8Y Uuwx2XZbYumKlqKhjzackwSmG8w5M0Blr5Bff2Baq4MoF2PeWP204zdClV3Cig== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733203959; a=rsa-sha256; cv=none; b=oxS9ecQoAcfcfVQ1uMVqNVssfckQuQgrIW9sL3/d1WHArpOmNdN3xA9CbdpFZGm31uv93U 2xVMezAblUbimOZlV4Y0t5L5dE0wV26HKKKJ61ZoA+yijoaseqO2LRLl3P2XTWCSKw46Re BGgUW+wPoCguXtpv+DAWrnapc1SBc2gzIjU8SPd90F2i6uXXY3y+E5l5b1IPTHaSxgZFLQ mwN0xn7FfKZJKyL7Va7NuQ9b6seJZ5jebO8QKp68qZ5WqxnPIkmOdRObEygPYR+7rAEllW 14iJQ01wgc/o1tZRaShql1xF/7UD4EomQDG+oFgVpi6HSMXQ+Wi1pF/GnduLsg== 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 4Y2TnM2BFNz18W7; Tue, 3 Dec 2024 05:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B35WdRE042144; Tue, 3 Dec 2024 05:32:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B35WdUZ042141; Tue, 3 Dec 2024 05:32:39 GMT (envelope-from git) Date: Tue, 3 Dec 2024 05:32:39 GMT Message-Id: <202412030532.4B35WdUZ042141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 057db5b227d0 - main - iwn: use ieee80211_ht_check_tx_ht() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 057db5b227d0e1c1d14c7dbc67c6613e328d1735 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=057db5b227d0e1c1d14c7dbc67c6613e328d1735 commit 057db5b227d0e1c1d14c7dbc67c6613e328d1735 Author: Adrian Chadd AuthorDate: 2024-11-26 01:50:50 +0000 Commit: Adrian Chadd CommitDate: 2024-12-03 05:32:26 +0000 iwn: use ieee80211_ht_check_tx_ht() ieee80211_ht_check_tx_ht() now implements the "is this a HT node with actual HT rates I can transmit to." Differential Revision: https://reviews.freebsd.org/D47755 Reviewed by: bz --- sys/dev/iwn/if_iwn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index db3eb37ced9e..b887ebf842e1 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -4480,7 +4480,7 @@ iwn_tx_rate_to_linkq_offset(struct iwn_softc *sc, struct ieee80211_node *ni, /* * Figure out if we're using 11n or not here. */ - if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && ni->ni_htrates.rs_nrates > 0) + if (ieee80211_ht_check_tx_ht(ni)) is_11n = 1; else is_11n = 0; @@ -5358,7 +5358,7 @@ iwn_set_link_quality(struct iwn_softc *sc, struct ieee80211_node *ni) * 11n _and_ we have some 11n rates, or don't * try. */ - if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && ni->ni_htrates.rs_nrates > 0) { + if (ieee80211_ht_check_tx_ht(ni)) { rs = (struct ieee80211_rateset *) &ni->ni_htrates; is_11n = 1; } else { From nobody Tue Dec 3 07:55:24 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2XyF4H6Vz5g23B; Tue, 03 Dec 2024 07:55:33 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.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 mx1.freebsd.org (Postfix) with ESMTPS id 4Y2XyF14z6z4QWf; Tue, 3 Dec 2024 07:55:32 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Authentication-Results: mx1.freebsd.org; none Received: from critter.freebsd.dk (unknown [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id 8FC788928B; Tue, 03 Dec 2024 07:55:24 +0000 (UTC) Received: (from phk@localhost) by critter.freebsd.dk (8.18.1/8.16.1/Submit) id 4B37tO1k018962; Tue, 3 Dec 2024 07:55:24 GMT (envelope-from phk) Message-Id: <202412030755.4B37tO1k018962@critter.freebsd.dk> To: Zhenlei Huang cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: b5a8abe9502e - main - How to show interface traffic in bits per second In-reply-to: From: "Poul-Henning Kamp" References: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> <043A2EA2-647F-4B04-B6AA-A3E6B001B741@FreeBSD.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18960.1733212524.1@critter.freebsd.dk> Date: Tue, 03 Dec 2024 07:55:24 +0000 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU] X-Rspamd-Queue-Id: 4Y2XyF14z6z4QWf X-Spamd-Bar: ---- -------- Zhenlei Huang writes: > When netstat reports every 8 seconds, you're gonna get `8 * bytes per 8 > seconds`, so you still get `bytes per second` but not `bits per second` Netstat -I reports bytes since last update, not bytes per second. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From nobody Tue Dec 3 10:00:25 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2bkZ6Lw4z5gCMf; Tue, 03 Dec 2024 10:00:38 +0000 (UTC) (envelope-from zlei@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2bkZ5wLVz4ckM; Tue, 3 Dec 2024 10:00:38 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733220038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kM+sSv9nh2w7DNzyygnQ/vtigK19hK1+jdqrrJ6tr7Q=; b=VlQDcKrAGhTbtQphdrkS2WXqHSqWisBUbac0Pp/IvexejLEcPR8ThgZhat1UTbCqGoPtlw UQRMqSh4YWOTsj9MgeIIN2Of27XXvx0s8oXm58x8vaeSe5vmueoxFJAIXcZL0F1y1yyeLI ex48KfjFvnqrkIz/YPtcwMvYtbNrA+YbKfhtFxJf6eZTG6zan9Vxbl6QKCXycbbVyNbbEt 6CViRLFMwf1vNaKLuhHILBnHbbNkTXgjT7QJHrkMuwuWbMCK8QM0Bl5X9DsHTD6BP/ZByV tO9pnRCjkSktr/2KHBWEeOpUX4rEU0MeGlP1Cwec8BJ574iw9zGYy7FwB4Uovw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733220038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kM+sSv9nh2w7DNzyygnQ/vtigK19hK1+jdqrrJ6tr7Q=; b=X19/GOqITldEff0oDuUGuMRd5KtiDwUAIqUCwY/0q3Xivc4QSqW3cM/pgqewYuhGeJUXRy FRtz9TXK4VdDkP/U3DJ6XLYtJhW/lM5zUs6Gu8QSPwJAb334sKv4QupK1evAIdjfjHHtyG CHycn+D0THW5EgfDnqyfZcyBYKRAVhnnmL9a+/wfQYIaUC3hJNnI6G0qFhFtU02WBuOIG2 AOsJ+mkmuu5s3Rxg6YABezeloJrSGoc8rcPxb2FDcHYZU/QeaBBZokT65su/q8IMfQrV1i yt51Q6M8yAsHlu6He02k+22I9uHYkxy90v7Xea3I+3NG1FSItuHis+eOUDwO/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733220038; a=rsa-sha256; cv=none; b=O0UGsjofeT5mXOt583fmC/303sfQNJceS+mKpZA0GfJAJSkFPLd4PbkuFHpBKJzBdI6P7w E7vSI4H2oduoHAx3fXuDKd2lbBs8wICrDXU84Z2cYzXamm4Z+rGdW0FE5BAJedRy9juZX8 HZj9KDSfHgBaIdNhVS5cDtwSmVyWM1x/CCNyFIY45OdLL6Giu5eEdNu4u5l5Hi08Y+fDuo MN5Q9IevBb0BSet1EAZ9Mv2GV4SbiVUyEk11PFrp/mC8JQEE/XaIhgqWeae95nfDRhn8pO a65/ZWxRYAEC0K5wf3LO724UwHHl7K7NrCz3vl0DUh+ztKVkSLD6Nlpvw1t8wg== Received: from smtpclient.apple (unknown [IPv6:2001:19f0:6001:9db:98f0:9fe0:3545:10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Y2bkV5clqzHdr; Tue, 3 Dec 2024 10:00:34 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Content-Type: text/plain; charset=us-ascii List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: git: b5a8abe9502e - main - How to show interface traffic in bits per second From: Zhenlei Huang In-Reply-To: <202412030755.4B37tO1k018962@critter.freebsd.dk> Date: Tue, 3 Dec 2024 18:00:25 +0800 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> <043A2EA2-647F-4B04-B6AA-A3E6B001B741@FreeBSD.org> <202412030755.4B37tO1k018962@critter.freebsd.dk> To: Poul-Henning Kamp X-Mailer: Apple Mail (2.3696.120.41.1.10) > On Dec 3, 2024, at 3:55 PM, Poul-Henning Kamp = wrote: >=20 > -------- > Zhenlei Huang writes: >=20 >> When netstat reports every 8 seconds, you're gonna get `8 * bytes per = 8=20 >> seconds`, so you still get `bytes per second` but not `bits per = second`=20 >=20 > Netstat -I reports bytes since last update, not bytes per second. Yeah, you're right. I think I over thought this and got confused by `per = second` :-) >=20 > --=20 > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe =20 > Never attribute to malice what can adequately be explained by = incompetence. From nobody Tue Dec 3 10:49:01 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2cpQ1hwXz5fnY1; Tue, 03 Dec 2024 10:49: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2cpQ19PYz4lPr; Tue, 3 Dec 2024 10:49:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733222942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UHZN4LBWz627YHzbXVxnGHJAgxkoUdjA2UMPwUKhmH4=; b=Lj4Ym0QD8yrKKnspkWUzUBrUOzPAMT1q3PRZ4K63jfYhGWSZSsmrurLfUCfGOgRbWlLGbV m8iN2maJ/BBEd5gNYPiF3ViHO2vt6Ggk3g2KoOi7Q3QRWS8xcLb20NoiRBT79kcQtXLpyo 8XD5unPy00hyJ1OKjRskBKQlpUCyvvKzjAAQzRifWB1MFGKwwf37jvJc9hhOYR8wljXS0k AtOQ4ASn4o9CkWcbC1flquvAv25L/vfDXIIOQjL1JwpwBcmff+utI2XhNMHptHXPC7WVGf +l/IzhryA+PZ9F82y6ij6S/9cy44PnvUlWO9yG14y8CPfzRwpBhY2RpcWa0vyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733222942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UHZN4LBWz627YHzbXVxnGHJAgxkoUdjA2UMPwUKhmH4=; b=eePf77IEmMCTxa7E/tX2gHk6+QhzxThWo5LNyWG/jaMuL9og/7Rr7U/dV4sN+Alh1Hg31n rXwSBuKw/6RR218OKUlHLShlWePD1IWQBbIqH/rIOMIvxdMPxUI8ugoReuvJrOw77dYLwp FZfVgxLiJhKRpGSUVB3c9l1FRGREQ4ltQ1WvqvD9YG+hOK7GZfrOhrGxayStF37QBGqvBC 82pfqbpES1Cf/7siz841KOMlo3nZKy0VAxOzz+K05whhtDreswNsEoCztn8VoD7NqSsTU9 6FxYHm/58+KGTgmDwL/smAvJdo/VJ+Vs2GTBxxUFfOdKjKT2zBFiKOGbjwZ2+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733222942; a=rsa-sha256; cv=none; b=Z8Zu+qUEPkYHNP1JQNDdpt7OeENUBFFCkmuPy6LJRJEBccWOgEzumXz14XKMk1pESfZU0V rX8OHMqeEEyQVTlRZvWz/IiYZJPby+tCxsuWY5w7tl9DpRX3Jdvc1S1w5ZpZCB5QEmWcFA vti/TqZlIOGRSYx22CWlMWxiqzUc5L6Pz6/YgpsAnuZIzi/kdJFz06l7L1vmG6qx3KnMAR /uDCJvBO7p8DCyzktMSOh0KT3qu5HJXJUyu6ZzvStf+cUQ14Otmu2/Pn3RpC7gMiW43GGu 3m/xFKgOj/akzlHfseXIrwEo6Kb7kZqJV6UuX8skS2WVJVLI+SdQM+1R/JPA/w== 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 4Y2cpQ0hpMzKTS; Tue, 3 Dec 2024 10:49:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B3An1Hg020501; Tue, 3 Dec 2024 10:49:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B3An1cm020498; Tue, 3 Dec 2024 10:49:01 GMT (envelope-from git) Date: Tue, 3 Dec 2024 10:49:01 GMT Message-Id: <202412031049.4B3An1cm020498@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tijl Coosemans Subject: git: 6b17d944a1d4 - main - rc.d/sendmail: Fix error with some configurations List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tijl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b17d944a1d448dbb797c5fa5b0778242ba02e52 Auto-Submitted: auto-generated The branch main has been updated by tijl: URL: https://cgit.FreeBSD.org/src/commit/?id=6b17d944a1d448dbb797c5fa5b0778242ba02e52 commit 6b17d944a1d448dbb797c5fa5b0778242ba02e52 Author: Tijl Coosemans AuthorDate: 2024-12-03 10:45:10 +0000 Commit: Tijl Coosemans CommitDate: 2024-12-03 10:46:39 +0000 rc.d/sendmail: Fix error with some configurations The sendmail startup script can run 4 daemons: sendmail, sendmail_submit, sendmail_outbound, and sendmail_msp_queue. Of the first 3 at most one can be enabled. There's a run_rc_command call for each and the ones for sendmail and sendmail_msp_queue run unconditionally. For some rc commands this triggers warnings or errors when sendmail_enable="NO" or sendmail_msp_queue_enable="NO". Since d2e7bb630b83 these errors are propagated and the whole script fails. Fix this by first determining which daemons are enabled, setting ${name} and ${rcvar} accordingly, and then always calling run_rc_command conditionally. Also replace ${name}.cf with sendmail.cf because ${name} isn't always sendmail. PR: 282585 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47757 --- libexec/rc/rc.d/sendmail | 49 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/libexec/rc/rc.d/sendmail b/libexec/rc/rc.d/sendmail index 5a780e5b15a1..fa82d44ecc35 100755 --- a/libexec/rc/rc.d/sendmail +++ b/libexec/rc/rc.d/sendmail @@ -42,11 +42,28 @@ esac if checkyesno sendmail_enable; then sendmail_submit_enable="NO" sendmail_outbound_enable="NO" + _sendmail_run=true fi # If sendmail_submit_enable=yes, don't need outbound daemon if checkyesno sendmail_submit_enable; then + name="sendmail_submit" + rcvar="sendmail_submit_enable" sendmail_outbound_enable="NO" + _sendmail_run=true +fi + +if checkyesno sendmail_outbound_enable; then + name="sendmail_outbound" + rcvar="sendmail_outbound_enable" + _sendmail_run=true +fi + +if checkyesno sendmail_msp_queue_enable; then + _sendmail_msp_queue_run=true +else + # Make sure run_rc_command is called at least once. + _sendmail_run=true fi sendmail_cert_create() @@ -166,8 +183,8 @@ sendmail_precmd() # Die if there's pre-8.10 custom configuration file. This check is # mandatory for smooth upgrade. See NetBSD PR 10100 for details. # - if checkyesno ${rcvar} && [ -f "/etc/${name}.cf" ]; then - if ! cmp -s "/etc/mail/${name}.cf" "/etc/${name}.cf"; then + if checkyesno ${rcvar} && [ -f "/etc/sendmail.cf" ]; then + if ! cmp -s "/etc/mail/sendmail.cf" "/etc/sendmail.cf"; then warn \ "${name} was not started; you have multiple copies of sendmail.cf." return 1 @@ -205,33 +222,19 @@ sendmail_precmd() fi } -run_rc_command "$1" -_ret=$? - -required_files= - -if checkyesno sendmail_submit_enable; then - name="sendmail_submit" - rcvar="sendmail_submit_enable" - _rc_restart_done=false +if ${_sendmail_run:-false}; then run_rc_command "$1" - _ret=$(( _ret > $? ? _ret : $? )) fi +_ret=$? -if checkyesno sendmail_outbound_enable; then - name="sendmail_outbound" - rcvar="sendmail_outbound_enable" +if ${_sendmail_msp_queue_run:-false}; then + name="sendmail_msp_queue" + rcvar="sendmail_msp_queue_enable" + pidfile="${sendmail_msp_queue_pidfile:-/var/spool/clientmqueue/sm-client.pid}" + required_files="/etc/mail/submit.cf" _rc_restart_done=false run_rc_command "$1" _ret=$(( _ret > $? ? _ret : $? )) fi -name="sendmail_msp_queue" -rcvar="sendmail_msp_queue_enable" -pidfile="${sendmail_msp_queue_pidfile:-/var/spool/clientmqueue/sm-client.pid}" -required_files="/etc/mail/submit.cf" -_rc_restart_done=false -run_rc_command "$1" -_ret=$(( _ret > $? ? _ret : $? )) - (exit "$_ret") From nobody Tue Dec 3 13:10:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2gxQ1jdzz5g2pp; Tue, 03 Dec 2024 13:10: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2gxQ158dz3y2d; Tue, 3 Dec 2024 13:10:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733231418; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bcf9kPTceuxE0jvXn0fioJ9ftUXfrdZ8MFTYefcyWn0=; b=QIQU5MdW4y+mVzfzRTZWYwsPeFS+SIk16xUCScgDxPonynWA6alx9sx2sKyggI72lt51/y diVnMARd9rV4tjMCdjQnV85dFe7ynjZXEDW8oPamUtfINJaMj84CPKtNxIhIvy7HDkTxb+ MIWJ1uWcFVZ6XDguB0niUcMrqwjR43lnp7kc7me0RKT3ePFffyF9+dpqcAZdDmGIK3ljZj svWkXdyy/WWcuoUNd4xnXj7DLOznS9fiOdiuhwK9QZ0aSaVDhFTiaTqgk8IHXczqjqgpUB jfkGkFs7/NV78BQlWOXnkO5iPzcpGOg3avJyBAkxx8zypBKAh2QLqTLZCGSAgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733231418; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bcf9kPTceuxE0jvXn0fioJ9ftUXfrdZ8MFTYefcyWn0=; b=we/Gonf3x0+oGMgQ9pW5c8ewRKZIwKj3easWbPUN9COAh432EAhq5z6BZ4Sv0k7jpuGMKp 4pDV35I/ESOolHPJarp+dNqDw/1CxIgWhfrxzTzLXmV4FDLitUh24d2jhii683NwFqUL0W u7UKkeOy2asOw8EIvN/743nslapOmK2cPe2pIOjaoavcEl4c0h++5171X9tJ1oLDd4Ec1z uEbTrmG1hsVzaPDmV9TNGA2JCTQgQOSEWWQT533jPXl8+/qTNwX28QFqsgWNPUiYUuiDg3 TOrJ/cHywiaKcq8hn9v4+GRp1pPlZ+8O9RufNi9p4QxrqLsruKtp3nOpfYOT3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733231418; a=rsa-sha256; cv=none; b=tfanhkr/RXpRlRY8CjGzgzBo7ALJmYVKnqegzWYSbpaevB1TtSEEA8dLfFaPnI73yqB/wl r295FNyKs39SE5oJUzLTp4TFRVxNHHHo1rTLD4trXJIQ8ITz2QA4jbzYbc1JL5LNku3b9b hN1cNhxxQyDa9+qHNSW1jXFYOQnzLQHkFFOuHkzE8niBCrxM/yjT5itFln2NU8hnNZfhx2 /cKHWi3aa2raRQNwy9ErxYLxlmwyIZVVpYkhS7CFGlhELlemvyUmW5ZPNaNsA/XURaxyUi d/nuo1BRGEoy8D7WNmJNUkET2kTLOzGKoT1YIQeMP/Gl7bBB3S6TytHhwUnHJA== 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 4Y2gxQ0R2FzNn1; Tue, 3 Dec 2024 13:10:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B3DAHn2091202; Tue, 3 Dec 2024 13:10:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B3DAHT0091183; Tue, 3 Dec 2024 13:10:17 GMT (envelope-from git) Date: Tue, 3 Dec 2024 13:10:17 GMT Message-Id: <202412031310.4B3DAHT0091183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kajetan Staszkiewicz Subject: git: c49c9da239ca - main - pf: Move route-to information to rule actions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c49c9da239ca59722f104a64d9128e4b6052885a Auto-Submitted: auto-generated The branch main has been updated by ks: URL: https://cgit.FreeBSD.org/src/commit/?id=c49c9da239ca59722f104a64d9128e4b6052885a commit c49c9da239ca59722f104a64d9128e4b6052885a Author: Kajetan Staszkiewicz AuthorDate: 2024-11-28 13:08:15 +0000 Commit: Kajetan Staszkiewicz CommitDate: 2024-12-03 12:46:34 +0000 pf: Move route-to information to rule actions Route-to redirection information (rt, rt_kif, rt_addr) can be considered an action of a rule. This information is duplicated in struct pf_kstate which means that the pf_route() function must always figure out where to get this information from: state for stateful forwarding, or rule for stateless. Create the necessary members in struct pf_rule_action. Fill them in right after parsing the ruleset, similar for how NAT redirection is applied right after parsing the NAT ruleset. Remove the logic for finding the right source for route-to redirection from pf_route(). As a bonus simplify pf_map_addr_sn() and source node handling. Both for the NAT and the filter ruleset there is now only one path: 1. parse the rules 2. apply redirection either from an existing source node or by load balancing for the last matching rule 3. create the source node using the redirection if the node does not yet exist Reviewed by: kp Approved by: kp (mentor) Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D47827 --- sys/net/pfvar.h | 12 ++-- sys/netpfil/pf/if_pfsync.c | 6 +- sys/netpfil/pf/pf.c | 153 +++++++++++++++++---------------------------- sys/netpfil/pf/pf_ioctl.c | 18 +++--- sys/netpfil/pf/pf_lb.c | 32 +++------- sys/netpfil/pf/pf_nl.c | 8 +-- sys/netpfil/pf/pf_nv.c | 2 +- 7 files changed, 91 insertions(+), 140 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0a0a17d2c754..30229cca2e74 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -648,17 +648,20 @@ struct pf_kpool { }; struct pf_rule_actions { + struct pf_addr rt_addr; + struct pfi_kkif *rt_kif; int32_t rtableid; + uint32_t flags; uint16_t qid; uint16_t pqid; uint16_t max_mss; + uint16_t dnpipe; + uint16_t dnrpipe; /* Reverse direction pipe */ uint8_t log; uint8_t set_tos; uint8_t min_ttl; - uint16_t dnpipe; - uint16_t dnrpipe; /* Reverse direction pipe */ - uint32_t flags; uint8_t set_prio[2]; + uint8_t rt; }; union pf_keth_rule_ptr { @@ -1089,12 +1092,10 @@ struct pf_kstate { struct pf_krule *rule; struct pf_krule *anchor; struct pf_krule *nat_rule; - struct pf_addr rt_addr; struct pf_state_key *key[2]; /* addresses stack and wire */ struct pf_udp_mapping *udp_mapping; struct pfi_kkif *kif; struct pfi_kkif *orig_kif; /* The real kif, even if we're a floating state (i.e. if == V_pfi_all). */ - struct pfi_kkif *rt_kif; struct pf_ksrc_node *src_node; struct pf_ksrc_node *nat_src_node; u_int64_t packets[2]; @@ -1104,7 +1105,6 @@ struct pf_kstate { u_int32_t pfsync_time; struct pf_rule_actions act; u_int16_t tag; - u_int8_t rt; u_int16_t if_index_in; u_int16_t if_index_out; }; diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 0dd1b480b313..8dd3d875dc0b 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -611,7 +611,7 @@ pfsync_state_import(union pfsync_state_union *sp, int flags, int msg_version) } /* copy to state */ - bcopy(&sp->pfs_1301.rt_addr, &st->rt_addr, sizeof(st->rt_addr)); + bcopy(&sp->pfs_1301.rt_addr, &st->act.rt_addr, sizeof(st->act.rt_addr)); st->creation = (time_uptime - ntohl(sp->pfs_1301.creation)) * 1000; st->expire = pf_get_uptime(); if (sp->pfs_1301.expire) { @@ -680,8 +680,8 @@ pfsync_state_import(union pfsync_state_union *sp, int flags, int msg_version) st->act.max_mss = ntohs(sp->pfs_1400.max_mss); st->act.set_prio[0] = sp->pfs_1400.set_prio[0]; st->act.set_prio[1] = sp->pfs_1400.set_prio[1]; - st->rt = sp->pfs_1400.rt; - if (st->rt && (st->rt_kif = pfi_kkif_find(sp->pfs_1400.rt_ifname)) == NULL) { + st->act.rt = sp->pfs_1400.rt; + if (st->act.rt && (st->act.rt_kif = pfi_kkif_find(sp->pfs_1400.rt_ifname)) == NULL) { if (V_pf_status.debug >= PF_DEBUG_MISC) printf("%s: unknown route interface: %s\n", __func__, sp->pfs_1400.rt_ifname); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index db23559774d0..fa656f92f79b 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -379,7 +379,8 @@ static void pf_counters_inc(int, struct pf_pdesc *, static void pf_overload_task(void *v, int pending); static u_short pf_insert_src_node(struct pf_ksrc_node **, struct pf_srchash **, struct pf_krule *, - struct pf_addr *, sa_family_t); + struct pf_addr *, sa_family_t, struct pf_addr *, + struct pfi_kkif *); static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); static int pf_mtag_uminit(void *, int, int); @@ -453,11 +454,11 @@ BOUND_IFACE(struct pf_kstate *st, struct pfi_kkif *k) return (k); /* No route-to, so don't overrule. */ - if (st->rt != PF_ROUTETO) + if (st->act.rt != PF_ROUTETO) return (k); /* Bind to the route-to interface. */ - return (st->rt_kif); + return (st->act.rt_kif); } #define STATE_INC_COUNTERS(s) \ @@ -1020,7 +1021,8 @@ pf_free_src_node(struct pf_ksrc_node *sn) static u_short pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_srchash **sh, - struct pf_krule *rule, struct pf_addr *src, sa_family_t af) + struct pf_krule *rule, struct pf_addr *src, sa_family_t af, + struct pf_addr *raddr, struct pfi_kkif *rkif) { u_short reason = 0; @@ -1071,6 +1073,8 @@ pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_srchash **sh, (*sn)->af = af; (*sn)->rule = rule; PF_ACPY(&(*sn)->addr, src, af); + PF_ACPY(&(*sn)->raddr, raddr, af); + (*sn)->rkif = rkif; LIST_INSERT_HEAD(&(*sh)->nodes, *sn, entry); (*sn)->creation = time_uptime; (*sn)->ruletype = rule->action; @@ -2709,8 +2713,8 @@ relock: s->kif->pfik_flags |= PFI_IFLAG_REFS; SLIST_FOREACH(mrm, &s->match_rules, entry) mrm->r->rule_ref |= PFRULE_REFS; - if (s->rt_kif) - s->rt_kif->pfik_flags |= PFI_IFLAG_REFS; + if (s->act.rt_kif) + s->act.rt_kif->pfik_flags |= PFI_IFLAG_REFS; count++; } PF_HASHROW_UNLOCK(ih); @@ -5307,6 +5311,21 @@ nextrule: if (pd->act.rtableid >= 0) M_SETFIB(pd->m, pd->act.rtableid); + if (r->rt) { + struct pf_ksrc_node *sn = NULL; + struct pf_srchash *snh = NULL; + /* + * Set act.rt here instead of in pf_rule_to_actions() because + * it is applied only from the last pass rule. + */ + pd->act.rt = r->rt; + /* Don't use REASON_SET, pf_map_addr increases the reason counters */ + reason = pf_map_addr_sn(pd->af, r, pd->src, &pd->act.rt_addr, + &pd->act.rt_kif, NULL, &sn, &snh); + if (reason != 0) + goto cleanup; + } + if (pd->virtual_proto != PF_VPROTO_FRAGMENT && (!state_icmp && (r->keep_state || nr != NULL || (pd->flags & PFDESC_TCP_NORM)))) { @@ -5391,14 +5410,15 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, /* src node for filter rule */ if ((r->rule_flag & PFRULE_SRCTRACK || r->rpool.opts & PF_POOL_STICKYADDR) && - (sn_reason = pf_insert_src_node(&sn, &snh, r, pd->src, pd->af)) != 0) { + (sn_reason = pf_insert_src_node(&sn, &snh, r, pd->src, pd->af, + &pd->act.rt_addr, pd->act.rt_kif)) != 0) { REASON_SET(&reason, sn_reason); goto csfailed; } /* src node for translation rule */ if (nr != NULL && (nr->rpool.opts & PF_POOL_STICKYADDR) && (sn_reason = pf_insert_src_node(&nsn, &nsnh, nr, &sk->addr[pd->sidx], - pd->af)) != 0 ) { + pd->af, &nk->addr[1], NULL)) != 0 ) { REASON_SET(&reason, sn_reason); goto csfailed; } @@ -5488,14 +5508,6 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->timeout = PFTM_OTHER_FIRST_PACKET; } - if (r->rt) { - /* pf_map_addr increases the reason counters */ - if ((reason = pf_map_addr_sn(pd->af, r, pd->src, &s->rt_addr, - &s->rt_kif, NULL, &sn, &snh)) != 0) - goto csfailed; - s->rt = r->rt; - } - s->creation = s->expire = pf_get_uptime(); if (pd->proto == IPPROTO_TCP) { @@ -5552,8 +5564,6 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, PF_HASHROW_UNLOCK(snh); } if (pf_src_node_exists(&nsn, nsnh)) { - /* XXX We only modify one side for now. */ - PF_ACPY(&nsn->raddr, &nk->addr[1], pd->af); s->nat_src_node = nsn; PF_HASHROW_UNLOCK(nsnh); } @@ -7686,23 +7696,20 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, struct mbuf *m0, *m1, *md; struct sockaddr_in dst; struct ip *ip; - struct pfi_kkif *nkif = NULL; struct ifnet *ifp = NULL; struct pf_addr naddr; int error = 0; uint16_t ip_len, ip_off; uint16_t tmp; - int r_rt, r_dir; + int r_dir; KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); SDT_PROBE4(pf, ip, route_to, entry, *m, pd, s, oifp); if (s) { - r_rt = s->rt; r_dir = s->direction; } else { - r_rt = r->rt; r_dir = r->direction; } @@ -7719,17 +7726,14 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, goto bad_locked; } - if (r_rt == PF_DUPTO) { + if (pd->act.rt == PF_DUPTO) { if ((pd->pf_mtag->flags & PF_MTAG_FLAG_DUPLICATED)) { - if (s == NULL) { + ifp = pd->act.rt_kif ? pd->act.rt_kif->pfik_ifp : NULL; + /* If pfsync'd from FreeBSD < 14 */ + if (ifp == NULL && r->rpool.cur != NULL) ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; - } else { - ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; - /* If pfsync'd */ - if (ifp == NULL && r->rpool.cur != NULL) - ifp = r->rpool.cur->kif ? - r->rpool.cur->kif->pfik_ifp : NULL; + if (s != NULL) { PF_STATE_UNLOCK(s); } if (ifp == oifp) { @@ -7750,7 +7754,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } } } else { - if ((r_rt == PF_REPLYTO) == (r_dir == pd->dir)) { + if ((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) { pf_dummynet(pd, s, r, m); if (s) PF_STATE_UNLOCK(s); @@ -7765,30 +7769,16 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, dst.sin_family = AF_INET; dst.sin_len = sizeof(dst); dst.sin_addr = ip->ip_dst; + dst.sin_addr.s_addr = pd->act.rt_addr.v4.s_addr; + ifp = pd->act.rt_kif ? pd->act.rt_kif->pfik_ifp : NULL; bzero(&naddr, sizeof(naddr)); - if (s == NULL) { - if (TAILQ_EMPTY(&r->rpool.list)) { - DPFPRINTF(PF_DEBUG_URGENT, - ("%s: TAILQ_EMPTY(&r->rpool.list)\n", __func__)); - SDT_PROBE1(pf, ip, route_to, drop, __LINE__); - goto bad_locked; - } - pf_map_addr(AF_INET, r, (struct pf_addr *)&ip->ip_src, - &naddr, &nkif, NULL); - if (!PF_AZERO(&naddr, AF_INET)) - dst.sin_addr.s_addr = naddr.v4.s_addr; - ifp = nkif ? nkif->pfik_ifp : NULL; - } else { + if (s != NULL){ struct pfi_kkif *kif; - if (!PF_AZERO(&s->rt_addr, AF_INET)) - dst.sin_addr.s_addr = - s->rt_addr.v4.s_addr; - ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; - kif = s->rt_kif; - /* If pfsync'd */ + kif = pd->act.rt_kif; + /* If pfsync'd from FreeBSD < 14 */ if (ifp == NULL && r->rpool.cur != NULL) { ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; @@ -7796,7 +7786,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } if (ifp != NULL && kif != NULL && r->rule_flag & PFRULE_IFBOUND && - r->rt == PF_REPLYTO && + pd->act.rt == PF_REPLYTO && s->kif == V_pfi_all) { s->kif = kif; s->orig_kif = oifp->if_pf_kif; @@ -7892,7 +7882,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, if ((ip_off & IP_DF) || (m0->m_pkthdr.csum_flags & CSUM_TSO)) { error = EMSGSIZE; KMOD_IPSTAT_INC(ips_cantfrag); - if (r_rt != PF_DUPTO) { + if (pd->act.rt != PF_DUPTO) { if (s && s->nat_rule != NULL) PACKET_UNDO_NAT(m0, pd, (ip->ip_hl << 2) + (ip_off & IP_OFFMASK), @@ -7936,7 +7926,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, KMOD_IPSTAT_INC(ips_fragmented); done: - if (r_rt != PF_DUPTO) + if (pd->act.rt != PF_DUPTO) *m = NULL; return; @@ -7958,20 +7948,17 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, struct m_tag *mtag; struct sockaddr_in6 dst; struct ip6_hdr *ip6; - struct pfi_kkif *nkif = NULL; struct ifnet *ifp = NULL; struct pf_addr naddr; - int r_rt, r_dir; + int r_dir; KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); SDT_PROBE4(pf, ip6, route_to, entry, *m, pd, s, oifp); if (s) { - r_rt = s->rt; r_dir = s->direction; } else { - r_rt = r->rt; r_dir = r->direction; } @@ -7988,17 +7975,14 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, goto bad_locked; } - if (r_rt == PF_DUPTO) { + if (pd->act.rt == PF_DUPTO) { if ((pd->pf_mtag->flags & PF_MTAG_FLAG_DUPLICATED)) { - if (s == NULL) { + ifp = pd->act.rt_kif ? pd->act.rt_kif->pfik_ifp : NULL; + /* If pfsync'd from FreeBSD < 14 */ + if (ifp == NULL && r->rpool.cur != NULL) ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; - } else { - ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; - /* If pfsync'd */ - if (ifp == NULL && r->rpool.cur != NULL) - ifp = r->rpool.cur->kif ? - r->rpool.cur->kif->pfik_ifp : NULL; + if (s != NULL) { PF_STATE_UNLOCK(s); } if (ifp == oifp) { @@ -8019,7 +8003,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } } } else { - if ((r_rt == PF_REPLYTO) == (r_dir == pd->dir)) { + if ((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) { pf_dummynet(pd, s, r, m); if (s) PF_STATE_UNLOCK(s); @@ -8034,31 +8018,15 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, dst.sin6_family = AF_INET6; dst.sin6_len = sizeof(dst); dst.sin6_addr = ip6->ip6_dst; - + PF_ACPY((struct pf_addr *)&dst.sin6_addr, &pd->act.rt_addr, AF_INET6); bzero(&naddr, sizeof(naddr)); + ifp = pd->act.rt_kif ? pd->act.rt_kif->pfik_ifp : NULL; - if (s == NULL) { - if (TAILQ_EMPTY(&r->rpool.list)) { - DPFPRINTF(PF_DEBUG_URGENT, - ("%s: TAILQ_EMPTY(&r->rpool.list)\n", __func__)); - SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); - goto bad_locked; - } - pf_map_addr(AF_INET6, r, (struct pf_addr *)&ip6->ip6_src, - &naddr, &nkif, NULL); - if (!PF_AZERO(&naddr, AF_INET6)) - PF_ACPY((struct pf_addr *)&dst.sin6_addr, - &naddr, AF_INET6); - ifp = nkif ? nkif->pfik_ifp : NULL; - } else { + if (s != NULL) { struct pfi_kkif *kif; - if (!PF_AZERO(&s->rt_addr, AF_INET6)) - PF_ACPY((struct pf_addr *)&dst.sin6_addr, - &s->rt_addr, AF_INET6); - ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; - kif = s->rt_kif; - /* If pfsync'd */ + kif = pd->act.rt_kif; + /* If pfsync'd from FreeBSD < 14 */ if (ifp == NULL && r->rpool.cur != NULL) { ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; @@ -8066,7 +8034,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } if (ifp != NULL && kif != NULL && r->rule_flag & PFRULE_IFBOUND && - r->rt == PF_REPLYTO && + pd->act.rt == PF_REPLYTO && s->kif == V_pfi_all) { s->kif = kif; s->orig_kif = oifp->if_pf_kif; @@ -8135,7 +8103,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } else { in6_ifstat_inc(ifp, ifs6_in_toobig); - if (r_rt != PF_DUPTO) { + if (pd->act.rt != PF_DUPTO) { if (s && s->nat_rule != NULL) PACKET_UNDO_NAT(m0, pd, ((caddr_t)ip6 - m0->m_data) + @@ -8150,7 +8118,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } done: - if (r_rt != PF_DUPTO) + if (pd->act.rt != PF_DUPTO) *m = NULL; return; @@ -9036,7 +9004,6 @@ pf_test(sa_family_t af, int dir, int pflags, struct ifnet *ifp, struct mbuf **m0 struct pf_pdesc pd; int use_2nd_queue = 0; uint16_t tag; - uint8_t rt; PF_RULES_RLOCK_TRACKER; KASSERT(dir == PF_IN || dir == PF_OUT, ("%s: bad direction %d\n", __func__, dir)); @@ -9328,10 +9295,8 @@ done: memcpy(&pd.act, &s->act, sizeof(struct pf_rule_actions)); pd.act.log |= log; tag = s->tag; - rt = s->rt; } else { tag = r->tag; - rt = r->rt; } if (tag > 0 && pf_tag_packet(&pd, tag)) { @@ -9474,7 +9439,7 @@ done: *m0 = NULL; break; default: - if (rt) { + if (pd.act.rt) { switch (af) { #ifdef INET case AF_INET: diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 59c442698b95..0fdf41a9811f 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2341,7 +2341,7 @@ relock_DIOCKILLSTATES: if (! PF_MATCHA(psk->psk_rt_addr.neg, &psk->psk_rt_addr.addr.v.a.addr, &psk->psk_rt_addr.addr.v.a.mask, - &s->rt_addr, sk->af)) + &s->act.rt_addr, sk->af)) continue; if (psk->psk_src.port_op != 0 && @@ -5587,7 +5587,7 @@ pfsync_state_export(union pfsync_state_union *sp, struct pf_kstate *st, int msg_ /* copy from state */ strlcpy(sp->pfs_1301.ifname, st->kif->pfik_name, sizeof(sp->pfs_1301.ifname)); - bcopy(&st->rt_addr, &sp->pfs_1301.rt_addr, sizeof(sp->pfs_1301.rt_addr)); + bcopy(&st->act.rt_addr, &sp->pfs_1301.rt_addr, sizeof(sp->pfs_1301.rt_addr)); sp->pfs_1301.creation = htonl(time_uptime - (st->creation / 1000)); sp->pfs_1301.expire = pf_state_expires(st); if (sp->pfs_1301.expire <= time_uptime) @@ -5615,10 +5615,10 @@ pfsync_state_export(union pfsync_state_union *sp, struct pf_kstate *st, int msg_ sp->pfs_1400.max_mss = htons(st->act.max_mss); sp->pfs_1400.set_prio[0] = st->act.set_prio[0]; sp->pfs_1400.set_prio[1] = st->act.set_prio[1]; - sp->pfs_1400.rt = st->rt; - if (st->rt_kif) + sp->pfs_1400.rt = st->act.rt; + if (st->act.rt_kif) strlcpy(sp->pfs_1400.rt_ifname, - st->rt_kif->pfik_name, + st->act.rt_kif->pfik_name, sizeof(sp->pfs_1400.rt_ifname)); break; default: @@ -5678,7 +5678,7 @@ pf_state_export(struct pf_state_export *sp, struct pf_kstate *st) strlcpy(sp->ifname, st->kif->pfik_name, sizeof(sp->ifname)); strlcpy(sp->orig_ifname, st->orig_kif->pfik_name, sizeof(sp->orig_ifname)); - bcopy(&st->rt_addr, &sp->rt_addr, sizeof(sp->rt_addr)); + bcopy(&st->act.rt_addr, &sp->rt_addr, sizeof(sp->rt_addr)); sp->creation = htonl(time_uptime - (st->creation / 1000)); sp->expire = pf_state_expires(st); if (sp->expire <= time_uptime) @@ -5728,9 +5728,9 @@ pf_state_export(struct pf_state_export *sp, struct pf_kstate *st) sp->min_ttl = st->act.min_ttl; sp->set_tos = st->act.set_tos; sp->max_mss = htons(st->act.max_mss); - sp->rt = st->rt; - if (st->rt_kif) - strlcpy(sp->rt_ifname, st->rt_kif->pfik_name, + sp->rt = st->act.rt; + if (st->act.rt_kif) + strlcpy(sp->rt_ifname, st->act.rt_kif->pfik_name, sizeof(sp->rt_ifname)); sp->set_prio[0] = st->act.set_prio[0]; sp->set_prio[1] = st->act.set_prio[1]; diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index e180f87d2998..8087546683af 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -631,24 +631,18 @@ pf_map_addr_sn(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, u_short reason = 0; struct pf_kpool *rpool = &r->rpool; + KASSERT(*sn == NULL, ("*sn not NULL")); + /* - * Try to find a src_node if none was given and this is - * a sticky-address rule. Request the sh to be unlocked if - * sn was not found, as here we never insert a new sn. + * If this is a sticky-address rule, try to find an existing src_node. + * Request the sh to be unlocked if sn was not found, as we never + * insert a new sn when parsing the ruleset. */ - if (*sn == NULL) { - if (r->rpool.opts & PF_POOL_STICKYADDR && - (r->rpool.opts & PF_POOL_TYPEMASK) != PF_POOL_NONE) - *sn = pf_find_src_node(saddr, r, af, sh, false); - } else { - pf_src_node_exists(sn, *sh); - } + if (r->rpool.opts & PF_POOL_STICKYADDR && + (r->rpool.opts & PF_POOL_TYPEMASK) != PF_POOL_NONE) + *sn = pf_find_src_node(saddr, r, af, sh, false); - /* If a src_node was found or explicitly given and it has a non-zero - route address, use this address. A zeroed address is found if the - src node was created just a moment ago in pf_create_state and it - needs to be filled in with routing decision calculated here. */ - if (*sn != NULL && !PF_AZERO(&(*sn)->raddr, af)) { + if (*sn != NULL) { PF_SRC_NODE_LOCK_ASSERT(*sn); /* If the supplied address is the same as the current one we've @@ -683,14 +677,6 @@ pf_map_addr_sn(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, goto done; } - if (*sn != NULL) { - PF_SRC_NODE_LOCK_ASSERT(*sn); - - PF_ACPY(&(*sn)->raddr, naddr, af); - if (nkif) - (*sn)->rkif = *nkif; - } - if (V_pf_status.debug >= PF_DEBUG_NOISY && (rpool->opts & PF_POOL_TYPEMASK) != PF_POOL_NONE) { printf("pf_map_addr: selected address "); diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index bdfa9a60faa4..68b3659b0ed2 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -173,7 +173,7 @@ dump_state(struct nlpcb *nlp, const struct nlmsghdr *hdr, struct pf_kstate *s, nlattr_add_string(nw, PF_ST_IFNAME, s->kif->pfik_name); nlattr_add_string(nw, PF_ST_ORIG_IFNAME, s->orig_kif->pfik_name); - dump_addr(nw, PF_ST_RT_ADDR, &s->rt_addr, af); + dump_addr(nw, PF_ST_RT_ADDR, &s->act.rt_addr, af); nlattr_add_u32(nw, PF_ST_CREATION, time_uptime - (s->creation / 1000)); uint32_t expire = pf_state_expires(s); if (expire > time_uptime) @@ -205,9 +205,9 @@ dump_state(struct nlpcb *nlp, const struct nlmsghdr *hdr, struct pf_kstate *s, nlattr_add_u16(nw, PF_ST_MAX_MSS, s->act.max_mss); nlattr_add_u16(nw, PF_ST_DNPIPE, s->act.dnpipe); nlattr_add_u16(nw, PF_ST_DNRPIPE, s->act.dnrpipe); - nlattr_add_u8(nw, PF_ST_RT, s->rt); - if (s->rt_kif != NULL) - nlattr_add_string(nw, PF_ST_RT_IFNAME, s->rt_kif->pfik_name); + nlattr_add_u8(nw, PF_ST_RT, s->act.rt); + if (s->act.rt_kif != NULL) + nlattr_add_string(nw, PF_ST_RT_IFNAME, s->act.rt_kif->pfik_name); if (!dump_state_peer(nw, PF_ST_PEER_SRC, &s->src)) goto enomem; diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 87c2211a84e0..b24d274db85d 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -963,7 +963,7 @@ pf_state_to_nvstate(const struct pf_kstate *s) nvlist_add_nvlist(nvl, "dst", tmp); nvlist_destroy(tmp); - tmp = pf_addr_to_nvaddr(&s->rt_addr); + tmp = pf_addr_to_nvaddr(&s->act.rt_addr); if (tmp == NULL) goto errout; nvlist_add_nvlist(nvl, "rt_addr", tmp); From nobody Tue Dec 3 15:22:42 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2ktC3L1vz5gGdG; Tue, 03 Dec 2024 15:22:43 +0000 (UTC) (envelope-from jhb@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2ktC2fNhz4FSj; Tue, 3 Dec 2024 15:22:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733239363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G+mUzn90uGgT7WqXbchKIe5VLpOx5Np2qmmCAYJcZaI=; b=XkC63r9naF5EGXZs32gcwxu8oTZdGhrn6Z+dQjXbQHkmmnMwsegzsoUSyWdNddSscupAVV y2KuBQzXcIzQBwfSZFG0etxKlEsLazFKGOIZIlYPM3wzx4DlPmX8huEfY9cgeEKZJzBYM4 DP9byAvzd+SGQs8/9GswKVqCdxaJAYlQUGfn6wl81ZSGl9Tf2G5+HYv5mJL6pwolNyca4+ 2K/HJPu12zGbjZO7o3RlsZMoLZi7vltRwOmEWSrlNM3clziQenxg0dVo64keNpky1m6xNk LIdJzydeh82Dn6hFx4gYnJHNYLV1HKBEFPAa5yvrP27qGHo5Uix31GDkg5F3Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733239363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G+mUzn90uGgT7WqXbchKIe5VLpOx5Np2qmmCAYJcZaI=; b=KP1893T7qt9YjpwI+axmxi1UBBT5BfmQ4VAyZuY7ZlonH6miDjVcHqDte5kLneVKN+BUVH QpBrmjL3GeP4MGcGH36mBYjU5ug2DoF8BA04wyjJ6VNFFTkbH+/bn327IrjDGguLAB091Z UauqPtqebtVgidbzcTqYBUrHijjC8st6hwae/doQKEax36Ic9Z8RC5kej5KTAhOqrGbq40 oZ4YQ19wRHRYpS4s9JuXcZLTV8EFtLUfDgcgMqdXMBbgkrvNdWdjgHv9QSNFsb9Wd/feBt 3N1DXMC78PKEoIzWge3ZEIFHFH9u10/OUkcrzznT4ImoLjk6xarO5swYy/F/XQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733239363; a=rsa-sha256; cv=none; b=LshyNtajE73HpwjZtaGH8a5OJvsGU63ICfdEIKubYAy1Svr20OEHnbs80OYTnWQtFuBLSU 1C8Yai6Sabk1U0WlmNVE82MxHuxZAZzF9+jVxUKzEi2tQdqaTS8i0l/8Ruo9NIoFYawjJa ucQoBzfU+hyD3qKjmTr80uNF7Fx9DcS6/hQzWo3HkBoCNhT53kqxvUnsPtsHu4uk3qsvxq 7ciLJlp9ZdOj/wb0mpfegaN/1i70pUC8SCqOZuyXqJTDgwIuMd3ifm2g0j3Jd7dNCEvw6Z O18oddGfivAj7L1aZ2PeBUzQp4/C3+cMaHik7TQa55oIqrN5BPEOqpP3Rg/8ag== Received: from [IPV6:2601:5c0:4200:b830:814a:cbb2:d950:d5f7] (unknown [IPv6:2601:5c0:4200:b830:814a:cbb2:d950:d5f7]) (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 did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Y2ktC11SfzPqK; Tue, 3 Dec 2024 15:22:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Tue, 3 Dec 2024 10:22:42 -0500 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 2f915345634e - main - LINT: Remove DTrace support Content-Language: en-US To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202412021939.4B2Jd5Oh025066@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <202412021939.4B2Jd5Oh025066@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/2/24 11:39, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2f915345634e9e0f809f79581359190268908ba9 > > commit 2f915345634e9e0f809f79581359190268908ba9 > Author: Kristof Provost > AuthorDate: 2024-11-27 16:57:08 +0000 > Commit: Kristof Provost > CommitDate: 2024-12-02 19:36:35 +0000 > > LINT: Remove DTrace support > > Ensure we have at least one commonly built kernel config that does not include > DTrace. > This is intended to help detect issues such as 45d108ee14 where a variable is > only used for static probe point, resulting in build failures when DTrace is > disabled. > > Sponsored by: Rubicon Communications, LLC ("Netgate") > Differential Revision: https://reviews.freebsd.org/D47821 > --- > sys/x86/conf/NOTES | 6 ------ > 1 file changed, 6 deletions(-) > > diff --git a/sys/x86/conf/NOTES b/sys/x86/conf/NOTES > index ffd90c06b516..bb45d4ecbf92 100644 > --- a/sys/x86/conf/NOTES > +++ b/sys/x86/conf/NOTES > @@ -2,12 +2,6 @@ > > # Common NOTES between i386 and amd64 > > -# > -# Enable the kernel DTrace hooks which are required to load the DTrace > -# kernel modules. > -# > -options KDTRACE_HOOKS > - For cases like this we generally leave the option in but comment it out so that NOTES is still documenting the option and the syntax for enabling it. > # DTrace core > # NOTE: introduces CDDL-licensed components into the kernel > #device dtrace ^^^ Like this -- John Baldwin From nobody Tue Dec 3 15:41:28 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2lHs6GFHz5gJ72; Tue, 03 Dec 2024 15:41:29 +0000 (UTC) (envelope-from jhb@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2lHs5f7kz4GVg; Tue, 3 Dec 2024 15:41:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733240489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tPXG1wBi0AL4+JAg8lVxbN2Jb2U5p3ABdqzyar9bXjQ=; b=uIIKZmWA4sMTqhMJeC7NBp8Ufkkf4FhgeaGPbc+fBp1sI3bLiWEj8nPAWFsckeDvDGpUUq +1bzejGiakzUZcpVJRfUp0hTi0xvrIhZvIbB6uAj+uEPZ3VH48t/phY4DHo8940PYM5+y1 efj/O+RlzZK0ERWAYTTUjsTq7BD5NSQ6yhNvxEkAYwdPjFaXajGyF7pKi8Kv7/w96a0y33 zEFcb59hs5IwH74p3V2QJfPt7ews9LMVDNPlFvgvbVq6fPUqIgzamHu2A5COzBb7JhxwTp tS2ecPeZ9zPbXKTFvp/To/3Dctwl+eENfzdLwdK4Z4L0HANZev3NqgLbxckSOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733240489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tPXG1wBi0AL4+JAg8lVxbN2Jb2U5p3ABdqzyar9bXjQ=; b=ZV9ZkPaicNMUDU8dN3FvbQ6Oc6BA5tnDqedtei5hI6Y7/L6U003OUhdGSBkP2OJK+dXzdO YjMGfNc3UYpbzYuM8D/46c2BY/7X+HEqLkkXxQbbaYhS4SPdhJnsHWzz0KD5JhCpk0WVcM RJg/TqtyDoLtSVVndyiyf4/5FJxV9N3nKtY/iKXGAphbqHuAmM3LYYK+MMqLBkC4PKJ4kJ X0bI27I0AJYmNlm1CQ606EnMaDHJA3kqTQkWTpqGSGVXOnNssGCjuHAgfdDznYgLY2ZNdo OWooiXzFyTPZyNSYykSBw/8Y+PeDRj6BoFb+jcIj3BXfhSZY/ln3qtpDUWQwTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733240489; a=rsa-sha256; cv=none; b=xcfa4QAwB8ZvyG5Qi+Bbx3XESAlStahSdluOcVlS4gsjDOd+cHGgIOk4/tV3b8d1JBi3m4 l7H3N/weboMvM8SJiBdBK21s7mMdoud5x/QWbODu/kC2BXcw0bCkS/89bJe9cxUFFGf4VA gFa825LABFbrnBNV66I9QPomH3xqrRYoV/xnC+TpDHlskuqW6VeplYk8S5wwmLJK6Y4u57 7VGazXXuwcZcyyyFvQUjbpxnLvvxLCtnXRsmldd/kkJ++IUYcMd0jYy4DdMSYKFtTa0vrS qOuAXQ3O55Z190Ri45PpYzsuFaNdCFdGwPl8Gk+eIhSq9GK49rm2/d+5tN4RHg== Received: from [IPV6:2601:5c0:4200:b830:814a:cbb2:d950:d5f7] (unknown [IPv6:2601:5c0:4200:b830:814a:cbb2:d950:d5f7]) (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 did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Y2lHs3zPkzPN5; Tue, 3 Dec 2024 15:41:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Tue, 3 Dec 2024 10:41:28 -0500 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: b5a8abe9502e - main - How to show interface traffic in bits per second Content-Language: en-US To: Poul-Henning Kamp , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/2/24 13:13, Poul-Henning Kamp wrote: > The branch main has been updated by phk: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b5a8abe9502e781598dc052698fe7fa5830f59ee > > commit b5a8abe9502e781598dc052698fe7fa5830f59ee > Author: Poul-Henning Kamp > AuthorDate: 2024-12-02 21:12:27 +0000 > Commit: Poul-Henning Kamp > CommitDate: 2024-12-02 21:12:27 +0000 > > How to show interface traffic in bits per second > --- > usr.bin/fortune/datfiles/freebsd-tips | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips > index c0807405005e..1e9501e3a6fb 100644 > --- a/usr.bin/fortune/datfiles/freebsd-tips > +++ b/usr.bin/fortune/datfiles/freebsd-tips > @@ -856,3 +856,7 @@ $ fc-list ':charset=0x1F4A1' > $ pkg which /usr/local/share/fonts/noto/NotoColorEmoji.ttf > /usr/local/share/fonts/noto/NotoColorEmoji.ttf was installed by package noto-emoji-2.042 > % > +When netstat reports every 8 seconds, it tells traffic in bits per second: > + > +$ netstat -I bge0 8 > +% Hmm, I'm pretty sure it's in bytes, and checking the code, it seems like show_stat() in netstat/if.c just shows the raw delta in values without scaling it by 'interval', so I think the counts are the number of bytes sent/received in 8 seconds: > netstat -I igc0 8 input igc0 output packets errs idrops bytes packets errs bytes colls 61 0 0 14418 6 0 420 0 42 0 0 8926 5 0 346 0 43 0 0 7631 7 0 540 0 31 0 0 4269 6 0 420 0 20 0 0 2173 6 0 420 0 26 0 0 3574 5 0 346 0 32 0 0 4407 9 0 678 0 22 0 0 2374 5 0 346 0 I do think having a tip about 'netstat -I foo ' is useful btw. I'm not sure if you are trying to do just highlight the interval feature, or if you are highlighting that the stat is scaled by the interval rather than the raw delta (which isn't true for netstat, but is true for some tools (e.g. vmstat uses per-second rates in interval mode). -- John Baldwin From nobody Tue Dec 3 16:03:08 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2lmr5njGz5gL0L; Tue, 03 Dec 2024 16:03: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2lmr27Pyz4J84; Tue, 3 Dec 2024 16:03:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733241788; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P2kash+kWwmpD84Pze7qXRmzzGksMqH8GY4+vGIJC78=; b=vU4WFC4Y4U6wikzDSTYUi4YVDQjRd7Ky7B/QPEBezDuQntp7Ueu7bMY9dWREEzC3G5t8PZ V8PhVgGCniScf+3yqR/9EWekpxAcXK4M9GkTKOpoXz8PMVsH/oL7sCjaNGCwy8/aSqTGEW +p1soE/JqK+3Bb2rRuyfx7obqwJtZdpR27eh7bTqjE9ktqcUJVcm5ofCTjQNkh+95a2KNR 3U2O6Z5Oi5MW8y+VCyKIKX6FH1778YjN31R2uBhEZ5W88vfpho04rt3nvsl0nVxMLLQ6B9 SNDkTIoCTpB4tKHQbgWiwFqK3t+UU2SzHPKNRfR29OODaCvKWncuF+/hQjHp7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733241788; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P2kash+kWwmpD84Pze7qXRmzzGksMqH8GY4+vGIJC78=; b=i6NBinPBr3SiaBC9pojoEdWkQTL/ZAL6mol4WCke3mICD2P2D8AT9VbWcY41ox64Ck9ebX UYbW7rZgZAnxiBjA0X4V59u+WgyBYsx6zD40Chu4x0mIOnGZ8IyJ6juXkAInNMBLSQLK+l 69LNfGNvSVUKH5ZM3xRleNJXfMhjS8Faa577DszZ8HgxlClkTOkMacdS5d+UpQQ4qveW3b 0ttbtANhIJ/Rg+4Rk7kubco+aG/W6RI8kjHuoz+K/2nU6Vb+P58qA/w+05jD2kQf3L8+P7 I8lusuahu+zEZ1CeUYjT4vm0fHmBSVHLY8LQQFREoZVX084EfW4mpqKvHxNguQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733241788; a=rsa-sha256; cv=none; b=NcRNxuhm/6CoF3xyatBWxzOkx+mmEh7xhkACX9vYmKZZ+YARqd7j8t08nZXFwz/TnYs4nS P2Q8fSXgPmBR6ZRnCzdGAviQembcjzb7LBLVGkM9VLp0eojofshOUUnW4Qx7XOLbbolv6E M/5qOq7HEh1y5qpf0D6hkshYOB3dT1niSGV7UbEwRb1ga3CC0yFOYa4mw3HjkNRBo0wHCS yDkhMYg/xOCSqegvB9+VA/EMHtKkT1TRf99ISbRxji5Dehn4oPuF2j+Ewatz0SQCXm1jVM bclyLivwAwxdjpqISAZGLUFZ7LbDPJrBY+7y0pdafeqjZsp+ypvlDjR6rQ6X5w== 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 4Y2lmr1XzYzTs3; Tue, 3 Dec 2024 16:03:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B3G38Y6014699; Tue, 3 Dec 2024 16:03:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B3G38DI014696; Tue, 3 Dec 2024 16:03:08 GMT (envelope-from git) Date: Tue, 3 Dec 2024 16:03:08 GMT Message-Id: <202412031603.4B3G38DI014696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: daad0b650135 - main - LINT: Remove DTrace support, but leave the commented out option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: daad0b6501359fefa0ee6065646508187e9dfbb0 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=daad0b6501359fefa0ee6065646508187e9dfbb0 commit daad0b6501359fefa0ee6065646508187e9dfbb0 Author: Kristof Provost AuthorDate: 2024-12-03 15:58:26 +0000 Commit: Kristof Provost CommitDate: 2024-12-03 15:59:50 +0000 LINT: Remove DTrace support, but leave the commented out option Fixes: 2f915345634e9e0f809f79581359190268908ba9 Reported by: John Baldwin Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/x86/conf/NOTES | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/x86/conf/NOTES b/sys/x86/conf/NOTES index bb45d4ecbf92..3b3439b519d7 100644 --- a/sys/x86/conf/NOTES +++ b/sys/x86/conf/NOTES @@ -2,6 +2,12 @@ # Common NOTES between i386 and amd64 +# +# Enable the kernel DTrace hooks which are required to load the DTrace +# kernel modules. +# +#options KDTRACE_HOOKS + # DTrace core # NOTE: introduces CDDL-licensed components into the kernel #device dtrace From nobody Tue Dec 3 16:09:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2lw00N78z5gLBb; Tue, 03 Dec 2024 16:09:20 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.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 mx1.freebsd.org (Postfix) with ESMTPS id 4Y2lvz5HBGz4Jpq; Tue, 3 Dec 2024 16:09:19 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Authentication-Results: mx1.freebsd.org; none Received: from critter.freebsd.dk (unknown [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id C947A89286; Tue, 03 Dec 2024 16:09:17 +0000 (UTC) Received: (from phk@localhost) by critter.freebsd.dk (8.18.1/8.16.1/Submit) id 4B3G9HAf023627; Tue, 3 Dec 2024 16:09:17 GMT (envelope-from phk) Message-Id: <202412031609.4B3G9HAf023627@critter.freebsd.dk> To: John Baldwin cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b5a8abe9502e - main - How to show interface traffic in bits per second In-reply-to: From: "Poul-Henning Kamp" References: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23625.1733242157.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Tue, 03 Dec 2024 16:09:17 +0000 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU] X-Rspamd-Queue-Id: 4Y2lvz5HBGz4Jpq X-Spamd-Bar: ---- -------- John Baldwin writes: > > +When netstat reports every 8 seconds, it tells traffic in bits per se= cond: > > + > > +$ netstat -I bge0 8 > > +% > > Hmm, I'm pretty sure it's in bytes, and checking the code, it seems like= show_stat() > in netstat/if.c just shows the raw delta in values without scaling it by= 'interval', > so I think the counts are the number of bytes sent/received in 8 seconds= : And since bytes/8 seconds =3D=3D bits/second Q.E.D > I do think having a tip about 'netstat -I foo ' is useful btw. I'm n= ot sure if > you are trying to do [...] I have personally used this trick for 35+ years from V.22bis modems til 10Gbit/s ethernet, to figure out how saturated a particular transmission facility is. Transmission media are always in nominal bits per second, and counters are almost invariably in bytes, so using 8 second integration eliminates the need for math. The 8 second integration time also averages most of the burstiness of the traffic quite nicely. As the author of the bikeshed email, I should have known better than to commit something this trivial :-) Poul-Henning -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From nobody Tue Dec 3 17:21:39 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2nWS4TXbz5gRk3; Tue, 03 Dec 2024 17:21:40 +0000 (UTC) (envelope-from jhb@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2nWS3slfz4R2P; Tue, 3 Dec 2024 17:21:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733246500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5/ZMjZn/h0BOhR5+jBTwTiQSfM/+gu0KOUKHImj+IVI=; b=H+ir+GoZKAC4B2JqKeWGeWYU/SwFGvcBaI4ia0NMGrJBpb+7fTizArlBExLOFu5WBPIn3i ROsjhUQ48+OxsPE1j2sVhh274JONCNfVREJubF9AFWPh9IfRRaREfvOZS/F+pNjshdq6pv EB9piOa2q7sCsclJezIy37ct7jicp/WQfF6/OMkO1T3mARhziE/8rsW2JA6sPpymSRTZ21 UfX7YWQPQ7GAuAZlZALKM/F/ktxogJiH9GJstgYdRASxOe+f6vxhEXQgJ/5iMAfp/X3r+k YDajrpK36mvi8bDlVWuRJUD5XUUGegOLcsI+nF3AXo8bdhkWPZLlwGWXrBPjGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733246500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5/ZMjZn/h0BOhR5+jBTwTiQSfM/+gu0KOUKHImj+IVI=; b=c5rrJ3u0UnMl4dcG+HwM9CkF/3QrE2jn1hsgvpryS27PtmbcA878/AGz1ll20iilVZi7AT zhUn5lA9KW3ARh/9T5sWVz9CZaDNc/vPRfnne5SzdWaH73Cp48VPpw6MREq6e+Qt9fFX98 tmD8nj6eg766o1q7OYFESh007TybdbOadyKvaF98W9dWE80JP4Fk1CXObrthaXByhLPsNo hFWy23um0V/5/9DchgsvPROoidkpG2/ZK+89L2//83ROuMcr4xpdZNKBXFqwy1a/eOzFZj ag3VleaATOuE2tE4/0wG9xuYwyJENvdqZUegm4pfmiDnGNjmLRXsgbdTfVH7Rg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733246500; a=rsa-sha256; cv=none; b=jaj1Af218nGePcPIGwBPf42yluQTKjNzvsxNy8bCC8MarCVDL6PkSpGp6mTMLTSAGONeu0 S7iUBrHs1Yz+0c7SDJSAiZGghwhXT6AHu7Exu8HlPPd9yNhjefiYXjKIkOaf9WvTFgQEQO c+JM5xHETGJb0fQkZore+0MbG86BloQ3lPUwkAq8Ijyol1er37pjL7ttvsxfa12blPOzpF c+EbT+pMwx6rAZw0gz9LDS4fcxuGxp2AmVRu/3xZIPDPYbqlC9QLjBLcVbf/CglPQpBdaY OKWhYMEXSn1pdwxxMayDDc0HVgz4lBUeYD23Gw0NveSS0Z9zssmBejLXXP4FPg== Received: from [IPV6:2601:5c0:4200:b830:814a:cbb2:d950:d5f7] (unknown [IPv6:2601:5c0:4200:b830:814a:cbb2:d950:d5f7]) (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 did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Y2nWS2DkYzR8K; Tue, 3 Dec 2024 17:21:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <665823ac-7f80-4872-b224-ae2bfa7059ac@FreeBSD.org> Date: Tue, 3 Dec 2024 12:21:39 -0500 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: b5a8abe9502e - main - How to show interface traffic in bits per second Content-Language: en-US To: Poul-Henning Kamp Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202412022113.4B2LD0mt010926@gitrepo.freebsd.org> <202412031609.4B3G9HAf023627@critter.freebsd.dk> From: John Baldwin In-Reply-To: <202412031609.4B3G9HAf023627@critter.freebsd.dk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/3/24 08:09, Poul-Henning Kamp wrote: > -------- > John Baldwin writes: > >>> +When netstat reports every 8 seconds, it tells traffic in bits per second: >>> + >>> +$ netstat -I bge0 8 >>> +% >> >> Hmm, I'm pretty sure it's in bytes, and checking the code, it seems like show_stat() >> in netstat/if.c just shows the raw delta in values without scaling it by 'interval', >> so I think the counts are the number of bytes sent/received in 8 seconds: > > And since > > bytes/8 seconds == bits/second > > Q.E.D Ah, fair enough. Clearly too subtle for my thick head. ;-) -- John Baldwin