From nobody Sun Feb 19 00:48:37 2023 X-Original-To: dev-commits-src-branches@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 4PK6P14097z3s8jJ; Sun, 19 Feb 2023 00:48:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK6P13YSTz42vb; Sun, 19 Feb 2023 00:48:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767717; 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=Pe6W+jOjQef5ECAM5pD/lJE8JptMrafghpwHmmUiI8Q=; b=F8LzHQGVf6ICaMsyGaeRtV0mi7VeP8yXXc9saXrhDYR8wyN0tDuDP/pi2lZV51ffylPi5e ssHVsEcuxcg+Iq32oi1XO8FWLfpPYOwy0ghEvMIr7w3SU7Ny8qwL+e/UoD4IOsbedbzeou o5zt3U9I05E42rc6E6fs4ZT52HNIrNgBR8o6ci54cqPMGdq91hcRK5Bh23AfJCqV/n7Vuq KsnDR3NPIF/kRvUvbc4MGvZHm4GouCfe2XrSXqckg3FpD9k87rlyf4xi4Hrz6WlmkqbfQb h7znWYsFylnfKFgwXtb8W5rUJb/HP15uY4+RfN2ExstEETB5N1EAjmG4XxTZ5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767717; 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=Pe6W+jOjQef5ECAM5pD/lJE8JptMrafghpwHmmUiI8Q=; b=HCMF+ram5zTBZI9SmvKz0K2VqzuXKohrXkd5iXAkvrsZp2kPXZEMNB/BZY0oFhXt/c2jju Geb1R9mdTd7Y2Epg4my7IXJEYHsfyArabu8Xn3Me7qYOlL0yJXoViigSRCkKS+9UMErEe2 p48Z6Mk/DAqwgHyjLX2JVT48dlzlXBZiKG8079AAIQi8l7e2PLKFKhoLBwz+9z38sGMlCU 80+p1yDxrqzNNT1AOFeIOoUypy9vaPbc9cAi6EisClgr9Xsd2fDOcShwgjC5dKydUGo/3t 33/tZlSeaMtAbVZNk7Q0rQsy4ppjObnMpxJedRA+0dySwUcf70PLVYdSc7ATsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676767717; a=rsa-sha256; cv=none; b=oOzvlUI9XY/UBMnLABOZdeceoRcN5INzZosBZRkqwtBxomvok2ti7hdCTkg7jEgO0RpHdn Y13VvpuDPh3twh0oavdDNh7xo0aQa5+yv4hBbQs3ZbCx0us86D8Fep84C9x6SdV0rxb5XD LsplJdNZxZw4bKMPg2yAg+aN18IV4yyUhnhorufBTI8u2cfUO1U3e4lhbJkeDRHyoxqmbj 3rNh1ClDazfy1mwRrxrJ6wwe7qPjFU5OkfV2BO3YV+of0EG6Mk5Z0AZUY/m8iX7BXzp4+Z kh5EPOEH4vAASaPgWJQ5VHY3cfEiwHfRfLCPO9E3pCJZgnVtVvfw4Gbi0ockmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK6P12bthzj9K; Sun, 19 Feb 2023 00:48:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J0mbHP069581; Sun, 19 Feb 2023 00:48:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J0mbst069580; Sun, 19 Feb 2023 00:48:37 GMT (envelope-from git) Date: Sun, 19 Feb 2023 00:48:37 GMT Message-Id: <202302190048.31J0mbst069580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 9ad4c0468f19 - stable/13 - efivar: Try harder to find label's efimedia List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9ad4c0468f1924cf7bdb9830bb781de9ca095c61 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9ad4c0468f1924cf7bdb9830bb781de9ca095c61 commit 9ad4c0468f1924cf7bdb9830bb781de9ca095c61 Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 00:46:57 +0000 efivar: Try harder to find label's efimedia If there's no efimedia attribute on the provider, and the provider's a glabel, then find the 'parent' geom. In this case, the provider's name is label-type/name, but the geom's label will that of the underlying device (eg ada0p1). If it is, recurisvely call find_geom_efimedia with the geom's name, which shuold have the efimedia attribute. Sponsored by: Netflix Reviewed by: corvink, manu, asomers Differential Revision: https://reviews.freebsd.org/D38614 (cherry picked from commit ccf2121d59ac51e1a0287d75262d48018d09cad6) --- lib/libefivar/efivar-dp-xlate.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index 1b30d1dfb143..effc8a2de475 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -527,6 +527,15 @@ find_geom_efimedia(struct gmesh *mesh, const char *dev) if (pp == NULL) return (NULL); efimedia = geom_pp_attr(mesh, pp, "efimedia"); + + /* + * If this device doesn't hav an efimedia attribute, see if it is a + * glabel node, and if so look for the underlying provider to get the + * efimedia attribute from. + */ + if (efimedia == NULL && + strcmp(pp->lg_geom->lg_class->lg_name, G_LABEL) == 0) + efimedia = find_geom_efimedia(mesh, pp->lg_geom->lg_name); if (efimedia == NULL) return (NULL); return strdup(efimedia); From nobody Sun Feb 19 00:48:38 2023 X-Original-To: dev-commits-src-branches@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 4PK6P253skz3s8vb; Sun, 19 Feb 2023 00:48:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK6P24P6Qz431W; Sun, 19 Feb 2023 00:48:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767718; 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=j67+wlYgoy/Vw/5MakF+rhjcv259cn/3PRH3ma3Eju8=; b=mwDa59XodMIbiuYhUNZvxZgeIca5z99qBfq+rjUS8qWlrH6tP39CqfREq89rplyrOInrJI WasgZbZkthD6y+1lWO4ecjhj9y/b9Za+JaqLHMEWlLX3G/1EzxEAjN3j0iNN14b0Q8i7Q8 yJWDDDeq2Cync4zl9o0C1Yb1mJgQHstyEJESKSSLXC/U0s0VeX9PXtU3tk1A1RJj7OJwsj Pg9M2iGgiHLD5ZOwjwJVEM16Z8bQs+cadt6twCDt/gsJ98T1tcICnMdWYsy8aIHe3Apzd6 eqPToAh2uJE63XzdhyOjrK4JdE5TwsZEANVWJ8dCFkXnzus39ivfhXah8nAgtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767718; 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=j67+wlYgoy/Vw/5MakF+rhjcv259cn/3PRH3ma3Eju8=; b=Ai2iQKt7Tifvai7/wBQytuzR5/XqQrTNU1UnIhkLyuZts9hQtOssIuKp86C1dxsZVPfad4 vACC90XGGd3LMZvB/k/lPltRSeIbO9tXzn1YFMph/TXyLEz0fqHcyRskVp8+T4ev7ElUMb poGc/r8OFdBgK3MS5PXVZjueL12MOp8AX3Q95M5xq3wIy/5TOimOWGDrsI0bxCEPuaRJCn Z53uu2+07Nr3DizD+v+vcUN0MjkFz24INJ0jOUcbZYQHcqEI9SV3mDq5eR1AQdcRTNTNR5 V8O+I2SxLhtV0xjGftQHaOAm02kHR8aVUOHkQsrXjFku3tlVjtGpbyjFUflrUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676767718; a=rsa-sha256; cv=none; b=olo0oC9uKbW1XnicmYg+EO4Wf7nzwJsuCLLLbRXW09yMZ/TDvQhAFXM3uczy2p7QWTlYVr uUqCSO4980OF3EUEzS9oRjuuX8kbjWyb8MS/dDxflR8jhpVxRVbB3E1WNc1Z+JcJyeWBMk yXq0cFILwqaJLYO99MNY8BCx7mzfnxDu+2R42K/4BCP8YAgPPv3fTsrCslUPxcfu+Q5SJy 5IaHX0lnkmLU+2moGzaAsVXaQWk8yQ2m/i8SZ0syf9PFagE5igEg3S7aQgzt5hXy+1WyCV cq9hjshMfacbhEGaxZDLzQDHKnChnKjHVpEvtMI6yCh3Fz664sJIK5cFZO3zhg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK6P23VFvzj9L; Sun, 19 Feb 2023 00:48:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J0mcbS069601; Sun, 19 Feb 2023 00:48:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J0mc77069600; Sun, 19 Feb 2023 00:48:38 GMT (envelope-from git) Date: Sun, 19 Feb 2023 00:48:38 GMT Message-Id: <202302190048.31J0mc77069600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 82c0aea8f3c2 - stable/13 - efivar: Allow NULL paths in build_dp List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 82c0aea8f3c270c6d20b093cf711d4bb1472237c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=82c0aea8f3c270c6d20b093cf711d4bb1472237c commit 82c0aea8f3c270c6d20b093cf711d4bb1472237c Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 00:46:57 +0000 efivar: Allow NULL paths in build_dp Allow there to be NULL paths in buildp. This lets us return the device path to the partition, as well as to files on the partition. Sponsored by: Netflix Reviewed by: corvink, manu, asomers Differential Revision: https://reviews.freebsd.org/D38615 (cherry picked from commit 49fd6affdbfe6af53f119ebb27ff5e5e292e1f67) --- lib/libefivar/efivar-dp-xlate.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index effc8a2de475..b6adae80fdb4 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -544,23 +544,25 @@ find_geom_efimedia(struct gmesh *mesh, const char *dev) static int build_dp(const char *efimedia, const char *relpath, efidp *dp) { - char *fp, *dptxt = NULL, *cp, *rp; + char *fp = NULL, *dptxt = NULL, *cp, *rp = NULL; int rv = 0; efidp out = NULL; size_t len; - rp = strdup(relpath); - for (cp = rp; *cp; cp++) - if (*cp == '/') - *cp = '\\'; - fp = path_to_file_dp(rp); - free(rp); - if (fp == NULL) { - rv = ENOMEM; - goto errout; + if (relpath != NULL) { + rp = strdup(relpath); + for (cp = rp; *cp; cp++) + if (*cp == '/') + *cp = '\\'; + fp = path_to_file_dp(rp); + free(rp); + if (fp == NULL) { + rv = ENOMEM; + goto errout; + } } - asprintf(&dptxt, "%s/%s", efimedia, fp); + asprintf(&dptxt, "%s/%s", efimedia, fp == NULL ? "" : fp); out = malloc(8192); len = efidp_parse_device_path(dptxt, out, 8192); if (len > 8192) { From nobody Sun Feb 19 00:48:39 2023 X-Original-To: dev-commits-src-branches@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 4PK6P36MLxz3s8n4; Sun, 19 Feb 2023 00:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK6P35lfGz43SY; Sun, 19 Feb 2023 00:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767719; 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=w6Hw62Xeby/cWqKrw+KjONxuR882dNDfoE4vEIKf8+I=; b=j6BC8abFi6TFr23DMrKXhOfTFTCxuBEEjshsaYah3pakxG9c7NxsggXl3zzVfatK1WWPgF ApAsVa6UNXm+qSIBe9tzYgpmmxMOw6s9V7epe4UCq5/eFnL2sQQN3DzDBTmz2BNSTrNCqV wwkaKmVU2MW+ww3oO7mlCS4GrDBh+FfMBPfBoKORKH1Vkl6REd9Cg++6CM0EsKWM+VW+V+ pWiEob5oe6YJ7sfHsQPcQr9jN6YeoVqus1ze3tg8oM5lnRD9eOdFiXKAKMkqnJygpt5hGF STfgYvpFDPGeidLpCza4MgxYoyIlYGHHEpELCxfWcn7BeG+3hXuR+3K7ggG91w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767719; 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=w6Hw62Xeby/cWqKrw+KjONxuR882dNDfoE4vEIKf8+I=; b=HnawUG3NZxBIZuUIgRJZqUep60VpC9204P5pqWfw6/LBu7L/p0+pi+fTzQ7hINLZZLE4sW 4Xh1V4RKGFZTnX/jQiPQEB3AbqEYnGqf1rDBM5pRMKkV8wEad6MqJnU4OpnSED5EYqamMD UWNM+Hzv1tBss4x+MsNW/HaPvGyBLjzLgVGXKe/qkaGFLnjV1woKAF6StvHX8nz0FfnxA/ 00Ji4AJlNhAk+8jHo8kuihmnJ3tv0c5Ex1tyV98jbXtA02WDo2nZSidBf1Fr8bWKOSQp61 sNnPyWKyHvk7K8XF3rsS8W6UANVaNugphN59r6etc0Yh7y6BwiBv8ON2FXHnNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676767719; a=rsa-sha256; cv=none; b=RPpCVwHeARpI6O+6g6Qij/BXR6dJ81Ky3R6EhdGwLsRg9Pvlu04ehm4DXvhOJxza2SWIEq nB073nc5LYlvDxYfibnPL16gDbXcG0N+sjtPUNwrzZqSJwSQ1s6q+NCPjBy+ogOnsoCxol f6SpR7GDfpkCgUqBNqNzQUwx0U6JFBYYOA5I8QMIZiNsO9XGoZhxo9rH2+XzxXYxbmcW7r yEofDFWfO6eI8WbzgYV/oTz8FwoN/8fzzzdUzDIOXsTsvbXhuRp4E1R6uf2t+P/2XjbRxA 2X28EmGxg+Vu9Q74ZCbzQkGjGW71BFy1Sn6tJ095JjjR50wru1P5iphr7r/T3w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK6P34lDnzjbq; Sun, 19 Feb 2023 00:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J0mdXh069620; Sun, 19 Feb 2023 00:48:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J0mdl8069619; Sun, 19 Feb 2023 00:48:39 GMT (envelope-from git) Date: Sun, 19 Feb 2023 00:48:39 GMT Message-Id: <202302190048.31J0mdl8069619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: bae5c36257ec - stable/13 - efivar: support device paths as well as mounted paths in path_to_dp List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bae5c36257ec5289631abf49b33a4041acc84e3c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bae5c36257ec5289631abf49b33a4041acc84e3c commit bae5c36257ec5289631abf49b33a4041acc84e3c Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 00:46:57 +0000 efivar: support device paths as well as mounted paths in path_to_dp In path_to_dp, allow passing in either the actual device path "eg /dev/foo/bar" or the path where the device is mounted (say /mnt/baz/bing). In the former case we'll assume the path within the device is nothing (the relpath). In the latter, we'll take from the mount point on down as the relpath. Sponsored by: Netflix Reviewed by: corvink, manu, asomers Differential Revision: https://reviews.freebsd.org/D38616 (cherry picked from commit 57d5ca4eeba6192e91044aad86fca4429966cfac) --- lib/libefivar/efivar-dp-xlate.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index b6adae80fdb4..586ba7d08180 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -648,6 +648,7 @@ errout: } /* Handles /path/to/file */ +/* Handles /dev/foo/bar */ static int path_to_dp(struct gmesh *mesh, char *path, efidp *dp) { @@ -667,9 +668,19 @@ path_to_dp(struct gmesh *mesh, char *path, efidp *dp) } dev = buf.f_mntfromname; - if (strncmp(dev, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) - dev += sizeof(_PATH_DEV) -1; - ep = rp + strlen(buf.f_mntonname); + /* + * If we're fed a raw /dev/foo/bar, then devfs is returned from the + * statfs call. In that case, use that dev and assume we have a path + * of nothing. + */ + if (strcmp(dev, "devfs") == 0) { + dev = rp + sizeof(_PATH_DEV) - 1; + ep = NULL; + } else { + if (strncmp(dev, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + dev += sizeof(_PATH_DEV) - 1; + ep = rp + strlen(buf.f_mntonname); + } efimedia = find_geom_efimedia(mesh, dev); #ifdef notyet From nobody Sun Feb 19 00:48:40 2023 X-Original-To: dev-commits-src-branches@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 4PK6P46vQKz3s8n7; Sun, 19 Feb 2023 00:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK6P4683Hz43Yc; Sun, 19 Feb 2023 00:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767720; 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=8OVnPc55ftFg6noNkgLibc/d8pjXHFKKabMPg5Nbixs=; b=OFcUik54EY4TdErPjeuQt+rUebW/bgCdjBvlHP2hXdENsphBzV6IHUA8ka320Yovkt3put tHOQ12TbqxGqlpYLlCy5N5k1U6IxOgxRgmT08pj6gcVh/GEPBD/krFlg3glqxGZFKrYSp2 ISZ82q0iJljm6OUIxYoi3BIvqb7Mlfsmv7vnFudH2I0QkKAKeO+xeAv9DYyHrISRNtS3gh L1322Z9HW/YvA8EkMLJP9lpClwuXIPYveKoZiaRiogJuaiEPnV0DSTlcG74X+sBBXQiW4L 46G2Zkl9EdaJq84yYuHRwlfm5AB/26Bv6Q5ilrzJXwYZkegrn2DxDrZhLb0vuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767720; 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=8OVnPc55ftFg6noNkgLibc/d8pjXHFKKabMPg5Nbixs=; b=xt+n7696IwiLUTSYzbGF6GhyvYC+EcrdWvftph56ubpI4xGRKLt+wVilBJZSy+GYhasJom 8c1ETu9k6HKMqz+zyK8erpj0DEflUcyFvwFx5TZzHur1n72Gsfm9j0Vm9b2EKUEHFeBsZg 91/WbDXC9dXBVloAw9CRwu1KFu8B5PmqBZudny/qs/ZCj6OQXUK9tLQ672w8FJeNnSa//l fHWmiYT6NX/UK4n+/Z06p82BiTbbptq0AKHGpCV8KxCv10gMxh3C0jXPRi7NP1DzCFeLCd wjL+1E5OtsF18m6q10qLUnm1mtyjQWQb4C9bNe0kUSQHYlW7buEgvryLnBjRzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676767720; a=rsa-sha256; cv=none; b=M8nlrExz4mSnr+b5OaWNkwf9YhwkewZpSuyrR+SIuaP6XoiCsA9PvnCZu3xrNn+kfQZFEt 7GpH1keSRCpo7uiU5EZ/0m6faqPN9KldVOu8Q75KCqStcJlyRW4tzOM5b5pqCeG6cXIYl0 n4eJKLzVY3QAJlo3c0ASWaAOG0IZ+exu6P0ygr+O7ChNPaRgeWn2S1QHh/wQkTEvlc4oB0 1m7hVz3mGs+XbZRPPzahIzHPG9ro6d7DLTd2BD54IHeXt58m6GVu+Pjh7G1svPHKHK0bls 0Ivv1ZHARWUrjfB5TD1AgLPdtKrEAjwDZikh0SR8mkwpOfUdbqSgEPT3rNE3tA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK6P45C84zjdZ; Sun, 19 Feb 2023 00:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J0meL0069645; Sun, 19 Feb 2023 00:48:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J0meGG069644; Sun, 19 Feb 2023 00:48:40 GMT (envelope-from git) Date: Sun, 19 Feb 2023 00:48:40 GMT Message-Id: <202302190048.31J0meGG069644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 8ab17c6dd1d8 - stable/13 - efibootmgr: Add --efidev (-u) to discover UEFI's device path to a dev or file List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8ab17c6dd1d8e8056e5354390f29e0f36cf4e406 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ab17c6dd1d8e8056e5354390f29e0f36cf4e406 commit 8ab17c6dd1d8e8056e5354390f29e0f36cf4e406 Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 00:46:57 +0000 efibootmgr: Add --efidev (-u) to discover UEFI's device path to a dev or file "efibootmgr --efidev unix-path" will return the UEFI device-path to the file or device specified by unix-path. It's useful for debugging, but may also be useful for scripting. Sponsored by: Netflix Reviewed by: corvink, manu Differential Revision: https://reviews.freebsd.org/D38617 (cherry picked from commit 9a7915299484a767fbffc7234b8dc45c29954cca) --- usr.sbin/efibootmgr/efibootmgr.8 | 6 +++++- usr.sbin/efibootmgr/efibootmgr.c | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/usr.sbin/efibootmgr/efibootmgr.8 b/usr.sbin/efibootmgr/efibootmgr.8 index 6b53de33db56..0aa70fe63da7 100644 --- a/usr.sbin/efibootmgr/efibootmgr.8 +++ b/usr.sbin/efibootmgr/efibootmgr.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 3, 2022 +.Dd February 15, 2023 .Dt EFIBOOTMGR 8 .Os .Sh NAME @@ -69,6 +69,7 @@ .Fl t Ar timeout .Nm .Fl T +.Nm Fl u Ar unix-path .Sh "DESCRIPTION" The .Nm @@ -174,6 +175,9 @@ Set the bootmenu timeout value. Delete the .Cm BootTimeout variable. +.It Fl u -efidev Ar unix-path +Displays the UEFI device path of +.Ar unix-path . .It Fl v -verbose Display the device path of boot entries in the output. .El diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c index 53bc417c4e07..58d83d28d6e5 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001 typedef struct _bmgr_opts { + char *dev; char *env; char *loader; char *label; @@ -85,6 +86,7 @@ typedef struct _bmgr_opts { bool dry_run; bool device_path; bool esp_device; + bool find_dev; bool fw_ui; bool no_fw_ui; bool has_bootnum; @@ -114,6 +116,7 @@ static struct option lopts[] = { {"dry-run", no_argument, NULL, 'D'}, {"env", required_argument, NULL, 'e'}, {"esp", no_argument, NULL, 'E'}, + {"efidev", required_argument, NULL, 'u'}, {"fw-ui", no_argument, NULL, 'f'}, {"no-fw-ui", no_argument, NULL, 'F'}, {"help", no_argument, NULL, 'h'}, @@ -284,6 +287,9 @@ parse_args(int argc, char *argv[]) opts.set_timeout = true; opts.timeout = strtoul(optarg, NULL, 10); break; + case 'u': + opts.find_dev = true; + opts.dev = strdup(optarg); case 'v': opts.verbose = true; break; @@ -996,7 +1002,7 @@ report_esp_device(bool do_dp, bool do_unix) char *name, *dev, *relpath, *abspath; uint8_t *walker, *ep; efi_char *descr; - efidp dp, edp; + efidp dp; char buf[PATH_MAX]; if (do_dp && do_unix) @@ -1026,7 +1032,6 @@ report_esp_device(bool do_dp, bool do_unix) // Now we have fplen bytes worth of file path stuff dp = (efidp)walker; walker += fplen; - edp = (efidp)walker; if (walker > ep) errx(1, "malformed boot variable %s", name); if (do_dp) { @@ -1068,6 +1073,26 @@ set_boot_to_fw_ui(bool to_fw) errx(1, "failed to set boot to fw ui"); } +static void +find_efi_device(const char *path) +{ + efidp dp = NULL; + size_t len; + int ret; + char buf[1024]; + + ret = efivar_unix_path_to_device_path(path, &dp); + if (ret != 0) + errc(1, ret, + "Cannot translate path '%s' to UEFI", path); + len = efidp_size(dp); + if (len > MAX_DP_LEN) + errx(1, "Resulting device path too long."); + efidp_format_device_path(buf, sizeof(buf), dp, len); + printf("%s -> %s\n", path, buf); + exit (0); +} + int main(int argc, char *argv[]) { @@ -1075,7 +1100,10 @@ main(int argc, char *argv[]) memset(&opts, 0, sizeof (bmgr_opts_t)); parse_args(argc, argv); - if (!efi_variables_supported()) + /* + * find_dev can operate without any efi variables + */ + if (!efi_variables_supported() && !opts.find_dev) errx(1, "efi variables not supported on this system. root? kldload efirt?"); read_vars(); @@ -1107,6 +1135,8 @@ main(int argc, char *argv[]) set_boot_to_fw_ui(true); else if (opts.no_fw_ui) set_boot_to_fw_ui(false); + else if (opts.find_dev) + find_efi_device(opts.dev); print_boot_vars(opts.verbose); } From nobody Sun Feb 19 00:48:41 2023 X-Original-To: dev-commits-src-branches@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 4PK6P61TYJz3s8vf; Sun, 19 Feb 2023 00:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK6P56hT9z43by; Sun, 19 Feb 2023 00:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767721; 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=GehJUUVawgy7JaIlcG3mmuAhZI+J9vmOpiX2apLK+mY=; b=xo2ntETRDc+yzMU6F0IV3Z/+bhMC0nStG0YuuXUZ2rojcXPgItHivG8QG63DnPXZxIwBAa dV0D/iBRPZ+WggV+Jr5RJhVVdmTbtdEHvT12FF2Fp8eCGRj6aMP5vgkiToPjV3E0h4rG1Q 5+4SCOpoVWifCt4/mwFepETjliyEPgY+/65fM4c/7kpy8sliE5Fi+d8/+OCrEHiB4yGcEn llYIL9aUTjjpmZd3FdZz817ZWwZWeZa/VMEXD8jfW2eZLqDv+ObPyZQYBWo1L+WTjgv+5B dHPgClYttNu1FWCBEL9jWlhGT/iNcZ4fKOhlLybFkhkbMLNLi3dbVBgL7uYmtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767721; 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=GehJUUVawgy7JaIlcG3mmuAhZI+J9vmOpiX2apLK+mY=; b=B+9I8wFpJiItlk6kh4uJQh34QJE6IL5B/YTTTG2QKWTAHN2WIR5iAS0P7NIoUruoimMLE4 lHHuCHgxydoS/PzK+2bvXj5PjsJp4Xdj2sgDIjkMh8rhsM36av2ePihiPbna1HVDKOtEhM nWNKaJPESr8/P9X2pV8zw0uUyBt9O1cWuYlqgRjdFOQixj0Rv+fGemdiNUrFg7qdlrv8By +vddq1NS5ycOm0q2fPtG/Wqc7h2UkV1JDo+pVtSMHbzP+ENx9cDG28Xpyeq0KbGy2i2JFJ FM1/cWVCL/xEWMsf0qPz6EInHYiqe7kHZKbPlZUJoI7b3ns9yv7NP9ShCWQN/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676767721; a=rsa-sha256; cv=none; b=oxihPRxD4dWi3ctvDIpQPCz2ewqWHUJnbDHupPSYgFuSXFIsLSZCVpC91yccLEd8lFU7MC NKH8pqYc3KhUc9xB7v113H8WMzR9ZJO5GgNLhartSJRVYAkYhSF/FDRVFIcKeTBtbIvWev C3iKuSA+4fyiDRK7GppokuGVdxdZKK8+/z6ezIphjfqKZxFyCng2+gYOYEKGzz9ioGKmSl /opzQU1TB46DZKZUWo3fXg7Rby4QJIVhJ8vJ5I6UNwNN+jjKjLJ2Bro250C4qJ4VDn7nf0 Afvsy5Sk7Gu/QjEPMdX8TL47ObFuu5pUU6cUW46B2VSexleBppQ2sFAlXeqoig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK6P55mZPzj9M; Sun, 19 Feb 2023 00:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J0mfdk069665; Sun, 19 Feb 2023 00:48:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J0mfX8069664; Sun, 19 Feb 2023 00:48:41 GMT (envelope-from git) Date: Sun, 19 Feb 2023 00:48:41 GMT Message-Id: <202302190048.31J0mfX8069664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f4d711e72090 - stable/13 - efivar: Really look for labels for the provider with right efimedia List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f4d711e7209073404c821c9c26c7c17b87b61997 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f4d711e7209073404c821c9c26c7c17b87b61997 commit f4d711e7209073404c821c9c26c7c17b87b61997 Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 00:46:58 +0000 efivar: Really look for labels for the provider with right efimedia The prior code mistakently thought that the g_consumer that hung off the provider we found were the right thing to use to find all the glabel aliases for this node. However, the only way to find that is to iterate through all the geoms that belong to the glabel geom class, looking for those geoms with the same name as the provider with the right efimedia. Do this in a way that caches glabel class, and allows for it to be absent. Tighten the filter for mounted filesystems to only look for the ones that are mounted on /dev/.. since the rest of the code assumes that. MFC After: 3 days Sponsored by: Netflix Reviewed by: corvink, asomers Differential Revision: https://reviews.freebsd.org/D38619 (cherry picked from commit 2b460910326c4f39068fe2158a0726dc3d362f68) --- lib/libefivar/efivar-dp-xlate.c | 64 ++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index 586ba7d08180..3d63868dacef 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -134,12 +134,15 @@ efi_hd_to_unix(struct gmesh *mesh, const_efidp dp, char **dev, char **relpath, c const_efidp media, file, walker; size_t len, mntlen; char buf[MAX_DP_TEXT_LEN]; - char *pwalk; + char *pwalk, *newdev = NULL; struct gprovider *pp, *provider; - struct gconsumer *cp; struct statfs *mnt; + struct gclass *glabel; + struct ggeom *gp; walker = media = dp; + *dev = NULL; + *relpath = NULL; /* * Now, we can either have a filepath node next, or the end. @@ -174,12 +177,6 @@ efi_hd_to_unix(struct gmesh *mesh, const_efidp dp, char **dev, char **relpath, c goto errout; } - *dev = strdup(pp->lg_name); - if (*dev == NULL) { - rv = ENOMEM; - goto errout; - } - /* * No file specified, just return the device. Don't even look * for a mountpoint. XXX Sane? @@ -217,6 +214,16 @@ efi_hd_to_unix(struct gmesh *mesh, const_efidp dp, char **dev, char **relpath, c rv = errno; goto errout; } + + /* + * Find glabel, if it exists. It's OK if not: we'll skip searching for + * labels. + */ + LIST_FOREACH(glabel, &mesh->lg_class, lg_class) { + if (strcmp(glabel->lg_name, G_LABEL) == 0) + break; + } + provider = pp; for (i = 0; i < n; i++) { /* @@ -225,30 +232,53 @@ efi_hd_to_unix(struct gmesh *mesh, const_efidp dp, char **dev, char **relpath, c * we'll need to invent one, but its decoding will be handled in * a separate function. */ - if (mnt[i].f_mntfromname[0] != '/') + if (strncmp(mnt[i].f_mntfromname, "/dev/", 5) != 0) continue; /* * First see if it is directly attached */ - if (strcmp(provider->lg_name, mnt[i].f_mntfromname + 5) == 0) + if (strcmp(provider->lg_name, mnt[i].f_mntfromname + 5) == 0) { + newdev = provider->lg_name; break; + } /* - * Next see if it is attached via one of the physical disk's - * labels. + * Next see if it is attached via one of the physical disk's labels. + * We can't search directly from the pointers we have for the + * provider, so we have to cast a wider net for all labels and + * filter those down to geoms whose name matches the PART provider + * we found the efimedia attribute on. */ - LIST_FOREACH(cp, &provider->lg_consumers, lg_consumer) { - pp = cp->lg_provider; - if (strcmp(pp->lg_geom->lg_class->lg_name, G_LABEL) != 0) + if (glabel == NULL) + continue; + LIST_FOREACH(gp, &glabel->lg_geom, lg_geom) { + if (strcmp(gp->lg_name, provider->lg_name) != 0) { continue; - if (strcmp(g_device_path(pp->lg_name), mnt[i].f_mntfromname) == 0) - goto break2; + } + LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { + if (strcmp(pp->lg_name, mnt[i].f_mntfromname + 5) == 0) { + newdev = pp->lg_name; + goto break2; + } + } } /* Not the one, try the next mount point */ } break2: + /* + * If nothing better was mounted, then use the provider we found as + * is. It's the most correct thing we can return in that acse. + */ + if (newdev == NULL) + newdev = provider->lg_name; + *dev = strdup(newdev); + if (*dev == NULL) { + rv = ENOMEM; + goto errout; + } + /* * No mountpoint found, no absolute path possible */ From nobody Sun Feb 19 03:16:28 2023 X-Original-To: dev-commits-src-branches@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 4PK9gd0btCz3sLDq; Sun, 19 Feb 2023 03:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gc599dz4KHq; Sun, 19 Feb 2023 03:16:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776588; 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=cJYuaptP3N49M5Z8Cn+Xvcu6lSLy9712NOS5vu6cA+I=; b=aT9C658TZyveCiEhOlLmERHUhgQ2apyPEJeL2bqztpTZhdi70xUW5kPzFnJiFxHz1rL2Oc WSfwcSuByBMqXqnYuU2PrvuS2cqIZFHVdr6Xab4k85+tRpbBo/FmL1lpmak2pjXDrU8dmU l6JjtRw5gcYTMbYU8Fb7lgjO07gSnobFgTHamZvlkOC2C87OVPft0RkTEQcg8vckoNe/M8 U2PB7b3kzxL9ZuWcmT9FklimdWyzeSTuAMEODhVvQDfwbYtfmLxT2/HzmalumvcYw5cgow rk6cjkkLxLS/l6EmzXcarcAXjBNMRjVpE8nn5FPekz4+wW39JHrzkby8Tf+chg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776588; 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=cJYuaptP3N49M5Z8Cn+Xvcu6lSLy9712NOS5vu6cA+I=; b=MIgvkXgaPHud49Yi17OyY7H4rCxEmWNmjJImbYfz4zZCiN3M5g80vNDilFcy09AKNy243o 6T0/MtD/kjWiPIkLfkmoWd9l/Be6eBcJzZP+UHcxs7nsu2W2BYl5ATLDUPNRD95M55+9qv w7bulUWqxZcGsR107is8B+ueYRRR9UxH9WpgHevggS67MMrZaPxBN2AAKcFk/xrmEUw5br klYmUrHGUxliTQDm9bgLjMhvudW7lX1v14fIcq7AUGn2WxpBBR5/i2Qibw6nnnT0MfCvyB zah9IgRALTXhswwbYpjgZ/8Hl322IEbih9NDHPjzssolLtHV76P+EEG174316A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776588; a=rsa-sha256; cv=none; b=b4W39+qFLjvg80rM/eW4ZDCRtsHV18I+EtG57oZrRqQhJMx91Q3SrD96hB12w6e2g1Zbu6 llkfE7NFcQzR8M3346XJ2xsR9SaS/uwY52advTkyzXpAxPi2pkK6f2eEVdC5PgBWTMWtUt vVLJeXktAIRX7agkxDPO2bE7H3iZbVU49p20c5QWgLq1/r+wxNqkKtgIezYNk+DfN+/Ekr 3MS3SME2dmoUQXZvsHqUiLBnptAXZkL7j20QHp+HpCP4uPXsgd8/brG7TOeqn0nzUk430W rokTgtpjo34QF+W5i17H70ZpeLUrXAOZ/tFQAFfGhuluL+/6Jz7BKixTtnzFVQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gc4FtDzn2v; Sun, 19 Feb 2023 03:16:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GS8l083786; Sun, 19 Feb 2023 03:16:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GSSH083785; Sun, 19 Feb 2023 03:16:28 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:28 GMT Message-Id: <202302190316.31J3GSSH083785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 83f1f44478fc - releng/13.2 - usb: Add Huawei 4G Modem devices (2022) to usbdevs List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 83f1f44478fc52782a03a91e539fafad1f90717e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=83f1f44478fc52782a03a91e539fafad1f90717e commit 83f1f44478fc52782a03a91e539fafad1f90717e Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:29 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:11:43 +0000 usb: Add Huawei 4G Modem devices (2022) to usbdevs ADD [sys/dev/usb/usbdevs] - add new Huawei 4G E3372_NCM 0x1505 - add new Huawei 4G E3372v153_NCM 0x155f - add new Huawei 4G E5573Cs322_NCM 0x155e - add new Huawei 4G E5573Cs322_ECM 0x14db - add new Huawei 4G E5573Cs322_ACM 0x1442 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633 Approved by: re (cperciva) (cherry picked from commit 2c6b88da7174b02c98b87cd4b7251ccf9d7acbae) (cherry picked from commit 7324f2b89f2cacecb0ce73e06297205891e7929a) --- sys/dev/usb/usbdevs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 6960ac8a33e2..01612662fd4d 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -2564,6 +2564,13 @@ product HUAWEI ETS2055 0x1803 CDMA modem product HUAWEI E173 0x1c05 3G modem product HUAWEI E173_INIT 0x1c0b 3G modem initial product HUAWEI E3272 0x1c1e LTE modem +product HUAWEI E3372_INIT 0x1f01 LTE modem initial +product HUAWEI E3372_NCM 0x1506 LTE modem in NCM mode +product HUAWEI E3372v153_INIT 0x14fe LTE modem initial +product HUAWEI E3372v153_NCM 0x155f LTE modem in NCM mode +product HUAWEI E5573Cs322_NCM 0x155e LTE AP modem NCM mode +product HUAWEI E5573Cs322_ECM 0x14db LTE AP modem ECM mode +product HUAWEI E5573Cs322_ACM 0x1442 LTE AP modem ACM mode /* HUAWEI 3com products */ product HUAWEI3COM WUB320G 0x0009 Aolynk WUB320g From nobody Sun Feb 19 03:16:29 2023 X-Original-To: dev-commits-src-branches@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 4PK9gf0x3gz3sLKy; Sun, 19 Feb 2023 03:16:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gd6zndz4KCZ; Sun, 19 Feb 2023 03:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776590; 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=gDkK7GP2b23YbAFzuhK8nE9s0csZhawgj/nnbVfsiyo=; b=U8+0A1Y6ssPHyr4Tz0ctx8GwyqjUqpa8zMnsKNeXOwERCyuzEb+EsPYodkYt5QEPYC0d5o Ygy5YqPZ7nUo8vQ2XkS36AEFMKMfk0yehK8Qb7fakgqaXw3NoBL8hJhNjsFytvDLZE9pK7 hL333K7dSgObpiGfq7iBOK/14tl3UuCcsxbMhgDtNW0DUje2e3fWuzbGodQdXt3NvudyF+ aueeqjPX5wT2Ea1POEJuzQipeLT/+/f8Ouu5swgKLC32HQ2e8qaxE8ZBI6HMcC6jxPFLXr gS5ZDxdfc3I7sB/Y7qEZJgaAGuxRouiGxXeSQfxZ7IY9qqiW6txRWpWSzFw2uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776590; 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=gDkK7GP2b23YbAFzuhK8nE9s0csZhawgj/nnbVfsiyo=; b=BaqAT8BVjngVQ7q9Ave+MlEGk1wIgGzQO91LwSr7KE6LEk/GGWio8C0aUXm7BYDljUkssR kQdsc2/BP9QeoAy2niSf2HtnE27qNCpOgmPqLTISuVnf8HkWewPLaYsnjjoNtvLHuUAUXH fq4Fvj5EyYD0T3bLjzlvzdkenZa+0IgzxeR5/ykSlW21qF6LxKX5urabV6DmMnlGZGovpL pw/6ULi5xqU10WQp3Hoz+oCcqfEGM2Ikvi5dzAG4JO47ZAcA3dIfeHkx3+dR3WBGp1qIAi lVLw4kCZQvv0kB0aTDp52eWsl3aATYwNsEZt4jYeELtNGzIHbxfvAfj2nzTkfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776590; a=rsa-sha256; cv=none; b=p3EQv4O4HcJv4QTKLo6DeCb321r/N4bZ/cNSQJ8MFp4J/+9UO3ahTpK0CFhurJ/AqF7LpY Q7kHCOXaZHvK+RuDeoCrn3rOVEOTeMysE2jobGbndavFgK2cg2KfD6PADPziPsh2F0Erkr z57modOu8OfGWNqs7/D4jaiW9PpVni02WsAi2i0xmo7Scs05MLput5Vd3y1qXgxEyzqc6h XSvPu0dr4VdVAJ5rIJ9ofzbqdwTQQ9AmNeLV8OVrsmxPeCs+b9gRmnisuJcCULMB2c6fm8 u2A+VoDY0SqcGWUcmkGmFod1MjCUBM+GU1FZeLENZXAYQA9pzXCGaf3Ew2QOwA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gd4tPmzmjt; Sun, 19 Feb 2023 03:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GTX9083805; Sun, 19 Feb 2023 03:16:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GTpS083804; Sun, 19 Feb 2023 03:16:29 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:29 GMT Message-Id: <202302190316.31J3GTpS083804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: fb22c140cc11 - releng/13.2 - usb: add new scsi_huawei eject3 & eject4 quirks List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: fb22c140cc11bec1e19f4825b54d1e8c8004fdf6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fb22c140cc11bec1e19f4825b54d1e8c8004fdf6 commit fb22c140cc11bec1e19f4825b54d1e8c8004fdf6 Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:30 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:12:45 +0000 usb: add new scsi_huawei eject3 & eject4 quirks Add new scsi_huawei eject3 & eject4 mode driver to usb quirks Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633 Approved by: re (cperciva) (cherry picked from commit 64fd867f8cdbad24d7af678ee17bd3893832b905) (cherry picked from commit 1d31c745cfe60d7a81fd91efdcfecd0405888af2) --- sys/dev/usb/quirk/usb_quirk.c | 2 ++ sys/dev/usb/quirk/usb_quirk.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index 3dd2aa735fb3..bb02b90ba4bd 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -696,6 +696,8 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = { [UQ_MSC_EJECT_SAEL_M460] = "UQ_MSC_EJECT_SAEL_M460", [UQ_MSC_EJECT_HUAWEISCSI] = "UQ_MSC_EJECT_HUAWEISCSI", [UQ_MSC_EJECT_HUAWEISCSI2] = "UQ_MSC_EJECT_HUAWEISCSI2", + [UQ_MSC_EJECT_HUAWEISCSI3] = "UQ_MSC_EJECT_HUAWEISCSI3", + [UQ_MSC_EJECT_HUAWEISCSI4] = "UQ_MSC_EJECT_HUAWEISCSI4", [UQ_MSC_EJECT_TCT] = "UQ_MSC_EJECT_TCT", [UQ_BAD_MIDI] = "UQ_BAD_MIDI", [UQ_AU_VENDOR_CLASS] = "UQ_AU_VENDOR_CLASS", diff --git a/sys/dev/usb/quirk/usb_quirk.h b/sys/dev/usb/quirk/usb_quirk.h index 755465576684..399c8d3f65b4 100644 --- a/sys/dev/usb/quirk/usb_quirk.h +++ b/sys/dev/usb/quirk/usb_quirk.h @@ -108,6 +108,8 @@ enum { UQ_MSC_EJECT_SAEL_M460, /* ejects after Sael USB commands */ UQ_MSC_EJECT_HUAWEISCSI, /* ejects after Huawei SCSI command */ UQ_MSC_EJECT_HUAWEISCSI2, /* ejects after Huawei SCSI 2 command */ + UQ_MSC_EJECT_HUAWEISCSI3, /* ejects after Huawei SCSI 3 command */ + UQ_MSC_EJECT_HUAWEISCSI4, /* ejects after Huawei SCSI 4 command */ UQ_MSC_EJECT_TCT, /* ejects after TCT SCSI command */ UQ_BAD_MIDI, /* device claims MIDI class, but isn't */ From nobody Sun Feb 19 03:16:30 2023 X-Original-To: dev-commits-src-branches@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 4PK9gg1nmlz3sb4C; Sun, 19 Feb 2023 03:16:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gf725qz4K9t; Sun, 19 Feb 2023 03:16:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776591; 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=HQynv5GrDUryHgI2q9i8krZ1ISsL2a2V/T1eEPJrJA8=; b=hpBmSeyWZWNSWdtFMkdKNim7WZg0CLtFlJ9zdY8fjyVTWOflfbvb1hAQhLZrFG0whRijhI TK7r9uqc7pxNyJr8XtD3QvuY0OvHOdYzBbXvTOnC+eXz6+g+Vh/VakfFl3TzY6zlz16dzw MQXLdPLCQuJeF4SKcedqTLsLVz9k/8eMfXVJ331eZuQcuOHzcdAyp78WSkfDan4SBhNYWU 9z1LeDFUARfIWWxRS7QDLxmpBHCRSLqZjmqJcsCwdTibPT2FHmfybMxW/jps6opStN3SPv jSvFmib+hd6ucaDSPllGMQozC+QrMCmzThg1bQW66iIZKFEF4y4Yq9gWswFPPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776591; 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=HQynv5GrDUryHgI2q9i8krZ1ISsL2a2V/T1eEPJrJA8=; b=wGHBkh4nOp9glIOf+1XmmFC2+Yh5zlF21PFIJk16RLEDVFum8djDmCieb1FL427Q8DGvRw EIxykU6hcjCLiHA4lMQrlTyffCxYVq9rhpspQ+DpBchEWavGCIzqt0Epf8/bqgN3yzqKX0 mS18u02NNHhL7b8dnXymkC2OCgto+54A00M2voFJxQ0iOdHSQ4jePbpcwXJx3C543CgIb9 6CCaxFBotzwNapyPaqNwVfEwDseDykOPu4Ghfogxw1lZUVPnvdmLCb0tugwY8rMz+8qs6q hudgHAI67acwadxfPN0rEVJkKS+GC2m/iDJm1LGQgchROADMBN9pa/BsNT+Bjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776591; a=rsa-sha256; cv=none; b=cS2dujbglbScn9f9UU41R/icxmMQctzFhc7W4QCMXM/Ah2eHrRnAwij1quzqOPxf8QyXLR Qx3z4wnNXY+7I9HqdDMllxXvXcTl5n2A4wBoQi7hQnDHBaaPGeELDHw39dXEttlJm2wZ/U 07eKXMP/R8gC5gmc3f8J551XmIB9/V7GFtcO2Ptiufzpi4jaCKbKEamRp4fx8n0Mer0e9h mo1ECKfihcBPbqR7WuFKXE2/u6LpIi6lEROQN2qENoSKNyr1+cZ0g6fuI08kVKgbzxjv/t 2dnT2FrOkFBkZzNSLjuHnM2oF51KyCXXHtHQnKXezleTriKXx+9jM7QqjzoTBQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gf5q1kzmTR; Sun, 19 Feb 2023 03:16:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GUgX083829; Sun, 19 Feb 2023 03:16:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GUpT083828; Sun, 19 Feb 2023 03:16:30 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:30 GMT Message-Id: <202302190316.31J3GUpT083828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: dbfdc2fdb092 - releng/13.2 - usb: add new scsi_huawei eject3 & eject4 sequences List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: dbfdc2fdb0924ae6810153a7fb030b2582a31a12 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dbfdc2fdb0924ae6810153a7fb030b2582a31a12 commit dbfdc2fdb0924ae6810153a7fb030b2582a31a12 Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:30 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:12:56 +0000 usb: add new scsi_huawei eject3 & eject4 sequences Add new Huawei eject3 and eject4 command sequences. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633 Approved by: re (cperciva) (cherry picked from commit 7d4b2b5834dba66732596d68d7f817d18affb67f) (cherry picked from commit 356e03eace327e3b255834d4a1e6a7278663ce85) --- sys/dev/usb/usb_msctest.c | 16 ++++++++++++++++ sys/dev/usb/usb_msctest.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c index 5dcf8d151119..338c17983d92 100644 --- a/sys/dev/usb/usb_msctest.c +++ b/sys/dev/usb/usb_msctest.c @@ -107,6 +107,12 @@ static uint8_t scsi_huawei_eject[] = { 0x11, 0x06, 0x00, 0x00, 0x00, 0x00, static uint8_t scsi_huawei_eject2[] = { 0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static uint8_t scsi_huawei_eject3[] = { 0x11, 0x06, 0x20, 0x00, 0x00, 0x01, + 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; +static uint8_t scsi_huawei_eject4[] = { 0x11, 0x06, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -1005,6 +1011,16 @@ usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method) &scsi_huawei_eject2, sizeof(scsi_huawei_eject2), USB_MS_HZ); break; + case MSC_EJECT_HUAWEI3: + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_huawei_eject3, sizeof(scsi_huawei_eject3), + USB_MS_HZ); + break; + case MSC_EJECT_HUAWEI4: + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_huawei_eject4, sizeof(scsi_huawei_eject4), + USB_MS_HZ); + break; case MSC_EJECT_TCT: /* * TCTMobile needs DIR_IN flag. To get it, we diff --git a/sys/dev/usb/usb_msctest.h b/sys/dev/usb/usb_msctest.h index ba4e094bab60..08a7de1b5b9c 100644 --- a/sys/dev/usb/usb_msctest.h +++ b/sys/dev/usb/usb_msctest.h @@ -36,6 +36,8 @@ enum { MSC_EJECT_CMOTECH, MSC_EJECT_HUAWEI, MSC_EJECT_HUAWEI2, + MSC_EJECT_HUAWEI3, + MSC_EJECT_HUAWEI4, MSC_EJECT_TCT, }; From nobody Sun Feb 19 03:16:31 2023 X-Original-To: dev-commits-src-branches@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 4PK9gh1VZQz3sb6V; Sun, 19 Feb 2023 03:16:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gh0PG1z4KCv; Sun, 19 Feb 2023 03:16:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776592; 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=1OAvIfU6A2N2wLWLTwB9E7jqa4fgDtilHdgYNFT0S/A=; b=HU3AaL07wrsYK2FdPQCQqE8d/hzKCgUhDd9hJExOElf8jZb4ih1/IjEXLXwxsl1XGGNEpk 2Vwp8pv0Ps89HqXkjelNEW0vdFJzwTrCrtDeNifF2stcl8NCPN5XdV24k55Fzr24bmBzBf 6uO/aqMmjADjVFzoS7PESsn3Z83TYylltTfw3rd0AZeeb7+cd213QVJ6YR/aokAlubt+cm 133AvAxKfR71zXsZzQ6Fi12VjBNJlxw/spXEokoz4e1v6vo9x4zIp5GWGsJ+k42gos/jdK BWdDHV6cM0HWsJ8ujnW1Kv3aNNcVfv+cWqf1xVwS/slkqy4x1lFJwXFedIzMjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776592; 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=1OAvIfU6A2N2wLWLTwB9E7jqa4fgDtilHdgYNFT0S/A=; b=RQy31kZHPi8KJ8PvS6Ut1fsL5T8FFjqX6J0YEGjaqSJEDhRP4k21Gb7q3c6WIB75ktCoOe RtT4SGKg80SfK8hlsZxJ+rU0wXg+vqurqE1dW7Un0OhIdncFtW0ZcgPwAA8j6pGD9CYtRt /7CVxtoaSow/JLeBh7GWbmA3RHJONiKfdz5oKgUyG2QkcyV0oIKbp4VcAsKgDJE2vH3INs GVJsrjFMLQ34nPpWDI5924h47bjnP+8MDvQ+mP/I/DHdITCrPI8q6URrT6ILK7DyJ2ThXR dAfOEUUEv8kwltq7VNyawf2d4JjQn8VEVU4XKXLnWNby8uW7EBH3UgyOG4JlNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776592; a=rsa-sha256; cv=none; b=vj0WTOlk6kxSw0arPvxRXs0S5Kw8NSMPLg0Kc0MKPKIfz9shc4Gr1kdqyWntoAdFg/zCsi BmUf77uyp779RJwyX7GbvJhPmCWDd/61M2IE2PgFCTWvdOdQU4fw3Y4tfpYFKkoi9CxVvJ 5FzkTxw9YbwjqVG7gSd5SX46zXgFBNbTtYF+Sybb8GYNtJ5l11D2/eNaRBzq1n3R2YoD4s gDqwEVaeY7v9GXvJTDkFLRFYXwXKl3CF6hj8TJS8ieT8nqGnUYeJTp4wDqqP/MTRwemWoV ZBfhAU7vyJpey9rtIYcaOTjeuOCrcZQG4a0dx93m/bw7WXLzCQTqwNYYakSHuQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gg6cZ0zmjv; Sun, 19 Feb 2023 03:16:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GVRZ083848; Sun, 19 Feb 2023 03:16:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GVDJ083847; Sun, 19 Feb 2023 03:16:31 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:31 GMT Message-Id: <202302190316.31J3GVDJ083847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 97e58ca95015 - releng/13.2 - usb: add new scsi_huawei eject3 & eject4 driver support List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 97e58ca95015fa4c3a73e335fe4dcf2390c2da69 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=97e58ca95015fa4c3a73e335fe4dcf2390c2da69 commit 97e58ca95015fa4c3a73e335fe4dcf2390c2da69 Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:31 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:13:06 +0000 usb: add new scsi_huawei eject3 & eject4 driver support Add initialization for new Huawei 4G E3372_NCM, E3372v153_NCM, E5573Cs322_NCM, E5573Cs322_ECM, and E5573Cs322_ACM. Remove now-obsolete Huawei 3G E3131 init sequence. These devices are obsolete, share IDs with new devices and the 3G networks are shutdown. These old devices work correctly via the 4G code while still allowing the shared IDs to work differently for the new devices. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633 Approved by:re (cperciva) (cherry picked from commit 1997d3a4a9f20a846cf762306fd5193526a1d603) (cherry picked from commit e20b6a8ec68e3f6805a5281d2691c2ac97f6bb93) --- sys/dev/usb/net/if_cdce.c | 2 ++ sys/dev/usb/serial/u3g.c | 24 ++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index f3c73567b7ce..0b6445e5908d 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -266,6 +266,8 @@ static int cdce_driver_loaded(struct module *, int, void *); static const STRUCT_USB_HOST_ID cdce_switch_devs[] = { {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3272_INIT, MSC_EJECT_HUAWEI2)}, + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3372v153_INIT, MSC_EJECT_HUAWEI2)}, + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3372_INIT, MSC_EJECT_HUAWEI3)}, }; static const STRUCT_USB_HOST_ID cdce_host_devs[] = { diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c index 0b020af53b71..0e20f42feb39 100644 --- a/sys/dev/usb/serial/u3g.c +++ b/sys/dev/usb/serial/u3g.c @@ -89,7 +89,9 @@ SYSCTL_INT(_hw_usb_u3g, OID_AUTO, debug, CTLFLAG_RWTUN, #define U3GINIT_SAEL_M460 8 /* Requires vendor init */ #define U3GINIT_HUAWEISCSI 9 /* Requires Huawei SCSI init command */ #define U3GINIT_HUAWEISCSI2 10 /* Requires Huawei SCSI init command (2) */ -#define U3GINIT_TCT 11 /* Requires TCT Mobile init command */ +#define U3GINIT_HUAWEISCSI3 11 /* Requires Huawei SCSI init command (3) */ +#define U3GINIT_HUAWEISCSI4 12 /* Requires Huawei SCSI init command (4) */ +#define U3GINIT_TCT 13 /* Requires TCT Mobile init command */ enum { U3G_BULK_WR, @@ -319,8 +321,6 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, E143F, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E173, 0), U3G_DEV(HUAWEI, E173_INIT, U3GINIT_HUAWEISCSI), - U3G_DEV(HUAWEI, E3131, 0), - U3G_DEV(HUAWEI, E3131_INIT, U3GINIT_HUAWEISCSI2), U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), @@ -343,6 +343,12 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, ETS2055, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E3272_INIT, U3GINIT_HUAWEISCSI2), U3G_DEV(HUAWEI, E3272, 0), + U3G_DEV(HUAWEI, E3372_INIT, U3GINIT_HUAWEISCSI3), + U3G_DEV(HUAWEI, E3372v153_INIT, U3GINIT_HUAWEISCSI2), + U3G_DEV(HUAWEI, E3372v153_NCM, 0), + U3G_DEV(HUAWEI, E5573Cs322_NCM, 0), + U3G_DEV(HUAWEI, E5573Cs322_ECM, 0), + U3G_DEV(HUAWEI, E5573Cs322_ACM, 0), U3G_DEV(KYOCERA2, CDMA_MSM_K, 0), U3G_DEV(KYOCERA2, KPC680, 0), U3G_DEV(LONGCHEER, WM66, U3GINIT_HUAWEI), @@ -814,6 +820,10 @@ u3g_test_autoinst(void *arg, struct usb_device *udev, method = U3GINIT_HUAWEISCSI; else if (usb_test_quirk(uaa, UQ_MSC_EJECT_HUAWEISCSI2)) method = U3GINIT_HUAWEISCSI2; + else if (usb_test_quirk(uaa, UQ_MSC_EJECT_HUAWEISCSI3)) + method = U3GINIT_HUAWEISCSI3; + else if (usb_test_quirk(uaa, UQ_MSC_EJECT_HUAWEISCSI4)) + method = U3GINIT_HUAWEISCSI4; else if (usb_test_quirk(uaa, UQ_MSC_EJECT_TCT)) method = U3GINIT_TCT; else if (usbd_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa) == 0) @@ -837,6 +847,12 @@ u3g_test_autoinst(void *arg, struct usb_device *udev, case U3GINIT_HUAWEISCSI2: error = usb_msc_eject(udev, 0, MSC_EJECT_HUAWEI2); break; + case U3GINIT_HUAWEISCSI3: + error = usb_msc_eject(udev, 0, MSC_EJECT_HUAWEI3); + break; + case U3GINIT_HUAWEISCSI4: + error = usb_msc_eject(udev, 0, MSC_EJECT_HUAWEI4); + break; case U3GINIT_SCSIEJECT: error = usb_msc_eject(udev, 0, MSC_EJECT_STOPUNIT); break; @@ -887,7 +903,7 @@ u3g_driver_loaded(struct module *mod, int what, void *arg) default: return (EOPNOTSUPP); } - return (0); + return (0); } static int From nobody Sun Feb 19 03:16:32 2023 X-Original-To: dev-commits-src-branches@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 4PK9gj3RMbz3sb03; Sun, 19 Feb 2023 03:16:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gj2GFdz4KJd; Sun, 19 Feb 2023 03:16:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776593; 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=pZ0Tg36KCPAex6OyMUTEQen87vqwsl5GujZl8pvjI2c=; b=Xoy/txyB1G3X+zYYiqYNEPxQrLQ+bxNSHMggHAUvl6zDVBSuup55CAJ0jAuKEF2JKllpgK SJSBMAwunVFH1LLsSlSwrNI45awUUapyk7BsTkGzioOk9FtxKBzWotqW8UNsjZssSgOLG9 qjZCwiifXcypOFWNbaL8ZaEsXCXmk2EyFpLj9S5I3SUFpLgNQ80KL+wzj/ksrW/YmmUsIz jWRhYDWNL/1l3vdkAB1adjlTZ5cVQLd6MCOmZwLdEzMVz7zFO7ISPqwqKhaE3p9fsYHDR0 uCaP3BKukeLi6LNsyr416/pekSgBNV81Wer9Azogd8oSS6nzrJAidCQAngaXUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776593; 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=pZ0Tg36KCPAex6OyMUTEQen87vqwsl5GujZl8pvjI2c=; b=i0I1nFDp3Ql7F7oHG4qt9B9tsZlTE6FvKo78+ENGopWJT4sus91GouLCHn6FDr+9XVabKy BDlZw+w4ZmjazZqgoqT8NTC/DroLAg3yaQYjlGQOBmsoF/yNl+duhLwhzbLB7sGw2wwpJs uY5nedJQ4ybENiZBSNWjm8keplWrTo9fcdPjaaOV8Toek1GhuPMq6tYzXyJcSYRuTxC/4B coVna+FxfEKbWD/KIjRnCmacwG2NpWF+3UDTWCDEnmjG6wLBJzMgzgXJYqBERL29ob42A0 UAHeiRHFYK2D9+Y40B3i2O9VDFxkmIsewfWtH1B/hzNq8OzRAC1UzAkLvRgd7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776593; a=rsa-sha256; cv=none; b=UFoVLrnwwpet3tLdFW66Zc7QhWd4er7I+ThLES/LvNvXiqM37VsY6rq++y5RtmjiqmZrnd yccYwWIupmXBQx4+z4YNZwMZqqqWMDyLiy0u7dlmTY6fFBm27VMpYFp2raT5c/TqHnF/Mo AcE4EGrkXjEBqtVDdignEXc6j03vGIB2X7isntrETTDxxKwgxDcPfMtN5Z3Onqh7pY2Ytq OWpUr7xH3qMEXY6+bAmO1wb5sKX/lJDhqU436al5LgPLv1aVQ06QkRJyYa/nnWYa9W4TF0 QdsSep7od3Yfak8RB3KKkIXttXNyZWdAciNW7Bd4roLD5+L29+cHyYENeEjkAw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gj0Hx0zmr5; Sun, 19 Feb 2023 03:16:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GWn9083867; Sun, 19 Feb 2023 03:16:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GWdc083866; Sun, 19 Feb 2023 03:16:32 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:32 GMT Message-Id: <202302190316.31J3GWdc083866@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a9c1274c4202 - releng/13.2 - usb: add support for Huawei E5573Cs322 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: a9c1274c4202aaf89991e8607577879de8d6521a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a9c1274c4202aaf89991e8607577879de8d6521a commit a9c1274c4202aaf89991e8607577879de8d6521a Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:31 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:13:18 +0000 usb: add support for Huawei E5573Cs322 Switch the now added E5573Cs322_ECM (0x14db) as well per default to NCM. With this patch we default all devices to simple NCM mode to avoid the problem and get a consistent reliable behavior. No matter what firmware version and provider mix are involved. Rationale: Even the bigger SOC shows under complex load in ECM (double-nat) mode the same performance drop from 25Mbit to 2Mbit Line Speed, similar to E3372h. Reason: Thermal problems (reported via serial debug interface in ACM Mode) after 2-3 minutes load. Fix the root cause and bundle a working firmware is out of reach because Huawei sells the same hardware, different (crippled) firmware versions at different price points in different markets as strategy. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633 Approved by: re (cperciva) (cherry picked from commit e66352013a67183dfeec14b2a22913305c26e838) (cherry picked from commit 623346ecb9b3f4390e9f13df4b19e6e41c4e53ee) --- sys/dev/usb/net/if_cdce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index 0b6445e5908d..bb2d08c2a282 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -267,7 +267,8 @@ static int cdce_driver_loaded(struct module *, int, void *); static const STRUCT_USB_HOST_ID cdce_switch_devs[] = { {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3272_INIT, MSC_EJECT_HUAWEI2)}, {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3372v153_INIT, MSC_EJECT_HUAWEI2)}, - {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3372_INIT, MSC_EJECT_HUAWEI3)}, + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3372_INIT, MSC_EJECT_HUAWEI4)}, + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E5573Cs322_ECM, MSC_EJECT_HUAWEI3)}, }; static const STRUCT_USB_HOST_ID cdce_host_devs[] = { From nobody Sun Feb 19 03:16:34 2023 X-Original-To: dev-commits-src-branches@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 4PK9gk3MHlz3sLCN; Sun, 19 Feb 2023 03:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gk1lY5z4KPh; Sun, 19 Feb 2023 03:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776594; 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=Gq92igr0i8IoDljrn7MkOhleQTAulUQdabb3u7XVZjo=; b=H0WtTvyNNeH/paUrFOcRsslePG2CSk23j9HFN4iM3lxilzeAy1kjwceJVYorhoW99rk86M EsEHrwiEMopsLsAeoF8yqXVCP5RYoi6Y33WAD79ru9xKjvY6dT/xLFx6cN1Ixo5o4ZpmYi x2MrFSTj2tCfDFVxbrvvMI7Rhh5TiHBfZdPKPtRJK/aXpKlW+6MTqMwu6ZcoPC+IfDZssq uY0fMtmPgLvbFogyZ/wPf2rKMw15W+QbQaEipSmozjU+/mwlBPCLAF+bFCED0t/gEDEANH z8YnOs5pE8wlfgA0XAG+us4NldY8eaGxzLdW1JBkVGTx+nonX/VANwKHC3HZ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776594; 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=Gq92igr0i8IoDljrn7MkOhleQTAulUQdabb3u7XVZjo=; b=PwzVgmnl4LzlW0t2mJqDJUQTgODM1ZHbNs8E24q5QmKxgfEBRDmBat7TPsNCYBkYPcDTNL QdqZlDtMa4YSelm42McHO3Ik3TAmuTS3IXKc6PLi78ybmSeJwuN6mQ2bIGLJa73cEvj5Xz 9gZkhxsbx+n1pRGL0ORn1gt8eXaS7tzikSOtwce5M6yQ4bJz+yOxZodQ+qkc6WoGSGXd3a 8xnxDdi4Y09iCYZKkYYWxMVqxMkc39Sq+L70l3BQz8a9o+dUIQ4BEaRQGwRtJEZGfl1Nt1 x0TSK850sbGKpgz3NMx6ffBl6/LKz29iKQojSWGuZCZMrWiU0dNxXIu9hw4ZOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776594; a=rsa-sha256; cv=none; b=hDVxTmFHINu2ffIl8QaOIzGutbBOEfR9KfTV6dLTsTioFkC7SL+J0mS1lxg8qeYBSmxaet HccW2jIF9vWe0giO+U1gSTVoL4IALHCOTQC8NArGhgd0ni6dmRnY7Z6VMtcmfMwL0JR576 u66y1jiB4tA82Z0Y2bZmZ1L8wT3s0GkfUAkPwonMRbDnWmY/VmjY9ZcFfoUVNataRNSKm3 3/jDM1s/ZMZXKS1G83xmu5qEQz3as8xs/iBOQ4p46qkdCMg1DLuHRRNX2yiMJlvqRGfUGH iVE4uQcsYSSuFsxLf0Mjgtyvh1pfxVl+StxN4ywh/4ahvSxIGe1JENssgaOLmA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gk0s7yzmjw; Sun, 19 Feb 2023 03:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GYqX083893; Sun, 19 Feb 2023 03:16:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GYhR083892; Sun, 19 Feb 2023 03:16:34 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:34 GMT Message-Id: <202302190316.31J3GYhR083892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: e58ad0e8354f - releng/13.2 - usb: Remove obsolete Huawei 3G from usbdevs List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: e58ad0e8354fd9a1155a415aa9f057ddbc265640 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e58ad0e8354fd9a1155a415aa9f057ddbc265640 commit e58ad0e8354fd9a1155a415aa9f057ddbc265640 Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:31 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:13:33 +0000 usb: Remove obsolete Huawei 3G from usbdevs - remove Huawei 3G E3131 (E3131_INIT): - frees up 0x1505/0x14fe shared IDs => product is EOL (since...) - 3G networks are shutdown/scheduled - E3131 devices will still work the same via scsi_huawei_eject2 - new 4G devices will switch & report correctly now Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633 Approved by: re (cperciva) (cherry picked from commit 848ac8451b08d09a81de7bac8ff8fbe0d35df8cb) (cherry picked from commit b9ddd053e800af8e8a4b06b96128f505d45f532f) --- sys/dev/usb/usbdevs | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 01612662fd4d..629b153f995c 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -2549,9 +2549,7 @@ product HUAWEI K3770 0x14c9 3G modem product HUAWEI K3771 0x14ca K3771 product HUAWEI K3772 0x14cf K3772 product HUAWEI K3770_INIT 0x14d1 K3770 Initial -product HUAWEI E3131_INIT 0x14fe 3G modem initial product HUAWEI E392 0x1505 LTE modem -product HUAWEI E3131 0x1506 3G modem product HUAWEI K3765_INIT 0x1520 K3765 Initial product HUAWEI K4505_INIT 0x1521 K4505 Initial product HUAWEI K3772_INIT 0x1526 K3772 Initial From nobody Sun Feb 19 03:16:35 2023 X-Original-To: dev-commits-src-branches@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 4PK9gl4rxQz3sLDx; Sun, 19 Feb 2023 03:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gl3jHQz4KH9; Sun, 19 Feb 2023 03:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776595; 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=AljstLl0tR+U2ndUTXxXjT4yv+hu1YD3Cap96wspdp0=; b=BMtd9MU392wHO2KHUKagboWhqxZOggS5QekvmeduE4Ne6yMkU0tjC557HRTAoEKxTniKmB +JzdW6sb9HuHdqSwhD3RGVqzxcmwcSZ/DKePsmYJJyZufOVlEQM/EVyp5ta1ojIyXs/qWP lUKFt7aoFbX/GxlppklUFZa8RCsHMG6mGshMCJtbwllxorVWT8npO17l2ZnnaiEmo/6RUD vk2zWxw8dEshC5jkL9VrlJp9dzFqWqKuQzitJbq+trbKSvgcTHZI+UwSU/tK8wQnfCFtAW F7bLKxpEjKwJhm4kv5DFhlXKLVdaxQroIdYEnwfRUaWLNHFMHIGsSS2vNn6paQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776595; 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=AljstLl0tR+U2ndUTXxXjT4yv+hu1YD3Cap96wspdp0=; b=PnQabJe3s5hL4Yj8vqpzlDYLLkglIkeOpzE6Rgy6JzcGVP7zp+F97mFMrqOsKiAov/0WrD MBLSV6ayelnmtPqXHbLFFoHI1vkUH5akzyc7u9skDlSS5AQJGdcaVzmSurFN6c8qWh3RLv 7lrlpNc8jLoWZqJkcbrqAr0bOYpfQqlJvHRVxfdKu6RjJTrlx0LctTQh6Q+D3rzC2zl0QZ gZUCJNkJTXw0H1gxS4pYNXbtbSmBaseAf/sTdmOWMZZfLLBl0LM4IZIprmN1xUg29wrOjq Gc62bQ73LRxM4qJRPnZ+yvocpB7tiCYH1O91w6/bK8y3oEhCQMNvUi6z1zFiOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776595; a=rsa-sha256; cv=none; b=DrtfJjrxmCnTy3OnryZwZh0lAfu+U4jYU7kuMpV1/B/v6zdQZpnMR08RvBZHxyvKafLycZ h6ivbHmlEuOmJug1JG8MUKV0/fpi0OtO9bcMOs/w7+L32K9HdobatRwFwaD2sZ3IxEYSaH riMPH5hQ0VQWLhBl3cRkJZwNP0ryRfNhzXW4FcqQANC8hhnOqMq7WkR0SRolTIg8950hcZ j1qRW024OGh+fBVk7Ae2bUH8XiXl9FNf+gzadjt/7D2E+nn6ftKyeX6nJKUeiqOZ68MGdI X9jbuM5s6X8Xt0SlJe/jfwktLAI+LhUFC7H7R6voRDt8OvdGrcRTh3QvPVfywQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gl1Wpjzmjx; Sun, 19 Feb 2023 03:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GZj0083912; Sun, 19 Feb 2023 03:16:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GZLP083911; Sun, 19 Feb 2023 03:16:35 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:35 GMT Message-Id: <202302190316.31J3GZLP083911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: b645d7ea3634 - releng/13.2 - u3g: Add new 4G Huawei devices List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: b645d7ea3634b38b2c2a85689b667668814d5b41 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b645d7ea3634b38b2c2a85689b667668814d5b41 commit b645d7ea3634b38b2c2a85689b667668814d5b41 Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:32 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:13:43 +0000 u3g: Add new 4G Huawei devices New 4G devices. Longer description of new modes to follow. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/633 Approved by: re (cperciva) (cherry picked from commit 75d41cb6967bef0e534afd6d20ea5eeeb2435e36) (cherry picked from commit 9786ac44efd689018ee8dafa4fb231cdba366e94) --- share/man/man4/u3g.4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/u3g.4 b/share/man/man4/u3g.4 index cf1152a6c1cb..91b3fc0761db 100644 --- a/share/man/man4/u3g.4 +++ b/share/man/man4/u3g.4 @@ -18,12 +18,12 @@ .\" .\" $FreeBSD$ .\" -.Dd September 11, 2018 +.Dd February 4, 2023 .Dt U3G 4 .Os .Sh NAME .Nm u3g -.Nd USB support for 3G datacards +.Nd USB support for 3G and 4G datacards .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -72,7 +72,7 @@ Qualcomm Inc. CDMA MSM .It QUECTEL EC25, EM05, EM12-G. .It -Huawei B190, E180v, E220 ('') +Huawei B190, E180v, E220, E3372, E3372v153, E5573Cs322, ('') .It Novatel U740, MC950D, X950D, etc. .It From nobody Sun Feb 19 03:16:36 2023 X-Original-To: dev-commits-src-branches@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 4PK9gm5Pf7z3sb0C; Sun, 19 Feb 2023 03:16:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gm3MBdz4KN9; Sun, 19 Feb 2023 03:16:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776596; 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=PNmxO0Ui4PmX8FDdLxtwtdMC6XzFFTs6PbQI68uO2/4=; b=NMKYxBIN/G+/d43qdQbS8FB7SresgksN7KWjcus/ELKb6ZvOT9Z0UHWYrDqKF69BAkaxhk YdD7vccypCcncNuiKcLJX+SdZ3pxkW9eP5QPxeuLLDQTjgGqBQ3W1dT/SIrbNGWv4frlrU +ldofSnz3pPe3VRnukWdcv6ydUpY/N2fquQZa5VBtTF4FrwW9CQ0OvNFggIKjMl3/iZzOV eZ7wxeIN4wSXUCPSzJsqt2uXcYUHiTlxwPzZ4CVfkxzJ0ub/KsK9q7aQ5nr7WKRPvtSdSY 614WpCZIzvVLzgkdntXBCMfQqcRgjro78zls/xXlnJ7prIYDmKBqcd+fVhzLMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776596; 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=PNmxO0Ui4PmX8FDdLxtwtdMC6XzFFTs6PbQI68uO2/4=; b=gVp9QkDjaXtmik+zOiaAe7zcrFuavOCyIPZTqPKR+u4tkHPLRAKs7hGrBpIZu5GAipxGQc upJCngkOIKoqpfCj6Bk+WBsjdP2iG0cbtw+KBgyLw4q6e/YQI9ss3W325oKGsf/u3qmS0E SoZp0qgZxFs1VQsXE0Rua0eaRbnwH5xjViMS8KmUDTKfhB9vHbb8Sh9CzS/5QTaDxncDur OMm6qwpRyRP/SnuiwXin0sT6jG+Nq0n2nBCv1fbzwaBIfeV/kEfNcsqxX+NaYFHGpWwLTv YRrKS4vCQmwHsUHWr++tGNmbYXHfUAf3DjZFaFOLCSK7hg2nrKNd9ggI6iMdyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776596; a=rsa-sha256; cv=none; b=uGQIglsToc6jtNEjIyLQGvQghnX9mmfZBxN7Ay5EgkTqKuugvnmnaNARfkl2JzabpBpjS5 YnZkE7Ti4uTmwYv6SgHWJLqmwZHH4pjwD9pWEQqbC1iiP/2SVgljtC8Z0EJHlqWpdRJ2RL nwPeFPvYalUCdoM7AsRgaCb8kO5UsUTH0Hc15sQ/aJidl3FDMccYeJMz+v6iBketFZq2Jr eikaZKNUaC/csiPFnJ5wV2wnaRYDll/8ZtDmsomqUrU2dTm1z19/Ib+UW3vRqFsnSc77ZR 81EH4ly3RcvmLlmWl8QCKMiFN9buBsqnIoJmaVcxCAQNFvalikvHasxLwKe+gQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gm2SsLzmvf; Sun, 19 Feb 2023 03:16:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GaQb083934; Sun, 19 Feb 2023 03:16:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3Gaow083933; Sun, 19 Feb 2023 03:16:36 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:36 GMT Message-Id: <202302190316.31J3Gaow083933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: ec9704eeaaa7 - releng/13.2 - usb/u3g: Add support for QUECTEL EP06-E 4G modem List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: ec9704eeaaa7552d1d6b83ac34fa894fa36f50bf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ec9704eeaaa7552d1d6b83ac34fa894fa36f50bf commit ec9704eeaaa7552d1d6b83ac34fa894fa36f50bf Author: ev AuthorDate: 2023-02-16 16:58:32 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:13:54 +0000 usb/u3g: Add support for QUECTEL EP06-E 4G modem Add QUECTEL EP06-E modem support via USB for FreeBSD. Tested and works like a ppp on FreeBSD-13. Reviewed by: imp PR: 269326 Approved by: re (cperciva) (cherry picked from commit 0cec5b99b3c0484925f3cc0813040c160987bd45) (cherry picked from commit 1256ad9b27b2eb34a066640e63039975ab4f8492) --- share/man/man4/u3g.4 | 2 +- sys/dev/usb/serial/u3g.c | 1 + sys/dev/usb/usbdevs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/share/man/man4/u3g.4 b/share/man/man4/u3g.4 index 91b3fc0761db..c4d9b4ee3460 100644 --- a/share/man/man4/u3g.4 +++ b/share/man/man4/u3g.4 @@ -70,7 +70,7 @@ Vodafone Mobile Broadband K3772-Z .It Qualcomm Inc. CDMA MSM .It -QUECTEL EC25, EM05, EM12-G. +QUECTEL EC25, EM05, EM12-G, EP06-E. .It Huawei B190, E180v, E220, E3372, E3372v153, E5573Cs322, ('') .It diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c index 0e20f42feb39..2186cd8e383d 100644 --- a/sys/dev/usb/serial/u3g.c +++ b/sys/dev/usb/serial/u3g.c @@ -514,6 +514,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(QUECTEL, EC25, 0), U3G_DEV(QUECTEL, EM05, 0), U3G_DEV(QUECTEL, EM12_G, 0), + U3G_DEV(QUECTEL, EP06_E, 0), U3G_DEV(SIERRA, AC402, 0), U3G_DEV(SIERRA, AC595U, 0), U3G_DEV(SIERRA, AC313U, 0), diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 629b153f995c..81abe91d93b4 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -3983,6 +3983,7 @@ product QUANTA RW6815R 0xf003 HP iPAQ rw6815 RNDIS /* Quectel products */ product QUECTEL EC25 0x0125 LTE modem product QUECTEL EM05 0x0127 LTE modem +product QUECTEL EP06_E 0x0306 LTE modem product QUECTEL EM12_G 0x0512 LTE modem /* Quickshot products */ From nobody Sun Feb 19 03:16:37 2023 X-Original-To: dev-commits-src-branches@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 4PK9gn5krzz3sLCV; Sun, 19 Feb 2023 03:16:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gn4KSKz4KXh; Sun, 19 Feb 2023 03:16:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776597; 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=EWlkHooiwbmC6dPA0szuzZ6YLKrOu9WdV3jcnxnYaGU=; b=d1If4WrI1C5kKG9talnbT70Fim7QcrpiSc8kAQbfkmE5LrgI9IVwiGeMbXyOsJmJ1kEa8q P1QNMcKAHV4fhYhNqbppvbG0Eqx37Mc4ryg1MahvCOK3+VQ6I3RIsfk5ESou9YfiVImRY9 ycWFmPBKUSkxw0fS8b/wSzJ09DNu3jaGuP2w0vHO0YtVusmae+gJtr7OMXRe5cRIF71sug UUiar049PaZ8vGOnD6GyhtWUsw+pL1y5Vjraf4QfBHTzic+O6th65pgRYi5Zu0OEwrlsqh trxOy6EqByrL8K0Sb2PfqkGN/8D3Gez+blo1UVLZ6gRng4Wr/LaMdqosCzEyXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776597; 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=EWlkHooiwbmC6dPA0szuzZ6YLKrOu9WdV3jcnxnYaGU=; b=PkR0lMWScC9rzBDPdfd+N7QjpngWYVDrzSfgL60LhGX1e6U8l0pEO1D6JqQJ+ZEsz6u8OK v+cAZS63kuOhLnJwwUrXohOV7sn9wxRRYejbX1Fi5P1xAai3JNeYIXHRPgGZpEe99nUmb8 Cy4IhTOcLE+RJqSlF4/SPWWphkl+a+ZQeEg1dFmPRrRLcPFzp4g4jjauwHgYTgye9Jjxtx y961hzjRSrdSdTCVzv8ntZxRa/l86Eoj3eUNp/O95Z91UUAMnEWx6TZ4JfuYwdlorxfPrs zwatJXBSk387pIXxcvh9VPHjkDnjAdtZNLfzBlGC8mI2bBUKNyT7+jxEA5+J3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776597; a=rsa-sha256; cv=none; b=f7efpIxaC6T7QRki3owo7006iYjVxI4oycj9NDyNK7uvQ/AuESDtO+hBSEzDhB6CVcAOsY hN1WQ4qONteW4v7vTa8YPhcn5y13U2TyKbSm7SKsQWh6yK7q081nkuYutJA/WciV+bQOpf wOSxLaFbARpr926xMYkCEDW4Qq5BrxuWfeI/u7ZKyXv59vbUe9lbN99TUQYuXmnvZzJsEh Ql30mviTqdfqCIrk8lMA0zrEdU3bahqfx5g4Wk3s/PzN27FzKBVQL3NtejOyx7MNaLU4fx zcNZpqcxw51lpdUIvs65pGyX/J8LNstXdhAmPGcDHOmgJ9dUgTFhy+UFLh0d2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gn3Nwbzn5n; Sun, 19 Feb 2023 03:16:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GbQH083956; Sun, 19 Feb 2023 03:16:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3Gbck083955; Sun, 19 Feb 2023 03:16:37 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:37 GMT Message-Id: <202302190316.31J3Gbck083955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a642b1290d43 - releng/13.2 - u3g: add huawei device id List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: a642b1290d432021f341f65e87c1b7268873d66c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a642b1290d432021f341f65e87c1b7268873d66c commit a642b1290d432021f341f65e87c1b7268873d66c Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:32 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:14:06 +0000 u3g: add huawei device id Add missing entry for E3372h Model already in NCM mode Noticed by: David BOYER Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/645 Approved by: re (cperciva) (cherry picked from commit 08ecb40e88a0d34cf6a177218a22f07431cadf3c) (cherry picked from commit 38a2e8fff2f7ede285fa66b765e5387026d779f6) --- sys/dev/usb/serial/u3g.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c index 2186cd8e383d..d577508fff37 100644 --- a/sys/dev/usb/serial/u3g.c +++ b/sys/dev/usb/serial/u3g.c @@ -343,6 +343,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, ETS2055, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E3272_INIT, U3GINIT_HUAWEISCSI2), U3G_DEV(HUAWEI, E3272, 0), + U3G_DEV(HUAWEI, E3372_NCM, 0), U3G_DEV(HUAWEI, E3372_INIT, U3GINIT_HUAWEISCSI3), U3G_DEV(HUAWEI, E3372v153_INIT, U3GINIT_HUAWEISCSI2), U3G_DEV(HUAWEI, E3372v153_NCM, 0), From nobody Sun Feb 19 03:16:38 2023 X-Original-To: dev-commits-src-branches@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 4PK9gq0gPKz3sLF5; Sun, 19 Feb 2023 03:16:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gp5PF4z4KL4; Sun, 19 Feb 2023 03:16:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776598; 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=odsCElVQkDXfCUOysmTIP+lFyp16cZQHehiLvUjjV4M=; b=s/PcMNtAFD1kbbuYF7vMxH60VaNbGRJBYcog8PnmacyhFekBpQMcNZBS/a/57jEcB9BboH LNrPwImXq5L332G0QMxk/AvyDyPfdg9UEHr398t7tyXKHcSGJzLcihk+ZIdBagTw8O7VGn Dbe9IgXaAu/+HY2yne5BIE3/bmMQaHsSMTxRStQOuxSH8lqmp3iKAwnKz+1QPMjCQ1CywQ SFAp1Ur2pM9sgAVsxvdEtVJEYh4lOyB863h3FoIZ802fotA2l9Awp9Yu71KjTXXJrX9Im1 1nYvzJPuLow6RZVETq5joQL2cd1uPQhWu8PW0GU2tPDJpKjXWWJwCdDpUWhRNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776598; 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=odsCElVQkDXfCUOysmTIP+lFyp16cZQHehiLvUjjV4M=; b=CGTWfPMQaSx7p7R+JbVDnm+/jLYtaqEHy33QFLusesyTaFUKdh3k86g+OAmclWhiWAuBNe QGEUNE23qrr3yYsfOQjUUmRVccR2rdwaiwzakQI/bQkRo0ncCSFPMqsQkxA5+nh8dpe0Dh owmdWY9hBuaEKHZa6zpwgjxUQjfY3MddS/MoD3UBbMI8iA38ENNPryRetD8zDRx+L+LdBS ONhKMWeUUbesZ9nzZw6f5QUxrv/DHaIy6onZkPZsQE9WsKXersI7hl4NHAlxvcXOKRDQls +vcZtkZ2phnwg8DjbpbZt4qEWNy/KGo7A9SsuaWUiOH5wsZHZUq3NV7SbGintA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776598; a=rsa-sha256; cv=none; b=hMjoctgFbMX3abIFVIvNt0/JYIog79nIf6iRVZwx7XYQ8ELWB4uyvFlQgy6+x9F/Qy1v/L 7kufTf/b47Q18h5LrGU71yATn/7mMcE12Xq0TzRzR81gxoJRlgymBK9G8Qm8h/qCEkayrO w1PYBfBH7l/CSmHAoBY6BKSdbjQ7I6oyIdFURc6IpPsYmyHCsAys3LmLuNjw7kNGICpTYJ C5nnrHdqKMBnMywR8VNu62EszG0Z/EdRBbUWRUJeFcGtVb12bKlAGv/AfLrnKBQmQ1+1gA yUKcej5nPykFLf8d+iedV6+foKf52kvzyk/BddkIkr0jo7gWtAPcZJvu3ce6ww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gp4JkRzn2w; Sun, 19 Feb 2023 03:16:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3Gc60083977; Sun, 19 Feb 2023 03:16:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GcNa083976; Sun, 19 Feb 2023 03:16:38 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:38 GMT Message-Id: <202302190316.31J3GcNa083976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 48b109db1edd - releng/13.2 - cdce: add to cdce.4 information about NCM network mode List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 48b109db1edd044a293dea7b77447de3773520c5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=48b109db1edd044a293dea7b77447de3773520c5 commit 48b109db1edd044a293dea7b77447de3773520c5 Author: Michael Paepcke AuthorDate: 2023-02-16 16:58:33 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:14:15 +0000 cdce: add to cdce.4 information about NCM network mode add a new section how to use NCM network mode and specify the required kernel modules Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/646 Approved by: re (cperciva) (cherry picked from commit 58e1d01022415e29d3e08c4d3936b6631c27406c) (cherry picked from commit 6c9ad7b8bc7dbc17f41ddab6779548fb2728608a) --- share/man/man4/cdce.4 | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/share/man/man4/cdce.4 b/share/man/man4/cdce.4 index b27d89bc1639..99d04bd12d07 100644 --- a/share/man/man4/cdce.4 +++ b/share/man/man4/cdce.4 @@ -28,7 +28,7 @@ .\" $NetBSD: cdce.4,v 1.4 2004/12/08 18:35:56 peter Exp $ .\" $FreeBSD$ .\" -.Dd July 10, 2019 +.Dd February 10, 2023 .Dt CDCE 4 .Os .Sh NAME @@ -47,6 +47,13 @@ kernel configuration file: .Cd "device cdce" .Ed .Pp +Mobile Devices (eg. Huawei E3372, E5573 and others) +may need additionally the u3g command port: +.Bd -ragged -offset indent +.Cd "device ucom" +.Cd "device u3g" +.Ed +.Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : @@ -77,6 +84,13 @@ received and transmitted over separate USB bulk transfer endpoints. The .Nm driver does not support different media types or options. +.Pp +Mobile +.Nm +Network Devices may need a connect command sequence via u3g +serial command port before they activate the NCM/ECM/ACM network +interface. Example: echo 'AT^NDISUP=1,1,"internet"' > /dev/cuaU[0].0, +where "internet" is your providers apn name. .Sh HARDWARE The following devices are supported by the .Nm @@ -93,6 +107,8 @@ Terayon TJ-715 DOCSIS Cable Modem Realtek RTL8156 USB GBE/2.5G Ethernet Family Controller .It Planex USB-LAN2500R +.It +Huawei 3G/4G LTE (eg. E3372, E5573) and other mobile network devices .El .Sh DIAGNOSTICS .Bl -diag @@ -127,6 +143,8 @@ is running low on mbufs. .Xr netintro 4 , .Xr urndis 4 , .Xr usb 4 , +.Xr ucom 4 , +.Xr u3g 4 , .Xr ifconfig 8 .Rs .%T "Universal Serial Bus Class Definitions for Communication Devices" From nobody Sun Feb 19 03:16:39 2023 X-Original-To: dev-commits-src-branches@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 4PK9gr0y08z3sb1l; Sun, 19 Feb 2023 03:16:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gq658vz4KdW; Sun, 19 Feb 2023 03:16:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776599; 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=bhlG3v3Q3GSc17LFsV6HeAOAjUd/DdVNJ8byEeRuDac=; b=Zj/GFxkB47PtcVyTqnK1T0UZ3MHJNM+rKNY8bFA3VcDkFeewDbDl89L7KEuWhqKtr0KlKL dF9K2b7+4KGXattSR1RFgj/6Sga8LgL5hz6LeFce5VM/alHUkoSTf6SDXN/EYttMGHPtMS uZbVUofxt1QpAAKGrtv6BeAU8JGVszbobLA2qRNPYdEBuiqsdAMZT2rSl0nthWKROxCkPD tsKHqWcAmGNRZ+keQ2aduMx4TTUjGlxJQoRNHja3TSkUTyCExRy+q8hIeWIdHfRvxL1Bwg P/s5Pni7BU2fS7iiE7O3NIig9JEyfwzo6XPGnN/LWV7456qNfrqwaM5cXzg4hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776599; 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=bhlG3v3Q3GSc17LFsV6HeAOAjUd/DdVNJ8byEeRuDac=; b=j70BeYBhi/eBc+cRWFC3HQgsWlWsd9zgMezzM+239jAdta08YTTuPiPusKp8Yb9pxDncbx JZD9YJ4DHaF5C2/c9tbYPdkkkkDRlITm5RRq82mrRhjknh7k5IQRs+/ZmYZ56nBAM4IWk3 VLEpfobajsbzL/S5u7Nqw0YpPaGwuA/7E+W2tGR92pWEdIYojB1FGKL5JoSW1I/kaOfhHE Rh3gNbby9xHxl+WtxYmgVUCyCDciAZle895wXRoEqnP81LVjIBKRv/ARmfNYcqc+42whPy 22ww3NFoSf5/8jnXHtYlHqGzbywbJfE1JkyfEpVqZnMDJyT9BxflDCjB7lPOiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776599; a=rsa-sha256; cv=none; b=BvXD7V0BQ3vEquQj8IWHIKwHwh3NFHMIDZOHy3t0MFWqaZdar6J7FdAxyo03eR01Zr2FVN 3C0MaZu2Mp3ISTcdj3hIo+8/n73rFPQwKfhKOwmVVS1GRoAHsc7p++dtv1J0SMpHih7vsi 5yv+NCTeeDK1wPB3ZW048+20AY18/NKGWfUmYnNF/+Be3wXN6TTieIht47KJZeLzWxA7u2 X0Ngvb9xSkGTi1bgr53SgI47n5btNI9L9wrh/i4tLpC6uIuhXfg/6BwH9azWq0C6kJX2sy JZhtjrehAGi0VXtRlCBO1WNGalPBG5bUTC51VbRPVjG0jeJprRPJNr5Bjfebhw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gq5CBVzmvg; Sun, 19 Feb 2023 03:16:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3Gd6O084002; Sun, 19 Feb 2023 03:16:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3GdQA084001; Sun, 19 Feb 2023 03:16:39 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:39 GMT Message-Id: <202302190316.31J3GdQA084001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 0b69409270e4 - releng/13.2 - powerpc: Drop old workaround for old gcc List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 0b69409270e47fc90fa7141098c2621e4df1c45c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0b69409270e47fc90fa7141098c2621e4df1c45c commit 0b69409270e47fc90fa7141098c2621e4df1c45c Author: Warner Losh AuthorDate: 2023-02-16 16:58:33 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:14:24 +0000 powerpc: Drop old workaround for old gcc Very old versions of gcc defined _BIG_ENDIAN and _LITTLE_ENDIAN. So to work around that, we undefined them here. However, that causes problems for programs that do: (and many other variations on that theme). Since this often is the result of weirdly nested includes in the ports world that are hard to unwind, drop this workaround to help more ports build out of the box. If there's still an issue here (and my testing hasn't shown it), we'll fix the issue in a brand-new way once I have a reproducer. This fixes the mesa-devel build, and others Sponsored by: Netflix Tested by: pkubaj MFC After: 3 days Differential Revision: https://reviews.freebsd.org/D38564 Approved by: re (cperciva) (cherry picked from commit e35448a901aa56aa232efbc4fe7a73a9bdac3511) (cherry picked from commit a86b9ed22ece362331f44a933bbf5426a06f527a) --- sys/powerpc/include/endian.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sys/powerpc/include/endian.h b/sys/powerpc/include/endian.h index 9e28237bfd24..0fac50361632 100644 --- a/sys/powerpc/include/endian.h +++ b/sys/powerpc/include/endian.h @@ -36,18 +36,6 @@ #define _MACHINE_ENDIAN_H_ #include - -/* - * GCC defines _BIG_ENDIAN and _LITTLE_ENDIAN equal to __BIG_ENDIAN__ - * and __LITTLE_ENDIAN__ (resp). - */ -#ifdef _BIG_ENDIAN -#undef _BIG_ENDIAN -#endif -#ifdef _LITTLE_ENDIAN -#undef _LITTLE_ENDIAN -#endif - #include #endif /* !_MACHINE_ENDIAN_H_ */ From nobody Sun Feb 19 03:16:40 2023 X-Original-To: dev-commits-src-branches@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 4PK9gs2WcGz3sb4T; Sun, 19 Feb 2023 03:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PK9gs0kWwz4Kdp; Sun, 19 Feb 2023 03:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776601; 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=Npurq8e2zkw653xmo4X5i1WdourewXCrZGLNWTX7Teg=; b=vL3Gk1j19Ik27k5p2WUr5388g3Pj5oCe0bE46FKWQiRVhkaADhQUMuENp3mUN8kRDnq7dX Squo+i3MBoiRsrcggT+d3CRat8xI2qWDraPA22Dilpl/EvPIQtG7ny/0LaEdAWHkAo6Z7E s6Jr7MrxWtcOKvW8R0SvxsCv96aDxSDzyKwWgVHqj48Va6UqKraMHvSazV6SWgLmKYOLot H6zuNiGATCWDeoIL2JpSdkV3QP0ydGMLGvJ2pHD6+mA1ieDvnI/b2YU4W3ZjFRVbuwrHnO Sd9rWKBo/T7umh5IkbhfdWAWTi3JOSs1/ySny2mkibKuLyQyt1ed59iIiKznhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676776601; 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=Npurq8e2zkw653xmo4X5i1WdourewXCrZGLNWTX7Teg=; b=AETPVp1OVlJgt0VFXI0K1Yow3jDK57pszjrGGXtTyqTGv0k0J9z4KrLCQa3Xxx2PrjPgQv Oi0zFrFMPfUacYh/VP4HvFRHF/iK8EMO927lp/6uC8oKwV51jKYxYDE9LkJn0jBbf2QCAG uWZhBSlAfMzytvlDDtqMSGVnD19gOH7flhqUBhREq0cr7XuLX+mkL+l/pFQIFGclbITaWm K81rH8x0EjOFptUf+wqTIK9f9z9c7zqT32c9Wxbncbk6nm5pJbFzOILUb/tkbG7viY7Ay2 vsw/Z4fV8wAFwqGi9bJc81UOY+3tze7bKFaS2mX9OKOTdUDEzT7CKe3tRvPnrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676776601; a=rsa-sha256; cv=none; b=PvyVC8KwV2yI9OuGpTjXYpE/MFtQe02MEiLokiiE8qhrEUL45cggBzjwWwifm/EKvOqfG4 YDmubNcKnN+zP5j7p2tAa6ZW5wxb+nUrdBx3Mj7FC/zweynuBlw4jwrrv9h1fIyTB8m+xv 4qTM+RG6bq77MP01lZweaGVskIgra0jgaBJx3N5KI8g9wkZiQu0uMQ2L0nyKkKGzh2rIgG Ik37tuYNReE+ud0ieBDImnX164yHjkCsHJbBtoSDKnLqU1z40N4eX3L/M00dVYJ0GAn6HA p3d7SN62/tlhijPabwdPUAdxr3N5awflCA7tK2TAm11KRIh+AvAiD11eyIDCFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PK9gr63f3zn2x; Sun, 19 Feb 2023 03:16:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J3GeRk084021; Sun, 19 Feb 2023 03:16:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J3Ge2V084020; Sun, 19 Feb 2023 03:16:40 GMT (envelope-from git) Date: Sun, 19 Feb 2023 03:16:40 GMT Message-Id: <202302190316.31J3Ge2V084020@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: bae5c73a5ffa - releng/13.2 - sys/_endian.h: Move powerpc workaround into _endian.h List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: bae5c73a5ffa237e437605bbf2216a574d1dbda2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bae5c73a5ffa237e437605bbf2216a574d1dbda2 commit bae5c73a5ffa237e437605bbf2216a574d1dbda2 Author: Warner Losh AuthorDate: 2023-02-16 16:58:33 +0000 Commit: Warner Losh CommitDate: 2023-02-19 03:14:36 +0000 sys/_endian.h: Move powerpc workaround into _endian.h Powerpc compilers often define _BIG_ENDIAN or _LITTLE_ENDIAN depending on the byte order of the target. This interfers with the endian.h and sys/endian.h APIs which expect those two to be 4321 or 1234. Unconditionally undefine these two before we define them to work around this issue. By including endian.h, the programmer is saying they want this API not the native one. This matches historic practice as well. Fixes: e35448a901aa Sponsored by: Netflix Noticed by: powerpc, powerpc64 CI jobs Approved by: re (cperciva) (cherry picked from commit 6f23df1ae7f6ec3cd06a15c87f0aaaa770b2941b) (cherry picked from commit 07e39710b170859ef6a57185f9a775973f3eeffe) --- sys/sys/_endian.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h index ff909f532663..7ac39386e2e1 100644 --- a/sys/sys/_endian.h +++ b/sys/sys/_endian.h @@ -41,9 +41,13 @@ /* * Definitions for byte order, according to byte significance from low - * address to high. + * address to high. We undefine any prior definition of them because + * powerpc compilers define _LITTLE_ENDIAN and _BIG_ENDIAN to mean + * something else. */ +#undef _LITTLE_ENDIAN #define _LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ /* LSB first: 1234 */ +#undef _BIG_ENDIAN #define _BIG_ENDIAN __ORDER_BIG_ENDIAN__ /* MSB first: 4321 */ #define _PDP_ENDIAN __ORDER_PDP_ENDIAN__ /* LSB first in word, * MSW first in long: 3412 */ From nobody Sun Feb 19 05:47:14 2023 X-Original-To: dev-commits-src-branches@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 4PKF1b2bQtz3smRF; Sun, 19 Feb 2023 05:47:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKF1b1mH5z3LCR; Sun, 19 Feb 2023 05:47:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785635; 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=0Z1/E3XgaRH4GwIiQCssR4e0/IHr5DZoFH1glf8eFqo=; b=B6EZoPBpt1vskWbG3jtRbqmZ/qITF7maGCRgDfmt21ceDcOhnjZSY2ZwkLebJfrq+UXEQJ YBWVdMnoKFa+mjrz05vTjK/QO+B8SQbXbNgyLTQf7KVp82HhW7htaERQu0Yt6beszsGHC+ 7v1itouSLSwTaxAHDTCOA0kEDE+Dk8x96PoIumlWA9Wj6OnGeq6k5HM2drfAcBh/E4WQ1M rCnwVuPgQBuzR0i/xx0TGf5L3rIW28TIZiJF7KXbIrwq2Hs1VTuvcLZ+5oDSip9VwGTMlq yfMVgWxBDgHXPFx65j73jvnbZMRgGB9vjQZcy018nK7iHaAGMjGkSHzpq/CiZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785635; 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=0Z1/E3XgaRH4GwIiQCssR4e0/IHr5DZoFH1glf8eFqo=; b=cp1SmBWrcp+jr7HUSWCENEUCF/m5wogbHu/BWHFa7yY7Amqri6jgGSgMOcvEI5fMhCuKLo HHKNkS3Ifg7OjQZojbDlI5Dee3ZbpThGUg6auTfZv6MFbTLMitBjFpkVPo3SJ83OABnlVv kVO4oCS4sgCFGCR9puoyVCgZa3mEf6Ym70t0oFhZE3nEVTP+PMbiZuYzANEUoShG/dx9Bc oszvIgGb0ihu3fU9Ua3fbekIXJVh8utb/Rza+trkePaAi/Vev0avplL24JP85Chstqq4Po BmAXrYkQNBOixzKcegksrTYx43+RI1SkNiCnY85DLdSVVMzIsXmQCM0Y64TKIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676785635; a=rsa-sha256; cv=none; b=Rlj8zH0cfDHed0gy5x0jTyVOjknygaZh7huvDCLhjZ/5iV9cmffNc2xAjrlN2eAFEM7+Nm mKAqIPoZXsVQ7xrIWXsE2gdw+7t8zz0G+ED1j7qoVs/Fym2YboOVwm4jUpD1JkBUbmgnxL OhiYLIvi0xJajv12gUTD7aKMx4bAcZMBYZp07s1SXbpDdlo1LVwRRM7qYEtrPoCqNu6nO/ 2/QzHTJccQypjD6NTSL3iq/WwerWduLgRmCQ06sLIsi75cNG3kzMpPJTBOtmKjPoNbe+Zg /ncg/HWSvm4j5YQhHEctGIOvo4N1ctmwrqX3sLm0hggZuocsJ4dp2W1cWBGIXQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKF1b0kw9zrWM; Sun, 19 Feb 2023 05:47:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J5lENF097125; Sun, 19 Feb 2023 05:47:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J5lEXj097124; Sun, 19 Feb 2023 05:47:14 GMT (envelope-from git) Date: Sun, 19 Feb 2023 05:47:14 GMT Message-Id: <202302190547.31J5lEXj097124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 071a0b5b7058 - stable/13 - allocbuf(): convert direct panic() calls to KASSERT()s List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 071a0b5b7058b97b629e6aa49e7d03bb87615f5f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=071a0b5b7058b97b629e6aa49e7d03bb87615f5f commit 071a0b5b7058b97b629e6aa49e7d03bb87615f5f Author: Konstantin Belousov AuthorDate: 2023-02-11 18:03:22 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-19 05:16:25 +0000 allocbuf(): convert direct panic() calls to KASSERT()s (cherry picked from commit 020e8a4d0609d56cb49a9f35258ff07815d5e478) --- sys/kern/vfs_bio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index abb9ebc7281b..6a479ed335ef 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4343,8 +4343,9 @@ allocbuf(struct buf *bp, int size) if (bp->b_bcount == size) return (1); - if (bp->b_kvasize != 0 && bp->b_kvasize < size) - panic("allocbuf: buffer too small"); + KASSERT(bp->b_kvasize == 0 || bp->b_kvasize >= size, + ("allocbuf: buffer too small %p %#x %#x", + bp, bp->b_kvasize, size)); newbsize = roundup2(size, DEV_BSIZE); if ((bp->b_flags & B_VMIO) == 0) { @@ -4361,11 +4362,12 @@ allocbuf(struct buf *bp, int size) } else { int desiredpages; - desiredpages = (size == 0) ? 0 : + desiredpages = size == 0 ? 0 : num_pages((bp->b_offset & PAGE_MASK) + newbsize); - if (bp->b_flags & B_MALLOC) - panic("allocbuf: VMIO buffer can't be malloced"); + KASSERT((bp->b_flags & B_MALLOC) == 0, + ("allocbuf: VMIO buffer can't be malloced %p", bp)); + /* * Set B_CACHE initially if buffer is 0 length or will become * 0-length. From nobody Sun Feb 19 05:47:16 2023 X-Original-To: dev-commits-src-branches@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 4PKF1c5F6lz3smTL; Sun, 19 Feb 2023 05:47:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKF1c2KTvz3L4R; Sun, 19 Feb 2023 05:47:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785636; 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=f0dHiGKzlAUD3ajhgwVSRQ/GKqxPWnFD3rOhdUOCAxU=; b=QIryqUEpbZu7d5fDT0E+BP1sL+FOZuRJPS5/ddQtZ+80JBeJGnTIxUOt80lQJ2O0/jaDjW 6V60NpFbuE4FQIy14ofKFxr2h8XpxEVjVC9iKHkYr3/J7mXklaB9PLl0oLKhw70RsP/l6S ler7wAo+Qv14NoPxfZCkGwcXNENdNwfu0mjEYQgn/jwjXP0ieO1lvqMonBkq/AfNtaWc7b S+GcKvu1+65ZR+uWdsdis+annvu41XiYRXeMHfKrbxAPp2zcptDjOh7TwplNB0wV8AIQlJ Mwc+/nQQHOXvEAQOjCMFOn6ofHds7YNDDr/IbBnuAwXvPQXzlvT8IHj2hGYwbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785636; 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=f0dHiGKzlAUD3ajhgwVSRQ/GKqxPWnFD3rOhdUOCAxU=; b=evxirZ3P0uczhfYI+lIlFqMeypRRfEsz/ZQpfCkpMGgSTzFcKL0jtiZO8JFE/o000jN3a3 S6tF3yj5MiAL/LuDrEG4F4nyYbRx52YhBfxtUALVE1DHKNpjRLQWTY79mfDZZhTyc4KjqX M3lU69x2dh8h78tIyBUS9dFfijkukj4IY5GQhoV8dMM10hwyRImhPfFcuxut9J+sBWrmrZ oZuvCuiMO0NIr3xgwPJGuZoz85I31V6Se+9sp86ZFm5QLEAbrXneQ0WKY8c8ugBdW0Y2Pr +/uVezC1k5S8S9mkWnbVfZVE0kiNV8w7uSc9YK715+WhwrRQoDXD4nt7Oj9ixA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676785636; a=rsa-sha256; cv=none; b=CZLrF2AdCOjB+zOlf6MMiVrjkRPVLRvrsef2snrLDZYiDv37suTxi0dxbbf4pTHUQVv5aT Znrgd+jfu0vssrg12bLp2agiVqlAKfyEb1B5jYAJZmf1JgalRZmSff7oDWfhDt8vctEAjW mP7oWHUw71NuMHNJyfkti3JWLFQE+JBD53DNi5AeB3a64czffBCQsgDDYQ7YyHOnbYltoA DYWQECXUgT6dqz2MiOI1Lluvx9HcUeL6hAMN0qFaX5c+labPY61T1vE1ALwxvOMQrsPZAZ TXUU2yXdjHWtv5hF/f6z6wwUOjLXGHoAU/rtHbXomAGnwJ3mRi2Ch0+1C0gF7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKF1c1NQVzrKj; Sun, 19 Feb 2023 05:47:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J5lG1j097144; Sun, 19 Feb 2023 05:47:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J5lGNW097143; Sun, 19 Feb 2023 05:47:16 GMT (envelope-from git) Date: Sun, 19 Feb 2023 05:47:16 GMT Message-Id: <202302190547.31J5lGNW097143@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 64152225022b - stable/13 - msdosfs: correct handling of vnode pager size on file extension error List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 64152225022bea784ca1948a67e7c040a8bb040a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=64152225022bea784ca1948a67e7c040a8bb040a commit 64152225022bea784ca1948a67e7c040a8bb040a Author: Konstantin Belousov AuthorDate: 2023-02-10 04:58:43 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-19 05:16:25 +0000 msdosfs: correct handling of vnode pager size on file extension error (cherry picked from commit e59180ea09a1d1d1463f2a269e94efa0f0b677c5) --- sys/fs/msdosfs/msdosfs_denode.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 030c96d6d354..8511d873ea50 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -384,10 +384,8 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred) return (EINVAL); } - if (dep->de_FileSize < length) { - vnode_pager_setsize(DETOV(dep), length); + if (dep->de_FileSize < length) return (deextend(dep, length, cred)); - } /* * If the desired length is 0 then remember the starting cluster of @@ -528,6 +526,7 @@ deextend(struct denode *dep, u_long length, struct ucred *cred) return (error); } } + vnode_pager_setsize(DETOV(dep), length); dep->de_FileSize = length; dep->de_flag |= DE_UPDATE | DE_MODIFIED; return (deupdat(dep, !DOINGASYNC(DETOV(dep)))); From nobody Sun Feb 19 05:47:17 2023 X-Original-To: dev-commits-src-branches@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 4PKF1f1Z2Gz3smTP; Sun, 19 Feb 2023 05:47:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKF1d4hQbz3L09; Sun, 19 Feb 2023 05:47:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785637; 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=n77TQaqrcPqBeqOplenIosibLJsbA2GM3wIVEnb9oc8=; b=OTNSILHqo2lg4EA6n7cSz+O8nWOqU3gY4gOl/vNjJoliyVuyu/W8Bd1LZfYzBaTwK9WZqe SHQt7qbEZuO+LwzxawxVgcLqZulkE41gjCfed+210wyjwEFu/XWPkrlb2DB0avwGxLDnXp 3bJ9iH4LnmuEqcLczealykFvsqjxK1To0j4D8V/0G4XWCD2kQfWRClPouUnOkX8QQFuha9 KxthFE4vdNmwLwyeqDAk7MjRzsk+ZDnrVHmsIXzwruVrIK98v2wXT1L1jMEuLIRKCEpM4y 13oR8B6s+BDULSWmxM7waYJsZ+o5l82ziSIdXSK+cNthoeEsk1gXBKmB9vtviw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785637; 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=n77TQaqrcPqBeqOplenIosibLJsbA2GM3wIVEnb9oc8=; b=HiKxAN2htqwtTgXv9lgF2Sb4JXwHoWKKgG5mZbshA8MvvMjUkQagSrra37xZVRyzFI5jsg UFxUtzjUReqKM7+eTeqYmnVa/5wo/kkIciYr7vti0DteeNb8xFsbs99yqGL10n933O17gF z/ZL4Zz6hLX2boDKINtKmHmZLC+7sJHNkHx8vKlKb2ibZ1In9+qzPSP56vCG/1HjES6U0o xNEcoSTwVl5pbrc9jXJCCN368Vfy99vXlu3oPU0BR3dXr3Ud66oUXBD2TdyzQf+HMev5hH 7OJBaGaCdweYgOclYdNl2Q2EKNAj8DRRidMiB/+tR/6WrmXSpiT7dOYxFr2JfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676785637; a=rsa-sha256; cv=none; b=hRbO872PaM+JtgzrM8VykBBcxBgJCibkWkU2W7X05aKl77B09f59rjzm1cZyqa6U34HHSM hDSFGug1nzNknGTL3rO4u1L0dVlm+TD3SvdtNMYoGRgK4A+95dOfl91ohrbiC9gXMWYtjC dpRKuaPVWQJNWxGZmEGQosoU6Mz7wFmkKrfia6hZ9AQHI/BcNKAQYpLMWvSvXYgqlqM06a vRI2C7tbkzIEhyVuvzRdrN0+IFboyh2uUcaDOsU5CiX95Cv95TVfnf5WcJAzphggEuVm7z 1llrS3iVdu/L4obNTIgoXWDtLjnIvO53sDWuNGqd+OH7WL94MrOQxvDDpcP/cQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKF1d22wWzrTd; Sun, 19 Feb 2023 05:47:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J5lHOK097163; Sun, 19 Feb 2023 05:47:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J5lHR6097162; Sun, 19 Feb 2023 05:47:17 GMT (envelope-from git) Date: Sun, 19 Feb 2023 05:47:17 GMT Message-Id: <202302190547.31J5lHR6097162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 03562adbefb8 - stable/13 - msdosfs deextend(): memoize DETOV(dep) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 03562adbefb80ba94bebe602fc051bbc4292cb37 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=03562adbefb80ba94bebe602fc051bbc4292cb37 commit 03562adbefb80ba94bebe602fc051bbc4292cb37 Author: Konstantin Belousov AuthorDate: 2023-02-11 18:05:14 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-19 05:16:25 +0000 msdosfs deextend(): memoize DETOV(dep) (cherry picked from commit 67dc1e7b0457ec014a1291c5874decdefe7bffdd) --- sys/fs/msdosfs/msdosfs_denode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 8511d873ea50..003c710801ee 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -494,13 +494,14 @@ int deextend(struct denode *dep, u_long length, struct ucred *cred) { struct msdosfsmount *pmp = dep->de_pmp; + struct vnode *vp = DETOV(dep); u_long count; int error; /* * The root of a DOS filesystem cannot be extended. */ - if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp)) + if ((vp->v_vflag & VV_ROOT) != 0 && !FAT32(pmp)) return (EINVAL); /* @@ -526,10 +527,10 @@ deextend(struct denode *dep, u_long length, struct ucred *cred) return (error); } } - vnode_pager_setsize(DETOV(dep), length); + vnode_pager_setsize(vp, length); dep->de_FileSize = length; dep->de_flag |= DE_UPDATE | DE_MODIFIED; - return (deupdat(dep, !DOINGASYNC(DETOV(dep)))); + return (deupdat(dep, !DOINGASYNC(vp))); } /* From nobody Sun Feb 19 05:47:18 2023 X-Original-To: dev-commits-src-branches@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 4PKF1g1hRfz3smWG; Sun, 19 Feb 2023 05:47:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKF1f46TXz3L7L; Sun, 19 Feb 2023 05:47:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785638; 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=DL+zyS2qr3y7Sp8UUyNkoJmqsqby5FkQovdPdcDL9cg=; b=F+P3cu/XqO0KQf/8XVhpo9ox1xc/tZcjZrUOF/7GUGxwBsAIzvLYxOMNtDMuRDJim606QP gA7IUqu90fzm3va93c77O85ru/vHaRysPQBwnNwmIAPfFRJRkkdjISsK42AqL65fuL9pMX wIdMcti6OxrpiC7uM8jrv46B5edSYSJTRH7G3msoLE1P4drdgmIGP3y95+c1m8RqaT0lGl ZXw1Q0VnycTSn/7mcxshoxrAebvZTYyA6G7+yXk52Sv5nlGWlBTdTCcgBuCxsccgiy8Geq v5HfANmjOFq9Jcvq8X6NAnQHPV5SAit65q7/3HaE0eUDSWY0ygFbfzsZacggmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785638; 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=DL+zyS2qr3y7Sp8UUyNkoJmqsqby5FkQovdPdcDL9cg=; b=FwsY6tWBDe2emqBQHvh4gHHGkksSEfg5CzscKhonUXXALlLubg800P8Sipkut8Zi5W8Z77 ygEe1QB2qq5Kcod3RKQjQwXZyZZrdpqVm+aooklJmvbnxrFtLRhR7EqjY60UVijc76vIxJ sVowcQhKfjvjRbes80OTHWyo5yl1Mm3kolCboDuBV4BXdXqZbLshC3OWR9uym1ZjE6ncDK 7ItuWYZivIuMZLV6gmFxyzRnzYZ4UW9yv+uWv2nVZ44Kf2/Vle8AJPvx+oVcM+2c+amKdQ jPnt/n4CD4E+q4eJAueLwY+1t0M0knNnCU7CC4kGxV2KLxYKD7I2Oc66MnTAwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676785638; a=rsa-sha256; cv=none; b=Zre6M/ksUG9wawiwyMz+rX2wUu+TnZw9Q5Prm32XQ6jnToDK8dWaEvGg6q9D0cQtFBIlZd hczvesWv81icW9glHtVy4ZeryZTYHp4N0O+PYwNAKsgxrazyD7pvl+XkPL9yOg03I6rrGF RPPNNFHliT8YghFvwYQMBwkkHIQaZzty8k0dmjM0BYjkPRaXUt/tXLP6ReqrZHldJ7rKan PomXFbQq4Sd6RIT2DmmYAsXSzFA2kWf3avjdhK6bdzpV7Ih31nnbDFxMLx2Cp1yVpGyZUF Pn7oBybOclzKNVXbj6fQ0w1xhA9OfEvMIxdAosQ819ahi04p3LK5YfNhT9qovA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKF1f3DVtzqw8; Sun, 19 Feb 2023 05:47:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J5lIag097183; Sun, 19 Feb 2023 05:47:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J5lIvG097182; Sun, 19 Feb 2023 05:47:18 GMT (envelope-from git) Date: Sun, 19 Feb 2023 05:47:18 GMT Message-Id: <202302190547.31J5lIvG097182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c2ee668306bb - stable/13 - msdosfs deextend: validate pages of the partial buffer List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c2ee668306bbe3edf4a05246ed3a88f52dfc94ae Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c2ee668306bbe3edf4a05246ed3a88f52dfc94ae commit c2ee668306bbe3edf4a05246ed3a88f52dfc94ae Author: Konstantin Belousov AuthorDate: 2023-02-11 18:09:30 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-19 05:16:25 +0000 msdosfs deextend: validate pages of the partial buffer PR: 269341 (cherry picked from commit 0152d453a08fa2bad694dc04a8184fce2b7faa10) --- sys/fs/msdosfs/msdosfs_denode.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 003c710801ee..51c2e3beaf39 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -495,6 +495,7 @@ deextend(struct denode *dep, u_long length, struct ucred *cred) { struct msdosfsmount *pmp = dep->de_pmp; struct vnode *vp = DETOV(dep); + struct buf *bp; u_long count; int error; @@ -521,16 +522,41 @@ deextend(struct denode *dep, u_long length, struct ucred *cred) if (count > pmp->pm_freeclustercount) return (ENOSPC); error = extendfile(dep, count, NULL, NULL, DE_CLEAR); - if (error) { - /* truncate the added clusters away again */ - (void) detrunc(dep, dep->de_FileSize, 0, cred); - return (error); - } + if (error != 0) + goto rewind; } + + /* + * For the case of cluster size larger than the page size, we + * need to ensure that the possibly dirty partial buffer at + * the old end of file is not filled with invalid pages by + * extension. Otherwise it has a contradictory state of + * B_CACHE | B_DELWRI but with invalid pages, and cannot be + * neither written out nor validated. + * + * Fix it by proactively clearing extended pages. + */ + error = bread(vp, de_cluster(pmp, dep->de_FileSize), pmp->pm_bpcluster, + NOCRED, &bp); + if (error != 0) + goto rewind; + vfs_bio_clrbuf(bp); + if (!DOINGASYNC(vp)) + (void)bwrite(bp); + else if (vm_page_count_severe() || buf_dirty_count_severe()) + bawrite(bp); + else + bdwrite(bp); + vnode_pager_setsize(vp, length); dep->de_FileSize = length; dep->de_flag |= DE_UPDATE | DE_MODIFIED; return (deupdat(dep, !DOINGASYNC(vp))); + +rewind: + /* truncate the added clusters away again */ + (void)detrunc(dep, dep->de_FileSize, 0, cred); + return (error); } /* From nobody Sun Feb 19 05:47:19 2023 X-Original-To: dev-commits-src-branches@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 4PKF1h0xTmz3smTR; Sun, 19 Feb 2023 05:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKF1g5jtKz3L7b; Sun, 19 Feb 2023 05:47:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785639; 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=FDbOqbJ10Pit/hnGju47rsxLnkEcTrQTCnABjflnNmA=; b=C8xNigVgZvLu7WVXw4F3PTNu1zraHb5GhyykmbvlbKhB+ZwFrNVALZvZ2hhqcXt7ZEi82F n4aqpSJeGGZuegNn/0RilOwguRynMQ4WgkQf23a2gpx4ID2qRZR2X+XV3HiO2RPiXuvVTm Zwf5a4svjU8TroexV8PHU6V6n4jsMkwN1MulCTHd+kCkskkJC7oy/6dOdU91TT3jB5vHGL R/IvtkMi3Nly59mJ/TQ8V224hFRzM6BaOc1xEeM39roH4mqLFfNN0Q5guIXce3AFTPnk7p rLQn5+1Jp+HQWkfCoyujzWuhB4Nr4zsV/C7i7yILdzzU4uEcOeYErq7SU7NWaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785639; 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=FDbOqbJ10Pit/hnGju47rsxLnkEcTrQTCnABjflnNmA=; b=SSrC79xbN/j8qenWQGs1gHjtsVzkofPMaycg4knzEjueVXdCq9eJOrhkoARz03D5cuJ2dc K3GEfoHC9uT2qI38I8QTFCq4RihYj3CMh5SbrhmA+lGX4YM2QNQXKshxDjb8ChOIrS9Xtn BQC9uLzZh9Qm9ZbT5tmjjANL5RDKw9MU4/nTBj55+lmd2OlU2tO4gp/7yl1cN13XGqfeX5 tqmN0lZ0Ci172imPYHQet4ACLvjF0oIhpx+YTQxjsKex8rHJs9uxt6qoIIkU3+ALIpv8MC AyM9j+wSE2WjSJc6P9eNZwZ9jhKVlHd2kacoZ5UfCxY/0/EWauWLjaVsdC1H7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676785639; a=rsa-sha256; cv=none; b=Ru7SbIKOocNq2vc6TS7Jzad9C7YsOHyjBYaAndxA98lHnvYock8hXoBn5JIS9TzYHtn83/ 5W17klDoLL0uFvyrFH2SUehU/jG6giYP/RXkt+P2cG5KTtRsIhM/3OaI7agDiQ9oaGhLHZ 0Py6Wk26GRt77x+yD6Uz3w6pU7+FBBMiH5yqeo/YiW/wcjqFWWPaRqWtXJG4eQfn8u4gsQ p2OQ7TnrUw5V+0y54ZjYULbgR3zIR2e12GYUvi1KKz51XZI3C27EC8/jyevHoPvkQBKMYx ZyR+a2mDviArnKivxo3JVadoSYTqYXLnFbo89kuWksjAx494JpFfzIBfZGHQqQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKF1g4D2czqsT; Sun, 19 Feb 2023 05:47:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J5lJos097202; Sun, 19 Feb 2023 05:47:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J5lJHQ097201; Sun, 19 Feb 2023 05:47:19 GMT (envelope-from git) Date: Sun, 19 Feb 2023 05:47:19 GMT Message-Id: <202302190547.31J5lJHQ097201@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1889a973af24 - stable/13 - sys/param.h: Add _WANT_P_OSREL List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1889a973af243373b1859827460910b1bee7495f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1889a973af243373b1859827460910b1bee7495f commit 1889a973af243373b1859827460910b1bee7495f Author: Konstantin Belousov AuthorDate: 2023-02-14 08:52:14 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-19 05:16:25 +0000 sys/param.h: Add _WANT_P_OSREL (cherry picked from commit 5942b4b6fde3f4ce6d0295fbcf135f552f92c607) --- lib/libc/amd64/sys/amd64_get_fsbase.c | 3 +-- lib/libc/amd64/sys/amd64_get_gsbase.c | 3 +-- lib/libc/amd64/sys/amd64_set_fsbase.c | 3 +-- lib/libc/amd64/sys/amd64_set_gsbase.c | 3 +-- libexec/rtld-elf/amd64/reloc.c | 1 + libexec/rtld-elf/map_object.c | 1 + sbin/fsck_ffs/main.c | 2 +- sbin/newfs/mkfs.c | 2 +- sys/sys/param.h | 2 +- 9 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/libc/amd64/sys/amd64_get_fsbase.c b/lib/libc/amd64/sys/amd64_get_fsbase.c index 2de99912daf2..04d872165e32 100644 --- a/lib/libc/amd64/sys/amd64_get_fsbase.c +++ b/lib/libc/amd64/sys/amd64_get_fsbase.c @@ -33,9 +33,8 @@ #include __FBSDID("$FreeBSD$"); -#define IN_RTLD 1 +#define _WANT_P_OSREL #include -#undef IN_RTLD #include #include #include diff --git a/lib/libc/amd64/sys/amd64_get_gsbase.c b/lib/libc/amd64/sys/amd64_get_gsbase.c index 0deac34c90d1..35f69da6ac1e 100644 --- a/lib/libc/amd64/sys/amd64_get_gsbase.c +++ b/lib/libc/amd64/sys/amd64_get_gsbase.c @@ -33,9 +33,8 @@ #include __FBSDID("$FreeBSD$"); -#define IN_RTLD 1 +#define _WANT_P_OSREL #include -#undef IN_RTLD #include #include #include diff --git a/lib/libc/amd64/sys/amd64_set_fsbase.c b/lib/libc/amd64/sys/amd64_set_fsbase.c index 02ca9233d855..9474b1148161 100644 --- a/lib/libc/amd64/sys/amd64_set_fsbase.c +++ b/lib/libc/amd64/sys/amd64_set_fsbase.c @@ -33,9 +33,8 @@ #include __FBSDID("$FreeBSD$"); -#define IN_RTLD 1 +#define _WANT_P_OSREL #include -#undef IN_RTLD #include #include #include diff --git a/lib/libc/amd64/sys/amd64_set_gsbase.c b/lib/libc/amd64/sys/amd64_set_gsbase.c index c4880c126ae9..5ecde27f27f0 100644 --- a/lib/libc/amd64/sys/amd64_set_gsbase.c +++ b/lib/libc/amd64/sys/amd64_set_gsbase.c @@ -33,9 +33,8 @@ #include __FBSDID("$FreeBSD$"); -#define IN_RTLD 1 +#define _WANT_P_OSREL #include -#undef IN_RTLD #include #include #include diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index c7cf7bd58845..c9a2734853b6 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -33,6 +33,7 @@ * John Polstra . */ +#define _WANT_P_OSREL #include #include #include diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 7c637fe1d6ba..fb5854910ee2 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -27,6 +27,7 @@ * $FreeBSD$ */ +#define _WANT_P_OSREL #include #include #include diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index c5dc10f1c3b0..74329bdb9483 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; #include __FBSDID("$FreeBSD$"); -#define IN_RTLD /* So we pickup the P_OSREL defines */ +#define _WANT_P_OSREL #include #include #include diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index a6c4ee60c2d5..6fc6a2475075 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #include __FBSDID("$FreeBSD$"); -#define IN_RTLD /* So we pickup the P_OSREL defines */ +#define _WANT_P_OSREL #include #include #include diff --git a/sys/sys/param.h b/sys/sys/param.h index 5d97c0b2dffb..909ff0ef1d8b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -78,7 +78,7 @@ #undef __FreeBSD_kernel__ #define __FreeBSD_kernel__ -#if defined(_KERNEL) || defined(IN_RTLD) +#if defined(_KERNEL) || defined(_WANT_P_OSREL) #define P_OSREL_SIGWAIT 700000 #define P_OSREL_SIGSEGV 700004 #define P_OSREL_MAP_ANON 800104 From nobody Sun Feb 19 05:47:20 2023 X-Original-To: dev-commits-src-branches@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 4PKF1j0qntz3smHr; Sun, 19 Feb 2023 05:47:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKF1h684sz3LDf; Sun, 19 Feb 2023 05:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785640; 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=5R+H/pgBaZd/+gqAbOeVOq3IBKBm0Rafcyc01ArrCj8=; b=vBq3XvLn3i8nFFuwNlZ45HyvDNkloRPmK7Yshj3G/smUBP7EWdCLOvriuttSVs0aQ+3xwh pct1la34bXlHy1rxSLMdRfDJmogZ9db0f14+7fewYoRr/O6SeKAybxh9LM27gic4Vy7od5 vPk19hWPNkhwSkKp5767JXSJTAW2akrPCv05IzzDlnXRV0dbeD0b25aETtz8DjU/xvxl2e B4yWXRqKwE113zUHCKT3ebsz6+GxrGvszHP4h1e7EZ7Uc2a/+8y1qmS2Bmvj617CHRsp19 0Suje+VyW4+U+iKCv6sRilsdQnNQ59QL54Rd+8wGrm6h4cNejSvkN40uEeQHwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785640; 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=5R+H/pgBaZd/+gqAbOeVOq3IBKBm0Rafcyc01ArrCj8=; b=nxNDaNmxynokm39ty941PaYUA5iSo4HTix4d1XOlrdrI3bFU/mv6PlawwzM/NdfSOUZ8sv AC2RKw9QKnWec01cZMHLxzP8zHzTQS0ISZOJGXwnpc9RDeKvbXK6+pJNjhp2iLY/KXlzXU NNjkKpgC/whhytXKgmBMdNL2oSGU6aTN45cPLmJ2jivkR2KUMhsh8oo906r+DLPEVKKNpx 1WBMoVs8TWZCmjm7gBI6nY0fzdVO6BPKz62HzXa4+SH5Fhpdqdx/IoRK2F5Qifv8Y7Akqy HHKpG89TyXTpZpRviQLRp+h6TI0LL4+7z3NTtEYSVTA2gs/vZHTVN475mQlp4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676785640; a=rsa-sha256; cv=none; b=clxvwuMLKQEtYfmqin/GyBDY0M8xCxxrtF/LbAvmgLT/UP0wEdQtaSODvaQxrA7UW6q5D2 b9tOcr9/PcPVR8XLZFgBD+xTl/ndFeYLY7czdmADs7o64Yh1noAjzxuNKHFlxcDttsS505 155WbjakaMV0m2pX7L2J2Cnz41m+OGVAbOn9Ovzow15BhSXGWbe37c9imwiQnaO7yLLbe7 ZEvse2ayUWS85Mp20nqHodXmooJA6w0UMu9oBtwlCCI00DLksILJolDc7Q6Zl8zaO1Jd1i pRziRpKvv/G2cAx1z25/laaFXf00iFQ2MJxk4oLAzJmnwTBx/2P4dvEWcM+6+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKF1h585TzqsV; Sun, 19 Feb 2023 05:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J5lKGr097228; Sun, 19 Feb 2023 05:47:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J5lKM8097227; Sun, 19 Feb 2023 05:47:20 GMT (envelope-from git) Date: Sun, 19 Feb 2023 05:47:20 GMT Message-Id: <202302190547.31J5lKM8097227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d152426ddf35 - stable/13 - tmpfs: remove bogus MPASS(VOP_ISLOCKED(vp)) asserts List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d152426ddf35cf7fd69e95c024f6a00c582ef809 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d152426ddf35cf7fd69e95c024f6a00c582ef809 commit d152426ddf35cf7fd69e95c024f6a00c582ef809 Author: Konstantin Belousov AuthorDate: 2023-02-13 23:23:24 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-19 05:16:25 +0000 tmpfs: remove bogus MPASS(VOP_ISLOCKED(vp)) asserts (cherry picked from commit 9ff2fbdf2ded59e276fdbf7ef7d18c726386b6fb) --- sys/fs/tmpfs/tmpfs_subr.c | 3 ++- sys/fs/tmpfs/tmpfs_vnops.c | 23 ++++++++--------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 1c0b4406e460..351530a56698 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1108,7 +1108,8 @@ out: *vpp = vp; #ifdef INVARIANTS - MPASS(*vpp != NULL && VOP_ISLOCKED(*vpp)); + MPASS(*vpp != NULL); + ASSERT_VOP_LOCKED(*vpp, __func__); TMPFS_NODE_LOCK(node); MPASS(*vpp == node->tn_vnode); TMPFS_NODE_UNLOCK(node); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 0074e3203bbb..aa4089b7c50d 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -222,11 +222,18 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) cache_enter(dvp, *vpp, cnp); out: +#ifdef INVARIANTS /* * If there were no errors, *vpp cannot be null and it must be * locked. */ - MPASS(IFF(error == 0, *vpp != NULLVP && VOP_ISLOCKED(*vpp))); + if (error == 0) { + MPASS(*vpp != NULLVP); + ASSERT_VOP_LOCKED(*vpp, __func__); + } else { + MPASS(*vpp == NULL); + } +#endif return (error); } @@ -549,7 +556,6 @@ tmpfs_setattr(struct vop_setattr_args *v) int error; - MPASS(VOP_ISLOCKED(vp)); ASSERT_VOP_IN_SEQC(vp); error = 0; @@ -592,8 +598,6 @@ tmpfs_setattr(struct vop_setattr_args *v) */ tmpfs_update(vp); - MPASS(VOP_ISLOCKED(vp)); - return (error); } @@ -723,8 +727,6 @@ tmpfs_fsync(struct vop_fsync_args *v) { struct vnode *vp = v->a_vp; - MPASS(VOP_ISLOCKED(vp)); - tmpfs_check_mtime(vp); tmpfs_update(vp); @@ -743,9 +745,6 @@ tmpfs_remove(struct vop_remove_args *v) struct tmpfs_node *dnode; struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(dvp)); - MPASS(VOP_ISLOCKED(vp)); - if (vp->v_type == VDIR) { error = EISDIR; goto out; @@ -794,7 +793,6 @@ tmpfs_link(struct vop_link_args *v) struct tmpfs_dirent *de; struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(dvp)); MPASS(cnp->cn_flags & HASBUF); MPASS(dvp != vp); /* XXX When can this be false? */ node = VP_TO_TMPFS_NODE(vp); @@ -986,8 +984,6 @@ tmpfs_rename(struct vop_rename_args *v) int error; bool want_seqc_end; - MPASS(VOP_ISLOCKED(tdvp)); - MPASS(IMPLIES(tvp != NULL, VOP_ISLOCKED(tvp))); MPASS(fcnp->cn_flags & HASBUF); MPASS(tcnp->cn_flags & HASBUF); @@ -1302,9 +1298,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) struct tmpfs_node *dnode; struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(dvp)); - MPASS(VOP_ISLOCKED(vp)); - tmp = VFS_TO_TMPFS(dvp->v_mount); dnode = VP_TO_TMPFS_DIR(dvp); node = VP_TO_TMPFS_DIR(vp); From nobody Sun Feb 19 05:47:21 2023 X-Original-To: dev-commits-src-branches@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 4PKF1k1zPsz3smWK; Sun, 19 Feb 2023 05:47:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKF1j6zXRz3LQF; Sun, 19 Feb 2023 05:47:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785642; 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=4q6fVlxEmlUg6IV7lMRx7izikmqr9MQnvmOqvFYuCNg=; b=x1MgYvOi9jmTH/OfMOWa5jvgV6geS1f+0WtIRVhfPrrNSClIKThZvyTaAXuIPW5RDU++0N OFe2w7XbH4nzB8vYQgWofScGa+SK2UzHAwf0UysVZbYXsws8ff7tsDBcIyV8oySmAAQk4/ hoooJUhrLrnzJ5jGMXUcWUcijrbNiOSh36JrqaVjP0rl1pfu5z7O3641UHEcXgF/dHdOp3 EciuPVkwZ752NlwcT2oQ5uzRw2ms2Ayl3nRZv9n5KQ2vt804sP/SPmkhVFQUEK7fsc+K+p 1xqeyXN0kRp+p9XeafY5SkLJB4b6K4OUNCNvCJla0nL9rSLkiKqRg1smW2hY8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676785642; 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=4q6fVlxEmlUg6IV7lMRx7izikmqr9MQnvmOqvFYuCNg=; b=AwZTvnxrc/nB+hIbs3Iz4iDZzdvDjgNyuEzDaHYyZ8gmiZW34P4f4lN4QYADTwT1err/VM AKes9aoyIdL0NoAZ6MQOSWvcdoWxqIkhtfCMdEgz3/0j5mpxGjNpCiKXMqqGDI7ajjTVdE u6BgKEr7ctL94dmC98KXunJ9xzL2DP3MdvS2e96OtaVu7JDlq6TQgk4zAdg5ptrQSuvGzf MvHVoQ25Mb4yP07EhGTtbaUtloI8841w3gBQcgZuplDYx+3oXu/XisQsR34mg4fEdj7POA emGtu9OydlQkVmLeSacHNroH6pltWhGDWkUrTgyodoUKa0rkHVBhp9x9nubKzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676785642; a=rsa-sha256; cv=none; b=T6bVghiHtP/2qAU1WW1asBoApFdmnbUX1gYeRXG53foliRYWhK88hxX8N16D5MRT8sS39C h3XctIiyVbBYfUWsQ8Ei4v9G/MARyFkTd4OGEQaWtJRSW07HHiRqVDxG5imPSJlYYN7e1z jp3UnK4+0fNgfhPq1b2jpbCDnDezcOlUCAtFzkqEks5Lw/dq7uPhU6lIvpEfE+cb/O2PXi tdnXRis/9g6p+koc6evNhMN/yxNPS0g0CLWKcMG3XBK1tkfLEKbWpEyicZGV8eMDEYbsZf Buena6+LFHIHXaXQf+S3EbU2X1pNH1paamKS9sLd3nqXnbb+RffUFDgRVOY4ag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKF1j65shzr8m; Sun, 19 Feb 2023 05:47:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J5lLLg097247; Sun, 19 Feb 2023 05:47:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J5lLwC097246; Sun, 19 Feb 2023 05:47:21 GMT (envelope-from git) Date: Sun, 19 Feb 2023 05:47:21 GMT Message-Id: <202302190547.31J5lLwC097246@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e6bc80a3dedc - stable/13 - tmpfs: remove IFF macro List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e6bc80a3dedce1a45357880963695dc74bdc63cf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e6bc80a3dedce1a45357880963695dc74bdc63cf commit e6bc80a3dedce1a45357880963695dc74bdc63cf Author: Konstantin Belousov AuthorDate: 2023-02-13 23:47:44 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-19 05:16:25 +0000 tmpfs: remove IFF macro (cherry picked from commit b918ee2ce4850253ddd884e39dabecd6e96bf474) --- sys/fs/tmpfs/tmpfs.h | 1 - sys/fs/tmpfs/tmpfs_subr.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 30c80ad70d48..e7928d4bf9dd 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -490,7 +490,6 @@ tmpfs_update(struct vnode *vp) * Convenience macros to simplify some logical expressions. */ #define IMPLIES(a, b) (!(a) || (b)) -#define IFF(a, b) (IMPLIES(a, b) && IMPLIES(b, a)) /* * Checks that the directory entry pointed by 'de' matches the name 'name' diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 351530a56698..bc9e1f08391b 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -547,8 +547,8 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, * allocated, this must be the request to do it. */ MPASS(IMPLIES(tmp->tm_root == NULL, parent == NULL && type == VDIR)); - MPASS(IFF(type == VLNK, target != NULL)); - MPASS(IFF(type == VBLK || type == VCHR, rdev != VNOVAL)); + MPASS((type == VLNK) ^ (target == NULL)); + MPASS((type == VBLK || type == VCHR) ^ (rdev == VNOVAL)); if (tmp->tm_nodes_inuse >= tmp->tm_nodes_max) return (ENOSPC); From nobody Sun Feb 19 06:48:24 2023 X-Original-To: dev-commits-src-branches@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 4PKGN90FF8z3sr6h; Sun, 19 Feb 2023 06:48:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKGN86cMCz3jBD; Sun, 19 Feb 2023 06:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789304; 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=foCrF3epjHpnw68BMvEQYSalEpQAEZcz3vxakhoVffk=; b=vp7kMHSYx2wuzpDFXLSrtA7RusQcTLXHPAG0En7b6CCDyhlB1o+e4f8md7v92rdnvFJlTu x0a4YV92DN19q0J+wlIw0ecuvX4zb8WSoKKx72fiZ33huuD6HA09rdLCLnrHytpJwcUg+f NlXw1zccypVG9QQoeCJdGZaAbFa6vnPcDdaI79vVMIwAng5SLuL9y+ehHFUcOpYnFa4WY1 oRzIEOWXvJoT1xGkiWq1tD5Mue7CHEWN5n2tDmXXrnQKodSqztIVn6Eo5ehobmdci5Npd9 +uXXSFixPDe5EoFpTMoSNrUXpQH6TRCGEPvv0FV3jvVXsRMw7m0xlEUOTgw0sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789304; 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=foCrF3epjHpnw68BMvEQYSalEpQAEZcz3vxakhoVffk=; b=NACw71IOiBPf4Qm9hCWg1p1/7jmJPMZ7vd0snDHdrcav0DuBQp3Tc2i1E4GQyRtCnZh9PF VP5cme0u+aXtn6XMkq+AqtsT3dPhCq3XqG4800j5JfJvIMDEtiQXWh68sDcqcqEDErBXBH Y/ZqnlahMxs6+9m7tNbK6mdwG88MpmU4JvX2012uZHmt8r/CFLC5S6KLnxT4k6wEAYYmhf eTQoAC+e8/3qIF/LnamkScis3cmWvfsazyC/sChyB4trZoPa3QMWfOooFVRnD9uINjWFd7 2MZV67lu7yh0fVSQVI4/X4bJ4pA1SM2B4AUg7Cy5v/UVXo2ceJNxIetsxb34bg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676789304; a=rsa-sha256; cv=none; b=xOAU6EpNZ0Py6uN837+MtuFcsy5uVtMD4nLs5PNOkHd72qv1EvhXRy2PoRn8Bu8K5yDZoV jrN3mcZMQrdBQgMc86My+mbOYI2WsOcbhfP7+xfYp/4446hcT80grEHeASO+IZ6B3qoyD/ PFfEMQQPB1tyAex4lVLWCQ+7+IZEFCKQQ6vwg5vAyiOBnhHckBmjDcoggwNmbwr/JzN0Cc cKasmINg4AtTL9RopUw+NxgGjWtG++ouZuRzYHgpa+J6U4n51FRgW0e4tzyavH8icdH1tI TVagV1KGQ/3KBaQFnGlnh665BkLJ0YQLpw/chH3hNjmH6hr+D3aQEXKmf/y47A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKGN85gYNzsLd; Sun, 19 Feb 2023 06:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J6mOlY082585; Sun, 19 Feb 2023 06:48:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J6mOiQ082584; Sun, 19 Feb 2023 06:48:24 GMT (envelope-from git) Date: Sun, 19 Feb 2023 06:48:24 GMT Message-Id: <202302190648.31J6mOiQ082584@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 0c479a5c47db - releng/13.2 - efivar: Try harder to find label's efimedia List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 0c479a5c47dbbba7b6ff3a867e0981749e3262a5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0c479a5c47dbbba7b6ff3a867e0981749e3262a5 commit 0c479a5c47dbbba7b6ff3a867e0981749e3262a5 Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 06:46:46 +0000 efivar: Try harder to find label's efimedia If there's no efimedia attribute on the provider, and the provider's a glabel, then find the 'parent' geom. In this case, the provider's name is label-type/name, but the geom's label will that of the underlying device (eg ada0p1). If it is, recurisvely call find_geom_efimedia with the geom's name, which shuold have the efimedia attribute. Sponsored by: Netflix Reviewed by: corvink, manu, asomers Differential Revision: https://reviews.freebsd.org/D38614 Approved by: re@ (cperciva) (cherry picked from commit ccf2121d59ac51e1a0287d75262d48018d09cad6) (cherry picked from commit 9ad4c0468f1924cf7bdb9830bb781de9ca095c61) --- lib/libefivar/efivar-dp-xlate.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index 1b30d1dfb143..effc8a2de475 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -527,6 +527,15 @@ find_geom_efimedia(struct gmesh *mesh, const char *dev) if (pp == NULL) return (NULL); efimedia = geom_pp_attr(mesh, pp, "efimedia"); + + /* + * If this device doesn't hav an efimedia attribute, see if it is a + * glabel node, and if so look for the underlying provider to get the + * efimedia attribute from. + */ + if (efimedia == NULL && + strcmp(pp->lg_geom->lg_class->lg_name, G_LABEL) == 0) + efimedia = find_geom_efimedia(mesh, pp->lg_geom->lg_name); if (efimedia == NULL) return (NULL); return strdup(efimedia); From nobody Sun Feb 19 06:48:25 2023 X-Original-To: dev-commits-src-branches@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 4PKGNB1RzXz3sqqZ; Sun, 19 Feb 2023 06:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKGNB0J9Rz3jJc; Sun, 19 Feb 2023 06:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789306; 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=czW7vTZOBA5h1pId4uXmqubM6EyUCq0vErSeLvhZNj4=; b=CedqDT83J2LXbGclvbotAtdkHO2DABsvIswKqXB1f74cOAPP5cGZRLyV50Gs7xiu71hdJ0 N+8WBCnaWhhUgse5eooH2leyiMA0vY0WUNmA00ucs2KWX6t8rxZf2oKmysBuIl/f4l091/ /MtOOhA9bdfpbcrVaIrsYNsE7TRf4WnFGhOS4XygRW4CdyGfOg1f/huzZRi17upgbOEi9s hdof5suOU9tMpDg0O2+UZRSDX5b/h3ZvKOdBXpjbcDSm/6uwbUQv0QArthAB1AORihdhaa dmMvfaozGmY6sGMArbgSVRuUDHs1Hiivw2DMMBE5g4n8OlWDdWh00lihFq8QMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789306; 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=czW7vTZOBA5h1pId4uXmqubM6EyUCq0vErSeLvhZNj4=; b=EIg8M2PbmeqJfq5/Z61K3HUb1jmZ7tnacSi3ryW3DZrY2qFjOHa0SKHEZwHUpGiIwq/g9V EESHGhBo/99gqzRK+K6AnEcrucZHWywdcph7F+zWQrUkQXZ3lzpSkT1gWHu733CkNy9MHE rCHlSeZ8/DGdbxN8IvJuoZV2nRhMP8z2rK8mN52rKgYPpTBNtCNLt+3AVQzH9/gvxKPHNU bVqlgPcHLGOTgIsUl9VGZ1IPw4NsQctPVc7qD3hcC+FgfAFO2c3Z8ljcvKDT6smuTRbz2O WvlxkQLBL0VFI1APrXFQfo52Lmpcs/zalqkx+IhK8vCtJuIC9TCzykF6UNR6tA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676789306; a=rsa-sha256; cv=none; b=SrQemRYOjF914zRD/qGzsONu8jmbOL6Z1vwkBW24+ZoPgCpx4MZlW5DQZxskdWtGBZ6/iv 9Djx3VMzDyA7sHgC8MjZJWQADMQRlVcG7/O13j4P2JpZfNinqcqm2yiqqbl876X1lJ73dX K4nqvqP7gkyTQgwhuKWWpVRUlRXsJAbm7TC7jcU4Bh7rPazXvq9bTB40TxbA8XXSc0h10C VhYpmbu1N9GsAkNmuCrqGsEAeIyIDkRnVjZKlCdh35q7EwvlBpxoPA+wyL/a/lG4WWp+Qe iwjjoUVFrrNZsHQ6v2GZZxUZZ3C7mPijod+B/xdEfDQWW7Oou9bg5tVS7Fr1+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKGN96WCgzs5m; Sun, 19 Feb 2023 06:48:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J6mPEE082607; Sun, 19 Feb 2023 06:48:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J6mPIC082606; Sun, 19 Feb 2023 06:48:25 GMT (envelope-from git) Date: Sun, 19 Feb 2023 06:48:25 GMT Message-Id: <202302190648.31J6mPIC082606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: cd475287ee5a - releng/13.2 - efivar: Allow NULL paths in build_dp List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: cd475287ee5a24b994cfad80b08c3d2b533b5dd9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cd475287ee5a24b994cfad80b08c3d2b533b5dd9 commit cd475287ee5a24b994cfad80b08c3d2b533b5dd9 Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 06:47:04 +0000 efivar: Allow NULL paths in build_dp Allow there to be NULL paths in buildp. This lets us return the device path to the partition, as well as to files on the partition. Sponsored by: Netflix Reviewed by: corvink, manu, asomers Differential Revision: https://reviews.freebsd.org/D38615 Approved by: re@ (cperciva) (cherry picked from commit 49fd6affdbfe6af53f119ebb27ff5e5e292e1f67) (cherry picked from commit 82c0aea8f3c270c6d20b093cf711d4bb1472237c) --- lib/libefivar/efivar-dp-xlate.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index effc8a2de475..b6adae80fdb4 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -544,23 +544,25 @@ find_geom_efimedia(struct gmesh *mesh, const char *dev) static int build_dp(const char *efimedia, const char *relpath, efidp *dp) { - char *fp, *dptxt = NULL, *cp, *rp; + char *fp = NULL, *dptxt = NULL, *cp, *rp = NULL; int rv = 0; efidp out = NULL; size_t len; - rp = strdup(relpath); - for (cp = rp; *cp; cp++) - if (*cp == '/') - *cp = '\\'; - fp = path_to_file_dp(rp); - free(rp); - if (fp == NULL) { - rv = ENOMEM; - goto errout; + if (relpath != NULL) { + rp = strdup(relpath); + for (cp = rp; *cp; cp++) + if (*cp == '/') + *cp = '\\'; + fp = path_to_file_dp(rp); + free(rp); + if (fp == NULL) { + rv = ENOMEM; + goto errout; + } } - asprintf(&dptxt, "%s/%s", efimedia, fp); + asprintf(&dptxt, "%s/%s", efimedia, fp == NULL ? "" : fp); out = malloc(8192); len = efidp_parse_device_path(dptxt, out, 8192); if (len > 8192) { From nobody Sun Feb 19 06:48:26 2023 X-Original-To: dev-commits-src-branches@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 4PKGNC2h70z3sr8m; Sun, 19 Feb 2023 06:48:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKGNC1FmCz3jX0; Sun, 19 Feb 2023 06:48:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789307; 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=AlkOIgOPX1rxLe2sLiPOqWraX/6GAG0yC1lTHmsO5Ok=; b=tPnF1P/hIf5KontlsayTp/Myg2+Goza2SVtPhVbmq6ePX8lrwyNEnz5jm21CdnLy5+HlQg j9n94tOybAuiUP8AkvxI+iNNVoePs8htZF+QH8IarGNZTshj07amW3GR6gvbnk8fQIC60W JWzKGbX+d5bQ4KIY18hYVfmhJdpuGEyn8TatC3kLd2gneMsBW0NoDwrFfQ6GAxHysQG6gb DkX1fzJ0L1eRbWc9uXz5q7Sd1TIZGu9xp6bFLg6oGHQawEmqp8zDn+F1r/tTsTQ0iw6cve rMuCWH+X274afZK3joxYF/kiFZEV9YBY4viNDLmuQiGzujaoQzlfAb84w+UaLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789307; 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=AlkOIgOPX1rxLe2sLiPOqWraX/6GAG0yC1lTHmsO5Ok=; b=W4hIKPl3Q8/8Tm4T2cSGc//+bpsX69xWxVrfa9nLj7KFLxe9h8zoerRLN3+dnCKwuByTi3 8/K3l5UI25Qxmovr5ANo4chMNbcgz1QxXf7aWYqXATdT6LHE3npp27vgIvy/hc5gSv9dGQ OdKV5isDa0XqiW/WaJHiZVhCo7xSeOdQvN7cfo8JTx0iFnOf021EJ+CqKRwD3BR3QibI+n TpYj5WfGaAXHp3D3M2/Lc7X5OFQawXI2VOwJKNTrHKyIMGx7S04a2k6oFwzHIHXwvFM6Uz 80z7ELIjL1KTw6WWysrlFg8sw8PO6IEObJmPqxPuy0k5U2xBtxWw5baN5MazQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676789307; a=rsa-sha256; cv=none; b=BmT2IF9wmjtCgX8BulE5PKv2kTlyj1FnNtlJJJp8jHXJ7yWMPhBAw/WdwavCyw2vbtqNkI lgUGqKPuCULr7SU+Jy2vIrDMblPi2fYWW2zi0wvfh2qpcFL70M4bjryG992Hw+dTuvxgML VgGP4+NAUK8jLm49OGE42/GVDVgsKBWotDhF9MJNJ69mx3dbOvC9U27PPVkdOY7IMw59xK JC1BmWBvgLrtNyf7yi787oCAm1T4MXp9EPbtRfWVIv/GNE3VvdimZw7MmA1UvrcE9yLrnM Xt4BBHZbK/8jPuA85on/EW4RLpocc8OhnEE7zPpCmjgTP+YTPuW9SkBiMs3bZg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKGNC0Lpqzslm; Sun, 19 Feb 2023 06:48:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J6mQhj082630; Sun, 19 Feb 2023 06:48:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J6mQ6j082629; Sun, 19 Feb 2023 06:48:26 GMT (envelope-from git) Date: Sun, 19 Feb 2023 06:48:26 GMT Message-Id: <202302190648.31J6mQ6j082629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 711c0ebd8342 - releng/13.2 - efivar: support device paths as well as mounted paths in path_to_dp List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 711c0ebd83428843cc88bb43bb6b78ef60c7b011 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=711c0ebd83428843cc88bb43bb6b78ef60c7b011 commit 711c0ebd83428843cc88bb43bb6b78ef60c7b011 Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 06:47:11 +0000 efivar: support device paths as well as mounted paths in path_to_dp In path_to_dp, allow passing in either the actual device path "eg /dev/foo/bar" or the path where the device is mounted (say /mnt/baz/bing). In the former case we'll assume the path within the device is nothing (the relpath). In the latter, we'll take from the mount point on down as the relpath. Sponsored by: Netflix Reviewed by: corvink, manu, asomers Differential Revision: https://reviews.freebsd.org/D38616 Approved by: re@ (cperciva) (cherry picked from commit 57d5ca4eeba6192e91044aad86fca4429966cfac) (cherry picked from commit bae5c36257ec5289631abf49b33a4041acc84e3c) --- lib/libefivar/efivar-dp-xlate.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index b6adae80fdb4..586ba7d08180 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -648,6 +648,7 @@ errout: } /* Handles /path/to/file */ +/* Handles /dev/foo/bar */ static int path_to_dp(struct gmesh *mesh, char *path, efidp *dp) { @@ -667,9 +668,19 @@ path_to_dp(struct gmesh *mesh, char *path, efidp *dp) } dev = buf.f_mntfromname; - if (strncmp(dev, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) - dev += sizeof(_PATH_DEV) -1; - ep = rp + strlen(buf.f_mntonname); + /* + * If we're fed a raw /dev/foo/bar, then devfs is returned from the + * statfs call. In that case, use that dev and assume we have a path + * of nothing. + */ + if (strcmp(dev, "devfs") == 0) { + dev = rp + sizeof(_PATH_DEV) - 1; + ep = NULL; + } else { + if (strncmp(dev, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + dev += sizeof(_PATH_DEV) - 1; + ep = rp + strlen(buf.f_mntonname); + } efimedia = find_geom_efimedia(mesh, dev); #ifdef notyet From nobody Sun Feb 19 06:48:28 2023 X-Original-To: dev-commits-src-branches@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 4PKGND51Hnz3srCC; Sun, 19 Feb 2023 06:48:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKGND1m3cz3jZy; Sun, 19 Feb 2023 06:48:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789308; 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=bvndZf6lbtAxtDi+srG0IfMRcU57l5Wzz3pWdyA+/UA=; b=t7hlbddPRfsoM29QZgYvDBzmbLDGd05LSSFF8ZUGvg4BDZmzSL0sfwWs3i2Fuizi9rDAsI qwuhybTxcZJRtk3y5yuzEIV+46DoV7RmjGOTHEUcacnL/NcsFAYqBoyuu6+Uvpd1qURRbs IX2Mz5v+t+9XUxqlVH8UADFcEOnQWFBG4mPjw4VU64WEnWfVY8zQXE5UQWXdRP+bjTYl4R fPDA5M3YVbqVJ1APzaeWRiVOKif5Ga8D7dvqQdI5NbwRvZgDw6grZzryjh8Nw5oqYBoWYe jKh+UNaJhBOVW6r3U5oLl3tY3qyQxYsabvM9jKrgXbaj5kwgw4CeUjrllR125g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789308; 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=bvndZf6lbtAxtDi+srG0IfMRcU57l5Wzz3pWdyA+/UA=; b=ShDnm+JMR+r9cFjUphtEHpw28j6Vh3Lzm/nmHahdXQOW+A62tGSSyZ56iNFECl7CEqHmft 14OGGhLmr4l0QM7FFZ5imJ3ph60aclbjj4dNFL2UNxWIZNpi0JoIz6+hgAiSxGrrOtNl48 f4DkMM3aNUf+7Lf/BZ6ROLANmd/vrxkRmOnQDSaBixf5cLxuJ/EiHfBxh5gecqFIuNDQ8/ Wi3+Gjc6UwBCegkB87+itpdNnuNGGzxEXTKdyaVK1qc5ga8KztVufRnY827Jm2peEjPlw5 jU30So01og0UDme2eopOYT1LcJ6cq2nK5PN5E8FeUOMoXhxQtOrDPXUgEg0USA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676789308; a=rsa-sha256; cv=none; b=nEvrVslTjgNZrv+zL7nOBwxYoXjKGS1A6itqBxN9izX9BWeRwYjptLy+DbDocUNr89k9yR eZJ7Gupe8nQCJ4b3Mirb0eNeKZkWG7Wf6e0XONhG3c0XfkpmnzW8as6KosXLMv7NP4+J4i extMCKDcDCiCUbCp9MWT/zOKk64VuP6iQkKPR7YMgvyfaTIgll1cchqkSDfHjBEmp4VGCZ 00nzgD9Z57A4E1U1+RPVaLO+Bnwpcz4zEyDkad9S3qIKoQMHjc8je6folPy6UZuZkOjYeF RxLvtyuxwnzhSJwgLM+KW24NGMpKIChRbUOe8ikr43AtAJaMmSjJO7CwHm8rIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKGND0rvyzsLf; Sun, 19 Feb 2023 06:48:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J6mSD7082649; Sun, 19 Feb 2023 06:48:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J6mSvI082648; Sun, 19 Feb 2023 06:48:28 GMT (envelope-from git) Date: Sun, 19 Feb 2023 06:48:28 GMT Message-Id: <202302190648.31J6mSvI082648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1a492583b50e - releng/13.2 - efibootmgr: Add --efidev (-u) to discover UEFI's device path to a dev or file List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 1a492583b50e8f74a5834c1c4c5f030162190a85 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1a492583b50e8f74a5834c1c4c5f030162190a85 commit 1a492583b50e8f74a5834c1c4c5f030162190a85 Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 06:47:19 +0000 efibootmgr: Add --efidev (-u) to discover UEFI's device path to a dev or file "efibootmgr --efidev unix-path" will return the UEFI device-path to the file or device specified by unix-path. It's useful for debugging, but may also be useful for scripting. Sponsored by: Netflix Reviewed by: corvink, manu Differential Revision: https://reviews.freebsd.org/D38617 Approved by: re@ (cperciva) (cherry picked from commit 9a7915299484a767fbffc7234b8dc45c29954cca) (cherry picked from commit 8ab17c6dd1d8e8056e5354390f29e0f36cf4e406) --- usr.sbin/efibootmgr/efibootmgr.8 | 6 +++++- usr.sbin/efibootmgr/efibootmgr.c | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/usr.sbin/efibootmgr/efibootmgr.8 b/usr.sbin/efibootmgr/efibootmgr.8 index 6b53de33db56..0aa70fe63da7 100644 --- a/usr.sbin/efibootmgr/efibootmgr.8 +++ b/usr.sbin/efibootmgr/efibootmgr.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 3, 2022 +.Dd February 15, 2023 .Dt EFIBOOTMGR 8 .Os .Sh NAME @@ -69,6 +69,7 @@ .Fl t Ar timeout .Nm .Fl T +.Nm Fl u Ar unix-path .Sh "DESCRIPTION" The .Nm @@ -174,6 +175,9 @@ Set the bootmenu timeout value. Delete the .Cm BootTimeout variable. +.It Fl u -efidev Ar unix-path +Displays the UEFI device path of +.Ar unix-path . .It Fl v -verbose Display the device path of boot entries in the output. .El diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c index 53bc417c4e07..58d83d28d6e5 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001 typedef struct _bmgr_opts { + char *dev; char *env; char *loader; char *label; @@ -85,6 +86,7 @@ typedef struct _bmgr_opts { bool dry_run; bool device_path; bool esp_device; + bool find_dev; bool fw_ui; bool no_fw_ui; bool has_bootnum; @@ -114,6 +116,7 @@ static struct option lopts[] = { {"dry-run", no_argument, NULL, 'D'}, {"env", required_argument, NULL, 'e'}, {"esp", no_argument, NULL, 'E'}, + {"efidev", required_argument, NULL, 'u'}, {"fw-ui", no_argument, NULL, 'f'}, {"no-fw-ui", no_argument, NULL, 'F'}, {"help", no_argument, NULL, 'h'}, @@ -284,6 +287,9 @@ parse_args(int argc, char *argv[]) opts.set_timeout = true; opts.timeout = strtoul(optarg, NULL, 10); break; + case 'u': + opts.find_dev = true; + opts.dev = strdup(optarg); case 'v': opts.verbose = true; break; @@ -996,7 +1002,7 @@ report_esp_device(bool do_dp, bool do_unix) char *name, *dev, *relpath, *abspath; uint8_t *walker, *ep; efi_char *descr; - efidp dp, edp; + efidp dp; char buf[PATH_MAX]; if (do_dp && do_unix) @@ -1026,7 +1032,6 @@ report_esp_device(bool do_dp, bool do_unix) // Now we have fplen bytes worth of file path stuff dp = (efidp)walker; walker += fplen; - edp = (efidp)walker; if (walker > ep) errx(1, "malformed boot variable %s", name); if (do_dp) { @@ -1068,6 +1073,26 @@ set_boot_to_fw_ui(bool to_fw) errx(1, "failed to set boot to fw ui"); } +static void +find_efi_device(const char *path) +{ + efidp dp = NULL; + size_t len; + int ret; + char buf[1024]; + + ret = efivar_unix_path_to_device_path(path, &dp); + if (ret != 0) + errc(1, ret, + "Cannot translate path '%s' to UEFI", path); + len = efidp_size(dp); + if (len > MAX_DP_LEN) + errx(1, "Resulting device path too long."); + efidp_format_device_path(buf, sizeof(buf), dp, len); + printf("%s -> %s\n", path, buf); + exit (0); +} + int main(int argc, char *argv[]) { @@ -1075,7 +1100,10 @@ main(int argc, char *argv[]) memset(&opts, 0, sizeof (bmgr_opts_t)); parse_args(argc, argv); - if (!efi_variables_supported()) + /* + * find_dev can operate without any efi variables + */ + if (!efi_variables_supported() && !opts.find_dev) errx(1, "efi variables not supported on this system. root? kldload efirt?"); read_vars(); @@ -1107,6 +1135,8 @@ main(int argc, char *argv[]) set_boot_to_fw_ui(true); else if (opts.no_fw_ui) set_boot_to_fw_ui(false); + else if (opts.find_dev) + find_efi_device(opts.dev); print_boot_vars(opts.verbose); } From nobody Sun Feb 19 06:48:29 2023 X-Original-To: dev-commits-src-branches@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 4PKGNF6MZxz3sqqj; Sun, 19 Feb 2023 06:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKGNF2YZjz3jS5; Sun, 19 Feb 2023 06:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789309; 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=Rs2Y8Aq7DfiPh0SrVpiH5igSNbNcKyRK0jTrD+KgrrQ=; b=XWLSjHSLYjKWFmMoMO13EFvhst+YI0tkfgkczbgCdHo5xVakvHXYIuTQwEhsCTlwHwZZZx DeKd9t4jQJaJaqMxJk0sqitKCIc1vbccK/7GK1tb5NXD0fgp1Z7UwaJjlxR95tYNp3m8v7 HXcFVCII9Y3INpQWljlSFtOb2mG0tLcBVV9aiQScR+pXjigy2bKa3aZwf0A3Sz7k/vj5yZ kAaGttE6ptNUSvvt20gOIP350PtvUwmzN3gnrt2GgwLaSvrhVhn6m+6VGYHV9TIJ5I49um DWeKV8SYEXjJ99EWP0AVQAqUL2/EyLZvwmI+6CkKG4EAyTemAgCAlOAkRDxSgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676789309; 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=Rs2Y8Aq7DfiPh0SrVpiH5igSNbNcKyRK0jTrD+KgrrQ=; b=P8b8vXr0jvCrd8enMvdA922148KnZYIiEGpjatRbxeNUQXXkmHt7u2eEX2fpEbfhv0ciCH ubU3vuTZ8dc7VpHLp4Jui/cXyLyOVa01ocgnDFPFHRnr97+Hns4Jdk1RqT4baDLbIkPt08 /CimJnqHhjNnI4KulEwPzgIavkYh0X2rb2aA7PXWoF320Df2oJWByRGpU4zK6DEYEJ/DWN cjE6Peh+Kn2UelD2q0My4i1igroGLCB/LF1w95vsnA3iJUqyMp52AEmxP7j29aeBa0J0Xq JbEo11IzwiNTFsM7QUtPwzeKbG4mzgYOjht88dxD7QEFKMx9/MwzeosBJu+aiw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676789309; a=rsa-sha256; cv=none; b=ppiM/o76czbcLAq0UycEufs0F/SpARk0DuD/+QeNBNVzMH6pX6ni1rMFBEg5RiavKZ1QfH BXHDAIMiC8OJraj8eqPUgnlS8IWv7B43mZhy/THrWs0ZggszcX2Ym9wrcX2fd23W4gZv1m WhgZ4gbsIVFYkEwTIFYQKxAwjXxgTssaBw2hx19VeNe5OyyJ3c0cOQ9XD3pXOwRmHV88Ok FuHnSpxCXfZn+eB6jD1PYEkK5n7d8q4GFggOfIuEOCZn8pxurBh6Hrh830IviOnxSNSEmM xjtL6f+QmGk5L2n+n/TPw0Xlhk5MMtca2h6b7xdFv9cnvKuXwd0Jo+g7pCLgBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKGNF1g0Yzs7y; Sun, 19 Feb 2023 06:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J6mTqv082671; Sun, 19 Feb 2023 06:48:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J6mT5G082670; Sun, 19 Feb 2023 06:48:29 GMT (envelope-from git) Date: Sun, 19 Feb 2023 06:48:29 GMT Message-Id: <202302190648.31J6mT5G082670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 3cfda2537654 - releng/13.2 - efivar: Really look for labels for the provider with right efimedia List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 3cfda25376542b65b459bc5af48b2fb0f200b552 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3cfda25376542b65b459bc5af48b2fb0f200b552 commit 3cfda25376542b65b459bc5af48b2fb0f200b552 Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 06:47:25 +0000 efivar: Really look for labels for the provider with right efimedia The prior code mistakently thought that the g_consumer that hung off the provider we found were the right thing to use to find all the glabel aliases for this node. However, the only way to find that is to iterate through all the geoms that belong to the glabel geom class, looking for those geoms with the same name as the provider with the right efimedia. Do this in a way that caches glabel class, and allows for it to be absent. Tighten the filter for mounted filesystems to only look for the ones that are mounted on /dev/.. since the rest of the code assumes that. MFC After: 3 days Sponsored by: Netflix Reviewed by: corvink, asomers Differential Revision: https://reviews.freebsd.org/D38619 Approved by: re@ (cperciva) (cherry picked from commit 2b460910326c4f39068fe2158a0726dc3d362f68) (cherry picked from commit f4d711e7209073404c821c9c26c7c17b87b61997) --- lib/libefivar/efivar-dp-xlate.c | 64 ++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index 586ba7d08180..3d63868dacef 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -134,12 +134,15 @@ efi_hd_to_unix(struct gmesh *mesh, const_efidp dp, char **dev, char **relpath, c const_efidp media, file, walker; size_t len, mntlen; char buf[MAX_DP_TEXT_LEN]; - char *pwalk; + char *pwalk, *newdev = NULL; struct gprovider *pp, *provider; - struct gconsumer *cp; struct statfs *mnt; + struct gclass *glabel; + struct ggeom *gp; walker = media = dp; + *dev = NULL; + *relpath = NULL; /* * Now, we can either have a filepath node next, or the end. @@ -174,12 +177,6 @@ efi_hd_to_unix(struct gmesh *mesh, const_efidp dp, char **dev, char **relpath, c goto errout; } - *dev = strdup(pp->lg_name); - if (*dev == NULL) { - rv = ENOMEM; - goto errout; - } - /* * No file specified, just return the device. Don't even look * for a mountpoint. XXX Sane? @@ -217,6 +214,16 @@ efi_hd_to_unix(struct gmesh *mesh, const_efidp dp, char **dev, char **relpath, c rv = errno; goto errout; } + + /* + * Find glabel, if it exists. It's OK if not: we'll skip searching for + * labels. + */ + LIST_FOREACH(glabel, &mesh->lg_class, lg_class) { + if (strcmp(glabel->lg_name, G_LABEL) == 0) + break; + } + provider = pp; for (i = 0; i < n; i++) { /* @@ -225,30 +232,53 @@ efi_hd_to_unix(struct gmesh *mesh, const_efidp dp, char **dev, char **relpath, c * we'll need to invent one, but its decoding will be handled in * a separate function. */ - if (mnt[i].f_mntfromname[0] != '/') + if (strncmp(mnt[i].f_mntfromname, "/dev/", 5) != 0) continue; /* * First see if it is directly attached */ - if (strcmp(provider->lg_name, mnt[i].f_mntfromname + 5) == 0) + if (strcmp(provider->lg_name, mnt[i].f_mntfromname + 5) == 0) { + newdev = provider->lg_name; break; + } /* - * Next see if it is attached via one of the physical disk's - * labels. + * Next see if it is attached via one of the physical disk's labels. + * We can't search directly from the pointers we have for the + * provider, so we have to cast a wider net for all labels and + * filter those down to geoms whose name matches the PART provider + * we found the efimedia attribute on. */ - LIST_FOREACH(cp, &provider->lg_consumers, lg_consumer) { - pp = cp->lg_provider; - if (strcmp(pp->lg_geom->lg_class->lg_name, G_LABEL) != 0) + if (glabel == NULL) + continue; + LIST_FOREACH(gp, &glabel->lg_geom, lg_geom) { + if (strcmp(gp->lg_name, provider->lg_name) != 0) { continue; - if (strcmp(g_device_path(pp->lg_name), mnt[i].f_mntfromname) == 0) - goto break2; + } + LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { + if (strcmp(pp->lg_name, mnt[i].f_mntfromname + 5) == 0) { + newdev = pp->lg_name; + goto break2; + } + } } /* Not the one, try the next mount point */ } break2: + /* + * If nothing better was mounted, then use the provider we found as + * is. It's the most correct thing we can return in that acse. + */ + if (newdev == NULL) + newdev = provider->lg_name; + *dev = strdup(newdev); + if (*dev == NULL) { + rv = ENOMEM; + goto errout; + } + /* * No mountpoint found, no absolute path possible */ From nobody Sun Feb 19 07:26:18 2023 X-Original-To: dev-commits-src-branches@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 4PKHCt4XP6z3st81; Sun, 19 Feb 2023 07:26:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKHCt3Xkjz3pC3; Sun, 19 Feb 2023 07:26:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676791578; 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=DMv8A0s2K38tt6VDzdK5oWFP/SH4QQZcVmxURWcwNks=; b=sJvyNanE04Pypfy+j3RhHu3Slg75TFQfP3eIMt8vps7fFhN2hM2tnVfQqiwCQrTnwwsB36 esyFM/KDAI4oDT1PvUpiY7nzhtLfSbTEF+n8SeIk+/qFNnTBaIYG2JdsKmciU3/RtRmIcn Gn4GQLWCBhbjL7CtCBQD93B+FMEPeF0vlOXpWsp9kkCliSNnyws2ee/6xcZAKfIpIteV/i ymszy2THGWPlp3dgl3IwCgSYwJQQ94BMXaWXh4v2VRAZYyLyasqe7i5Mk3HZczG1zGsEe/ yj2Sk+n6oLx7/Uoe+pt/Ev6KEPgveVWvQGEiF3Ypz5iKiAW7JqzvnF1yJe2+OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676791578; 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=DMv8A0s2K38tt6VDzdK5oWFP/SH4QQZcVmxURWcwNks=; b=UlSV1uFdlLfpQvybs5o9NfG8PCUjRbuyfH7M7NLtsD0VH0tFvRz6OHYISpQ+jFUdGU7QtV Ky5s826A7rA7tPIkW8KgfbEpVjvPrO5gqxyVpswFpCbt62Iee/A/fmqY18cX4+XVsLhdxE o2aX5Pnx2EfSDIi/zJ6mT8HSqf67vSATOXclUtrNwr6vIIXctdJzG/+1ldp6/y8C7wIHHc BnBrMHGJ/TEIuZZ/ThheYSQ3S/KigmvXURnxJfiWn0yXdvU1O7wzKCwla42QgdECzuOzBI B6Wnye6cpvQhZ3k91OV3RKADyHkleJQ4iNwtdLT1Zm+9pJ763cVb8ocO7ALVAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676791578; a=rsa-sha256; cv=none; b=B1mqM3jmMV+37OqEcXe1eERBpRlsDjWew3TKU2CG78oY3dyUo2doyNhajalrx7M/JgpXY8 sKI2wKP3cghwx86qgTfs5FU/MXGgv1XfazTSK5eonxi6lL5gFUZFDXGT+omaD+Ud8Rvvf/ PXYorEanhsGePz7h4mCwsfSEVT9aewaHP9jrRgtpOcnxOR7jmyiJJTffD93KDB5JiC6APc k1jYFu0EizXF8FGXP935mgTB/4ot/sglT1pxg7QhsUSFM2nlXGaOAGt8NIUMpCYdBIRncJ fKXiTvko6Uxq9yMjB/rmOlhhsROWHUB+qpFQVtA8kFMQEEH5pNk7FcxrgSQ/og== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKHCt2FKyzt6y; Sun, 19 Feb 2023 07:26:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31J7QINJ039583; Sun, 19 Feb 2023 07:26:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J7QIvG039582; Sun, 19 Feb 2023 07:26:18 GMT (envelope-from git) Date: Sun, 19 Feb 2023 07:26:18 GMT Message-Id: <202302190726.31J7QIvG039582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: f3f350c5c8e4 - stable/13 - cpuset: Add compat shim to the sched_affinity functions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f3f350c5c8e4f6b0d3ff9806881b8f042a9ca925 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f3f350c5c8e4f6b0d3ff9806881b8f042a9ca925 commit f3f350c5c8e4f6b0d3ff9806881b8f042a9ca925 Author: Dmitry Chagin AuthorDate: 2023-02-15 09:23:15 +0000 Commit: Dmitry Chagin CommitDate: 2023-02-19 07:26:06 +0000 cpuset: Add compat shim to the sched_affinity functions To allow to run a newer world on a pre-1400079 kernel a compat shims to the sched_affinity functions has beed added. Reported by: antoine Tested by: antoine Reviewed by: kib Differential revision: https://reviews.freebsd.org/D38555 MFC after: 3 days (cherry picked from commit cbc32e4c5e8427e0f1032d9d3aa5863dd1538c11) --- lib/libc/gen/sched_getaffinity.c | 15 ++++++++++++++- lib/libc/gen/sched_setaffinity.c | 14 +++++++++++++- lib/libc/include/libc_private.h | 6 ++++++ sys/sys/param.h | 1 + 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c index 95145a1eb019..fce47fbfc0d2 100644 --- a/lib/libc/gen/sched_getaffinity.c +++ b/lib/libc/gen/sched_getaffinity.c @@ -26,16 +26,29 @@ * SUCH DAMAGE. */ +#define _WANT_P_OSREL +#include #include #include #include +#include "libc_private.h" + int sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset) { + cpuwhich_t which; int error; - error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TIDPID, + if (__getosreldate() < P_OSREL_TIDPID) { + if (pid == 0 || pid > _PID_MAX) + which = CPU_WHICH_TID; + else + which = CPU_WHICH_PID; + } else + which = CPU_WHICH_TIDPID; + + error = cpuset_getaffinity(CPU_LEVEL_WHICH, which, pid == 0 ? -1 : pid, cpusetsz, cpuset); if (error == -1 && errno == ERANGE) errno = EINVAL; diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c index 36ed0f45d417..b878e1affc41 100644 --- a/lib/libc/gen/sched_setaffinity.c +++ b/lib/libc/gen/sched_setaffinity.c @@ -26,20 +26,32 @@ * SUCH DAMAGE. */ +#define _WANT_P_OSREL #include #include #include #include #include +#include "libc_private.h" + int sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) { static int mp_maxid; + cpuwhich_t which; cpuset_t c; int error, lbs, cpu; size_t len, sz; + if (__getosreldate() < P_OSREL_TIDPID) { + if (pid == 0 || pid > _PID_MAX) + which = CPU_WHICH_TID; + else + which = CPU_WHICH_PID; + } else + which = CPU_WHICH_TIDPID; + sz = cpusetsz > sizeof(cpuset_t) ? sizeof(cpuset_t) : cpusetsz; memset(&c, 0, sizeof(c)); memcpy(&c, cpuset, sz); @@ -58,7 +70,7 @@ sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) if (cpu > mp_maxid) CPU_CLR(cpu, &c); } - error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TIDPID, + error = cpuset_setaffinity(CPU_LEVEL_WHICH, which, pid == 0 ? -1 : pid, sizeof(cpuset_t), &c); if (error == -1 && errno == EDEADLK) errno = EINVAL; diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 61c1eb438142..78a75cc6284d 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -39,6 +39,12 @@ #include #include +/* + * The kernel doesn't expose PID_MAX to the user space. Save it here + * to allow to run a newer world on a pre-1400079 kernel. + */ +#define _PID_MAX 99999 + /* * This global flag is non-zero when a process has created one * or more threads. It is used to avoid calling locking functions diff --git a/sys/sys/param.h b/sys/sys/param.h index 909ff0ef1d8b..d2fbad6c127b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -91,6 +91,7 @@ #define P_OSREL_CK_SUPERBLOCK 1300000 #define P_OSREL_CK_INODE 1300005 #define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 +#define P_OSREL_TIDPID 1400079 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif From nobody Sun Feb 19 16:42:42 2023 X-Original-To: dev-commits-src-branches@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 4PKWZ83dNdz3rQ4r; Sun, 19 Feb 2023 16:42:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4PKWZ80PVDz3PH1; Sun, 19 Feb 2023 16:42:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.17.1/8.17.1) with ESMTPS id 31JGggO5062801 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 19 Feb 2023 18:42:45 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 31JGggO5062801 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 31JGgg1X062800; Sun, 19 Feb 2023 18:42:42 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 19 Feb 2023 18:42:42 +0200 From: Konstantin Belousov To: Dmitry Chagin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: f3f350c5c8e4 - stable/13 - cpuset: Add compat shim to the sched_affinity functions Message-ID: References: <202302190726.31J7QIvG039582@gitrepo.freebsd.org> List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202302190726.31J7QIvG039582@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Rspamd-Queue-Id: 4PKWZ80PVDz3PH1 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Sun, Feb 19, 2023 at 07:26:18AM +0000, Dmitry Chagin wrote: > The branch stable/13 has been updated by dchagin: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f3f350c5c8e4f6b0d3ff9806881b8f042a9ca925 > > commit f3f350c5c8e4f6b0d3ff9806881b8f042a9ca925 > Author: Dmitry Chagin > AuthorDate: 2023-02-15 09:23:15 +0000 > Commit: Dmitry Chagin > CommitDate: 2023-02-19 07:26:06 +0000 > > cpuset: Add compat shim to the sched_affinity functions > > To allow to run a newer world on a pre-1400079 kernel a compat shims to > the sched_affinity functions has beed added. > > Reported by: antoine > Tested by: antoine > Reviewed by: kib > Differential revision: https://reviews.freebsd.org/D38555 > MFC after: 3 days > > (cherry picked from commit cbc32e4c5e8427e0f1032d9d3aa5863dd1538c11) > --- > lib/libc/gen/sched_getaffinity.c | 15 ++++++++++++++- > lib/libc/gen/sched_setaffinity.c | 14 +++++++++++++- > lib/libc/include/libc_private.h | 6 ++++++ > sys/sys/param.h | 1 + > 4 files changed, 34 insertions(+), 2 deletions(-) > > diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c > index 95145a1eb019..fce47fbfc0d2 100644 > --- a/lib/libc/gen/sched_getaffinity.c > +++ b/lib/libc/gen/sched_getaffinity.c > @@ -26,16 +26,29 @@ > * SUCH DAMAGE. > */ > > +#define _WANT_P_OSREL > +#include > #include > #include > #include > > +#include "libc_private.h" > + > int > sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset) > { > + cpuwhich_t which; > int error; > > - error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TIDPID, > + if (__getosreldate() < P_OSREL_TIDPID) { > + if (pid == 0 || pid > _PID_MAX) > + which = CPU_WHICH_TID; > + else > + which = CPU_WHICH_PID; > + } else > + which = CPU_WHICH_TIDPID; > + > + error = cpuset_getaffinity(CPU_LEVEL_WHICH, which, > pid == 0 ? -1 : pid, cpusetsz, cpuset); > if (error == -1 && errno == ERANGE) > errno = EINVAL; > diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c > index 36ed0f45d417..b878e1affc41 100644 > --- a/lib/libc/gen/sched_setaffinity.c > +++ b/lib/libc/gen/sched_setaffinity.c > @@ -26,20 +26,32 @@ > * SUCH DAMAGE. > */ > > +#define _WANT_P_OSREL > #include > #include > #include > #include > #include > > +#include "libc_private.h" > + > int > sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) > { > static int mp_maxid; > + cpuwhich_t which; > cpuset_t c; > int error, lbs, cpu; > size_t len, sz; > > + if (__getosreldate() < P_OSREL_TIDPID) { > + if (pid == 0 || pid > _PID_MAX) > + which = CPU_WHICH_TID; > + else > + which = CPU_WHICH_PID; > + } else > + which = CPU_WHICH_TIDPID; > + > sz = cpusetsz > sizeof(cpuset_t) ? sizeof(cpuset_t) : cpusetsz; > memset(&c, 0, sizeof(c)); > memcpy(&c, cpuset, sz); > @@ -58,7 +70,7 @@ sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) > if (cpu > mp_maxid) > CPU_CLR(cpu, &c); > } > - error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TIDPID, > + error = cpuset_setaffinity(CPU_LEVEL_WHICH, which, > pid == 0 ? -1 : pid, sizeof(cpuset_t), &c); > if (error == -1 && errno == EDEADLK) > errno = EINVAL; > diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h > index 61c1eb438142..78a75cc6284d 100644 > --- a/lib/libc/include/libc_private.h > +++ b/lib/libc/include/libc_private.h > @@ -39,6 +39,12 @@ > #include > #include > > +/* > + * The kernel doesn't expose PID_MAX to the user space. Save it here > + * to allow to run a newer world on a pre-1400079 kernel. > + */ > +#define _PID_MAX 99999 > + > /* > * This global flag is non-zero when a process has created one > * or more threads. It is used to avoid calling locking functions > diff --git a/sys/sys/param.h b/sys/sys/param.h > index 909ff0ef1d8b..d2fbad6c127b 100644 > --- a/sys/sys/param.h > +++ b/sys/sys/param.h > @@ -91,6 +91,7 @@ > #define P_OSREL_CK_SUPERBLOCK 1300000 > #define P_OSREL_CK_INODE 1300005 > #define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 > +#define P_OSREL_TIDPID 1400079 Does it work to have 14.x osrel value for P_OSREL_TIDPID as compat selector on 13.x? > > #define P_OSREL_MAJOR(x) ((x) / 100000) > #endif From nobody Sun Feb 19 16:48:34 2023 X-Original-To: dev-commits-src-branches@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 4PKWhf3pYRz3rQNN; Sun, 19 Feb 2023 16:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKWhf3HBkz3Q54; Sun, 19 Feb 2023 16:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676825314; 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=JpHYV2v2WLFZnORx9W3IFXZKUJJ7oyk9uNcG0+Edo10=; b=qp5CmhoOGYnPQpnJCb5f4GwN6kyO9Y3jsPFvR6ipEZovIOC6jjiMTJ3UDjSIlg7RJg2u9b SYKl+gzcxZNRkd0nUEq1EjZ2s55WhvKGyXi0aPyuyPCf/rVaEPB/8BuPvPjgi8uFY3wI43 ck4VVmGySpuu7+xTHEWfCgbRgP3zdwtpZdKdoEhfyGP4ayKj+W/bLjhu4NnvHfVWobl8LT F/qcO0JrvGd29BgTeC2KFsmBnewmyu82J5V43HFJs3zOj5CcS+9lYYH4iKRd/gb4p4KC/v 7FpPI4jqp1GFbTe4jKM+6J5BpesAqEXCjtATscI8IKdOFxyvHI5d4yCsKhhfwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676825314; 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=JpHYV2v2WLFZnORx9W3IFXZKUJJ7oyk9uNcG0+Edo10=; b=LdMiOVJAm0IfzThe5GslPI7KzS8t0/SY64qG7X1I4Fwl1nzsBQj31lAikKWkGazSWdt+s1 gFPgxsaZr7tTg0vIU6wSgOwVWSjcu1DMPF5DHvtrQh6RjUIEwWGyu1HUY6h86fpkG8LJRN ExTI7gh2qmMyZqjdpUv1bp6tEoS8IIAnmxI7azGAVaeANTEm/YxwaSrPba98JGtjLle1rI FPfHC5PoiiJQfCINmAbsxv1ZlAf9LegzO8iAVWhkEvwFNPIafCtEEj71OB8So+f2gPjtre tQRAhOVncUyt47+UozNTrZEfE+YjUx/45xvGnzr0gHh+OZW+8rh9nT2mWVJqBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676825314; a=rsa-sha256; cv=none; b=ocHmSii30uuu3GBShtZhIFAEAiBzCalmhHXjtl0Z+nN282JptO9VOHLU0TsZul9d/mNTIf fjwzmj800Wl2d9Ui8tPMO3cAbKDGpaO4UOmk8y6vmf4nFaSEJtnLtVuAwoSF/OK79XPQ79 p+pPnJc1CG9FiZr6Ax1m2gIhpGex9xAtccJ+aBGwqj8uWDuRh9v98xzAg6jDaFcEohBAR4 ksiwFNH8anYsIwygsxgleBdig+oe3PLjMehkT3faGb/3S5SCioLePgYjhjiXXGeK8liz8w J88rRXZOmkRTOKjtrT2/y5k0YWhQHv02qyHNbJCKSkrgn/g6gn+q/QcJOAJxPA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKWhf2Kxsz17w2; Sun, 19 Feb 2023 16:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31JGmYa0037858; Sun, 19 Feb 2023 16:48:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31JGmYfN037857; Sun, 19 Feb 2023 16:48:34 GMT (envelope-from git) Date: Sun, 19 Feb 2023 16:48:34 GMT Message-Id: <202302191648.31JGmYfN037857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 57756461548b - stable/13 - fusefs: fix some resource leaks List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57756461548b813c288e190900de31e847e412f9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=57756461548b813c288e190900de31e847e412f9 commit 57756461548b813c288e190900de31e847e412f9 Author: Alan Somers AuthorDate: 2023-02-11 23:43:30 +0000 Commit: Alan Somers CommitDate: 2023-02-19 15:41:24 +0000 fusefs: fix some resource leaks fusefs would leak tickets in three cases: * After FUSE_CREATE, if the server returned a bad inode number. * After a FUSE_FALLOCATE operation during VOP_ALLOCATE * After a FUSE_FALLOCATE operation during VOP_DEALLOCATE Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38526 (cherry picked from commit 1bdf879b97b686a8f36fdba050b68f9e7493f363) MFC Note: changes to VOP_DEALLOCATE are not MFCed, because that VOP does not exist in stable/13. --- sys/fs/fuse/fuse_vnops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index eaace113d67e..7fd96ff639ff 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -668,6 +668,7 @@ fuse_vnop_allocate(struct vop_allocate_args *ap) } } + fdisp_destroy(&fdi); return (err); } @@ -1104,6 +1105,7 @@ fuse_vnop_create(struct vop_create_args *ap) uint64_t nodeid = feo->nodeid; uint64_t fh_id = foo->fh; + fdisp_destroy(fdip); fdisp_init(fdip, sizeof(*fri)); fdisp_make(fdip, FUSE_RELEASE, mp, nodeid, td, cred); fri = fdip->indata; From nobody Sun Feb 19 18:31:45 2023 X-Original-To: dev-commits-src-branches@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 4PKYzt5yDXz3rYYg; Sun, 19 Feb 2023 18:31:54 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [195.93.173.158]) (using TLSv1.3 with cipher TLS_AES_256_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 4PKYzt2MZCz3tbc; Sun, 19 Feb 2023 18:31:54 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Authentication-Results: mx1.freebsd.org; none Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.17.1/8.16.1) with ESMTP id 31JIVjY6050046; Sun, 19 Feb 2023 21:31:45 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.17.1/8.16.1/Submit) id 31JIVjPA050042; Sun, 19 Feb 2023 21:31:45 +0300 (MSK) (envelope-from dchagin) Date: Sun, 19 Feb 2023 21:31:45 +0300 From: Dmitry Chagin To: Konstantin Belousov Cc: Dmitry Chagin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: f3f350c5c8e4 - stable/13 - cpuset: Add compat shim to the sched_affinity functions Message-ID: References: <202302190726.31J7QIvG039582@gitrepo.freebsd.org> List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4PKYzt2MZCz3tbc X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:61400, ipnet:195.93.173.0/24, country:RU] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Sun, Feb 19, 2023 at 06:42:42PM +0200, Konstantin Belousov wrote: > On Sun, Feb 19, 2023 at 07:26:18AM +0000, Dmitry Chagin wrote: > > The branch stable/13 has been updated by dchagin: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=f3f350c5c8e4f6b0d3ff9806881b8f042a9ca925 > > > > commit f3f350c5c8e4f6b0d3ff9806881b8f042a9ca925 > > Author: Dmitry Chagin > > AuthorDate: 2023-02-15 09:23:15 +0000 > > Commit: Dmitry Chagin > > CommitDate: 2023-02-19 07:26:06 +0000 > > > > cpuset: Add compat shim to the sched_affinity functions > > > > To allow to run a newer world on a pre-1400079 kernel a compat shims to > > the sched_affinity functions has beed added. > > > > Reported by: antoine > > Tested by: antoine > > Reviewed by: kib > > Differential revision: https://reviews.freebsd.org/D38555 > > MFC after: 3 days > > > > (cherry picked from commit cbc32e4c5e8427e0f1032d9d3aa5863dd1538c11) > > --- > > lib/libc/gen/sched_getaffinity.c | 15 ++++++++++++++- > > lib/libc/gen/sched_setaffinity.c | 14 +++++++++++++- > > lib/libc/include/libc_private.h | 6 ++++++ > > sys/sys/param.h | 1 + > > 4 files changed, 34 insertions(+), 2 deletions(-) > > > > diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c > > index 95145a1eb019..fce47fbfc0d2 100644 > > --- a/lib/libc/gen/sched_getaffinity.c > > +++ b/lib/libc/gen/sched_getaffinity.c > > @@ -26,16 +26,29 @@ > > * SUCH DAMAGE. > > */ > > > > +#define _WANT_P_OSREL > > +#include > > #include > > #include > > #include > > > > +#include "libc_private.h" > > + > > int > > sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset) > > { > > + cpuwhich_t which; > > int error; > > > > - error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TIDPID, > > + if (__getosreldate() < P_OSREL_TIDPID) { > > + if (pid == 0 || pid > _PID_MAX) > > + which = CPU_WHICH_TID; > > + else > > + which = CPU_WHICH_PID; > > + } else > > + which = CPU_WHICH_TIDPID; > > + > > + error = cpuset_getaffinity(CPU_LEVEL_WHICH, which, > > pid == 0 ? -1 : pid, cpusetsz, cpuset); > > if (error == -1 && errno == ERANGE) > > errno = EINVAL; > > diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c > > index 36ed0f45d417..b878e1affc41 100644 > > --- a/lib/libc/gen/sched_setaffinity.c > > +++ b/lib/libc/gen/sched_setaffinity.c > > @@ -26,20 +26,32 @@ > > * SUCH DAMAGE. > > */ > > > > +#define _WANT_P_OSREL > > #include > > #include > > #include > > #include > > #include > > > > +#include "libc_private.h" > > + > > int > > sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) > > { > > static int mp_maxid; > > + cpuwhich_t which; > > cpuset_t c; > > int error, lbs, cpu; > > size_t len, sz; > > > > + if (__getosreldate() < P_OSREL_TIDPID) { > > + if (pid == 0 || pid > _PID_MAX) > > + which = CPU_WHICH_TID; > > + else > > + which = CPU_WHICH_PID; > > + } else > > + which = CPU_WHICH_TIDPID; > > + > > sz = cpusetsz > sizeof(cpuset_t) ? sizeof(cpuset_t) : cpusetsz; > > memset(&c, 0, sizeof(c)); > > memcpy(&c, cpuset, sz); > > @@ -58,7 +70,7 @@ sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) > > if (cpu > mp_maxid) > > CPU_CLR(cpu, &c); > > } > > - error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TIDPID, > > + error = cpuset_setaffinity(CPU_LEVEL_WHICH, which, > > pid == 0 ? -1 : pid, sizeof(cpuset_t), &c); > > if (error == -1 && errno == EDEADLK) > > errno = EINVAL; > > diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h > > index 61c1eb438142..78a75cc6284d 100644 > > --- a/lib/libc/include/libc_private.h > > +++ b/lib/libc/include/libc_private.h > > @@ -39,6 +39,12 @@ > > #include > > #include > > > > +/* > > + * The kernel doesn't expose PID_MAX to the user space. Save it here > > + * to allow to run a newer world on a pre-1400079 kernel. > > + */ > > +#define _PID_MAX 99999 > > + > > /* > > * This global flag is non-zero when a process has created one > > * or more threads. It is used to avoid calling locking functions > > diff --git a/sys/sys/param.h b/sys/sys/param.h > > index 909ff0ef1d8b..d2fbad6c127b 100644 > > --- a/sys/sys/param.h > > +++ b/sys/sys/param.h > > @@ -91,6 +91,7 @@ > > #define P_OSREL_CK_SUPERBLOCK 1300000 > > #define P_OSREL_CK_INODE 1300005 > > #define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 > > +#define P_OSREL_TIDPID 1400079 > Does it work to have 14.x osrel value for P_OSREL_TIDPID as compat selector > on 13.x? > sure, not perfect, but it will, ideally it should be something like below, being testing now, I'll post it on phab later: diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c index fce47fbfc0d2..7c8f37a8cb64 100644 --- a/lib/libc/gen/sched_getaffinity.c +++ b/lib/libc/gen/sched_getaffinity.c @@ -38,9 +38,11 @@ int sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset) { cpuwhich_t which; - int error; + int error, osrel; - if (__getosreldate() < P_OSREL_TIDPID) { + osrel = __getosreldate(); + if (osrel < P_OSREL_TIDPID || + (P_OSREL_MAJOR(osrel) == 14 && osrel < 1400079)) { if (pid == 0 || pid > _PID_MAX) which = CPU_WHICH_TID; else diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c index b878e1affc41..622021bab3cd 100644 --- a/lib/libc/gen/sched_setaffinity.c +++ b/lib/libc/gen/sched_setaffinity.c @@ -41,10 +41,12 @@ sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) static int mp_maxid; cpuwhich_t which; cpuset_t c; - int error, lbs, cpu; + int error, lbs, cpu, osrel; size_t len, sz; - if (__getosreldate() < P_OSREL_TIDPID) { + osrel = __getosreldate(); + if (osrel < P_OSREL_TIDPID || + (P_OSREL_MAJOR(osrel) == 14 && osrel < 1400079)) { if (pid == 0 || pid > _PID_MAX) which = CPU_WHICH_TID; else diff --git a/sys/sys/param.h b/sys/sys/param.h index d2fbad6c127b..714c6cff5c90 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -91,7 +91,7 @@ #define P_OSREL_CK_SUPERBLOCK 1300000 #define P_OSREL_CK_INODE 1300005 #define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 -#define P_OSREL_TIDPID 1400079 +#define P_OSREL_TIDPID 1302501 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif > > > > #define P_OSREL_MAJOR(x) ((x) / 100000) > > #endif From nobody Sun Feb 19 23:43:30 2023 X-Original-To: dev-commits-src-branches@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 4PKhvQ4NT7z3sF19; Sun, 19 Feb 2023 23:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKhvQ3rYkz4Q1W; Sun, 19 Feb 2023 23:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676850210; 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=iy8emTBlYOCTzsY+liw4ihATaatqVHA7QNSsTJyNnLA=; b=mMdd9i7330sYtIaHo+R2YwCwImKNIPhiHSBt8/+ZywltZxVrCBx1HB4jhMwdz68JA3kW0g 10MLESm/wew8Rtg2ZKuwteDs6/+1wt8j7hGEc6anIzVkTQlxUR9pkMOlShGJdEi2zQR5ET uS7cqdLv4t/yvav8sImC6+GUCSfWxhp6wwII/JeEfDO4fMYZaWs1IVSSrbSkoLUCnpTpRb 9U1pzd55rn9Li7uaUbyyPN8zpYbQ9EaFbjz2/gcJXJrPRZnHHy4cS9g6d/wPHXZxAxPd5K ocy/yQstrjKeTkNIFLBUZXgiR4xJB0Vgqxdhf0ti/4u43AT602pjZQeyBzJDZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676850210; 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=iy8emTBlYOCTzsY+liw4ihATaatqVHA7QNSsTJyNnLA=; b=mzGqjjo0oqnCubh9BcPVbHv9A3PDseO0JdUp5SHkzcPQra6GLY0ytiA7JmFzIrOhep+W9P h4hOVWaI9IhKlUX8G0a3quXgV/9DV/pD3sPPhEbAI/Q4XQPtYfbpWnB5z0zEZcywIfTqDK RMxPSPzFxy9bOhZ2aiuQNIpDe/uzkhqJnvifR8A6HYMlWWqZpPntV0xlL6KRvT4Jzr9hs1 aRgO0WSLHGp6s9KXSZBAJ+iO78ho/d01YzSLRXCSJjVqZoZeo7SV8T3GfEjg0mfqLLk4Gz 7fOFTaSSmEIHKUlWlECwlXeStK27jdQ4/Cyt9cTxsR+dzqZZbWqbJf21nPjpXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676850210; a=rsa-sha256; cv=none; b=xS9ZLLYxprRKs4NwGAVM8ogA3vM5Yn+31ehIMK4xAKUS4Hh+rsOPOUSoPtcz9QSKQAu0KR fSpjZA3sc6DMrQN7NjXs2vuZ1aYfMItHe6ZIONs6uIzfOIu3kOETej7SFhkkOFVDhnpgLr OJd9LsQdsrdwP5JtYFCyLK1BeXOIImCY7iZBtVusCSlmKASoTY2tI9M/hOpXurdQSQ+eTz rrnsR+vMD7bXaMXiwB/V+AbblFkaouaDeNq5+ADsDmmGWaf3uHqoby+mkoq4a1m+gOcqXH fg6rUHnEVcUqSEv71SK5GBbHmNd/HnOk9vKDrJ6FYS2Y6zzfKgSNPantnC5IJQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKhvQ2vwpzLKt; Sun, 19 Feb 2023 23:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31JNhUuC035347; Sun, 19 Feb 2023 23:43:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31JNhUYR035346; Sun, 19 Feb 2023 23:43:30 GMT (envelope-from git) Date: Sun, 19 Feb 2023 23:43:30 GMT Message-Id: <202302192343.31JNhUYR035346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: fbb102b2cec5 - releng/13.2 - fusefs: fix some resource leaks List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: fbb102b2cec57181d0b00d81e8de384021f60ab0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=fbb102b2cec57181d0b00d81e8de384021f60ab0 commit fbb102b2cec57181d0b00d81e8de384021f60ab0 Author: Alan Somers AuthorDate: 2023-02-11 23:43:30 +0000 Commit: Alan Somers CommitDate: 2023-02-19 23:42:32 +0000 fusefs: fix some resource leaks fusefs would leak tickets in three cases: * After FUSE_CREATE, if the server returned a bad inode number. * After a FUSE_FALLOCATE operation during VOP_ALLOCATE * After a FUSE_FALLOCATE operation during VOP_DEALLOCATE Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38526 (cherry picked from commit 1bdf879b97b686a8f36fdba050b68f9e7493f363) MFC Note: changes to VOP_DEALLOCATE are not MFCed, because that VOP does not exist in stable/13. Approved by: re (cperciva) (cherry picked from commit 57756461548b813c288e190900de31e847e412f9) --- sys/fs/fuse/fuse_vnops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index eaace113d67e..7fd96ff639ff 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -668,6 +668,7 @@ fuse_vnop_allocate(struct vop_allocate_args *ap) } } + fdisp_destroy(&fdi); return (err); } @@ -1104,6 +1105,7 @@ fuse_vnop_create(struct vop_create_args *ap) uint64_t nodeid = feo->nodeid; uint64_t fh_id = foo->fh; + fdisp_destroy(fdip); fdisp_init(fdip, sizeof(*fri)); fdisp_make(fdip, FUSE_RELEASE, mp, nodeid, td, cred); fri = fdip->indata; From nobody Mon Feb 20 06:16:33 2023 X-Original-To: dev-commits-src-branches@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 4PKscx3Bh0z3s1qh; Mon, 20 Feb 2023 06:16:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKscx2kBdz3t82; Mon, 20 Feb 2023 06:16:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676873793; 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=FnH7jP/QY49LfWnhJ1iB0WVis1HV6nixvBd3aETp+M0=; b=Co3bVstxUztAER0L9AYPoO/ciATycExssu4+FEVVz3NFiopg1OJvU4UAri1KWwVerKSGQd O3qWbF32KPmQ4b6K7mKuYY1e4drYPZXmKFf4OIzfxV+SrH0sjKjulSiv68c0kG9B4c2uNc Ys9V6j38E49c7epXRfGLPHh4jBZaU0/P7+4vpxYkMVkOWg/l5R9iV1G3QmXAjgJOZ9+L0b rGjgAyGFejDLByqSWOLaqNyxLl7olJS+RZh5bSz0Dua+pNZNZl+NAE4WUAIrm5d0gQqdly 9E4fJhllRO8+hHWTNq2iMGmURzEafbtBd2uPPXDuCsLFecOMNX4LUeOhXUegmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676873793; 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=FnH7jP/QY49LfWnhJ1iB0WVis1HV6nixvBd3aETp+M0=; b=Ickk97Xv40q3h5e5v75Pm6+UlfhFMDrJDowpoXxFAFxBhQroQ3BQ+gME6ys4oiRU+nLq/c p3atid7z4RkYL+AaGMl9uy/MmwiuJLcrj4wN6DSiPExNsharwn2ix6HEbScZFXK78B1hEU uks5va9QkHz2G4eKL9pC6e0euO31whlQGoT/DNJQt9bUtFuYm1iRJXDHSpzpp7ZnKheA9q NAg7qYrNwpwo/FTs0fa/9vHpsk6O7zPpBsIZGvK69gr1l/M5eeg+6ornl3ognUgLI4yJr3 D/8hheSGKgOIQKMjqnKaSmRX9hwHmPY880DJ6QPNi15hqyM6yfBDHV5Hbtr+Uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676873793; a=rsa-sha256; cv=none; b=pidkdDmhG4/Mk+y3RnQNxtUNt2dkSpAgmQ4Ev/h1ZbtvBKKy+/tH8UXZSaSHuf+KEx97wu ihhFk9m0szTBXP0lqEFrYNy1xvOjqaCfk3wd0hvMfqnWFrr/gZflTtTgH6PvvLI0Hpik6P HnH2H90NWx9WDnLK7xkrWn1EUi05KZv4pLksAGlLBTPTyXH2LDRuQwEnDp2qzwiK9JuwZz ZMmEftx5a18XZagrBmMldKRzVu7Z3AGWw4l6wDy6wYOKQbLXi8i9jHakWIqbdv4wwP0m2D /wHNEmJwP1doCQ8EBLHkCy9vn/CnLj6eSIUNWnyCG0suKEdwfjncHCRmsw2uLQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKscx1nwHzWMd; Mon, 20 Feb 2023 06:16:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31K6GXiT091954; Mon, 20 Feb 2023 06:16:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31K6GXc2091953; Mon, 20 Feb 2023 06:16:33 GMT (envelope-from git) Date: Mon, 20 Feb 2023 06:16:33 GMT Message-Id: <202302200616.31K6GXc2091953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 0699f0d43416 - stable/13 - cleanvar: Be more careful when cleaning up /var. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0699f0d43416776d87d20d7953b7d686f1e2e572 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=0699f0d43416776d87d20d7953b7d686f1e2e572 commit 0699f0d43416776d87d20d7953b7d686f1e2e572 Author: Xin LI AuthorDate: 2023-02-13 04:56:17 +0000 Commit: Xin LI CommitDate: 2023-02-20 06:16:20 +0000 cleanvar: Be more careful when cleaning up /var. The cleanvar script uses find -delete to remove stale files under /var, which could lead to unwanted removal of files in some unusual scenarios. For example, when a mounted fdescfs(5) is present under /var/run/samba/fd, find(1) could descend into a directory that is out of /var/run and remove files that should not be removed. To mitigate this, modify the script to use find -x, which restricts the find scope to one file system only instead of descending into mounted file systems. PR: 269213 (cherry picked from commit 39e8c2a29a860bdb69ffcfbc06de4d4ad103b458) --- libexec/rc/rc.d/cleanvar | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.d/cleanvar b/libexec/rc/rc.d/cleanvar index fcfd365268c3..a682021ce5f6 100755 --- a/libexec/rc/rc.d/cleanvar +++ b/libexec/rc/rc.d/cleanvar @@ -31,15 +31,15 @@ cleanvar_start() { if [ -d /var/run -a ! -f /var/run/clean_var ]; then # Skip over logging sockets - find /var/run \( -type f -or -type s ! -name log -and ! -name logpriv \) -delete + find -x /var/run \( -type f -or -type s ! -name log -and ! -name logpriv \) -delete >/var/run/clean_var fi if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then - find /var/spool/lock -type f -delete + find -x /var/spool/lock -type f -delete >/var/spool/lock/clean_var fi if [ -d /var/spool/uucp/.Temp ]; then - find /var/spool/uucp/.Temp -delete + find -x /var/spool/uucp/.Temp -delete fi } From nobody Mon Feb 20 07:18:18 2023 X-Original-To: dev-commits-src-branches@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 4PKv0C2Gd1z3s5vF; Mon, 20 Feb 2023 07:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PKv0C1PYSz3yH5; Mon, 20 Feb 2023 07:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676877499; 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=3sPayIv40/dtoZQaXQurayq7cwafH+d/FkWULbNg3TA=; b=ZTPFYbUZktmOUcyI8d6yo6GBW+EyzvSgj20T5J7fblMDkmLjPKUMUsAh1Lwbm9DxScIl4/ 1s0ysFvjVFNeTp4eFI0QRQYtLoGQ5wvC5pswtvB8GuCIBLTTOfAwl9MuX/90FuRNs3UUp1 8g7tl9jTBSU/e9QtlETmFbagnTw3h21UgxMYqH0xleGDIY00jvEBLFXi9tAkRPcl8LTXMb Xk9MChjDpDi1HHc8eW7gnC73gLsRCrP1/IEKdHUMSinP9DBW6RlrPElxi4/LuxDDSf+13i CXVy4q3Bukb40cf7ctflWX13n9gS6zz8TLwrL+Zd7WuKgQPDPpJK6mKwevlvrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676877499; 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=3sPayIv40/dtoZQaXQurayq7cwafH+d/FkWULbNg3TA=; b=v13N5jr2B/FXXsBQN7dXS960bIM0pIVWPjbO5VMG6fx8HXyJQt2NXXalikIww8zZs+HCzQ nFULMYOpIuoqho/Paqw3OAiO0x8ru4ls3ucKrWcD7QGIFIOqBauC6bCzSnDnyN+tecRh8a xDpGDCkj5yut8pDvo3Lp/VhAbOba/v824N8LrnjhX3jjvlSLJZipu0Jb7+urx4Vx/Thd1D Ez8emlFhmsu45icBtscmiIl2pdZK3ArUyW79+PzisYA5PTSiUw6P/M1kWUuE1BDyPRIvz4 83S5udLQJ7BMIBHuoXB5z77727Ezj6DIxwoJAlmVSup3eKj687rUvYeI5Mmebw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676877499; a=rsa-sha256; cv=none; b=o+ryCHdTVDUUwaP6xplmMz5B8LxfxHb2MwDV05T1oXCSLP6Cesk8x54wzdzaa+k2X3HTJH GBns/sdTKmDUlGhfbPBRGK661wx5Q33T3My8yi/JuF7Xyz4xtlYBB2EBcim8ovAGvXOBSA Ze//Un0y9k7jtZ/q5bTCloBZixPzXJcpXEhEXDgJHYguj4qPk5IWm7cUXcoQ2mzzqGzVTz dmJxni85pToCGeqZ/n+rmwbQ77bmgZJStG82ujBU0W5rZ49S9VTkrbDTDqZ7lWPHrgn0SH /I5eLbXqsO/1QxQxtlQ4VZKQm+WpizlBK5bGk/vJrHVXZywrNGnmJ6p2KScNnA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PKv0C0DmxzXXR; Mon, 20 Feb 2023 07:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31K7II1H077354; Mon, 20 Feb 2023 07:18:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31K7II8G077353; Mon, 20 Feb 2023 07:18:18 GMT (envelope-from git) Date: Mon, 20 Feb 2023 07:18:18 GMT Message-Id: <202302200718.31K7II8G077353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 04b24c1069a5 - stable/12 - cleanvar: Be more careful when cleaning up /var. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 04b24c1069a546056dc33fab1ce7b11d9bf89f14 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=04b24c1069a546056dc33fab1ce7b11d9bf89f14 commit 04b24c1069a546056dc33fab1ce7b11d9bf89f14 Author: Xin LI AuthorDate: 2023-02-13 04:56:17 +0000 Commit: Xin LI CommitDate: 2023-02-20 07:18:06 +0000 cleanvar: Be more careful when cleaning up /var. The cleanvar script uses find -delete to remove stale files under /var, which could lead to unwanted removal of files in some unusual scenarios. For example, when a mounted fdescfs(5) is present under /var/run/samba/fd, find(1) could descend into a directory that is out of /var/run and remove files that should not be removed. To mitigate this, modify the script to use find -x, which restricts the find scope to one file system only instead of descending into mounted file systems. PR: 269213 (cherry picked from commit 39e8c2a29a860bdb69ffcfbc06de4d4ad103b458) --- libexec/rc/rc.d/cleanvar | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.d/cleanvar b/libexec/rc/rc.d/cleanvar index fcfd365268c3..a682021ce5f6 100755 --- a/libexec/rc/rc.d/cleanvar +++ b/libexec/rc/rc.d/cleanvar @@ -31,15 +31,15 @@ cleanvar_start() { if [ -d /var/run -a ! -f /var/run/clean_var ]; then # Skip over logging sockets - find /var/run \( -type f -or -type s ! -name log -and ! -name logpriv \) -delete + find -x /var/run \( -type f -or -type s ! -name log -and ! -name logpriv \) -delete >/var/run/clean_var fi if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then - find /var/spool/lock -type f -delete + find -x /var/spool/lock -type f -delete >/var/spool/lock/clean_var fi if [ -d /var/spool/uucp/.Temp ]; then - find /var/spool/uucp/.Temp -delete + find -x /var/spool/uucp/.Temp -delete fi } From nobody Mon Feb 20 14:34:04 2023 X-Original-To: dev-commits-src-branches@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 4PL4g05s11z3st1L; Mon, 20 Feb 2023 14:34:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL4g05NcYz3v9g; Mon, 20 Feb 2023 14:34:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903644; 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=JURvuk+fyxxB0p6gtbs1PF7VE6GQ6IL44akTUiG3Pww=; b=JP0qXbmDe2rwUT2uFWTE69DNIBniIrutmZsbzTaDplxqIiEGoSJEmqts9ll2yUVBA6eyB5 Vze1Knl5ubDBishL05kx6CMF4WGeF8oIiNz+t6f7AK398FyeTwnJnM+unLXMkY6OvzYmVr 1oxKWh/aG0W6PR4K0805MRVkjQQgElJKmpNpG/XDxcEyMVq4rGFkjNkYTj6c5KTJElNEDk kDRN1ZWWTrg2WdrrV7qDi8Sw4tjxH+qsR0Jxxx7+L0uzH3Ya3OCiL4AWBL3NwUW8N6c/m0 E0pG6MPWnLOI/9WrWeXI0lQtO+zGrLGO+XpaiH19IXbwpzQYylQRTVidp0Jelg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903644; 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=JURvuk+fyxxB0p6gtbs1PF7VE6GQ6IL44akTUiG3Pww=; b=o42Y2wxqT6rK+Zij377ltY1g8N3TUw4jUSYuP7wV2luO7R2u1Js3R8GuJjui0DTvRpohzz YDqsdaHDe1uY7aTSX3Lhb3Z+9dQyAMqzC6lvzj3wrK2kKNBb19SEwJClSxgq6AqhEdUOKZ 0YXvYr+z6b2OIjmpaDaJEVMM2YF6OqUFprq1Uo1rPUstO+c2k+EE2+eFCv+CcIXC5ffjbb 3+Ru/niTAwr+drETNXEJpHpHumPfe+czD1TNXr4PBhOHQqU7PESWPZ/DV/dYwrlGL2ODkI 0utaKpyEiqx8sLV4r4ZR8O04ELZLD71KkVHJdhSlP8BKiLGh0ohjQVwFMrawMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676903644; a=rsa-sha256; cv=none; b=vFVQ8EyFSl4sncUJO0GzNWquJ6nbExE0khn/4vZ465Hd89fXZMSGaGMBgcN33BDFdb9rao EiZ5AYBMCDf0tscHzU5Xq+CCU9HSweobq+hU3u3dceRxQf7ZlVAHH0w4Fmuj9X6vJ5toVS NMDP+aF5L8CFlpKvsCoM9dzdN0pGwU8DAzM9G/6q8L8cC+TXarhkH6u5EHGabBmQPdF3M1 VtdTw5WZ9I4N8Pgav7q8Shtx4a31H+Ozl/FXJMb+GcyXcaSk9/U6BSTnISVMtasRfHiDdq 6dp5+6nAcquORfjm06alg9fSy0zv/l2vV/Mh/pMfXD+NQ+Kl/iI1Xdc0DoKIgw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL4g04SLLzl1C; Mon, 20 Feb 2023 14:34:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KEY4ma005707; Mon, 20 Feb 2023 14:34:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KEY4Sj005706; Mon, 20 Feb 2023 14:34:04 GMT (envelope-from git) Date: Mon, 20 Feb 2023 14:34:04 GMT Message-Id: <202302201434.31KEY4Sj005706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: ac40ea6fbb4e - stable/13 - netlink: call genetlink notification handler upon successful family search. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ac40ea6fbb4e6af98a4540fc8fd5a3e824cb181d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=ac40ea6fbb4e6af98a4540fc8fd5a3e824cb181d commit ac40ea6fbb4e6af98a4540fc8fd5a3e824cb181d Author: Alexander V. Chernikov AuthorDate: 2023-02-17 17:58:53 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 14:33:27 +0000 netlink: call genetlink notification handler upon successful family search. MFC after: 3 days (cherry picked from commit 7cbe771f013f6cf3316910648f6d46641cad7f44) --- sys/netlink/netlink_generic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/netlink/netlink_generic.c b/sys/netlink/netlink_generic.c index 028ea24fc5e9..066379e2afae 100644 --- a/sys/netlink/netlink_generic.c +++ b/sys/netlink/netlink_generic.c @@ -160,9 +160,8 @@ genl_unregister_family(const char *family_name) GENL_LOCK(); struct genl_family *gf = find_family(family_name); - nlctrl_notify(gf, CTRL_CMD_DELFAMILY); - if (gf != NULL) { + nlctrl_notify(gf, CTRL_CMD_DELFAMILY); found = true; unregister_groups(gf); /* TODO: zero pointer first */ From nobody Mon Feb 20 14:34:05 2023 X-Original-To: dev-commits-src-branches@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 4PL4g16xf1z3st2v; Mon, 20 Feb 2023 14:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL4g160spz3v0n; Mon, 20 Feb 2023 14:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903645; 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=9eAWJaDxP2MZierYFMGy6/6myB6BgWaKHlxRIy86ZeY=; b=n0tFeYNeuuOdOJrvBFRRf+9k/JOiVvDBy1O0PTQHoQcQXEWbOW69NFVEtxtRsSKGPezUCu FO+rHcTM5Mhg4lYuEGvewV0LIQUNRx5Fi5276JDXsXJ7vXd5Yi+oE9pu1Yo0ilgUCaqvrS FAK1YhZosQsYYjtI9bF+2np4R8leq3CEOJmAA1YoT2pJ9TzfwpMycbWVTjkHyx3aBKpi8b 86j7wMCxv4s0VMwjQEnBU3tWoosxMIK41nEyteMoj4uVngv32vE27YAYiuYhyiHvNZF+2e Ff7Mw22Id0ky4xVyxJFBojVP1JE74dFBi2nHd1lyex7QOqLPMEKGMfsU5Llmow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903645; 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=9eAWJaDxP2MZierYFMGy6/6myB6BgWaKHlxRIy86ZeY=; b=rVrMIeT/IS28aeaxkwfsRqTKiX87vepbyPgzeGjhBo7tXdkY2jmhu6/fNUBm99fNijAgKS 1jir6/b4FU1kr/ROi0d6NVcUceYYBv6abURHouMufT/o1FmahgelECz3wGZCmKPtAYArtM 6fFD9eesSllf4HG6nM71Fa8lO4YV7u09je+20e9ygb0TpbS9c/TPhbJv8PwmGuruF+2r6J M7JNq5rBOKSezeMwWRLCsEagzAsND6OY70BRjxqbxezenp5Wqu4xOr9mcUQHptiqjx12lZ VRcrJrpdglXjgcP4mEZ0g8svwpS8q8iYzubr0K2OAvuHEg67SG6IynKSbgiK9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676903645; a=rsa-sha256; cv=none; b=QkT2V5frpvWocKxUnZDg7wNqh/7nl5lbINbVXAhwkElK3rPuFFmPRAqEYArfRuyOdzYQjg 9qXbCWo4crl13H//NyMxRRc6iuQ/PlbnyYZTMrxTdFcDqQ39L8ZN592eaRZBCL6xri/9uy rsEM2PKwyEyYC0pdw+iITiYRsdJXgSUbQoo2Hb9aVJJ8vDPi8lPtQifo2pyzBANAk2P0V4 +g83mubD+60YNg9xggoZ8KRuoc2WSChgelrReInzFQU9VptP3jInqZOAD2VI0dZGV6CZXI XST2L1XZMyvOzQt44huz07WhpQHATB8joN2LXekOVWgfjv+/FXEvsKNj0UYlBw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL4g156GKzkt6; Mon, 20 Feb 2023 14:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KEY5kt005729; Mon, 20 Feb 2023 14:34:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KEY5JJ005728; Mon, 20 Feb 2023 14:34:05 GMT (envelope-from git) Date: Mon, 20 Feb 2023 14:34:05 GMT Message-Id: <202302201434.31KEY5JJ005728@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 72467b39f1db - stable/13 - netlink: return optional metadata with the operation result. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 72467b39f1db794f2ac54ac9baa1de3166507c6b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=72467b39f1db794f2ac54ac9baa1de3166507c6b commit 72467b39f1db794f2ac54ac9baa1de3166507c6b Author: Alexander V. Chernikov AuthorDate: 2023-02-09 14:53:44 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 14:33:28 +0000 netlink: return optional metadata with the operation result. Some operations like interface creation may need to return metadata - in this case, interface name - back to the caller if the operation is successful. This change implements attaching an `NLMSGERR_ATTR_COOKIE` nla to the operation reply message via `nlmsg_report_cookie()`. Additionally, on successful interface creation, interface index and interface name are returned in the `IFLA_NEW_IFINDEX` and `IFLA_IFNAME TLVs, encapsulated in the `NLMSGERR_ATTR_COOKIE`. Reviewed By: pauamma Differential Revision: https://reviews.freebsd.org/D38283 MFC after: 1 week (cherry picked from commit 25c2dd2f2c6c6144d59d463c95f0471301d6efaa) --- share/man/man4/netlink.4 | 4 ++ share/man/man4/rtnetlink.4 | 7 ++ sys/netlink/netlink_message_parser.c | 19 +++++ sys/netlink/netlink_message_parser.h | 4 ++ sys/netlink/netlink_message_writer.c | 6 +- sys/netlink/netlink_message_writer.h | 31 ++++++++ sys/netlink/route/iface_drivers.c | 37 ++++++++++ tests/atf_python/sys/net/netlink.py | 134 +++++++++++++++++++---------------- tests/sys/netlink/test_rtnl_iface.py | 35 +++++++++ 9 files changed, 213 insertions(+), 64 deletions(-) diff --git a/share/man/man4/netlink.4 b/share/man/man4/netlink.4 index 1894de5841fe..fdcc823b01a6 100644 --- a/share/man/man4/netlink.4 +++ b/share/man/man4/netlink.4 @@ -217,6 +217,10 @@ socket option is set, the kernel may add a string TLV with the textual error description, optionally followed by the .Dv NLMSGERR_ATTR_OFFS TLV, indicating the offset from the message start that triggered an error. +Some operations may return additional metadata encapsulated in the +.Dv NLMSGERR_ATTR_COOKIE +TLV. +The metadata format is specific to the operation. If the operation reply is a multipart message, then no .Dv NLMSG_ERROR reply is generated, only a diff --git a/share/man/man4/rtnetlink.4 b/share/man/man4/rtnetlink.4 index 5849508b74c2..2c601251f7b0 100644 --- a/share/man/man4/rtnetlink.4 +++ b/share/man/man4/rtnetlink.4 @@ -284,6 +284,13 @@ struct ifinfomsg { Creates a new interface. The only mandatory TLV is .Dv IFLA_IFNAME . +The following attributes are returned inside the nested +.Dv NLMSGERR_ATTR_COOKIE : +.Pp +.Bd -literal -offset indent -compact +IFLA_NEW_IFINDEX (uint32) created interface index +IFLA_IFNAME (string) created interface name +.Ed .Ss RTM_DELLINK Deletes the interface specified by .Dv IFLA_IFNAME . diff --git a/sys/netlink/netlink_message_parser.c b/sys/netlink/netlink_message_parser.c index dc0c38712613..e30138266d9d 100644 --- a/sys/netlink/netlink_message_parser.c +++ b/sys/netlink/netlink_message_parser.c @@ -78,6 +78,25 @@ nlmsg_report_err_offset(struct nl_pstate *npt, uint32_t off) return (true); } +void +nlmsg_report_cookie(struct nl_pstate *npt, struct nlattr *nla) +{ + MPASS(nla->nla_type == NLMSGERR_ATTR_COOKIE); + MPASS(nla->nla_len >= sizeof(struct nlattr)); + npt->cookie = nla; +} + +void +nlmsg_report_cookie_u32(struct nl_pstate *npt, uint32_t val) +{ + struct nlattr *nla = npt_alloc(npt, sizeof(*nla) + sizeof(uint32_t)); + + nla->nla_type = NLMSGERR_ATTR_COOKIE; + nla->nla_len = sizeof(*nla) + sizeof(uint32_t); + memcpy(nla + 1, &val, sizeof(uint32_t)); + nlmsg_report_cookie(npt, nla); +} + static const struct nlattr_parser * search_states(const struct nlattr_parser *ps, int pslen, int key) { diff --git a/sys/netlink/netlink_message_parser.h b/sys/netlink/netlink_message_parser.h index 94f0ca5260d7..083c93dcbf8d 100644 --- a/sys/netlink/netlink_message_parser.h +++ b/sys/netlink/netlink_message_parser.h @@ -71,6 +71,7 @@ struct nl_pstate { uint32_t err_off; /* error offset from hdr start */ int error; /* last operation error */ char *err_msg; /* Description of last error */ + struct nlattr *cookie; /* NLA to return to the userspace */ bool strict; /* Strict parsing required */ }; @@ -198,6 +199,9 @@ bool nlmsg_report_err_msg(struct nl_pstate *npt, const char *fmt, ...); bool nlmsg_report_err_offset(struct nl_pstate *npt, uint32_t off); +void nlmsg_report_cookie(struct nl_pstate *npt, struct nlattr *nla); +void nlmsg_report_cookie_u32(struct nl_pstate *npt, uint32_t val); + /* * Have it inline so compiler can optimize field accesses into * the list of direct function calls without iteration. diff --git a/sys/netlink/netlink_message_writer.c b/sys/netlink/netlink_message_writer.c index 2187c40f2786..8a9315eedd1b 100644 --- a/sys/netlink/netlink_message_writer.c +++ b/sys/netlink/netlink_message_writer.c @@ -643,10 +643,6 @@ nlmsg_ack(struct nlpcb *nlp, int error, struct nlmsghdr *hdr, if ((npt->err_msg || npt->err_off) && nlp->nl_flags & NLF_EXT_ACK) nl_flags |= NLM_F_ACK_TLVS; - /* - * TODO: handle cookies - */ - NL_LOG(LOG_DEBUG3, "acknowledging message type %d seq %d", hdr->nlmsg_type, hdr->nlmsg_seq); @@ -662,6 +658,8 @@ nlmsg_ack(struct nlpcb *nlp, int error, struct nlmsghdr *hdr, nlattr_add_string(nw, NLMSGERR_ATTR_MSG, npt->err_msg); if (npt->err_off != 0 && nlp->nl_flags & NLF_EXT_ACK) nlattr_add_u32(nw, NLMSGERR_ATTR_OFFS, npt->err_off); + if (npt->cookie != NULL) + nlattr_add_raw(nw, npt->cookie); if (nlmsg_end(nw)) return; diff --git a/sys/netlink/netlink_message_writer.h b/sys/netlink/netlink_message_writer.h index 99f50fb94213..bb4bb759251a 100644 --- a/sys/netlink/netlink_message_writer.h +++ b/sys/netlink/netlink_message_writer.h @@ -163,6 +163,27 @@ _nlmsg_reserve_attr(struct nl_writer *nw, uint16_t nla_type, uint16_t sz) } #define nlmsg_reserve_attr(_ns, _at, _t) ((_t *)_nlmsg_reserve_attr(_ns, _at, NLA_ALIGN(sizeof(_t)))) +static inline bool +nlattr_add_nla(struct nl_writer *nw, const struct nlattr *nla_src) +{ + MPASS(nla_src->nla_len >= sizeof(struct nlattr)); + + int required_len = NLA_ALIGN(nla_src->nla_len); + if (__predict_false(nw->offset + required_len > nw->alloc_len)) { + if (!nlmsg_refill_buffer(nw, required_len)) + return (false); + } + + struct nlattr *nla = (struct nlattr *)(&nw->data[nw->offset]); + if ((nla_src->nla_len % 4) != 0) { + /* clear padding bytes */ + bzero((char *)nla + nla_src->nla_len - 4, 4); + } + memcpy(nla, nla_src, nla_src->nla_len); + nw->offset += required_len; + return (true); +} + static inline bool nlattr_add(struct nl_writer *nw, int attr_type, int attr_len, const void *data) { @@ -188,6 +209,16 @@ nlattr_add(struct nl_writer *nw, int attr_type, int attr_len, const void *data) return (true); } +static inline bool +nlattr_add_raw(struct nl_writer *nw, const struct nlattr *nla_src) +{ + int attr_len = nla_src->nla_len - sizeof(struct nlattr); + + MPASS(attr_len >= 0); + + return (nlattr_add(nw, nla_src->nla_type, attr_len, (const void *)(nla_src + 1))); +} + static inline bool nlattr_add_u8(struct nl_writer *nw, int attrtype, uint8_t value) { diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c index 1b8c27bfca68..7cfaa5a6614b 100644 --- a/sys/netlink/route/iface_drivers.c +++ b/sys/netlink/route/iface_drivers.c @@ -109,6 +109,41 @@ modify_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, return (0); } +/* + * Saves the resulting ifindex and ifname to report them + * to userland along with the operation result. + * NLA format: + * NLMSGERR_ATTR_COOKIE(nested) + * IFLA_NEW_IFINDEX(u32) + * IFLA_IFNAME(string) + */ +static void +store_cookie(struct nl_pstate *npt, struct ifnet *ifp) +{ + int ifname_len = strlen(if_name(ifp)); + uint32_t ifindex = (uint32_t)ifp->if_index; + + int nla_len = sizeof(struct nlattr) * 3 + + sizeof(ifindex) + NL_ITEM_ALIGN(ifname_len + 1); + struct nlattr *nla_cookie = npt_alloc(npt, nla_len); + + /* Nested TLV */ + nla_cookie->nla_len = nla_len; + nla_cookie->nla_type = NLMSGERR_ATTR_COOKIE; + + struct nlattr *nla = nla_cookie + 1; + nla->nla_len = sizeof(struct nlattr) + sizeof(ifindex); + nla->nla_type = IFLA_NEW_IFINDEX; + memcpy(NLA_DATA(nla), &ifindex, sizeof(ifindex)); + + nla = NLA_NEXT(nla); + nla->nla_len = sizeof(struct nlattr) + ifname_len + 1; + nla->nla_type = IFLA_IFNAME; + strlcpy(NLA_DATA(nla), if_name(ifp), ifname_len + 1); + + nlmsg_report_cookie(npt, nla_cookie); +} + /* * Generic creation interface handler. * Responsible for creating interfaces w/o parameters and setting @@ -135,6 +170,8 @@ create_generic(struct nl_parsed_link *lattrs, const struct nlattr_bmask *bm, if (!success) return (EINVAL); error = modify_generic(ifp, lattrs, bm, nlp, npt); + if (error == 0) + store_cookie(npt, ifp); if_rele(ifp); } diff --git a/tests/atf_python/sys/net/netlink.py b/tests/atf_python/sys/net/netlink.py index 57c8582627cf..ba7d41c7cbf8 100644 --- a/tests/atf_python/sys/net/netlink.py +++ b/tests/atf_python/sys/net/netlink.py @@ -950,58 +950,68 @@ def prepare_attrs_map(attrs: List[AttrDescr]) -> Dict[str, Dict]: return ret -rtnl_route_attrs = [ - AttrDescr(RtattrType.RTA_DST, NlAttrIp), - AttrDescr(RtattrType.RTA_SRC, NlAttrIp), - AttrDescr(RtattrType.RTA_IIF, NlAttrIfindex), - AttrDescr(RtattrType.RTA_OIF, NlAttrIfindex), - AttrDescr(RtattrType.RTA_GATEWAY, NlAttrTable), - AttrDescr(RtattrType.RTA_VIA, NlAttrVia), - AttrDescr(RtattrType.RTA_NH_ID, NlAttrNhId), - AttrDescr( - RtattrType.RTA_METRICS, - NlAttrNested, - [ - AttrDescr(NlRtaxType.RTAX_MTU, NlAttrU32), - ], - ), -] - -nldone_attrs = [] - -nlerr_attrs = [ - AttrDescr(NlErrattrType.NLMSGERR_ATTR_MSG, NlAttrStr), - AttrDescr(NlErrattrType.NLMSGERR_ATTR_OFFS, NlAttrU32), -] - -rtnl_ifla_attrs = [ - AttrDescr(IflattrType.IFLA_ADDRESS, NlAttrMac), - AttrDescr(IflattrType.IFLA_BROADCAST, NlAttrMac), - AttrDescr(IflattrType.IFLA_IFNAME, NlAttrStr), - AttrDescr(IflattrType.IFLA_MTU, NlAttrU32), - AttrDescr(IflattrType.IFLA_PROMISCUITY, NlAttrU32), - AttrDescr(IflattrType.IFLA_OPERSTATE, NlAttrU8), - AttrDescr(IflattrType.IFLA_CARRIER, NlAttrU8), - AttrDescr(IflattrType.IFLA_IFALIAS, NlAttrStr), - AttrDescr(IflattrType.IFLA_STATS64, NlAttrIfStats), - AttrDescr( - IflattrType.IFLA_LINKINFO, - NlAttrNested, - [ - AttrDescr(IflinkInfo.IFLA_INFO_KIND, NlAttrStr), - AttrDescr(IflinkInfo.IFLA_INFO_DATA, NlAttr), - ], - ), -] - -rtnl_ifa_attrs = [ - AttrDescr(IfattrType.IFA_ADDRESS, NlAttrIp), - AttrDescr(IfattrType.IFA_LOCAL, NlAttrIp), - AttrDescr(IfattrType.IFA_LABEL, NlAttrStr), - AttrDescr(IfattrType.IFA_BROADCAST, NlAttrIp), - AttrDescr(IfattrType.IFA_ANYCAST, NlAttrIp), - AttrDescr(IfattrType.IFA_FLAGS, NlAttrU32), -] +rtnl_route_attrs = prepare_attrs_map( + [ + AttrDescr(RtattrType.RTA_DST, NlAttrIp), + AttrDescr(RtattrType.RTA_SRC, NlAttrIp), + AttrDescr(RtattrType.RTA_IIF, NlAttrIfindex), + AttrDescr(RtattrType.RTA_OIF, NlAttrIfindex), + AttrDescr(RtattrType.RTA_GATEWAY, NlAttrTable), + AttrDescr(RtattrType.RTA_VIA, NlAttrVia), + AttrDescr(RtattrType.RTA_NH_ID, NlAttrNhId), + AttrDescr( + RtattrType.RTA_METRICS, + NlAttrNested, + [ + AttrDescr(NlRtaxType.RTAX_MTU, NlAttrU32), + ], + ), + ] +) + +nldone_attrs = prepare_attrs_map([]) + +nlerr_attrs = prepare_attrs_map( + [ + AttrDescr(NlErrattrType.NLMSGERR_ATTR_MSG, NlAttrStr), + AttrDescr(NlErrattrType.NLMSGERR_ATTR_OFFS, NlAttrU32), + AttrDescr(NlErrattrType.NLMSGERR_ATTR_COOKIE, NlAttr), + ] +) + +rtnl_ifla_attrs = prepare_attrs_map( + [ + AttrDescr(IflattrType.IFLA_ADDRESS, NlAttrMac), + AttrDescr(IflattrType.IFLA_BROADCAST, NlAttrMac), + AttrDescr(IflattrType.IFLA_IFNAME, NlAttrStr), + AttrDescr(IflattrType.IFLA_MTU, NlAttrU32), + AttrDescr(IflattrType.IFLA_PROMISCUITY, NlAttrU32), + AttrDescr(IflattrType.IFLA_OPERSTATE, NlAttrU8), + AttrDescr(IflattrType.IFLA_CARRIER, NlAttrU8), + AttrDescr(IflattrType.IFLA_IFALIAS, NlAttrStr), + AttrDescr(IflattrType.IFLA_STATS64, NlAttrIfStats), + AttrDescr(IflattrType.IFLA_NEW_IFINDEX, NlAttrU32), + AttrDescr( + IflattrType.IFLA_LINKINFO, + NlAttrNested, + [ + AttrDescr(IflinkInfo.IFLA_INFO_KIND, NlAttrStr), + AttrDescr(IflinkInfo.IFLA_INFO_DATA, NlAttr), + ], + ), + ] +) + +rtnl_ifa_attrs = prepare_attrs_map( + [ + AttrDescr(IfattrType.IFA_ADDRESS, NlAttrIp), + AttrDescr(IfattrType.IFA_LOCAL, NlAttrIp), + AttrDescr(IfattrType.IFA_LABEL, NlAttrStr), + AttrDescr(IfattrType.IFA_BROADCAST, NlAttrIp), + AttrDescr(IfattrType.IFA_ANYCAST, NlAttrIp), + AttrDescr(IfattrType.IFA_FLAGS, NlAttrU32), + ] +) class BaseNetlinkMessage(object): @@ -1140,7 +1150,7 @@ class StdNetlinkMessage(BaseNetlinkMessage): raise return self - def _parse_attrs(self, data: bytes, attr_map): + def parse_attrs(self, data: bytes, attr_map): ret = [] off = 0 while len(data) - off >= 4: @@ -1157,7 +1167,7 @@ class StdNetlinkMessage(BaseNetlinkMessage): val = v["ad"].cls.from_bytes(data[off : off + nla_len], v["ad"].val) if "child" in v: # nested - attrs, _ = self._parse_attrs(data[off : off + nla_len], v["child"]) + attrs, _ = self.parse_attrs(data[off : off + nla_len], v["child"]) val = NlAttrNested(raw_nla_type, attrs) else: # unknown attribute @@ -1167,7 +1177,7 @@ class StdNetlinkMessage(BaseNetlinkMessage): return ret, off def parse_nla_list(self, data: bytes) -> List[NlAttr]: - return self._parse_attrs(data, self.nl_attrs_map) + return self.parse_attrs(data, self.nl_attrs_map) def print_message(self): self.print_nl_header(self.nl_hdr) @@ -1178,7 +1188,7 @@ class StdNetlinkMessage(BaseNetlinkMessage): class NetlinkDoneMessage(StdNetlinkMessage): messages = [NlMsgType.NLMSG_DONE.value] - nl_attrs_map = prepare_attrs_map(nldone_attrs) + nl_attrs_map = nldone_attrs @property def error_code(self): @@ -1197,7 +1207,7 @@ class NetlinkDoneMessage(StdNetlinkMessage): class NetlinkErrorMessage(StdNetlinkMessage): messages = [NlMsgType.NLMSG_ERROR.value] - nl_attrs_map = prepare_attrs_map(nlerr_attrs) + nl_attrs_map = nlerr_attrs @property def error_code(self): @@ -1217,6 +1227,10 @@ class NetlinkErrorMessage(StdNetlinkMessage): return nla.u32 return None + @property + def cookie(self): + return self.get_nla(NlErrattrType.NLMSGERR_ATTR_COOKIE) + def parse_base_header(self, data): if len(data) < sizeof(Nlmsgerr): raise ValueError("length less than nlmsgerr header") @@ -1257,7 +1271,7 @@ class NetlinkRtMessage(BaseNetlinkRtMessage): NlRtMsgType.RTM_DELROUTE.value, NlRtMsgType.RTM_GETROUTE.value, ] - nl_attrs_map = prepare_attrs_map(rtnl_route_attrs) + nl_attrs_map = rtnl_route_attrs def __init__(self, helper, nlm_type): super().__init__(helper, nlm_type) @@ -1297,7 +1311,7 @@ class NetlinkIflaMessage(BaseNetlinkRtMessage): NlRtMsgType.RTM_DELLINK.value, NlRtMsgType.RTM_GETLINK.value, ] - nl_attrs_map = prepare_attrs_map(rtnl_ifla_attrs) + nl_attrs_map = rtnl_ifla_attrs def __init__(self, helper, nlm_type): super().__init__(helper, nlm_type) @@ -1329,7 +1343,7 @@ class NetlinkIfaMessage(BaseNetlinkRtMessage): NlRtMsgType.RTM_DELADDR.value, NlRtMsgType.RTM_GETADDR.value, ] - nl_attrs_map = prepare_attrs_map(rtnl_ifa_attrs) + nl_attrs_map = rtnl_ifa_attrs def __init__(self, helper, nlm_type): super().__init__(helper, nlm_type) diff --git a/tests/sys/netlink/test_rtnl_iface.py b/tests/sys/netlink/test_rtnl_iface.py index 7cff592b1676..ecc932c6213e 100644 --- a/tests/sys/netlink/test_rtnl_iface.py +++ b/tests/sys/netlink/test_rtnl_iface.py @@ -17,6 +17,7 @@ from atf_python.sys.net.netlink import NlmBaseFlags from atf_python.sys.net.netlink import NlmNewFlags from atf_python.sys.net.netlink import NlMsgType from atf_python.sys.net.netlink import NlRtMsgType +from atf_python.sys.net.netlink import rtnl_ifla_attrs from atf_python.sys.net.vnet import SingleVnetTestTemplate @@ -91,6 +92,40 @@ class TestRtNlIface(NetlinkTestTemplate, SingleVnetTestTemplate): self.get_interface_byname("lo10") + @pytest.mark.require_user("root") + def test_create_iface_plain_retvals(self): + """Tests loopback creation w/o any parameters""" + flags = NlmNewFlags.NLM_F_EXCL.value | NlmNewFlags.NLM_F_CREATE.value + msg = NetlinkIflaMessage(self.helper, NlRtMsgType.RTM_NEWLINK.value) + msg.nl_hdr.nlmsg_flags = ( + flags | NlmBaseFlags.NLM_F_ACK.value | NlmBaseFlags.NLM_F_REQUEST.value + ) + msg.add_nla(NlAttrStr(IflattrType.IFLA_IFNAME, "lo10")) + msg.add_nla( + NlAttrNested( + IflattrType.IFLA_LINKINFO, + [ + NlAttrStrn(IflinkInfo.IFLA_INFO_KIND, "lo"), + ], + ) + ) + + rx_msg = self.get_reply(msg) + assert rx_msg.is_type(NlMsgType.NLMSG_ERROR) + assert rx_msg.error_code == 0 + assert rx_msg.cookie is not None + nla_list, _ = rx_msg.parse_attrs(bytes(rx_msg.cookie)[4:], rtnl_ifla_attrs) + nla_map = {n.nla_type: n for n in nla_list} + assert IflattrType.IFLA_IFNAME.value in nla_map + assert nla_map[IflattrType.IFLA_IFNAME.value].text == "lo10" + assert IflattrType.IFLA_NEW_IFINDEX.value in nla_map + assert nla_map[IflattrType.IFLA_NEW_IFINDEX.value].u32 > 0 + + lo_msg = self.get_interface_byname("lo10") + assert ( + lo_msg.base_hdr.ifi_index == nla_map[IflattrType.IFLA_NEW_IFINDEX.value].u32 + ) + @pytest.mark.require_user("root") def test_create_iface_attrs(self): """Tests interface creation with additional properties""" From nobody Mon Feb 20 14:34:06 2023 X-Original-To: dev-commits-src-branches@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 4PL4g309x1z3st2x; Mon, 20 Feb 2023 14:34:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL4g26jRjz3tvq; Mon, 20 Feb 2023 14:34:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903646; 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=Tv/UAO4K6i/gORkw8IeDdEg7cXv+Zo3OHJApWRvqPxY=; b=xl+RVHUShapKciSSQ+pHI8z/BrCuxviCPS1Z0mZx410+fsTYm3voR+AIsyAS3nJ41CX0M/ L+rxevFa68u2JOQKrUCAu/9lzFivT0n9t4lwtyvE5CtZWxHZm3LCLhreVirD4tGbhRdgJu qCfAw0U5D28WpaYrdh4rFoo3mu34KgHHOcCmpIwMO46NIifcQzHBIRp25QN36wYIomyUV5 Oh1Xt3Tggg2n+UbWpdx96Epzonv2u6SF+0B42Xk5WYmA/YF7eICSnNmeSH0i5wA7ALfKEm eocqlvRD7yvFZgljOJ85AaEkaxycMIKP3WTxxENHIuyu4WrhomFBUH1exoVPKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903646; 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=Tv/UAO4K6i/gORkw8IeDdEg7cXv+Zo3OHJApWRvqPxY=; b=EyPbRIvEfUDT8apt8/HQKhQ56UYpiY7pm5UDEuKIyvOal0ge9XMyARmBKaIxlgHlyU5PRJ 3gkFC9uNUGVFMcCNtyvvRvOyVm8Wy866xkhxDPe9duvbx/zDYvklgOE4L8Sj8+E9iquOis 85+9aAiZT65VCndbIRb5b2pyBUEn6Lz30bqCj8eQKdDtDbQzQNE2IeazfIXmPtJSE1Nptg Qy4gWymqtvUJw7vniGycHXzO7QfJr6yZwjxnfM71v1EU661RjMCw3nx0pKmg/GBoS2l+ST K/YM+9R5ONus4FSUmWGS3Nb+1xw6p8vrYBp+PKw5anHVyn/u7ad9SRHaxf701w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676903646; a=rsa-sha256; cv=none; b=xvqoJU3n8utGTm9wtxLUUqstenbdtyWti+Zut+d8qxwvm/MmTJIIcSQ3h8Wp+Fb6N1H2T1 Mi3QF+hBV2ShNEB6m/d+SwYGuhyFKHjra8vph5NC8QVP8Y+HOyrRLyd1ZErigOEuueQcVw QlZJvaMs9PjMhs+U19WI0sIva5x6uA7B+aKPsmUR01uKDVewzJERJ6yTS+AFd9N6HIUnzB ds3M30ZPV+937VEnFpepCvPJUkFSfOJvk0rfYHmHpuaY74CU0GId4M7l+Ot9O8NfRxHyhN CkPifZmBc8v4LYuXUIlL2y+gUD1XYLGAXnvV8sD5mkT8s+WI4q1ACLS57CmGRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL4g25kqqzknC; Mon, 20 Feb 2023 14:34:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KEY61N005748; Mon, 20 Feb 2023 14:34:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KEY6fS005747; Mon, 20 Feb 2023 14:34:06 GMT (envelope-from git) Date: Mon, 20 Feb 2023 14:34:06 GMT Message-Id: <202302201434.31KEY6fS005747@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: ed363bbc624e - stable/13 - fibs: restrict jail_attach(2) if process fibnum >= numfibs in the jail. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ed363bbc624e3a69da1867e86f979b30668a0934 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=ed363bbc624e3a69da1867e86f979b30668a0934 commit ed363bbc624e3a69da1867e86f979b30668a0934 Author: Alexander V. Chernikov AuthorDate: 2023-02-11 15:43:23 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 14:33:28 +0000 fibs: restrict jail_attach(2) if process fibnum >= numfibs in the jail. Reported by: olivier Tested by: olivier Reviewed by: kp, glebius Differential Revision: https://reviews.freebsd.org/D38505 MFC after: 1 week (cherry picked from commit 69e7d9b7e6b369b760e1f189af2e25587b56a102) --- sys/net/route/route_tables.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c index 65829676d76f..406bedc4c769 100644 --- a/sys/net/route/route_tables.c +++ b/sys/net/route/route_tables.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -162,6 +163,39 @@ sys_setfib(struct thread *td, struct setfib_args *uap) return (error); } +static int +rtables_check_proc_fib(void *obj, void *data) +{ + struct prison *pr = obj; + struct thread *td = data; + int error = 0; + + if (TD_TO_VNET(td) != pr->pr_vnet) { + /* number of fibs may be lower in a new vnet */ + CURVNET_SET(pr->pr_vnet); + if (td->td_proc->p_fibnum >= V_rt_numfibs) + error = EINVAL; + CURVNET_RESTORE(); + } + return (error); +} + +static void +rtables_prison_destructor(void *data) +{ +} + +static void +rtables_init(void) +{ + osd_method_t methods[PR_MAXMETHOD] = { + [PR_METHOD_ATTACH] = rtables_check_proc_fib, + }; + osd_jail_register(rtables_prison_destructor, methods); +} +SYSINIT(rtables_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rtables_init, NULL); + + /* * If required, copy interface routes from existing tables to the * newly-created routing table. From nobody Mon Feb 20 14:34:07 2023 X-Original-To: dev-commits-src-branches@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 4PL4g41FsQz3st5g; Mon, 20 Feb 2023 14:34:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL4g40XmGz3vX2; Mon, 20 Feb 2023 14:34:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903648; 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=HoGQ6YLHLJU5kc4Bns/J7Lq9FxMMkVFcK+h1r285nlE=; b=klQ8XrJ4MiUA2votauypW0DxGoeRTdpX8q5wRb9Aume7u/hHf6F7ws4oLs6oloMZslRv4U yjpySXGSYTceZlyr8bFhvAbMaFn5m0ftTow7MUX9yQ9LSfcLxO4DQXAJSxsbLKt0KKChNT fdQ1rGaN9jPv3kXaaK+MuQRhHhKLztL7eSnrilx7OcdmwzAIgUjzr0k8MNZYd31oLeAtKJ ynooBfMZKzdt5T3KlJGM0lmFFx/SdFXaFB6vgv1kjbNHfgrsSMM9ZHx6SHCWyMXFmPEnKQ vTl0H7YSGuTumdYFtnRV5aqsItkMfuhWGSXdFksiOAH/2B5BsDzgyxhL7Dpa1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903648; 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=HoGQ6YLHLJU5kc4Bns/J7Lq9FxMMkVFcK+h1r285nlE=; b=EjpmEZIPwO3HCKNqUgoHFHhRsPJuPF9Z4N3fE89Fn4M51vFHIDhCU6nl/JYQaXbg9PPpVV TzoYVazekMDI6yYnkdmN0HLCMjwiHQmiJ8on+wVWWu2VUALz2uyQuS3ZMtIvPY8eAL1dRm bPy+U/g8BAaBxlH1/G/Fq7EZVMNzjrTX1PEDrVt9FFXtIUsEkurQZ20wGemS5wCGkqa8S2 e5WbNnQ3XSL8ip5ggqu2JDnaUN1Yh3UUUQc9iA2PCY2Y/EDVuAuIL6CKcVGGFE1ldehoAC 6VN4HXEDrcNHBKjTjD/lJxbH4y8GuT+ncDckMaoEbiiOf0epyGj/LGxZYCD+eQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676903648; a=rsa-sha256; cv=none; b=mU++KmyL7Es2M8ORv2bN3qA8ILezpCgoDSPeirpRUGqQxTkncYQVMlOL805YPndKa9MKoa WTWxdsir+4L4rEceyOHwpWiVrRO7HMj6vRVE+lS00PSViTC6lfTPuBlJRFjtObX7Pf6zNr qVnVlDuivEIhCe+uE8WRtqfvn2a/71JeDkl6HMIUPg4BDfADaJp/AMJYgWOPorQtgqTQip obm1PbDi62ZcxpkPFWjBJzNszPhUnAFGRQmt6yZsNPfgYM6ddfb2Db5YCBMwMgThudf0zz /KTts0HvyWD6BFwBP1rXE+/JQsVaOrcdcbjrFuM7E8Bf9MXzVQ+PArDhvXueaA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL4g36fWWzl8f; Mon, 20 Feb 2023 14:34:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KEY7iF005773; Mon, 20 Feb 2023 14:34:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KEY7Cc005772; Mon, 20 Feb 2023 14:34:07 GMT (envelope-from git) Date: Mon, 20 Feb 2023 14:34:07 GMT Message-Id: <202302201434.31KEY7Cc005772@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: a800622765b1 - stable/13 - netlink: fix interface dump. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a800622765b1e7cab79fa857e9a671e6c0c1ccec Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=a800622765b1e7cab79fa857e9a671e6c0c1ccec commit a800622765b1e7cab79fa857e9a671e6c0c1ccec Author: Alexander V. Chernikov AuthorDate: 2023-02-16 13:17:58 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 14:33:28 +0000 netlink: fix interface dump. The current code missed interface addition when reallocating temporary buffer. Tweak the code to perform the reallocation first and add interface afterwards unconditionally. Reported by: Marek Zarychta MFC after: 3 days (cherry picked from commit 86fd0bdba540132ae298457e160b651f61d1db6b) --- sys/netlink/route/iface.c | 33 ++++++++++--------- tests/sys/netlink/test_rtnl_iface.py | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 17 deletions(-) diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index 9cd7e6e80f3c..0eafacff4775 100644 --- a/sys/netlink/route/iface.c +++ b/sys/netlink/route/iface.c @@ -449,24 +449,23 @@ rtnl_handle_getlink(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *n CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { wa.count++; if (match_iface(&attrs, ifp)) { - if (offset < base_count) { - if (!if_try_ref(ifp)) - continue; - match_array[offset++] = ifp; - continue; - } - /* Too many matches, need to reallocate */ - struct ifnet **new_array; - int sz = base_count * sizeof(void *); - base_count *= 2; - new_array = malloc(sz * 2, M_TEMP, M_NOWAIT); - if (new_array == NULL) { - error = ENOMEM; - break; + if (offset >= base_count) { + /* Too many matches, need to reallocate */ + struct ifnet **new_array; + int sz = base_count * sizeof(void *); + base_count *= 2; + new_array = malloc(sz * 2, M_TEMP, M_NOWAIT); + if (new_array == NULL) { + error = ENOMEM; + break; + } + memcpy(new_array, match_array, sz); + free(match_array, M_TEMP); + match_array = new_array; } - memcpy(new_array, match_array, sz); - free(match_array, M_TEMP); - match_array = new_array; + + if (if_try_ref(ifp)) + match_array[offset++] = ifp; } } NET_EPOCH_EXIT(et); diff --git a/tests/sys/netlink/test_rtnl_iface.py b/tests/sys/netlink/test_rtnl_iface.py index ecc932c6213e..cbe5aed8b8ae 100644 --- a/tests/sys/netlink/test_rtnl_iface.py +++ b/tests/sys/netlink/test_rtnl_iface.py @@ -242,6 +242,67 @@ class TestRtNlIface(NetlinkTestTemplate, SingleVnetTestTemplate): assert rx_msg.is_type(NlMsgType.NLMSG_ERROR) assert rx_msg.error_code == errno.ENODEV + @pytest.mark.require_user("root") + def test_dump_ifaces_many(self): + """Tests if interface dummp is not missing interfaces""" + + ifmap = {} + for ifname in (self.vnet.iface_alias_map["if1"].name, "lo0"): + ifindex = socket.if_nametoindex(ifname) + ifmap[ifindex] = ifname + + for i in range(40): + ifname = "lo{}".format(i + 1) + flags = NlmNewFlags.NLM_F_EXCL.value | NlmNewFlags.NLM_F_CREATE.value + msg = NetlinkIflaMessage(self.helper, NlRtMsgType.RTM_NEWLINK.value) + msg.nl_hdr.nlmsg_flags = ( + flags | NlmBaseFlags.NLM_F_ACK.value | NlmBaseFlags.NLM_F_REQUEST.value + ) + msg.add_nla(NlAttrStr(IflattrType.IFLA_IFNAME, ifname)) + msg.add_nla( + NlAttrNested( + IflattrType.IFLA_LINKINFO, + [ + NlAttrStrn(IflinkInfo.IFLA_INFO_KIND, "lo"), + ], + ) + ) + + rx_msg = self.get_reply(msg) + assert rx_msg.is_type(NlMsgType.NLMSG_ERROR) + nla_list, _ = rx_msg.parse_attrs(bytes(rx_msg.cookie)[4:], rtnl_ifla_attrs) + nla_map = {n.nla_type: n for n in nla_list} + assert nla_map[IflattrType.IFLA_IFNAME.value].text == ifname + ifindex = nla_map[IflattrType.IFLA_NEW_IFINDEX.value].u32 + assert ifindex > 0 + assert ifindex not in ifmap + ifmap[ifindex] = ifname + + # Dump all interfaces and check if the output matches ifmap + kernel_ifmap = {} + msg = NetlinkIflaMessage(self.helper, NlRtMsgType.RTM_GETLINK.value) + msg.nl_hdr.nlmsg_flags = ( + NlmBaseFlags.NLM_F_ACK.value | NlmBaseFlags.NLM_F_REQUEST.value + ) + self.write_message(msg) + while True: + rx_msg = self.read_message() + if msg.nl_hdr.nlmsg_seq != rx_msg.nl_hdr.nlmsg_seq: + raise ValueError( + "unexpected seq {}".format(rx_msg.nl_hdr.nlmsg_seq) + ) + if rx_msg.is_type(NlMsgType.NLMSG_ERROR): + raise ValueError("unexpected message {}".format(rx_msg)) + if rx_msg.is_type(NlMsgType.NLMSG_DONE): + break + if not rx_msg.is_type(NlRtMsgType.RTM_NEWLINK): + raise ValueError("unexpected message {}".format(rx_msg)) + + ifindex = rx_msg.base_hdr.ifi_index + assert ifindex == rx_msg.base_hdr.ifi_index + kernel_ifmap[ifindex] = rx_msg.get_nla(IflattrType.IFLA_IFNAME).text + assert kernel_ifmap == ifmap + # # * # * {len=76, type=RTM_NEWLINK, flags=NLM_F_REQUEST|NLM_F_ACK|NLM_F_EXCL|NLM_F_CREATE, seq=1662892737, pid=0}, From nobody Mon Feb 20 14:34:08 2023 X-Original-To: dev-commits-src-branches@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 4PL4g52sPbz3stND; Mon, 20 Feb 2023 14:34:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL4g51Wpzz3vd0; Mon, 20 Feb 2023 14:34:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903649; 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=KTNPBpvI2zjtC2RwjLnV977tN5rzw/iSGYsxFLwHnfc=; b=WFIRdh/2vTt0SKGyISk7THXDjIxH3HgpqLz7y3Uquy/U22HvbjVa2FE4VbhkGhvT38whOM wFYi6QCTj6GmVpxTZ9Rs3qB48wB+D/B3VXQr6POVx77JIQw5CckmKgNuZee54ZEIZcpooJ XJ51K7gNvN9eb/o8xSuRq2v/5sn6UWS0bnWMaT+ShHEFbPgkPAg28upOfxx9SjpOsq06Wf zTOSfoWeg8egzeW2pH0T7MLMv/PClklSX5nrDbYx3B8XAschRVVxdUGD5hvBvypxxh/r9S Qk6hhxx0HRTwxuY51x6pBDaYw+dKe041Oxw2FST2AUuC3mraIBUIPFVZdMfg8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903649; 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=KTNPBpvI2zjtC2RwjLnV977tN5rzw/iSGYsxFLwHnfc=; b=BJXoJt48QKsGBKTQQbj3j6fbfxPmPEUOPnere5ggLG3UPRFVfdGT+Ean1oC1WgLiitrGzw Arkf+RnlqHFfnoX6ssKcrRPI8kkmBUEajr4kQE0Rv3Byu6SfmAcBFMuHaDqRKpwQ6OlQM4 49XiqDk4ZIj7nXrulDti8lodxc7oWx8TVyKEGBm1Um4lLwfJi5BVd2mDm55ZnEyklieSPF YQTgNek99EdR0sD96jzRGcJIQUGjRxPzBE2PLeMHD+xVv9lzBT6eH3dNE4EnDOgukhxFiy TxcqgfhdF7RQ4AhgsbMGwaZr7TXTjsSnwjvS2ikyLL3MOlU05+3PlnHYXenEUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676903649; a=rsa-sha256; cv=none; b=Jh40/Ujjg/kr9YFAWeDDZNyDLP+QBPYnMwBM3ucjQR15R6A2IxtnlBRrOKoGvS13cuPz7t Wy/V13Qs/1t5WJr8y1fHZbY0Dt2KMprrBzvjT/guh8mxi0LIA8J6Gkya/37AQKtF0JdR7t 4Efn90LjpGY9NKRzHGnUXejp1JSOazzhz0N/JAGO9NKSRzb6POTH2TH9lJgfgH9f6Jyofy UIR01YkkRne2rlhtkwmFobyjFuzMNkjXgmzAR92AlzdEvr8ztp3JfWw+/WV/T/7LxYKsaK lbSUh50zNzzE8C32NHYZbwDQCxxHBtU30guWepgxMnIts4bLFJ+HC73reCxucg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL4g50Tc7zknD; Mon, 20 Feb 2023 14:34:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KEY8i4005793; Mon, 20 Feb 2023 14:34:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KEY8IF005792; Mon, 20 Feb 2023 14:34:08 GMT (envelope-from git) Date: Mon, 20 Feb 2023 14:34:08 GMT Message-Id: <202302201434.31KEY8IF005792@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 4c1ef49999c6 - stable/13 - netlink: simplify temporary address allocation in rtnl_handle_getlink(). List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4c1ef49999c6687905664eecd73ea9473ffe5fda Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4c1ef49999c6687905664eecd73ea9473ffe5fda commit 4c1ef49999c6687905664eecd73ea9473ffe5fda Author: Alexander V. Chernikov AuthorDate: 2023-02-17 17:57:44 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 14:33:28 +0000 netlink: simplify temporary address allocation in rtnl_handle_getlink(). MFC after: 3 days (cherry picked from commit 45356a1864c79680c6911b48a18b14a88a7d07fa) --- sys/netlink/route/iface.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index 0eafacff4775..96f21a79a369 100644 --- a/sys/netlink/route/iface.c +++ b/sys/netlink/route/iface.c @@ -439,9 +439,8 @@ rtnl_handle_getlink(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *n NL_LOG(LOG_DEBUG2, "Start dump"); - struct ifnet **match_array; - int offset = 0, base_count = 16; /* start with 128 bytes */ - match_array = malloc(base_count * sizeof(void *), M_TEMP, M_NOWAIT); + struct ifnet **match_array = NULL; + int offset = 0, base_count = 0; NLP_LOG(LOG_DEBUG3, nlp, "MATCHING: index=%u type=%d name=%s", attrs.ifi_index, attrs.ifi_type, attrs.ifla_ifname); @@ -452,14 +451,14 @@ rtnl_handle_getlink(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *n if (offset >= base_count) { /* Too many matches, need to reallocate */ struct ifnet **new_array; - int sz = base_count * sizeof(void *); - base_count *= 2; - new_array = malloc(sz * 2, M_TEMP, M_NOWAIT); + /* Start with 128 bytes, do 2x increase on each realloc */ + base_count = (base_count != 0) ? base_count * 2 : 16; + new_array = malloc(base_count * sizeof(void *), M_TEMP, M_NOWAIT); if (new_array == NULL) { error = ENOMEM; break; } - memcpy(new_array, match_array, sz); + memcpy(new_array, match_array, offset * sizeof(void *)); free(match_array, M_TEMP); match_array = new_array; } From nobody Mon Feb 20 14:34:10 2023 X-Original-To: dev-commits-src-branches@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 4PL4g64Q2jz3stF4; Mon, 20 Feb 2023 14:34:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL4g62fLZz3vKK; Mon, 20 Feb 2023 14:34:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903650; 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=vtpf3TfhorvzVQMVpKRAWXN4Tl+nAWGwlgIIhBLXKg0=; b=bJqYjC/JLBHbhXtDMNNbpmMAqWX2swMG5T5bzfcsqGYr3CvkXpoP3HxIeFJLLgpZQtg1Re hVsESp/jANn6kCqF99efa+V8O73LdS/r4RITIplhvlKluVVsREMvUsJzQ7fO117+ikN/BN MMU+HOCnwr8oRntGwO9hGo6bUModsHuqxMlKuErvxtrwRsQfDIE37RRMxqKb3MYJRhL7Ii /n3ajMKDKZsLhBRDpveOq7oW4sF1ve6PM/jXkRUoBNn8QkL5wZO95ouCNhSN3jqDgRNwdA PmVJxqn0sz9AEJd1a7P4a3uoXoq6XWJOzIqJmW2iHOSAiDJWJcIZaBrh/f0feA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676903650; 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=vtpf3TfhorvzVQMVpKRAWXN4Tl+nAWGwlgIIhBLXKg0=; b=Tzzq4m7uqgzzhFWSOcG9yBRGoRHL2iFkze4paeQlHKOOX0dKuwNdPncMtjskJH3zl2YZwP 2597FKZAd9loqh9nMNUOYAju/mNMre4xgLEzv0gTOoW66e8kFcWj+MIdpu09ugpZoDD7kT ajKhIul+RZyrJa90dRokbpRouhi8oDkrBc/b+VObYwcApDtkjLoxqaq76OKfnjHd0V7xcC wT4UTVdw7JynB3idK3HShnriG5GCWpRJSTU7kKCCx7jAZIjcrDcLZM7611ZGKq09FSFykA TQjVvVFV1CjMr17EKz8H7b2aveiiBN8o2OObet5njZKKjLXyfLLa4J3Qr+uHog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676903650; a=rsa-sha256; cv=none; b=x0GYIak2qDA4xlgWOnwoNTGAkTomVveq4xtorpxaVkF5mV17H68HU2CgfEa/jWpTnBxMqQ OkIaRFjh6n9ppaYwsZy3cJNdys0p648YrR+NNCWFRgMfudgK+x4JiPOsc4h5DPnJJ+946V ek8UDWDrNTes/rhQtK4CtOEshQCuyvp1du2lZBNbKGJ4map5y20kkqbp0CYpFm5xR/kkOF J2z+xUS/1O8JLpNn1egiCfFhtOFkHgewet/qR9zdJReDmJFAIvYghNiTeX3uasJQmZ2OQn rzNEJL1bYZerEQ0bBtgRDoozihHgwWWHEYXJnsrdNvCUchUeaiwrvN+H9DLgTA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL4g61MfYzkW4; Mon, 20 Feb 2023 14:34:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KEYAfP005813; Mon, 20 Feb 2023 14:34:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KEYARa005812; Mon, 20 Feb 2023 14:34:10 GMT (envelope-from git) Date: Mon, 20 Feb 2023 14:34:10 GMT Message-Id: <202302201434.31KEYARa005812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d9d596bb2ce0 - stable/13 - netlink: fix OOB read in genetlink List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d9d596bb2ce04bbec5ea811342efd4216c1fc2a3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d9d596bb2ce04bbec5ea811342efd4216c1fc2a3 commit d9d596bb2ce04bbec5ea811342efd4216c1fc2a3 Author: Alexander V. Chernikov AuthorDate: 2023-02-18 17:24:59 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 14:33:30 +0000 netlink: fix OOB read in genetlink CID: 1498863 MFC after: 1 day (cherry picked from commit 8f7455a9265f4952f885b06c08c57fcce6f16e5c) --- sys/netlink/netlink_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netlink/netlink_generic.c b/sys/netlink/netlink_generic.c index 066379e2afae..a16fdc312daa 100644 --- a/sys/netlink/netlink_generic.c +++ b/sys/netlink/netlink_generic.c @@ -267,7 +267,7 @@ genl_handle_message(struct nlmsghdr *hdr, struct nl_pstate *npt) int family_id = (int)hdr->nlmsg_type - GENL_MIN_ID; - if (__predict_false(family_id < 0 || family_id > MAX_FAMILIES)) { + if (__predict_false(family_id < 0 || family_id >= MAX_FAMILIES)) { NLP_LOG(LOG_DEBUG, nlp, "invalid message type: %d", hdr->nlmsg_type); return (ENOTSUP); } From nobody Mon Feb 20 15:25:45 2023 X-Original-To: dev-commits-src-branches@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 4PL5pd6fzhz3sxdF; Mon, 20 Feb 2023 15:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL5pd697kz429h; Mon, 20 Feb 2023 15:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676906745; 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=2Izo2YSnHcd2MFpgJhq87ry0GqUjIBMOBEeG9/cObGI=; b=W2fpkviL4YngQpbFO+AdR+aWpAUmdGkMvcfUngQIrGyyINfM+jF3Tevk4o1mP/TS/o4jjN Fs9e1Go/29NZOCFhPkh2MlhT31U4VF02HBGmtJ41QyMzwvU+TnO3SrwpuQEsCwZGMQTqZs ytQmnQE8wuSzOTKhU02hv2uYcZoes3/Wxlj8N+o//bmtRfpSA0MuMmmGjSVRLtd1Y3OTT7 QWuriob6wMziVfRH5b7tWl/AdvHSWClqVcX+jvkH5cFOYGu6UI5/kfkiG7n8thjeDl6uLA /OI6i4aZ9kEU+NBBZl0/CL8nE3KnjldSLNv74UpXtXN4yv+qEa0rqQ/DL/ISzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676906745; 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=2Izo2YSnHcd2MFpgJhq87ry0GqUjIBMOBEeG9/cObGI=; b=amYwCAP+vhYIQ7jnS91zaWJQNXrbWDKJZQOgjYMJjBczLpwKyn9vY5jZuGMir1qGfeaUwX ELPyATg1VmFNdSOI/tP9V8C/qSWKfPp8wlzRus6DZPooNGsvEs+/0Brv6aRnb8Y3So8CGD Za1bzCTFI0mvm0KpWXRP7apVSFauJnyu1I6oolyhJaxkeeVmbzZbzvpNTK0tGH0gq0vnyr wamFeZzZRCfhU+hL2/nvgz4HKfSLb1o0zTLNvGiYSN2neMH+XGX/m9J71vo1Gf9n+sf6lj RRCgzlE0nYtQN791JRIvDd7stib1DlhVF/TcSHSln9wj8170DzUb4kYWEYnVRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676906745; a=rsa-sha256; cv=none; b=WflG+uBVlvZyPb2t9q7Mj5tmD6dOKEUKw3V+g3nEesQ49XyDCNmQ+Ynx+k6t9rRsYRzJSA UuDyWpRjzYGHHHnAnsKOndYCcddUSxJnzBuDTGUtC95PjaqaFiwGFWlX2moPWP1Nhrj6+A VR7Rw2BqAakyye/j9msvr8HFmPbvRFLtTJqXaQAW13a1ZQi2Pyx7zUg0mf9qw+rYicmFwn WeFb5bcNFeCLAHYlZfmzHGoWh3I2ggwMmDktJLxNLc4+iZfJiWYbGeA7WEQH7DkPH2Pgx0 84y6tIx0fONxJnswt4Pn3hHX+ySVM4uuHDwUt/HBvI5+McoVNFd3AAfGgsiohg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL5pd5GWVzmL2; Mon, 20 Feb 2023 15:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KFPjgJ078273; Mon, 20 Feb 2023 15:25:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KFPj9X078272; Mon, 20 Feb 2023 15:25:45 GMT (envelope-from git) Date: Mon, 20 Feb 2023 15:25:45 GMT Message-Id: <202302201525.31KFPj9X078272@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: a38e2ff92458 - stable/13 - netinet6: Fix mbuf leak in NDP List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a38e2ff92458b97db06fccf9036c6f74d80155a2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=a38e2ff92458b97db06fccf9036c6f74d80155a2 commit a38e2ff92458b97db06fccf9036c6f74d80155a2 Author: Arseny Smalyuk AuthorDate: 2022-05-31 20:04:51 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 15:14:24 +0000 netinet6: Fix mbuf leak in NDP Mbufs leak when manually removing incomplete NDP records with pending packet via ndp -d. It happens because lltable_drop_entry_queue() rely on `la_numheld` counter when dropping NDP entries (lles). It turned out NDP code never increased `la_numheld`, so the actual free never happened. Fix the issue by introducing unified lltable_append_entry_queue(), common for both ARP and NDP code, properly addressing packet queue maintenance. Reviewed By: melifaro Differential Revision: https://reviews.freebsd.org/D35365 MFC after: 2 weeks (cherry picked from commit d18b4bec98f1cf3c51103a22c0c041e6238c44c7) --- sys/net/if_llatbl.c | 43 ++++++++++++++++++++++++++++++++++----- sys/net/if_llatbl.h | 2 ++ sys/netinet/icmp6.h | 1 + sys/netinet/if_ether.c | 23 ++++----------------- sys/netinet6/nd6.c | 53 ++++++++++--------------------------------------- usr.bin/netstat/inet6.c | 2 ++ 6 files changed, 58 insertions(+), 66 deletions(-) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 05cd8ea24a46..9ada3af318f3 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -127,6 +127,41 @@ done: return (error); } +/* + * Adds a mbuf to hold queue. Drops old packets if the queue is full. + * + * Returns the number of held packets that were dropped. + */ +size_t +lltable_append_entry_queue(struct llentry *lle, struct mbuf *m, + size_t maxheld) +{ + size_t pkts_dropped = 0; + + LLE_WLOCK_ASSERT(lle); + + while (lle->la_numheld >= maxheld && lle->la_hold != NULL) { + struct mbuf *next = lle->la_hold->m_nextpkt; + m_freem(lle->la_hold); + lle->la_hold = next; + lle->la_numheld--; + pkts_dropped++; + } + + if (lle->la_hold != NULL) { + struct mbuf *curr = lle->la_hold; + while (curr->m_nextpkt != NULL) + curr = curr->m_nextpkt; + curr->m_nextpkt = m; + } else + lle->la_hold = m; + + lle->la_numheld++; + + return pkts_dropped; +} + + /* * Common function helpers for chained hash table. */ @@ -285,14 +320,12 @@ llentries_unlink(struct lltable *llt, struct llentries *head) size_t lltable_drop_entry_queue(struct llentry *lle) { - size_t pkts_dropped; - struct mbuf *next; + size_t pkts_dropped = 0; LLE_WLOCK_ASSERT(lle); - pkts_dropped = 0; - while ((lle->la_numheld > 0) && (lle->la_hold != NULL)) { - next = lle->la_hold->m_nextpkt; + while (lle->la_hold != NULL) { + struct mbuf *next = lle->la_hold->m_nextpkt; m_freem(lle->la_hold); lle->la_hold = next; lle->la_numheld--; diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index 143b000adc22..6af13660e344 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -221,6 +221,8 @@ void lltable_link(struct lltable *llt); void lltable_prefix_free(int, struct sockaddr *, struct sockaddr *, u_int); int lltable_sysctl_dumparp(int, struct sysctl_req *); +size_t lltable_append_entry_queue(struct llentry *, + struct mbuf *, size_t); struct lltable *in_lltable_get(struct ifnet *ifp); struct lltable *in6_lltable_get(struct ifnet *ifp); diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index d4fde01c7e88..d4a103d04f00 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -602,6 +602,7 @@ struct icmp6stat { uint64_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */ uint64_t icp6s_checksum; /* bad checksum */ uint64_t icp6s_badlen; /* calculated bound mismatch */ + uint64_t icp6s_dropped; /* # of packets dropped waiting for a resolution */ /* * number of responses: this member is inherited from netinet code, but * for netinet6 code, it is already available in icp6s_outhist[]. diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 59a7c78cb03b..d252d8be9a99 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -465,8 +465,6 @@ arpresolve_full(struct ifnet *ifp, int is_gw, int flags, struct mbuf *m, struct llentry **plle) { struct llentry *la = NULL, *la_tmp; - struct mbuf *curr = NULL; - struct mbuf *next = NULL; int error, renew; char *lladdr; int ll_len; @@ -534,6 +532,7 @@ arpresolve_full(struct ifnet *ifp, int is_gw, int flags, struct mbuf *m, } renew = (la->la_asked == 0 || la->la_expire != time_uptime); + /* * There is an arptab entry, but no ethernet address * response yet. Add the mbuf to the list, dropping @@ -541,24 +540,10 @@ arpresolve_full(struct ifnet *ifp, int is_gw, int flags, struct mbuf *m, * setting. */ if (m != NULL) { - if (la->la_numheld >= V_arp_maxhold) { - if (la->la_hold != NULL) { - next = la->la_hold->m_nextpkt; - m_freem(la->la_hold); - la->la_hold = next; - la->la_numheld--; - ARPSTAT_INC(dropped); - } - } - if (la->la_hold != NULL) { - curr = la->la_hold; - while (curr->m_nextpkt != NULL) - curr = curr->m_nextpkt; - curr->m_nextpkt = m; - } else - la->la_hold = m; - la->la_numheld++; + size_t dropped = lltable_append_entry_queue(la, m, V_arp_maxhold); + ARPSTAT_ADD(dropped, dropped); } + /* * Return EWOULDBLOCK if we have tried less than arp_maxtries. It * will be masked by ether_output(). Return EHOSTDOWN/EHOSTUNREACH diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 924727d598de..be881b6291ac 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -139,7 +139,6 @@ static void nd6_free(struct llentry **, int); static void nd6_free_redirect(const struct llentry *); static void nd6_llinfo_timer(void *); static void nd6_llinfo_settimer_locked(struct llentry *, long); -static void clear_llinfo_pqueue(struct llentry *); static int nd6_resolve_slow(struct ifnet *, int, int, struct mbuf *, const struct sockaddr_in6 *, u_char *, uint32_t *, struct llentry **); static int nd6_need_cache(struct ifnet *); @@ -805,18 +804,19 @@ nd6_llinfo_timer(void *arg) /* Send NS to multicast address */ pdst = NULL; } else { - struct mbuf *m = ln->la_hold; - if (m) { - struct mbuf *m0; + struct mbuf *m; + ICMP6STAT_ADD(icp6s_dropped, ln->la_numheld); + + m = ln->la_hold; + if (m != NULL) { /* * assuming every packet in la_hold has the * same IP header. Send error after unlock. */ - m0 = m->m_nextpkt; + ln->la_hold = m->m_nextpkt; m->m_nextpkt = NULL; - ln->la_hold = m0; - clear_llinfo_pqueue(ln); + ln->la_numheld--; } nd6_free(&ln, 0); if (m != NULL) { @@ -2149,6 +2149,7 @@ nd6_grab_holdchain(struct llentry *ln) chain = ln->la_hold; ln->la_hold = NULL; + ln->la_numheld = 0; if (ln->ln_state == ND6_LLINFO_STALE) { /* @@ -2368,6 +2369,7 @@ nd6_resolve_slow(struct ifnet *ifp, int family, int flags, struct mbuf *m, struct in6_addr *psrc, src; int send_ns, ll_len; char *lladdr; + size_t dropped; NET_EPOCH_ASSERT(); @@ -2434,28 +2436,8 @@ nd6_resolve_slow(struct ifnet *ifp, int family, int flags, struct mbuf *m, * packet queue in the mbuf. When it exceeds nd6_maxqueuelen, * the oldest packet in the queue will be removed. */ - - if (lle->la_hold != NULL) { - struct mbuf *m_hold; - int i; - - i = 0; - for (m_hold = lle->la_hold; m_hold; m_hold = m_hold->m_nextpkt){ - i++; - if (m_hold->m_nextpkt == NULL) { - m_hold->m_nextpkt = m; - break; - } - } - while (i >= V_nd6_maxqueuelen) { - m_hold = lle->la_hold; - lle->la_hold = lle->la_hold->m_nextpkt; - m_freem(m_hold); - i--; - } - } else { - lle->la_hold = m; - } + dropped = lltable_append_entry_queue(lle, m, V_nd6_maxqueuelen); + ICMP6STAT_ADD(icp6s_dropped, dropped); /* * If there has been no NS for the neighbor after entering the @@ -2650,19 +2632,6 @@ nd6_rem_ifa_lle(struct in6_ifaddr *ia, int all) lltable_delete_addr(LLTABLE6(ifp), LLE_IFADDR, saddr); } -static void -clear_llinfo_pqueue(struct llentry *ln) -{ - struct mbuf *m_hold, *m_hold_next; - - for (m_hold = ln->la_hold; m_hold; m_hold = m_hold_next) { - m_hold_next = m_hold->m_nextpkt; - m_freem(m_hold); - } - - ln->la_hold = NULL; -} - static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) { diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index b8d954dbd939..2724590de7d3 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -994,6 +994,8 @@ icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) "{N:/bad checksum%s}\n"); p(icp6s_badlen, "\t{:dropped-bad-length/%ju} " "{N:/message%s with bad length}\n"); + p(icp6s_dropped, "{:dropped-no-entry/%ju} " + "{N:/total packet%s dropped due to failed NDP resolution}\n"); #define NELEM (int)(sizeof(icmp6stat.icp6s_inhist)/sizeof(icmp6stat.icp6s_inhist[0])) for (first = 1, i = 0; i < NELEM; i++) if (icmp6stat.icp6s_inhist[i] != 0) { From nobody Mon Feb 20 15:25:46 2023 X-Original-To: dev-commits-src-branches@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 4PL5pg1BwQz3sxFq; Mon, 20 Feb 2023 15:25:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL5pf74Clz42Zc; Mon, 20 Feb 2023 15:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676906747; 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=RtpRj/kP7h9HFNzi57Qwwp5LszITgqKxJMx65a1MU1I=; b=KF6XZe+ZHKCgX/n7goT+2Klvw4eUEGD3CuDp52xtzragRpnUm9E0XsNediEGmq2+0oHI8D IWf/7hQNt2TnrfT1eDfANHskJHpOhJLPG4KfxqQnCiA20e7CGtVdxBAYOYs/lu7vGkEFBN 4iOC2/jkRQfxHBMWl0BAh261C+8teYCuJL2/3UyD6cZ3BH1SZK+Xww1Zi5ET/E22cAfRbr ks7vyvsvCnuRV1C6TnlMmnXHU5Wyox1FQ89bMSy/AvKQVSIt5vuX7TpEUXJZiAnTTb8me/ KWz6N7Z6qNaPqyGdZfSpBCFi1Mw5Ad2CuYTxb07j18DaAc81X1PedE8IGc4k+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676906747; 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=RtpRj/kP7h9HFNzi57Qwwp5LszITgqKxJMx65a1MU1I=; b=prS+8GjLlimnG3WdeHc4KAFEDXMyo1yUrhgxdcDkQ0EuLPsL961veTVBPr2NTlFe/bO7WU F12c8pNZwMP4xXlVeFdM0o0IBg4AiZ7sxiWa300JexwNxB2k67Di13ojcVJP3i9BVOYymQ OB396bcC/wSiwc5KE1JdIW+u3FRX25zXwYz1Vt6Vny38GPdwNsrIhiGi8Wuv5bGR3Wpi+n /7mMCta+2XbLWzltM1AEnlX7GYBNYgWnmd0JcLLrTvvOYjcETz9DyrVQ+uc2OZO90mzVWp CG73fuuqUgxwKH0GvzvZKmaamr1X/8vIJosDLWbDUn5fFGE5UKuGkUkzSZJNuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676906747; a=rsa-sha256; cv=none; b=vGoldIDlR2e01sR7IFakyOvWEWjv/yxgk9JqNCC1wiQPHkPhsjVc0kqnyEttMJhOrHqFcx 4Ax7kN5Atgj4mNRDOuAfZCMFK3Ph2w0iIhRX5f+W/oWernX5SCuvxAN6lO0mh8bc1AuZVT zemVgYwBoZfiph5dF73wFxhV3w0QvW2JZ3ZqF9MQB9xUf2/KtRvfU6EaLLaEBLOk9x71FW hXitQ6lulJh3HVwoML315kI9Byt6Y872XNc7JzEb0Xd80wh9GKrhYKeeZjDVtYQS3iwK6g l4XWQtNBT20x4wsY4+xMnYAsZBer2BgMh1uXIeT5UJiwABN7oEeMPdyR4kolrw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL5pf68Y7zmHh; Mon, 20 Feb 2023 15:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KFPk5H078292; Mon, 20 Feb 2023 15:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KFPkXL078291; Mon, 20 Feb 2023 15:25:46 GMT (envelope-from git) Date: Mon, 20 Feb 2023 15:25:46 GMT Message-Id: <202302201525.31KFPkXL078291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 27ee5625a829 - stable/13 - nd6: fix panic in lltable_drop_entry_queue() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 27ee5625a829acfa0db0e1fbd0b695fa91aadc6c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=27ee5625a829acfa0db0e1fbd0b695fa91aadc6c commit 27ee5625a829acfa0db0e1fbd0b695fa91aadc6c Author: Alexander V. Chernikov AuthorDate: 2023-01-15 15:10:48 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 15:15:30 +0000 nd6: fix panic in lltable_drop_entry_queue() nd6_resolve_slow() can be called without mbuf. If the LLE entry is not reachable, nd6_resolve_slow() will add this NULL mbuf to the holdchain via lltable_append_entry_queue, which will "append" NULL to the end of the queue (effectively no-op) and bump la_numhold value. When this entry gets freed, the kernel will panic due to the inconsistency between the amount of mbufs in the queue and the value of la_numhold. Fix the panic by checking of mbuf is not NULL prior to inserting it into the holdchain. Reported by: kib MFC after: 3 days (cherry picked from commit 6468b6b23e08d9bd02c8cb74ec0ff389ed74c3bb) --- sys/netinet6/nd6.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index be881b6291ac..de35127bd17d 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -2369,7 +2369,6 @@ nd6_resolve_slow(struct ifnet *ifp, int family, int flags, struct mbuf *m, struct in6_addr *psrc, src; int send_ns, ll_len; char *lladdr; - size_t dropped; NET_EPOCH_ASSERT(); @@ -2436,8 +2435,12 @@ nd6_resolve_slow(struct ifnet *ifp, int family, int flags, struct mbuf *m, * packet queue in the mbuf. When it exceeds nd6_maxqueuelen, * the oldest packet in the queue will be removed. */ - dropped = lltable_append_entry_queue(lle, m, V_nd6_maxqueuelen); - ICMP6STAT_ADD(icp6s_dropped, dropped); + if (m != NULL) { + size_t dropped; + + dropped = lltable_append_entry_queue(lle, m, V_nd6_maxqueuelen); + ICMP6STAT_ADD(icp6s_dropped, dropped); + } /* * If there has been no NS for the neighbor after entering the From nobody Mon Feb 20 16:22:44 2023 X-Original-To: dev-commits-src-branches@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 4PL74P0XXkz3t2DQ; Mon, 20 Feb 2023 16:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL74N5SNCz4BqH; Mon, 20 Feb 2023 16:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910164; 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=vMPUo/plhFW2Y3Aq9npiuBDx7UlvRbaNexuvoEXR9cU=; b=rMIzZko7BHP2rN4BEUNgJ96HRDMeZbKQuW1yf65hFlQ0hbnMoWSTtvuAdWtDzmPltwBzET mFWof+tG5TwLIIqwBSQMhH9g4L+AN9Owk+pUlAOapbzmT1bEhraJlSVzpqRx/itRblO1DK tuft/Z1axhtar8/DWNSWbmUlTCLhJSaQrPlqL6aTjjcxr+AGaPNxmJngs0qMG9v2kB/Mh0 cxpHdYEDOn5Z0p0uPCdfy4h6bIiTJhgsJScuk3h1GAr0zU/+yaqBWHc2X49zGxBI3RZaFV rik1pxN9/bMUwQsQmNIT94lR1QxnnStZsSPARWCoEQxSYNbcIB/BvhQ1EPbyLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910164; 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=vMPUo/plhFW2Y3Aq9npiuBDx7UlvRbaNexuvoEXR9cU=; b=kTBy45I+OM9qecw9n2QybfQSQp0upIVLyfKkOvic4tB/O2hMW+qpQqICrEp6sd+8VthVjp Xu6y/fNYCQv42M7/ow5gT3bLnM7jPSHcXXixSW6dQT6SrcE0NUNLKaop8Fm1eKJfVmVPlG UfVNke+r2ss2HNVV2oKpnJktPpG0aIcO0EzDE0IFpaLzIKokMvgbiuK4JMY1sSk9dVJNIU hQO0R/UMzMw5cicDg0CjovIxnwzcF8xf3fxlw8kb5/TGEXVqOqyXNYsRdg7H5aaC7ZqqfI jH0r72cEXWBUBYU5ohC7u8pgr8h8HjaxDDMOouKrWLOj3vmmIUtID69ZeKYCBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676910164; a=rsa-sha256; cv=none; b=QepcKDqXVY2k2FnFBTOJBLv7DGnxqayvy0B8O8dTgKN0PXiGCl0PzW+YNOtyb7pEEo9xBy eknqjJWNhOs1VX8XWK7LNnExboAZ9gJykfq9fb41LVl7uH/SXzgQN0/XEozAB9L6l+iUhh PLOJzPBGR/cXyR1JP+W1Y+wRdy7g/ybVVEucgRczyjjAevGnV5eJ13opu2NEIav7G+vfx0 APdox+1rmiX9e5YI9EApvbB8AcKnxFkAzmBAdqxongwSbcgdWaDpVgViaQU8dzGgYap485 dBdIRK4w5ci8df4b4PCU/rX5GPUKyZaH8ydeLvW7XALZyKIebaqk79rfsRYLtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL74N4Xg4zncy; Mon, 20 Feb 2023 16:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KGMiDS064300; Mon, 20 Feb 2023 16:22:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KGMiON064299; Mon, 20 Feb 2023 16:22:44 GMT (envelope-from git) Date: Mon, 20 Feb 2023 16:22:44 GMT Message-Id: <202302201622.31KGMiON064299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 402df99daa87 - stable/13 - stand: Update mfc notes List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 402df99daa878af0cb6d83b7ca7f6cd42cddd18c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=402df99daa878af0cb6d83b7ca7f6cd42cddd18c commit 402df99daa878af0cb6d83b7ca7f6cd42cddd18c Author: Warner Losh AuthorDate: 2023-02-20 16:09:07 +0000 Commit: Warner Losh CommitDate: 2023-02-20 16:21:08 +0000 stand: Update mfc notes Using some automation I found a few mistakes in my earlier list and also a change merged without a cherry-pick -x (and evidentally changed as well, since git log --cherry didn't know it had been merged). Fix them so I can use this list with my experimental mfc script. Sponsored by: Netflix This is a direct commit to stable/13 --- stand/mfc-notes.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stand/mfc-notes.txt b/stand/mfc-notes.txt index 89dca26af4d0..338ff70c2500 100644 --- a/stand/mfc-notes.txt +++ b/stand/mfc-notes.txt @@ -23,12 +23,16 @@ c7046f76c2c0 blake workarounds merged f993fff68979 sorting these is useless to merge if the lists aren't already the same 8a744de27eef let's leave firewire in place 0163de282e31 These depend on newer OpenZFS so not needed and conflicts -ed68931c3f9c geliboot: Use the multi-block functions for AES-XTS. -399b56c46c1c stand: delete zstd_shim.c -- dependent changes nor merged 119c786f7b5a +df76778ad5e0 stand: delete zstd_shim.c -- dependent changes nor merged 119c786f7b5a 03bbe1845de7 mips is still in stable/13 20b23ae74b2b mips is still in stable/13 8cc2156f85bb We're not 14, yet 44796b7e822e beri uses this, it seems, and is still in stable/13 +d51cc252a062 userboot gfx stubs were combined with others +5666643a9538 skip merging the typos due to scope of typo fix +b15636233845 geliboot multiblock functions +5c73b3e0a3db entropy MFC'd w/o the -x & with changes as dd6c1475a63a7 +e36c256040f9 merged with other man page changes, apparently silently Also, BERI was removed with the permission of the originators since all that hardware has been retired. From nobody Mon Feb 20 16:22:45 2023 X-Original-To: dev-commits-src-branches@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 4PL74Q1cBDz3t2DS; Mon, 20 Feb 2023 16:22:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL74P6LnYz4BqJ; Mon, 20 Feb 2023 16:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910165; 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=r11Sp0upfU6RNoI5BTA7L+VqW37dUazY5Ruowyg/ZKo=; b=PYI4M7jG4I8BHUs5VUF3uF31sWFg1EaNCiHnyY6V3nojHvToDnmFSP9G04zqt0RUH4lik6 TAxw/QecDCKZirm1dmDV/eHsl2K2eV1N81asGZGGgBombEP/iGyspc/di1GhfHM/sAek/D +pEzjDCfWPSqhmYU9156WUcUUsW+9Lmm54k/sYQTVp62NKm7OKXr9agHnagfOYOMLhzCzq HC4mwsC2efGaqHenVcILMzIBcFQQg+VqAry9EFmSw47jbasn3zRoXPJnSL4yR9fxK0nc3f QXLFRIbG712tbkQTBuy97w0n0niXESi4xu35R8uEOzH6XYuChA8Lq4fXFf2iTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910165; 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=r11Sp0upfU6RNoI5BTA7L+VqW37dUazY5Ruowyg/ZKo=; b=pr8p1Y3kL3xV6qavXMva8jYaxeDSzfsf4ngiRiKBYua1Nge97+B1lexZPcdLfTTCngNerB IfuAyA3YeI1Ay+be5kjLrKikk5W8XN/yu4HOpfyUk/R6nhuzRF9YSffLnSl0tDpVLlPM3X kgmc4Ph/Q6h7d9I6AsBuHEM/vhMGQOQqI/mbMu+9yyMV+LeZtS4xupxI/4/GGXyb7UW8bh FJBcXjRfOc6An0s9Zqmopf1Od7tPuXcvJ0oTN3Pvpma8cWu0xW43P+3B0yDq2gi4+3P5/7 QBSIUGHt/mFbIBLSNeVwhYl/9tUFInhOfixFOmozogzX3f0MYiVZWOUlrtEAaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676910165; a=rsa-sha256; cv=none; b=MT7wNXnzYgjZ+q7UEak+Ls6yc/9IQxMmbcOPQYBsVfwQPjyFOzZBwm+fvpgA+mhe205TTO IcBLOp0Uha2FDTXmyJdLXwHXtu2OYhzmq8mJ5KW+tiqKic4aN5hhOQlUZ0FftSASjdWIhc wELS7w7S9lqeY4sg9LN0oQ6ux/dxVw+IDfq7VMTAfojimadZShlXnRPalLZlmtDk4PLtda eUO1UedbDHzSzchoWVxGKtLftWjWFV8jAy67onnZLTWGfcs0NThTvFIHzG5wvMspY2SpmX q3NhnVkWp62dYyqep7ygUHC6j42lR9ndDI0CXM8HvqgfowizvTeVfBGaM3bwqQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL74P5SmqznX5; Mon, 20 Feb 2023 16:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KGMjeu064319; Mon, 20 Feb 2023 16:22:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KGMj2J064318; Mon, 20 Feb 2023 16:22:45 GMT (envelope-from git) Date: Mon, 20 Feb 2023 16:22:45 GMT Message-Id: <202302201622.31KGMj2J064318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 06d74a746eb1 - stable/13 - lua: reduce diffs between luaconf.h copies List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 06d74a746eb1a8d62bc5669763f5f48d2441d382 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=06d74a746eb1a8d62bc5669763f5f48d2441d382 commit 06d74a746eb1a8d62bc5669763f5f48d2441d382 Author: Ed Maste AuthorDate: 2023-02-20 16:19:35 +0000 Commit: Warner Losh CommitDate: 2023-02-20 16:21:08 +0000 lua: reduce diffs between luaconf.h copies Upstream luaconf.h is contrib/lua/src/luaconf.h.dist, while userland lua and loader lua have copies in lib/liblua/luaconf.h and stand/liblua/luaconf.h. Adjust whitespace, VCS tags, etc. to match upstream's version, for ease of comparison. Reviewed By: imp Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38206 (cherry picked from commit ec965063070e5753c166cf592c9336444b74720a) --- lib/liblua/luaconf.h | 6 +++--- stand/liblua/luaconf.h | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/liblua/luaconf.h b/lib/liblua/luaconf.h index 892ac3a0c8f3..d5ac628e3052 100644 --- a/lib/liblua/luaconf.h +++ b/lib/liblua/luaconf.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /* ** $Id: luaconf.h $ ** Configuration file for Lua @@ -83,7 +82,7 @@ */ #define LUAI_IS32INT ((UINT_MAX >> 30) >= 3) -/* }================================================================== */ +/* }================================================================== */ @@ -203,6 +202,7 @@ #define LUA_LDIR "!\\lua\\" #define LUA_CDIR "!\\" #define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" + #if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ @@ -211,7 +211,7 @@ ".\\?.lua;" ".\\?\\init.lua" #endif -#if !define(LUA_CPATH_DEFAULT) +#if !defined(LUA_CPATH_DEFAULT) #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.dll;" \ LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ diff --git a/stand/liblua/luaconf.h b/stand/liblua/luaconf.h index 8a0ad782e5e1..d5c222ce30be 100644 --- a/stand/liblua/luaconf.h +++ b/stand/liblua/luaconf.h @@ -1,6 +1,5 @@ -/* $FreeBSD$ */ /* -** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp $ +** $Id: luaconf.h $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -218,7 +217,7 @@ #define LUA_LDIR LUA_ROOT "share/" #define LUA_CDIR LUA_ROOT "lib/" -#ifndef LUA_PATH_DEFAULT +#if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ @@ -433,6 +432,7 @@ #define lua_str2number(s,p) strtof((s), (p)) + #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ #define LUA_NUMBER long double @@ -783,3 +783,4 @@ #endif + From nobody Mon Feb 20 16:24:20 2023 X-Original-To: dev-commits-src-branches@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 4PL76F0V1Pz3t20w; Mon, 20 Feb 2023 16:24:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL76D710pz4CtR; Mon, 20 Feb 2023 16:24:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910261; 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=H0VAJMs8ss6MtHAUDPirjl0NhNe3ApfXw5Yzyu26EpE=; b=dzD0pkggPcjQVHwRlef/eFM18/sSw7BLWmOBJ0lLSJVbhYGs/0PX3oWN+jtkueBDETo0Sz pSyYAoTxcqCkkAwxqH/5rs26yPR8Pd0fQnjP0NbrbP7zZQmDhxoECabRqxHNyRXMsRgH0d YMIM5B8jS5u/O5TCLTqkCFSFNl75370IX8rRhnAkPuAx+zoGm7Lx2n2TMblzrJ7nY3aqhr tOftT6edxD0bwYNkQmg0Rt/U60i2jD5phjGKHfCk7XwQXHUrTArcQnes3E1IEZ1u2VpKoS WAggvV6A73H7/Bqkb+E6ls1zWdzgE69T+acuOvkZ97fqeHCAUuXaOqMJwnm+tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910261; 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=H0VAJMs8ss6MtHAUDPirjl0NhNe3ApfXw5Yzyu26EpE=; b=QeVJ3A9grWRLGnPbYyD6bfZJ/1JqTWqMnp/vSubarv/r5LW6t5K9NLwMeYSs5p0Si9FXvH lgrKCd9Z9XzHkKmSSXVOnRQyknzV1TOx5FUnyz1RsEHUMV78UNMqrutLqJXfJr6tgH0FaH mYkSs/Iwyb1fJ/2qc/S0iEYtf+RhL2CW6fss+2OIPKoEAYEhJCrDiQA08VUhupBII4jboX 5aQjRozYiQ90lstqLvXgB6v/+8sMznUy/CAbT8+dnj+AYRdnareLa4h4aQR5VXdtTNGLG0 R5So7WpUjJtoWBQV2QaD8Se1PwgWtOQdDc4TS9fWMKyt7MkNa+2fEW7ia06Blw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676910261; a=rsa-sha256; cv=none; b=u9bNbMykdTWW0tVRRmHEG4ajl2nAjjlS+kYAtqfxpE7NvCOxr5zCsyFbShddLpwN/b4ODE iCi+SqdJQNF3qoijQc4YyQSQ7Nau4Qfzwg7QqJm7rRHkVQe/BHF07qHgsSKJtuJLTsJkyx Bm0Ctb4W38DdF+YMXx0HOVb1d1VBvPcc7qTKKU/Raj1j/pIH38NZHnNeVjHaBCzXFzpOyO 6fn6kfqQyyUhZ87vc8hCahn6JV7JuvOmT/3rgrfz7RJPYSfYbNEZuWd1zUEw2Wy9xKm4ta T3baqGut9fWFv1+zGYeOZXxbToodLTxVEBvpb52k6Kk8xD4+kj69mLiD0uy9NA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL76D64xnznm9; Mon, 20 Feb 2023 16:24:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KGOKj3064635; Mon, 20 Feb 2023 16:24:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KGOK2j064634; Mon, 20 Feb 2023 16:24:20 GMT (envelope-from git) Date: Mon, 20 Feb 2023 16:24:20 GMT Message-Id: <202302201624.31KGOK2j064634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 74631b842197 - stable/13 - shm: Document shm_create_largepage() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 74631b842197d520b5889b3f24863f5037bbc5d8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=74631b842197d520b5889b3f24863f5037bbc5d8 commit 74631b842197d520b5889b3f24863f5037bbc5d8 Author: Mark Johnston AuthorDate: 2023-02-03 15:55:30 +0000 Commit: Mark Johnston CommitDate: 2023-02-20 16:24:08 +0000 shm: Document shm_create_largepage() While here, move notes about FreeBSD-specific functionality to the COMPATIBILITY section, and document the ECAPMODE error for shm_open(). Reviewed by: pauamma, kib MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38282 (cherry picked from commit 5f03f96fbefbb5c68a5d7d06728ff5b4a05f87b0) --- lib/libc/sys/Makefile.inc | 1 + lib/libc/sys/shm_open.2 | 173 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 163 insertions(+), 11 deletions(-) diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 5c30f7d6b796..6f663158d840 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -484,6 +484,7 @@ MLINKS+=setuid.2 setegid.2 \ setuid.2 setgid.2 MLINKS+=shmat.2 shmdt.2 MLINKS+=shm_open.2 memfd_create.3 \ + shm_open.2 shm_create_largepage.3 \ shm_open.2 shm_unlink.2 \ shm_open.2 shm_rename.2 MLINKS+=sigwaitinfo.2 sigtimedwait.2 diff --git a/lib/libc/sys/shm_open.2 b/lib/libc/sys/shm_open.2 index ec12f9f2c0b7..061f0b126c53 100644 --- a/lib/libc/sys/shm_open.2 +++ b/lib/libc/sys/shm_open.2 @@ -28,11 +28,11 @@ .\" .\" $FreeBSD$ .\" -.Dd September 26, 2019 +.Dd January 30, 2023 .Dt SHM_OPEN 2 .Os .Sh NAME -.Nm memfd_create , shm_open , shm_rename, shm_unlink +.Nm memfd_create , shm_create_largepage , shm_open , shm_rename, shm_unlink .Nd "shared memory object operations" .Sh LIBRARY .Lb libc @@ -43,6 +43,14 @@ .Ft int .Fn memfd_create "const char *name" "unsigned int flags" .Ft int +.Fo shm_create_largepage +.Fa "const char *path" +.Fa "int flags" +.Fa "int psind" +.Fa "int alloc_policy" +.Fa "mode_t mode" +.Fc +.Ft int .Fn shm_open "const char *path" "int flags" "mode_t mode" .Ft int .Fn shm_rename "const char *path_from" "const char *path_to" "int flags" @@ -51,8 +59,8 @@ .Sh DESCRIPTION The .Fn shm_open -system call opens (or optionally creates) a -.Tn POSIX +function opens (or optionally creates) a +POSIX shared memory object named .Fa path . The @@ -114,9 +122,7 @@ see and .Xr fcntl 2 . .Pp -As a -.Fx -extension, the constant +The constant .Dv SHM_ANON may be used for the .Fa path @@ -143,6 +149,131 @@ will fail with All other flags are ignored. .Pp The +.Fn shm_create_largepage +function behaves similarly to +.Fn shm_open , +except that the +.Dv O_CREAT +flag is implicitly specified, and the returned +.Dq largepage +object is always backed by aligned, physically contiguous chunks of memory. +This ensures that the object can be mapped using so-called +.Dq superpages , +which can improve application performance in some workloads by reducing the +number of translation lookaside buffer (TLB) entries required to access a +mapping of the object, +and by reducing the number of page faults performed when accessing a mapping. +This happens automatically for all largepage objects. +.Pp +An existing largepage object can be opened using the +.Fn shm_open +function. +Largepage shared memory objects behave slightly differently from non-largepage +objects: +.Bl -bullet -offset indent +.It +Memory for a largepage object is allocated when the object is +extended using the +.Xr ftruncate 2 +system call, whereas memory for regular shared memory objects is allocated +lazily and may be paged out to a swap device when not in use. +.It +The size of a mapping of a largepage object must be a multiple of the +underlying large page size. +Most attributes of such a mapping can only be modified at the granularity +of the large page size. +For example, when using +.Xr munmap 2 +to unmap a portion of a largepage object mapping, or when using +.Xr mprotect 2 +to adjust protections of a mapping of a largepage object, the starting address +must be large page size-aligned, and the length of the operation must be a +multiple of the large page size. +If not, the corresponding system call will fail and set +.Va errno +to +.Er EINVAL . +.El +.Pp +The +.Fa psind +argument to +.Fn shm_create_largepage +specifies the size of large pages used to back the object. +This argument is an index into the page sizes array returned by +.Xr getpagesizes 3 . +In particular, all large pages backing a largepage object must be of the +same size. +For example, on a system with large page sizes of 2MB and 1GB, a 2GB largepage +object will consist of either 1024 2MB pages, or 2 1GB pages, depending on +the value specified for the +.Fa psind +argument. +The +.Fa alloc_policy +parameter specifies what happens when an attempt to use +.Xr ftruncate 2 +to allocate memory for the object fails. +The following values are accepted: +.Bl -tag -offset indent -width SHM_ +.It Dv SHM_LARGEPAGE_ALLOC_DEFAULT +If the (non-blocking) memory allocation fails because there is insufficient free +contiguous memory, the kernel will attempt to defragment physical memory and +try another allocation. +The subsequent allocation may or may not succeed. +If this subsequent allocation also fails, +.Xr ftruncate 2 +will fail and set +.Va errno +to +.Er ENOMEM . +.It Dv SHM_LARGEPAGE_ALLOC_NOWAIT +If the memory allocation fails, +.Xr ftruncate 2 +will fail and set +.Va errno +to +.Er ENOMEM . +.It Dv SHM_LARGEPAGE_ALLOC_HARD +The kernel will attempt defragmentation until the allocation succeeds, +or an unblocked signal is delivered to the thread. +However, it is possible for physical memory to be fragmented such that the +allocation will never succeed. +.El +.Pp +The +.Dv FIOSSHMLPGCNF +and +.Dv FIOGSHMLPGCNF +.Xr ioctl 2 +commands can be used with a largepage shared memory object to get and set +largepage object parameters. +Both commands operate on the following structure: +.Bd -literal +struct shm_largepage_conf { + int psind; + int alloc_policy; +}; + +.Ed +The +.Dv FIOGSHMLPGCNF +command populates this structure with the current values of these parameters, +while the +.Dv FIOSSHMLPGCNF +command modifies the largepage object. +Currently only the +.Va alloc_policy +parameter may be modified. +Internally, +.Fn shm_create_largepage +works by creating a regular shared memory object using +.Fn shm_open , +and then converting it into a largepage object using the +.Dv FIOSSHMLPGCNF +ioctl command. +.Pp +The .Fn shm_rename system call atomically removes a shared memory object named .Fa path_from @@ -162,10 +293,6 @@ Return an error if an shm exists at .Fa path_to , rather than unlinking it. .El -.Fn shm_rename -is also a -.Fx -extension. .Pp The .Fn shm_unlink @@ -235,6 +362,17 @@ All functions return -1 on failure, and set to indicate the error. .Sh COMPATIBILITY The +.Fn shm_create_largepage +and +.Fn shm_rename +functions are +.Fx +extensions, as is support for the +.Dv SHM_ANON +value in +.Fn shm_open . +.Pp +The .Fa path , .Fa path_from , and @@ -377,6 +515,18 @@ and are specified and the named shared memory object does exist. .It Bq Er EACCES The required permissions (for reading or reading and writing) are denied. +.It Bq Er ECAPMODE +The process is running in capability mode (see +.Xr capsicum 4 ) +and attempted to create a named shared memory object. +.El +.Pp +.Fn shm_create_largepage +can fail for the reasons listed above. +It also fails with these error codes for the following conditions: +.Bl -tag -width Er +.It Bq Er ENOTTY +The kernel does not support large pages on the current platform. .El .Pp The following errors are defined for @@ -424,6 +574,7 @@ requires write permission to the shared memory object. .Xr close 2 , .Xr fstat 2 , .Xr ftruncate 2 , +.Xr ioctl 2 , .Xr mmap 2 , .Xr munmap 2 , .Xr sendfile 2 From nobody Mon Feb 20 16:24:21 2023 X-Original-To: dev-commits-src-branches@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 4PL76G1BRtz3t212; Mon, 20 Feb 2023 16:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL76G0l7yz4CxL; Mon, 20 Feb 2023 16:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910262; 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=ho/p8JZDhghFicpoShR48r4LKbB2y85Hxbf0jcGxJVc=; b=XX8u5tilBCF1jzZIqxKwdY7J7f53DnrliwQxRvu1l+q/2VBIOREWHe2W8QBZY/4RwQz7AX Yp2uNK4npW29zP5Xw6GXbO+s5dkF10OycmNKa3VotcItubmcbh+KmlwB6Zpvda5698vsn1 WY+OL72xSlzzWEjCd4qpIstRzuMzNiPVPz/D4LFgFMLszrsUnMf6AR3Mon+nI2EbrJ+k4m 78ssT7F6ijErghYW/BLHM4K/Llyi19GRTXizsougG2+oWuNF8i95oQ0/zhisq+Fhdzov26 YHj2ON5fbNizCDTBuDyBKvbpvFHafyqpILNHzB1kYli3WK0oJsB/canX6Mwshg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910262; 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=ho/p8JZDhghFicpoShR48r4LKbB2y85Hxbf0jcGxJVc=; b=XtROzDhDIiwHyoQVsRn6whuSx2UyDgyYW8lhHFgtI7ua21wMKbVd96VUsme3uPI59IulUY 7WgppTyaj3XPHbsk7kRCEvKcEficmtMuLnQL23GS3wUoDAs5/QwaPQASXEfSXPoRORA0TR jSsF+oyJ5HedmXJPfmZnfXD3DjqR7g5f9Y7KDa+Z/Ga/Hm/aOX6wz4CW7XPkfZe4//nvq0 yitJfGZbvKG4fMZUyl5L8I9NkumfAk/uufzGpkDjbC5oMgE0K7yyu78skmzl2JMuUK5ObV 3/4RjN8J8z69c6UmhTQmG7nC9VxxzOAFRc+3j0/GbgFdQR9rgJ2rWzaSeFIVhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676910262; a=rsa-sha256; cv=none; b=rm184EnK3WvwWDZ9uR22Djwll2mkoK/EmrSxzunnxsLYc+c5VDiRk2NWqHXlRZjUelNpBC jZ+897F40JgdGLs/ocfYHRTTQWyK6UAotgrp/wPcTX4ePE2qyqN6CPEmF6hK2/QHWHrgXc pWFX+N5QibZPJZ6VLap1/dNjNsgImiSMopzSM+c13Mh8tDNR+XOjtk0PoPvk/wFudiN3vw T/GXZxUDZXpCdQ7gkDuK26k3AyBslGN0s15dYf9yzpj0Nd/OW0Pv55UgdysOTW7pHNJhuP YH001GziUcHRpFhgVpsm4PbQi++E9uzIRYU25R3EhLB/ChJgE/ggQYffLEz8AA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL76F6vw3znZR; Mon, 20 Feb 2023 16:24:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KGOLpF064654; Mon, 20 Feb 2023 16:24:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KGOLCC064653; Mon, 20 Feb 2023 16:24:21 GMT (envelope-from git) Date: Mon, 20 Feb 2023 16:24:21 GMT Message-Id: <202302201624.31KGOLCC064653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: dadfe099255d - stable/13 - libc: Fall back to rdtsc when using pvclock and rdtscp is not available List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dadfe099255d38c96ce91a9b246294853aace3ea Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=dadfe099255d38c96ce91a9b246294853aace3ea commit dadfe099255d38c96ce91a9b246294853aace3ea Author: Mark Johnston AuthorDate: 2023-02-03 15:53:20 +0000 Commit: Mark Johnston CommitDate: 2023-02-20 16:24:08 +0000 libc: Fall back to rdtsc when using pvclock and rdtscp is not available In preparation for a follow-up revision wherein kvmclock may export timekeeping info to userspace even in the absence of AMDID_RDTSCP, fall back to using rdtsc when rdtscp isn't available. This mimics pvclock_read_time_info() in the kernel. Reviewed by: kib Tested by: Shrikanth R Kamath MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38341 (cherry picked from commit 26d105199ec89d6eaec8a9ca70e3b05ca65e3aac) --- lib/libc/x86/sys/__vdso_gettc.c | 42 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index b3f3de9f4203..7159d46c0113 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -101,6 +101,13 @@ rdtsc32_mb_lfence(void) return (rdtsc32()); } +static uint64_t +rdtsc_mb_lfence(void) +{ + lfence(); + return (rdtsc()); +} + static u_int rdtsc32_mb_mfence(void) { @@ -108,38 +115,62 @@ rdtsc32_mb_mfence(void) return (rdtsc32()); } +static uint64_t +rdtsc_mb_mfence(void) +{ + mfence(); + return (rdtsc()); +} + static u_int rdtsc32_mb_none(void) { return (rdtsc32()); } +static uint64_t +rdtsc_mb_none(void) +{ + return (rdtsc()); +} + static u_int rdtscp32_(void) { return (rdtscp32()); } +static uint64_t +rdtscp_(void) +{ + return (rdtscp()); +} + struct tsc_selector_tag { u_int (*ts_rdtsc32)(void); + uint64_t (*ts_rdtsc)(void); u_int (*ts_rdtsc_low)(const struct vdso_timehands *); }; static const struct tsc_selector_tag tsc_selector[] = { [0] = { /* Intel, LFENCE */ .ts_rdtsc32 = rdtsc32_mb_lfence, + .ts_rdtsc = rdtsc_mb_lfence, .ts_rdtsc_low = rdtsc_low_mb_lfence, }, [1] = { /* AMD, MFENCE */ .ts_rdtsc32 = rdtsc32_mb_mfence, + .ts_rdtsc = rdtsc_mb_mfence, .ts_rdtsc_low = rdtsc_low_mb_mfence, }, [2] = { /* No SSE2 */ - .ts_rdtsc32 = rdtsc32_mb_none, - .ts_rdtsc_low = rdtsc_low_mb_none, + .ts_rdtsc32 = rdtsc32_mb_none, + .ts_rdtsc = rdtsc_mb_none, + .ts_rdtsc_low = rdtsc_low_mb_none, }, [3] = { /* RDTSCP */ .ts_rdtsc32 = rdtscp32_, + .ts_rdtsc = rdtscp_, .ts_rdtsc_low = rdtscp_low, }, }; @@ -193,6 +224,11 @@ DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc32, (void)) return (tsc_selector[tsc_selector_idx(cpu_feature)].ts_rdtsc32); } +DEFINE_UIFUNC(static, uint64_t, __vdso_gettc_rdtsc, (void)) +{ + return (tsc_selector[tsc_selector_idx(cpu_feature)].ts_rdtsc); +} + #define HPET_DEV_MAP_MAX 10 static volatile char *hpet_dev_map[HPET_DEV_MAP_MAX]; @@ -325,7 +361,7 @@ __vdso_pvclock_gettc(const struct vdso_timehands *th, u_int *tc) version = atomic_load_acq_32(&ti->version); stable = (ti->flags & th->th_x86_pvc_stable_mask) != 0; if (stable) { - tsc = rdtscp(); + tsc = __vdso_gettc_rdtsc(); } else { (void)rdtscp_aux(&cpuid_ti); ti = &pvclock_timeinfos[cpuid_ti]; From nobody Mon Feb 20 16:24:23 2023 X-Original-To: dev-commits-src-branches@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 4PL76H1vf3z3t23g; Mon, 20 Feb 2023 16:24:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL76H1Sljz4Crs; Mon, 20 Feb 2023 16:24:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910263; 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=g4sGq0QZnhkcGO2+5AsTGpgn94wJF8jQcMd18CGIkKg=; b=aoM7qc5r97hmoFhszP45qrRBAtkjUHS6NF1qQUJs41KixONvnUSY9v6ozE9SluCoZtaWmP wIO+/Xi20olaAU6kS6J/VSzJh7wuv6Be+7EyCyEV1LbeoJl4zXyJ1He25doKpZCeh/PC8g tdNnuXVKob5UDKg8vjDQGRhFsomCER6IWFKYxP0VJZY7ubAN1lfrZ9coJAtGW6J+MBKqeB jDzHI6oElcrP9P3g/gSY+HbQeWag92PoA9nvhX/pAGDMKrLB0TuFhhMzOSmd372EvVbudE oEQQKaZvjg2NCQB9RlPRTGgPepr4PGVtzIzOq2puwA2WYpbu+H7tQD6TMn7vDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910263; 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=g4sGq0QZnhkcGO2+5AsTGpgn94wJF8jQcMd18CGIkKg=; b=uFqRlqvKZx2SiLmymuZnR3rsjGWbcrhLd5ItVw/nysKYe1P80GGjxT8BkKOAZuT/OcmKSv H0eIfzNhiSqVU5fTPxHczJs2wxEcO7fYlUvAmCVSjD63iwSAaIXMDnPrvLcB8vjtfkOHfl +EJc4kGH1V0KISIKB1F/HxkQJCGoZ9Sl1Zuz5ZSteoM+3gZ++qfRyo7hCzWnt7tNLamdsv J/pSjVuw/AQMLkw9H2d0qp2SjxReUIdLoOfB/4LUFcHdVWIdbWz6l56yRkMNCNCdd8fzg5 k86Pg7P5UricDBjdzfPT8i/Jiex5ei7CpkhVlv64hdeJGQPMklE4YlFJyS94BA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676910263; a=rsa-sha256; cv=none; b=KeV9wHAQG1xiPBHDY4ewonVUjnJX794t9P3gt6uiriclOi0q0ELox+6Au7pyWNfw2224fj HfjrmYMEgqBIKrwmSR4RpNRIyN1yI+h+HLnMZkbceAUX6LFh+gDZrc33vKrk7KsVJe9Hn7 BfUf0zFq7QC3hhMr7pzPQ9riTLjGaVgsOFA4y5mAIHJC7YhGZ6ZSzdW7+wswDmNoHFTQln ZoRv2oREhE7IQDgKD6r+7gac3ngsY/kTLn/KjWtEOtctkAVPiR2pqn3Ndoa/9AdUTfhobf eH+o2K6Zr4NrjDU8j632bRcR5Ohyo0i6F0D/ZMEtDTlb3XJY3FjTXQbSlnm/rg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL76H0XdXznX8; Mon, 20 Feb 2023 16:24:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KGON97064673; Mon, 20 Feb 2023 16:24:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KGONOK064672; Mon, 20 Feb 2023 16:24:23 GMT (envelope-from git) Date: Mon, 20 Feb 2023 16:24:23 GMT Message-Id: <202302201624.31KGONOK064672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 14d014c3a9b7 - stable/13 - pvclock: Export a vDSO page even without rdtscp available List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 14d014c3a9b7966db0557462e773298c8bf70dc2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=14d014c3a9b7966db0557462e773298c8bf70dc2 commit 14d014c3a9b7966db0557462e773298c8bf70dc2 Author: Mark Johnston AuthorDate: 2023-02-03 15:54:23 +0000 Commit: Mark Johnston CommitDate: 2023-02-20 16:24:08 +0000 pvclock: Export a vDSO page even without rdtscp available When the cycle counter is "stable", i.e., synchronized across vCPUs by the hypervisor, userspace can use a serialized rdtsc instead of relying on rdtscp, just like the kernel timecounter does. This can be useful for performance in guests where the hypervisor hides rdtscp for some reason. To avoid breaking compatibility with older userspace which expects rdtscp to be usable when pvclock exports timekeeping info, hide this feature behind a sysctl. Reviewed by: kib Tested by: Shrikanth R Kamath MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38342 (cherry picked from commit 2bed14192cec1abcdc4e02ca7b18dafd868095ef) --- sys/x86/include/pvclock.h | 1 + sys/x86/x86/pvclock.c | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/sys/x86/include/pvclock.h b/sys/x86/include/pvclock.h index 023acdb80d9c..1306f11fc960 100644 --- a/sys/x86/include/pvclock.h +++ b/sys/x86/include/pvclock.h @@ -121,6 +121,7 @@ struct pvclock { /* Private; initialized by the 'pvclock' API: */ bool vdso_force_unstable; + bool vdso_enable_without_rdtscp; struct timecounter tc; struct cdev *cdev; }; diff --git a/sys/x86/x86/pvclock.c b/sys/x86/x86/pvclock.c index cc2377bdbcf0..3da3373bb2ee 100644 --- a/sys/x86/x86/pvclock.c +++ b/sys/x86/x86/pvclock.c @@ -224,6 +224,9 @@ pvclock_tc_vdso_timehands(struct vdso_timehands *vdso_th, { struct pvclock *pvc = tc->tc_priv; + if (pvc->cdev == NULL) + return (0); + vdso_th->th_algo = VDSO_TH_ALGO_X86_PVCLK; vdso_th->th_x86_shift = 0; vdso_th->th_x86_hpet_idx = 0; @@ -232,7 +235,9 @@ pvclock_tc_vdso_timehands(struct vdso_timehands *vdso_th, vdso_th->th_x86_pvc_stable_mask = !pvc->vdso_force_unstable && pvc->stable_flag_supported ? PVCLOCK_FLAG_TSC_STABLE : 0; bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); - return (pvc->cdev != NULL && amd_feature & AMDID_RDTSCP); + return ((amd_feature & AMDID_RDTSCP) != 0 || + ((vdso_th->th_x86_pvc_stable_mask & PVCLOCK_FLAG_TSC_STABLE) != 0 && + pvc->vdso_enable_without_rdtscp)); } #ifdef COMPAT_FREEBSD32 @@ -242,6 +247,9 @@ pvclock_tc_vdso_timehands32(struct vdso_timehands32 *vdso_th, { struct pvclock *pvc = tc->tc_priv; + if (pvc->cdev == NULL) + return (0); + vdso_th->th_algo = VDSO_TH_ALGO_X86_PVCLK; vdso_th->th_x86_shift = 0; vdso_th->th_x86_hpet_idx = 0; @@ -250,7 +258,9 @@ pvclock_tc_vdso_timehands32(struct vdso_timehands32 *vdso_th, vdso_th->th_x86_pvc_stable_mask = !pvc->vdso_force_unstable && pvc->stable_flag_supported ? PVCLOCK_FLAG_TSC_STABLE : 0; bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); - return (pvc->cdev != NULL && amd_feature & AMDID_RDTSCP); + return ((amd_feature & AMDID_RDTSCP) != 0 || + ((vdso_th->th_x86_pvc_stable_mask & PVCLOCK_FLAG_TSC_STABLE) != 0 && + pvc->vdso_enable_without_rdtscp)); } #endif @@ -284,6 +294,18 @@ pvclock_init(struct pvclock *pvc, device_t dev, const char *tc_name, "vdso_force_unstable", CTLFLAG_RW, &pvc->vdso_force_unstable, 0, "Forcibly deassert stable flag in vDSO codepath"); + /* + * Make it possible to use the vDSO page even when the hypervisor does + * not support the rdtscp instruction. This is disabled by default for + * compatibility with old libc. + */ + pvc->vdso_enable_without_rdtscp = false; + SYSCTL_ADD_BOOL(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "vdso_enable_without_rdtscp", CTLFLAG_RWTUN, + &pvc->vdso_enable_without_rdtscp, 0, + "Allow the use of a vDSO when rdtscp is not available"); + /* Set up timecounter and timecounter-supporting members: */ pvc->tc.tc_get_timecount = pvclock_tc_get_timecount; pvc->tc.tc_poll_pps = NULL; From nobody Mon Feb 20 16:24:24 2023 X-Original-To: dev-commits-src-branches@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 4PL76K1Tyrz3t2Xy; Mon, 20 Feb 2023 16:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL76J2r2Zz4Cvj; Mon, 20 Feb 2023 16:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910264; 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=u0uFX+rhsYcD6kDVRW/thGrA42dtMKx0RwmBLnKl76I=; b=n/Pg8wKxSkj+gz500X4qJk8jwBlu6ni6uEBUPiDhXaw+o4fPuIm9KD6VRwpWt1TckEgwQx +/y22s0TKh7FdWFBxhDM4UruBXldC4PK9MPnMZoMmAt2CNauQc+A57tZujFlMEJcJNxQEL sfMRWbvhUVSLshirxU+cN7oyVh5r4mERgonITHUOzT1ci5as/pfiPXKH402xXZeDpdVvcF VRb09pYwfTk1Y2YzwJclx2UiDALdfUIaC1vNQWI1hrqOfZwWMkb+PoXT3ujwxH2ApM7rXX VxzdBizfE/x4M8POZvehS35tTabOnFebRWBMl22MrmgxuSgGLFz5P2jC2aX7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910264; 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=u0uFX+rhsYcD6kDVRW/thGrA42dtMKx0RwmBLnKl76I=; b=j1ANHg6ZjzPbJu+FUWASHIs+6aaZNu1un+9kDCOlb2SCA3FVwIpvVnOZ86zlonmshUHOYC pB6w3q2qcqzyU7m2j4RTrye5s+qXMQbOGnCvYOkJsKpdSDIBBXcYKYc38tX7J4WhpN83ND AGCaBrPSk8+FoUAluo7C9IKZ2KRj3TIOsa+TVcPXu9FInXOhH5ddIQcFGm5GcXfFo4VE1J 9c2v9qcPbxpDoE2baKKpxZPNn9olT3xhBu4SLsDx3IRoepJgiTNRtuP2e7/Q/oupSueCEJ 6xkwttcaJIGu6kcsd8SaJBJldYH0URn6CkpsbpaG7ElEICaivt8HBI8Io0WzRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676910264; a=rsa-sha256; cv=none; b=wc/m2ytXdja1lfmrURAnHmaMB1W45LDtavDkFi4S/uF2ZXzXt8XIYhx1xpEXl2WDqaP+Up 9UwieTtw0vplFtJ7k7Fv5r2+Bl9RSSN/KS+TXCr7sJriB/vnRLzUUNM1+cojiU2DKf+8+z Y0fSKcwFmXoRhhaav5qjrjbZ4LrtAM3ZH5shYPt0tE/8DzhGo/X4AQSiwJhdMsxTrQ3/1C BQY9vopP01r6ll8ZidQKu7NTVX6bqk9U0Znq1ZyTA+j0NCkoFAGhybSdAXxO2lcsj43WKP T/d/2ini5bHpQCyJlIepTT59UFqUXwXUg+4m4V/+cRe7VWK1WJVUqY1f77h6gQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL76J1T5GznJ0; Mon, 20 Feb 2023 16:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KGOOaC064692; Mon, 20 Feb 2023 16:24:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KGOO6V064691; Mon, 20 Feb 2023 16:24:24 GMT (envelope-from git) Date: Mon, 20 Feb 2023 16:24:24 GMT Message-Id: <202302201624.31KGOO6V064691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 460e41a24baf - stable/13 - man4: Add a manual page for kvmclock List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 460e41a24baf03b910364e77bfce02baf3047891 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=460e41a24baf03b910364e77bfce02baf3047891 commit 460e41a24baf03b910364e77bfce02baf3047891 Author: Mark Johnston AuthorDate: 2023-02-03 15:54:50 +0000 Commit: Mark Johnston CommitDate: 2023-02-20 16:24:08 +0000 man4: Add a manual page for kvmclock Reviewed by: pauamma, imp, kib MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38343 (cherry picked from commit a2286a1f4651f9369cacb82bb1777920f5a86fdc) --- share/man/man4/Makefile | 2 + share/man/man4/kvmclock.4 | 96 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 0af0246f9328..a8064d12fc0d 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -273,6 +273,7 @@ MAN= aac.4 \ ktls.4 \ ktr.4 \ kue.4 \ + ${_kvmclock.4} \ lagg.4 \ le.4 \ led.4 \ @@ -846,6 +847,7 @@ _igc.4= igc.4 _imcsmb.4= imcsmb.4 _io.4= io.4 _itwd.4= itwd.4 +_kvmclock.4= kvmclock.4 _mgb.4= mgb.4 _nda.4= nda.4 _ndis.4= ndis.4 diff --git a/share/man/man4/kvmclock.4 b/share/man/man4/kvmclock.4 new file mode 100644 index 000000000000..55ee5fc1cb42 --- /dev/null +++ b/share/man/man4/kvmclock.4 @@ -0,0 +1,96 @@ +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2023 Klara, Inc. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd February 1, 2023 +.Dt KVMCLOCK 4 +.Os +.Sh NAME +.Nm kvmclock +.Nd Para-virtualized clock driver for x86 KVM guests +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device kvm_clock" +.Ed +.Sh DESCRIPTION +This driver reads time-keeping information from the para-virtualized clock +device provided by the KVM hypervisor on Linux hosts. +The +.Nm +driver is only implemented on i386 and amd64 platforms. +It acts as a +.Xr timecounters 4 +device and is preferred over the Time Stamp Counter (TSC) when available. +The driver exports timekeeping information via +.Pa /dev/pvclock , +enabling the implementation of +.Xr clock_gettime 2 +and related functions without entering the kernel. +.Pp +The +.Nm +driver works by accessing a per-vCPU timekeeping structure maintained by the +hypervisor. +It uses a combination of TSC readings and information from the shared structure +to produce a high-resolution timecounter which is invariant under hypervisor +events such as vCPU migration and live VM migration. +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va dev.kvmclock.0.vdso_enable_without_rdtscp +By default, timekeeping information is exported to userspace only when the +(virtual) CPU announces support for the +.Dq rdtscp +instruction. +Setting this sysctl to 1 overrides this behavior, allowing timekeeping +information to be exported even in the absence of +.Dq rdtscp +support. +However, this breaks compatibility with copies of +.Pa /lib/libc.so.7 +released prior to +.Fx 14.0 , +and statically linked binaries which embed a copy of the system C library. +Thus, this sysctl value should not be changed if the system may execute +binaries older than +.Fx 14.0 . +.It Va dev.kvmclock.0.vdso_force_unstable +Mark the timecounter as unstable for userspace consumers. +This is mostly useful for debugging the driver and userspace timekeeping code, +and generally should not be touched. +.El +.Sh SEE ALSO +.Xr timecounters 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.1 . From nobody Mon Feb 20 16:24:25 2023 X-Original-To: dev-commits-src-branches@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 4PL76K44G9z3t2bV; Mon, 20 Feb 2023 16:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL76K3d7Sz4D76; Mon, 20 Feb 2023 16:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910265; 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=awHrR4sTByWmchjbqeMOVS61h5kEo94KMejM1GD9tRU=; b=pNlvoSkY/pcyQ6cjPf9P54VrJL6jxzan0EGhd14Jv+X0p8HhrtN54zO8pkM48RVyeMpqTA sarT1yxmHtjGNjt2jBIcggrbrWJ/LQsPBay4e7OZSy0uf32h8sDvL4HPrhbWoDyOSHjHQa Mh8m8n7L9aKI+y157kAFs7ewtXKKUHULDKqaqPMqyq4H5EJEOhvLbjaMnbVI8r/N0+B/24 RRRe/2Fr4+1QNV7+J1PJwg4Fu6PCgvy/4rNJtEbwCHGI9qxatrEsoFk6fHQ+IUgzPgAkZr UTQrnX6IZ643RNQzvXewTJR7CvYymWBux0keODDsQhuhuvFIM453hcs7RCBi4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676910265; 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=awHrR4sTByWmchjbqeMOVS61h5kEo94KMejM1GD9tRU=; b=LFUchTR8bwLvjcGIO1STkz4cGXYMjwDW2/ma+lme73t3ADoCk07xrDzFFT3BJeYbFGMOpx 0oRmi5vdzimS+TLQuiwgwzZMhRITqXMT18mdxvEmV6VjHpUhHFJUrjpOWc77eAY/Vd9JLR YgdLC67ACT+ay/iU44I5Bb8wqVTrpxSEFAttfj114H2MKT9lzjxxrFrtknPq2bZ+eMBpVR XxNDicR2HyNPEyYBlAascrX3NNBtDiHYeBlwYCae0k/JIDlhs/rYFc4Av1wghiL7dzwShL FR/cgNvQr8X83XsN45kH9OQz967gEk+0e3XsfIlpPGiVXhszca37Ok2uaAkDdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676910265; a=rsa-sha256; cv=none; b=H8sUG4CBD91/LB0BJ/VPZu+o2HPJuBNwlEVrzHBdQxIRwdCWP27/dOpHzdIJ45GHq+pW33 OB86hgYJdiKaJ5GLVivJtnYpJrjcFBLxLQPx4NDl+cF/GyfST6irsJbQ8aR+znFdgViu7M glO/npN/C/6dyySoG78bK/kE7tE4GmlwolSXrKonOah2JqEbYeVFRGIEgr97u7qTlAoo5p JYv8wpp04dv9PyBHEn7hhwr7y+ZT8J+wucHhk6MblFKGiDErEhd0ca8UPSPx2x3dMpD/se xcde0QCbUjWcFgmR/0inNQnil4cqLkgZyXz8cu4cBwmltZPpYvVBu1aZHx4CTw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL76K2dtZznKx; Mon, 20 Feb 2023 16:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KGOPge064718; Mon, 20 Feb 2023 16:24:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KGOPJ3064717; Mon, 20 Feb 2023 16:24:25 GMT (envelope-from git) Date: Mon, 20 Feb 2023 16:24:25 GMT Message-Id: <202302201624.31KGOPJ3064717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5a33e9990b67 - stable/13 - pcb: Move an assignment into in_pcbdisconnect() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a33e9990b6745b5b659229ab33661b4811f8ddb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5a33e9990b6745b5b659229ab33661b4811f8ddb commit 5a33e9990b6745b5b659229ab33661b4811f8ddb Author: Mark Johnston AuthorDate: 2023-02-03 15:57:37 +0000 Commit: Mark Johnston CommitDate: 2023-02-20 16:24:09 +0000 pcb: Move an assignment into in_pcbdisconnect() All callers of in_pcbdisconnect() clear the local address, so let's just do that in the function itself. Note that the inp's local address is not a parameter to the inp hash functions. No functional change intended. Reviewed by: glebius MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D38362 (cherry picked from commit 2589ec0f365777faacf36bd1eb24706538836b17) --- sys/netinet/in_pcb.c | 1 + sys/netinet/udp_usrreq.c | 3 --- sys/netinet6/in6_pcb.c | 3 ++- sys/netinet6/udp6_usrreq.c | 3 --- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index d9247f50d32b..55fa795457cb 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1499,6 +1499,7 @@ in_pcbdisconnect(struct inpcb *inp) INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); + inp->inp_laddr.s_addr = INADDR_ANY; inp->inp_faddr.s_addr = INADDR_ANY; inp->inp_fport = 0; in_pcbrehash(inp); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index cb7d10f68c48..1289ba7c5d2f 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1544,7 +1544,6 @@ udp_abort(struct socket *so) if (inp->inp_faddr.s_addr != INADDR_ANY) { INP_HASH_WLOCK(pcbinfo); in_pcbdisconnect(inp); - inp->inp_laddr.s_addr = INADDR_ANY; INP_HASH_WUNLOCK(pcbinfo); soisdisconnected(so); } @@ -1664,7 +1663,6 @@ udp_close(struct socket *so) if (inp->inp_faddr.s_addr != INADDR_ANY) { INP_HASH_WLOCK(pcbinfo); in_pcbdisconnect(inp); - inp->inp_laddr.s_addr = INADDR_ANY; INP_HASH_WUNLOCK(pcbinfo); soisdisconnected(so); } @@ -1750,7 +1748,6 @@ udp_disconnect(struct socket *so) } INP_HASH_WLOCK(pcbinfo); in_pcbdisconnect(inp); - inp->inp_laddr.s_addr = INADDR_ANY; INP_HASH_WUNLOCK(pcbinfo); SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; /* XXX */ diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index bc7c0a2bebf5..02fd3dff2ad7 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -500,7 +500,8 @@ in6_pcbdisconnect(struct inpcb *inp) INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); - bzero((caddr_t)&inp->in6p_faddr, sizeof(inp->in6p_faddr)); + memset(&inp->in6p_laddr, 0, sizeof(inp->in6p_laddr)); + memset(&inp->in6p_faddr, 0, sizeof(inp->in6p_faddr)); inp->inp_fport = 0; /* clear flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ inp->inp_flow &= ~IPV6_FLOWLABEL_MASK; diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 5166c0a2cbbc..ff7227cb99f3 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -1019,7 +1019,6 @@ udp6_abort(struct socket *so) if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { INP_HASH_WLOCK(pcbinfo); in6_pcbdisconnect(inp); - inp->in6p_laddr = in6addr_any; INP_HASH_WUNLOCK(pcbinfo); soisdisconnected(so); } @@ -1155,7 +1154,6 @@ udp6_close(struct socket *so) if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { INP_HASH_WLOCK(pcbinfo); in6_pcbdisconnect(inp); - inp->in6p_laddr = in6addr_any; INP_HASH_WUNLOCK(pcbinfo); soisdisconnected(so); } @@ -1316,7 +1314,6 @@ udp6_disconnect(struct socket *so) INP_HASH_WLOCK(pcbinfo); in6_pcbdisconnect(inp); - inp->in6p_laddr = in6addr_any; INP_HASH_WUNLOCK(pcbinfo); SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; /* XXX */ From nobody Mon Feb 20 17:29:02 2023 X-Original-To: dev-commits-src-branches@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 4PL8Xt6tcnz3rNdj; Mon, 20 Feb 2023 17:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PL8Xt6MYHz4Pr0; Mon, 20 Feb 2023 17:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676914142; 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=59WdTgjfYwmNHOeXnkhu/GDaENLp6VqDpOXGL6F50/Y=; b=xAXmyGYW56qNK07l5Fc/PoOT6vXOPX7hw1hiL1NTuR+4F69Izsl7Ar8iGD7ee+OgJCmH2B rrxhVFL7l61dYG3Kf/PZLuY3Pdl2JyIvAFtCneBMvT1uMUEPZe9j4urZWmO6K3/eKfnbuc h1KOFy5bgcqb30uhx2Lczzc0dNAAXBO9ctyMATXBHzehmxjl9LHFpEL1cMzH58/LrnSwwf sFRQT8ZN/kV6HYadqjiXvVxIswuLI36Ag1klwuYqogM7syVB6jiAMoyzfrlinm99Hetid9 LVam2OWQgULrFgOG8Tmik4ITg2DX53BgvZQom1juxMwk90bkC9+9BI2VxdG94Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676914142; 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=59WdTgjfYwmNHOeXnkhu/GDaENLp6VqDpOXGL6F50/Y=; b=EYe81scMY6LO2yJXHftHEhQ+QaciC1DVs1cNjSho6e4Cj+T02Q6sbLbGKDENLKLSGnR8fJ Yc4WfMbgiwLjXh5z8Zxo9Pose08WIvq6cksG8K6e5QHhAxc+h2uNznoOc0gZJNWzwbiNHf Bs1nbyc8BfR3nWpVj3SSnqy7b7AjIaxMmrEdqyOHXWhk2qgGDPYXjodMkzl+fnGKTjjye2 3SnT/Y9p63wlblvB7Wonoor3EM7Ula6ogVNp9DGqKgOZRKVTeA6mXaCAH+ZjwG/gPzHU+u eDxhYxoTrs4jyCklb3zgh6bRcrT/b9ev1B6Sp+ukdZFFuV9KhdFg2HpYmGqiYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676914142; a=rsa-sha256; cv=none; b=HNgVC/YBCCUgUWkgLZaDT5zOYgQ/2XaA8xAD1yOEvA2yVehWgLyBMzSZE+8VO5Hi0oCmlw lvTnC9B6hnTYttFdW/hFs3KHyWl9yZUiesu7mlDOWj1dTHjl6m3f7D+B5oNUpQL1pXnO5U ENGTqNunt7W862XQFjKwF3xYPbXszniU++njl7tnJGo0YzblUO74T+5OnREYHNbKDPbm7h uY2Kmsgzmu1CFyjtIh1OsfFMOmxxo1ygZ7OvXTfJy1bpYdJRiMl9CKsnbxMoxseKfck8bx Hg7pQYaq8WkyvPHlhr1htSUXlqFjg2/OCaxyD0/7SJCqeRB75H9Ev8p5Urhjtw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PL8Xt5QD9zpvP; Mon, 20 Feb 2023 17:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KHT2sT051909; Mon, 20 Feb 2023 17:29:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KHT2rj051908; Mon, 20 Feb 2023 17:29:02 GMT (envelope-from git) Date: Mon, 20 Feb 2023 17:29:02 GMT Message-Id: <202302201729.31KHT2rj051908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 24a7d1392823 - stable/13 - cpuset: Adapt sched_affinity compat shims to the stable/13 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 24a7d13928234ff989bdbf8a5f1397b94f086bdd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=24a7d13928234ff989bdbf8a5f1397b94f086bdd commit 24a7d13928234ff989bdbf8a5f1397b94f086bdd Author: Dmitry Chagin AuthorDate: 2023-02-20 17:28:36 +0000 Commit: Dmitry Chagin CommitDate: 2023-02-20 17:28:36 +0000 cpuset: Adapt sched_affinity compat shims to the stable/13 Use compat shims to run the stable/13 world on a kernels which does not support CPU_WHICH_TIDPID. This is direct commit to the stable/13. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D38677 --- lib/libc/gen/sched_getaffinity.c | 6 ++++-- lib/libc/gen/sched_setaffinity.c | 6 ++++-- sys/sys/param.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c index fce47fbfc0d2..0275a2190afa 100644 --- a/lib/libc/gen/sched_getaffinity.c +++ b/lib/libc/gen/sched_getaffinity.c @@ -38,9 +38,11 @@ int sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset) { cpuwhich_t which; - int error; + int error, osrel; - if (__getosreldate() < P_OSREL_TIDPID) { + osrel = __getosreldate(); + if (osrel < P_OSREL_TIDPID_13 || (osrel < P_OSREL_TIDPID && + P_OSREL_MAJOR(osrel) == P_OSREL_MAJOR(P_OSREL_TIDPID))) { if (pid == 0 || pid > _PID_MAX) which = CPU_WHICH_TID; else diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c index b878e1affc41..7fbebbfe6b6e 100644 --- a/lib/libc/gen/sched_setaffinity.c +++ b/lib/libc/gen/sched_setaffinity.c @@ -41,10 +41,12 @@ sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) static int mp_maxid; cpuwhich_t which; cpuset_t c; - int error, lbs, cpu; + int error, lbs, cpu, osrel; size_t len, sz; - if (__getosreldate() < P_OSREL_TIDPID) { + osrel = __getosreldate(); + if (osrel < P_OSREL_TIDPID_13 || (osrel < P_OSREL_TIDPID && + P_OSREL_MAJOR(osrel) == P_OSREL_MAJOR(P_OSREL_TIDPID))) { if (pid == 0 || pid > _PID_MAX) which = CPU_WHICH_TID; else diff --git a/sys/sys/param.h b/sys/sys/param.h index d2fbad6c127b..6c95088e783d 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -92,6 +92,7 @@ #define P_OSREL_CK_INODE 1300005 #define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 #define P_OSREL_TIDPID 1400079 +#define P_OSREL_TIDPID_13 1302501 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif From nobody Mon Feb 20 19:58:50 2023 X-Original-To: dev-commits-src-branches@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 4PLCsk3ldrz3rbLw; Mon, 20 Feb 2023 19:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLCsk3FPhz3J38; Mon, 20 Feb 2023 19:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923130; 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=iuTkFG1j9ApwVCORuQsTdiZtPrzzVlWMrpwqpG4VUZ8=; b=kYyYOQB0K4XFfxxXZ622X4LYLSQflPtmugWqMgseTb9H0ovSZnL1h9O1hmjb3MsDlLQSRP nMsV/4iEAuTv3AWFXI/Cg7SYws0qqqxjUphDPvx9cz52zSucbLZCzzIp7skTzyadK0KBNP qNn8fwmnaBDNbWIKiPJOQabl0neHL0vhQ38e+Nv/s+zPeDQp/5fy+tU2I9kjWmzH7SQzl1 zIK1sqnFTD1mYUIqp9EfEfnwxi0gi3Px/Xji3VqJKqn0cxePZbFFUAoQjQxKqRgu3kOzy2 5cO1YIpzOjo4dqT/a46NnNj45wLB72/X3el1QcowWpcJTuX0/qSW+SQoPdGw/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923130; 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=iuTkFG1j9ApwVCORuQsTdiZtPrzzVlWMrpwqpG4VUZ8=; b=YNzlZ+5gf0CyMOqSROAXUHjehj/U8GaoZaADmMw9dF8HSlGTGgSZ9KrN9yoKgt8c2ZZEh2 kgltpOgwgduTNOGk+eMkfDs9BZwHPEysdPu4gRjeV0Fp+h9GCLbJUY1XEZsEtGV7sLOdmM WFV7ZhVcjT09cwXtWuz50mo7TcNIXfb0l+twz20A2FFAVV40g4qfZoYVu77LwoyafxvVjX j24cjLQZgacOXilf38IugkpRfUO8kJV+ImQqi2WmeTEk+xBhPbKkW9STRbqx4aW8WfwIKn Fl1Q4rjWSDDJUCh977XF+NTnGfNbyaR2lt833khWtUqQgYR82pk1kXWbBDw1Ww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676923130; a=rsa-sha256; cv=none; b=fvf/CX5OdD0eQXH6qnjUlNAqJ3k3ylDWWijylEU6Sd1p5r5FFAa15NGh6+bjF01KGVJUfv ve6yYbikjfuGEymmX/+S/NjTMHHm9R3xwsvNl4LWY5ZRa9WXPmlvMrgc2JpmbBSasiykW2 O/fFdeTg2Sf55BmlPdPEleD0CbL+2gLXPPg0gUNlzIvaCXTVM4Th36OQpxw2uaGC/bve9f xGWt3HMP3B/NFRGFTfHVIxKTLjW3R+ZlMoAIat653EzOkFRNCTnVTNVfx7247oJjYjy8Bf mh5ZJJqOO4o+PUEo/+9nXzAHDkYaou92fwJdNxB4eQtXm15L35UzV8adJ1xBIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLCsk2JzTztXW; Mon, 20 Feb 2023 19:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KJwoO1065865; Mon, 20 Feb 2023 19:58:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KJwodl065864; Mon, 20 Feb 2023 19:58:50 GMT (envelope-from git) Date: Mon, 20 Feb 2023 19:58:50 GMT Message-Id: <202302201958.31KJwodl065864@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 13f1d1bd8647 - stable/13 - kern: physmem: improve region coalescing logic List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 13f1d1bd86476393b8a2ec2c79cb0b1637fcdec6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=13f1d1bd86476393b8a2ec2c79cb0b1637fcdec6 commit 13f1d1bd86476393b8a2ec2c79cb0b1637fcdec6 Author: Kyle Evans AuthorDate: 2021-10-28 04:40:08 +0000 Commit: Kyle Evans CommitDate: 2023-02-20 19:58:20 +0000 kern: physmem: improve region coalescing logic The existing logic didn't take into account newly inserted mappings wholly contained by an existing region (or vice versa), nor did it account for weird overlap scenarios. The latter is probably unlikely to happen, but the former may happen in UEFI: BootServicesData allocated within a large chunk of ConventionalMemory. This situation blows up vm initialization. While we're here, remove the "exact match" logic as it's likely wrong; if an exact match exists with conflicting flags, for instance, then we should probably be doing something else. The new logic takes into account exact matches as part of the overlapping efforts. Reviewed by: kib, mhorne (both earlier version) Differential Revision: https://reviews.freebsd.org/D32701 (cherry picked from commit 7771f2a0c94fc2f7b9ce1565a49e52dba1e7381d) --- sys/kern/subr_physmem.c | 92 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_physmem.c b/sys/kern/subr_physmem.c index 99b4c2141612..2c7837019ea2 100644 --- a/sys/kern/subr_physmem.c +++ b/sys/kern/subr_physmem.c @@ -295,6 +295,67 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail, return (acnt); } +/* + * Check if the region at idx can be merged with the region above it. + */ +static size_t +merge_upper_regions(struct region *regions, size_t rcnt, size_t idx) +{ + struct region *lower, *upper; + vm_paddr_t lend, uend; + size_t i, mergecnt, movecnt; + + lower = ®ions[idx]; + lend = lower->addr + lower->size; + + /* + * Continue merging in upper entries as long as we have entries to + * merge; the new block could have spanned more than one, although one + * is likely the common case. + */ + for (i = idx + 1; i < rcnt; i++) { + upper = ®ions[i]; + if (lend < upper->addr || lower->flags != upper->flags) + break; + + uend = upper->addr + upper->size; + if (uend > lend) { + lower->size += uend - lend; + lend = lower->addr + lower->size; + } + + if (uend >= lend) { + /* + * If we didn't move past the end of the upper region, + * then we don't need to bother checking for another + * merge because it would have been done already. Just + * increment i once more to maintain the invariant that + * i is one past the last entry merged. + */ + i++; + break; + } + } + + /* + * We merged in the entries from [idx + 1, i); physically move the tail + * end at [i, rcnt) if we need to. + */ + mergecnt = i - (idx + 1); + if (mergecnt > 0) { + movecnt = rcnt - i; + if (movecnt == 0) { + /* Merged all the way to the end, just decrease rcnt. */ + rcnt = idx + 1; + } else { + memmove(®ions[idx + 1], ®ions[idx + mergecnt + 1], + movecnt * sizeof(*regions)); + rcnt -= mergecnt; + } + } + return (rcnt); +} + /* * Insertion-sort a new entry into a regions list; sorted by start address. */ @@ -303,19 +364,38 @@ insert_region(struct region *regions, size_t rcnt, vm_paddr_t addr, vm_size_t size, uint32_t flags) { size_t i; + vm_paddr_t nend, rend; struct region *ep, *rp; + nend = addr + size; ep = regions + rcnt; for (i = 0, rp = regions; i < rcnt; ++i, ++rp) { - if (rp->addr == addr && rp->size == size) /* Pure dup. */ - return (rcnt); if (flags == rp->flags) { - if (addr + size == rp->addr) { + rend = rp->addr + rp->size; + if (addr <= rp->addr && nend >= rp->addr) { + /* + * New mapping overlaps at the beginning, shift + * for any difference in the beginning then + * shift if the new mapping extends past. + */ + rp->size += rp->addr - addr; rp->addr = addr; - rp->size += size; + if (nend > rend) { + rp->size += nend - rend; + rcnt = merge_upper_regions(regions, + rcnt, i); + } return (rcnt); - } else if (rp->addr + rp->size == addr) { - rp->size += size; + } else if (addr <= rend && nend > rp->addr) { + /* + * New mapping is either entirely contained + * within or it's overlapping at the end. + */ + if (nend > rend) { + rp->size += nend - rend; + rcnt = merge_upper_regions(regions, + rcnt, i); + } return (rcnt); } } From nobody Mon Feb 20 20:13:04 2023 X-Original-To: dev-commits-src-branches@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 4PLDB84Ly5z3s6Zm; Mon, 20 Feb 2023 20:13:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLDB83rNCz3KQn; Mon, 20 Feb 2023 20:13:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923984; 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=pvLxZVpU7J899SfCq7fbANtylY71RigAEwO3VFeU99c=; b=T7kEGQ+p6kgw31CRc74qctcYtBcuwTyeipJx6m9WBkJ/QGMhyHkoIGKgELX8DLbasZ64r8 osNwrSWOBpknDv2+RsIzaGaU123ZVh/kR5ITcVQinU6fXeALFZHkvyWKwt7l45GuTpRUJa 2Y64HCX39ReqgId3ejMatFkad2LYWlJ+fXg0YUhBUDBzPy5ABinaU0K+Lp0ijPVl54RPAw 66NT+SU/mxoiAaQ0MhAfYhLxdiGPRsaEqZ2ab0tW9wY9oDypylLcljXk/2T4hGQuYuGPz7 9gdoEGjude+NhEndX828uejADSSKjUc34hsbo2qdx89iPBrlbuM3uhD0a93HzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923984; 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=pvLxZVpU7J899SfCq7fbANtylY71RigAEwO3VFeU99c=; b=RX3Nd7PGcZ2XkDa834npvkz2P3cNcveEHxQaB0d7izWNwjzbpZ7rBmatMQgMeQvFsYCFkX spEfolfSyIvEr6uWWnoAaPgnkUcE07Am892kqREHl3YlQ3hUCN2u9YEYzLFzOraZ9kNnh2 eRmHwHlrgroWPXkOdI+gqP3cvicVhfu2thT/fAzaxCbIUpKue3vXFiEeqxA7MKGMpIVTrY Xyu3EqOJxLoluwU28jQIuyN016V8vWIgmThZPuYBqLuZNb19w2YA7W3s95z8/dWfd15LgV w+JlTrbp3yrMY2JNv7p88ED8iFKyjFiMFlHaurQK+c04Bca6zM6D//jzYzq6WQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676923984; a=rsa-sha256; cv=none; b=rTGRejjZ6qdiEtA/pDKLXHy9peWS2WrYofezMps3k5uQApeaBt7LoNZ4i1o5is0mOIGNhk 2oGM6O14KLRL6s6nYMLKp5guvE2GRkT1D0RbfZXAF2uRPkA2yETp/KfF5lCSwHfRmabNzY wmWAY66oDKAZMcF5U28tDz30qZmYLfssJ5s2SRkHhjkI7M/nKfCc2nTc2kwVLGC8rtIIUt kCGE/qu0yWwZv4xP2gw8tTpgkR45t8xQ0l9kmorCcCg0q6lG05MB6MAf1ta/xApPzqRih4 vo5Go+WN9RP6p98ZjtMPLlPD/jMDEpr/ZGCGVhZ3PsaPaiQOQ0SxhBVHUb2yog== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLDB82vpgztx0; Mon, 20 Feb 2023 20:13:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KKD4Sq094031; Mon, 20 Feb 2023 20:13:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KKD4Xw094030; Mon, 20 Feb 2023 20:13:04 GMT (envelope-from git) Date: Mon, 20 Feb 2023 20:13:04 GMT Message-Id: <202302202013.31KKD4Xw094030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 5eaad7c9c593 - releng/13.2 - netlink: Zero-initialize mbuf messages List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 5eaad7c9c593908dfd4ab7e665b66e0e19542e60 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=5eaad7c9c593908dfd4ab7e665b66e0e19542e60 commit 5eaad7c9c593908dfd4ab7e665b66e0e19542e60 Author: Mark Johnston AuthorDate: 2023-01-17 14:36:54 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 19:47:42 +0000 netlink: Zero-initialize mbuf messages Some users of nlmsg_reserve_object() and nlmsg_reserve_data() are not careful to fully initialize pad and reserved fields, allowing uninitialized bytes to leak to userspace. For example, dump_nhgrp() doesn't set nhm->resvd = 0. Meanwhile, nlmsg_get_ns_buf() and nlmsg_get_ns_lbuf() zero-initialize the buffer, so nlmsg_get_ns_mbuf() is inconsistent. Let's just make them all behave the same here. Reported by: KMSAN Reviewed by: melifaro Approved by: re(cperciva) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38098 (cherry picked from commit d91be0f1211b0196a0087cdfa237a6a0d2a43b65) (cherry picked from commit 13e997289240c4697536f904167720a29abf7a58) --- sys/netlink/netlink_message_writer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netlink/netlink_message_writer.c b/sys/netlink/netlink_message_writer.c index 37414703c6f6..6573394eb881 100644 --- a/sys/netlink/netlink_message_writer.c +++ b/sys/netlink/netlink_message_writer.c @@ -215,6 +215,7 @@ nlmsg_get_ns_mbuf(struct nl_writer *nw, int size, bool waitok) nw->malloc_flag = mflag; nw->num_messages = 0; nw->enomem = false; + memset(nw->data, 0, size); NL_LOG(LOG_DEBUG2, "alloc mbuf %p req_len %d alloc_len %d data_ptr %p", m, size, nw->alloc_len, nw->data); return (true); From nobody Mon Feb 20 20:13:05 2023 X-Original-To: dev-commits-src-branches@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 4PLDB95HWgz3s6Xl; Mon, 20 Feb 2023 20:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLDB94nRtz3KdC; Mon, 20 Feb 2023 20:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923985; 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=j+6lTaX3bXlzbFDOiRMlIooPQtHFDysDCJLHvPWQ/pE=; b=IbejJLRDmliNEu7IVnMAPbGa+DvOrl2TdX8sCUeuYyymKuwI3UabriyVWFwCvEzmRj1JGu EJDTnsOVujLnyKeo1PEPKaOXRrTCeI9WGpOaxgCRjnMg1A1JFIp3KnngLpXDAA1T7YPa3W 01dp7PZT9IhmzryjNmXl5Md6cVu6ioMi758j9TPwm3MG0p4QQrm9WNFVgj/o7uQBg0T0iq hC1ijKvglzSUkrF+9V7pAT6JXXwFaS/agAtnGvxjJ4sWpK1ODQdm40opcM+RWOlVrCzBPp RR1SGCytv/5anfnZpcODnGuHhMjYgG1kkqv5F0MBfXVzyDT1WLzkYl9oLvFy+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923985; 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=j+6lTaX3bXlzbFDOiRMlIooPQtHFDysDCJLHvPWQ/pE=; b=heN0hlmr33F2eDkxx7xDCOw04s6D7UdgpIdU6QaqV29JRFavjAH5Cv//STqhcRF781QiYD Unj/3idAoRBNz00hQ35XDGqwEqwXRDYnkGInW2oCJisdeqmPnXwoRIUWVd4KZBUwSTB1mr w9Cw2tzoeoCJqbiKWuKdqOG4zAzeZMINiEkJ16lTJt0BbQmcbTtGc/P1O0K8Vay11glagT 4mPs1XG1S5geHK2BpUKjSsQEK7+L0cOvI8ZbmTTjx9pl1Kdlu9DKa7MeP2QdfFZyFo8yPm rcVZSO6R00nDiav3dia0s84vJ6OiIQseOzejV2t0X8NsRUaURUsD+ukNbHD9+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676923985; a=rsa-sha256; cv=none; b=NDHt3sEx7heB47MlB9WTlhL6Mft8ist+qkpdq9bHO8sFEiiOx0hrbF5c33pl8kO3ZHqYCv WSGKj9CGTgut/epKIyrSf5WBBeI59PBHERmozUNczOWO87TWXzA0bwyA5dzffoA9sde5/O IYo6cDP2suKMIBZBK7BSbrNxSz+JdMeChPd9UNe2Sk3lXrfqnGZ5qfrfllQYIgJmnyN1BC KIbsgiwNIAcj+YtKi0ZXXzy1G5dEhb0DyJnhWferpuBTS5yDkATxEWiz3hTRO5AbFP14G0 CzTQib/Ue6JDKHISN4rRNpr6wfz6N8m305od/2JgFmxbOB59ROMxaQ/JYvWrSw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLDB93qVbzv4y; Mon, 20 Feb 2023 20:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KKD5lw094050; Mon, 20 Feb 2023 20:13:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KKD5UZ094049; Mon, 20 Feb 2023 20:13:05 GMT (envelope-from git) Date: Mon, 20 Feb 2023 20:13:05 GMT Message-Id: <202302202013.31KKD5UZ094049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 2e847957c50c - releng/13.2 - netlink: Zero-initialize writer structures allocated on the stack List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 2e847957c50c63ebecdd6825b9466e3d979fac9b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=2e847957c50c63ebecdd6825b9466e3d979fac9b commit 2e847957c50c63ebecdd6825b9466e3d979fac9b Author: Mark Johnston AuthorDate: 2023-01-26 15:46:19 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 19:48:12 +0000 netlink: Zero-initialize writer structures allocated on the stack The prevailing pattern seems to be to simply initialize all fields to zero. Without this, it's possible to trigger a branch on uninitialized memory, specifically, when testing nw->ignore_limit in nlmsg_refill_buffer(). Initialize the writer structure in a couple of functions where this is necessary. Reported by: KMSAN Reviewed by: melifaro Approved by: re(cperciva) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38213 (cherry picked from commit 7a78ae88659e0f6a901574d17672d1ccdc3e971b) (cherry picked from commit 2de541757e0a2e25ce974b3c4c29bc8b753b8b6a) --- sys/netlink/route/rt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 48a6b0928cab..59b34c53ad4b 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -341,9 +341,9 @@ static void report_operation(uint32_t fibnum, struct rib_cmd_info *rc, struct nlpcb *nlp, struct nlmsghdr *hdr) { - struct nl_writer nw; - + struct nl_writer nw = {}; uint32_t group_id = family_to_group(rt_get_family(rc->rc_rt)); + if (nlmsg_get_group_writer(&nw, NLMSG_SMALL, NETLINK_ROUTE, group_id)) { struct route_nhop_data rnd = { .rnd_nhop = rc_get_nhop(rc), @@ -926,10 +926,9 @@ rtnl_handle_getroute(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * void rtnl_handle_route_event(uint32_t fibnum, const struct rib_cmd_info *rc) { + struct nl_writer nw = {}; int family, nlm_flags = 0; - struct nl_writer nw; - family = rt_get_family(rc->rc_rt); /* XXX: check if there are active listeners first */ From nobody Mon Feb 20 20:13:06 2023 X-Original-To: dev-commits-src-branches@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 4PLDBB6GxKz3s6xS; Mon, 20 Feb 2023 20:13:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLDBB5h32z3KZT; Mon, 20 Feb 2023 20:13:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923986; 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=vcsztzpf7wrhsq8kEWO2wTwg7hWrWVqskB95zSa1XIE=; b=CEaqDWknLwj1cYTAf2sw14z9oHV2efIFd4GhRsY/uyqIE7t89U5B6OUZA6pwWzl4tiqDpU 9H7LevQNqE5Wh9Jx44K6nTIPjhA/ekBoEmY14rf/VWbiDtG9PtsSEBuyMiT7tm11eeWgtL DffJNEiiIkNFfzSff06TU3+O/NbdjP+ySly3pAXx9Eztcado3qqe/U46Z3zNbFGn2vEDgQ M5/UrR1DBCilnsWJDyBbr49vZouoOV4ysRwzTUfg1pml/m883Ixip48leFllVetfXARUNW dj+oeSN5VQYm70N/ps4n67IXOsRDy3IQCoTD4OHAw+6jk7O6mBUWYNyva9cE0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923986; 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=vcsztzpf7wrhsq8kEWO2wTwg7hWrWVqskB95zSa1XIE=; b=xykX7d93MidCxIXvTJr9kggUNutAaYj2QST+cqL0W5lDMJX23PEH4NWb+QAWEyIBX2PRgo iEegzvaS7TTlui2D2vrHz1VDEHHoOWRUyb39nd1WcVLhqRYafYyF98UDKuZwHwMStSPYx8 pyT9Y/x1CJ0SbAH01wCYO/5kTglalSk+csF2grparXmcJlp4KvNGm7MderpUSSMgu7CwKb fsv/G2sn7pATUAuiueY4NbhvY+XLMUdzQPZtgvqMnUdmUsSploJQJWSNUUlCAXPUI73b1F ClhyGXUPDxgjKrkyJfmC/WmKtAzyVimDkv2z3rn6RceVlgFBWYMEOBpJJJuDdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676923986; a=rsa-sha256; cv=none; b=e4Ytwr7uG6O+X3k+r8Y1K8c2zlYZbyHchOzOX6XjrQUJknZ60B082nr4DOxfdIrIil+QQo HHgoylh7F9asWy7XdWSQw/Jjy9WqhQjOqYKkH1Z6uffJCZGyh303l1CFLVQLs3TB8d8PWe I4HPKu1TvkOiBBiHiS9y60s/HIEc8Xt87EJE1F9aHTkV+O7mlLB0VPbKL16ZwFxhds072C Zq18lhiDx8hMJDJ6OQk+HCbfrm7JEI6xwNW41XSO1/o2F0TXOVLNniA8KlTTo1xzUAXkCZ D7XmouTzLBK2LrhY6R0jfVrb0nb92s0EnVehPggQRkKg26Vt5pT12CP/A6EvuQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLDBB4nGzztQ7; Mon, 20 Feb 2023 20:13:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KKD6sK094069; Mon, 20 Feb 2023 20:13:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KKD6XN094068; Mon, 20 Feb 2023 20:13:06 GMT (envelope-from git) Date: Mon, 20 Feb 2023 20:13:06 GMT Message-Id: <202302202013.31KKD6XN094068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d8198bd81ed0 - releng/13.2 - netlink: add forgotten pru_rcvd handler. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: d8198bd81ed00fe9364ba5ef7ca764a585c95521 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d8198bd81ed00fe9364ba5ef7ca764a585c95521 commit d8198bd81ed00fe9364ba5ef7ca764a585c95521 Author: Alexander V. Chernikov AuthorDate: 2023-02-18 11:48:40 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 19:48:17 +0000 netlink: add forgotten pru_rcvd handler. There were changes in -HEAD domain/protosw setup logic and .pru_rcvd netlink handler was missed when performing the merge. Lack of this handler resulted in userland being waiting forever when performing large dumps of data. This change restores the handler as direct commit to stable/13. Reported by: Marek Zarychta Approved by: re(cperciva) (cherry picked from commit 4a081cc5a44e97794df5dae3df4a49c177b9ae4b) --- sys/netlink/netlink_domain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c index de96818d5e35..c451274b1e63 100644 --- a/sys/netlink/netlink_domain.c +++ b/sys/netlink/netlink_domain.c @@ -710,6 +710,7 @@ struct pr_usrreqs nl_usrreqs = { .pru_detach = nl_pru_detach, .pru_disconnect = nl_pru_disconnect, .pru_peeraddr = nl_pru_peeraddr, + .pru_rcvd = nl_pru_rcvd, .pru_send = nl_pru_send, //.pru_soreceive = soreceive_dgram, //.pru_sosend = sosend_dgram, From nobody Mon Feb 20 20:13:07 2023 X-Original-To: dev-commits-src-branches@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 4PLDBD05KNz3s6lP; Mon, 20 Feb 2023 20:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLDBC6bQMz3L0Z; Mon, 20 Feb 2023 20:13:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923987; 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=GwzThnnVSw3dTLv53Rz+D58XBSSSpGZTymK8eOyBFAQ=; b=AkTJrJX8vbXxW/JCz1gOg8YkFuVAdsTq4ebVAdy6sAILkY+NzgkGDX7IC0HcinvXT1Vn+i CSx1V1C5S08XkHLbmrJbs4fLJRi0+ZwOJLrZIZ/ejthEXe5V8Q0be/goPCnN4zX/6hOzQb Jr6A4EzJwikzWo8RpXngBr4hXzuhiELbtFUcoDIHcujwtubFLObu9IW4xUGjCNQYg5YSGq 5/DiFVpEc/DBRtHExTusPz6je/fLnNj5V0CpJc5qMg87DWmoct1kfHNhs+z4mg29Hc2+vl rOC5BO4FrhYniE9ZE8YuloMAsCB0kPi5u/wOs11ALEscRHoNBi7NofOmebM78A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923987; 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=GwzThnnVSw3dTLv53Rz+D58XBSSSpGZTymK8eOyBFAQ=; b=Ujug6fz67uJFeAZbQSq4voonKACoKxEViadeR+GrbzAInAvvKHxPukFUGulLdYv/YUqShn n+1JYgFmj70Mivnx4movpJjWvFWrEnRqpZyYyoNGAsOkXsZo56WagCiSuZ4fBtdCRUvWV0 SJ6tsCRDukJKUl/OEOv9SbvWLFDsvPNsO6HmuUOD7Nw/4velV48XyGlNZbilJkt4QQQhrE 7OxtmKOBMwTRh0sr3G29iub5Ra+9+Xd9FWy+OEqf3/RSaqyn1HllOzuTQZSnl+10BwEcFB +WTzox9a3lgnMl0yzgRTWAllwtlX4z88ylvk2W27IE8OoFX+pHSwN5Y9lsdzcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676923987; a=rsa-sha256; cv=none; b=aJMWckmJ5js7r6hg3ZbUxSdd+DrYPRkrP8i60i2R7G48B5pcxrphKxvPnDfhGLM1wnZ97f i7jUUHnoC11TEhkmOTsktbogAL6j0FqaT1C3sXpEO4cM2Ze43S/TdCPPOep9MdByiFClT7 GWp/4IAK7Y0vW5l+OT4wJ52CMnGhY/B8n3CflmqM0Ffb9lJxXQBOQnNJnkf/TwEAfQ2Wl5 zY/SrUlUBtOCPFUba8Lqq+U1wlr8zG/4IEQ+z3k5+yGzYMR2+Aw27NqkHHWqjPrAqKLN+c +5cm1XJWOHIeBXTVA7TztsqZWK15gWUigCiq4Ln1z5qMmprEUmHK8QEwFepBCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLDBC5hMHztQ8; Mon, 20 Feb 2023 20:13:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KKD72s094088; Mon, 20 Feb 2023 20:13:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KKD7aF094087; Mon, 20 Feb 2023 20:13:07 GMT (envelope-from git) Date: Mon, 20 Feb 2023 20:13:07 GMT Message-Id: <202302202013.31KKD7aF094087@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 816aebf69c3d - releng/13.2 - netlink: fix if_allocdescr() malloc options argument. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 816aebf69c3dfabef3e9d7fca799438fcd5760ad Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=816aebf69c3dfabef3e9d7fca799438fcd5760ad commit 816aebf69c3dfabef3e9d7fca799438fcd5760ad Author: Alexander V. Chernikov AuthorDate: 2023-02-17 17:35:28 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 19:48:22 +0000 netlink: fix if_allocdescr() malloc options argument. The current value was based on the initial revision of D37566 and was not updated afterwards. MFC after: 1 day Approved by: re(cperciva) (cherry picked from commit 6694cb1f5784d6ceacd684d29b3e3012e1e4e4d5) (cherry picked from commit 8c60d469d3faa98f6b0e49173f16a8603c4c4654) --- sys/netlink/route/iface_drivers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c index 7f098b808743..1b8c27bfca68 100644 --- a/sys/netlink/route/iface_drivers.c +++ b/sys/netlink/route/iface_drivers.c @@ -72,7 +72,7 @@ modify_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, if (lattrs->ifla_ifalias != NULL) { if (nlp_has_priv(nlp, PRIV_NET_SETIFDESCR)) { int len = strlen(lattrs->ifla_ifalias) + 1; - char *buf = if_allocdescr(len, true); + char *buf = if_allocdescr(len, M_WAITOK); memcpy(buf, lattrs->ifla_ifalias, len); if_setdescr(ifp, buf); From nobody Mon Feb 20 20:13:08 2023 X-Original-To: dev-commits-src-branches@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 4PLDBF1tkpz3s6jb; Mon, 20 Feb 2023 20:13:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLDBD6Vy4z3KvK; Mon, 20 Feb 2023 20:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923988; 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=FVIKiuyX6gcV1AdDNPXjuRWrnZ1LCjdHpB4dO/xVCYc=; b=fxBGWKdqTpggUqERBAZdtnAA3nc+8UfbFWyKv3nZpDLYGMm0Xex9TTQTWNOkeqNG+smI2Z UmajjmJ1ztfGCBI3hG5zSE1rJnb0rEZggQ/up4OQhFVdUp1z3unXpIy9gqqQDn+sNx8A/c AGnfv/aYsf0t2N2BUM7ZXwzPS7p0vY5O6W1ddnapQvw2EzRTjT01z+JI62enGflZw6eG3N qptaCTdG2+hbcuX6yNfg8iwbMxJb4HJ/PXP/kwJTtb9c9d4/0HvCHcek772zFD/bq2HFhX TmeLJUR5Iy+UPs2kML9VLEI9CSBCzIUJALwTjyaQHdZOAs1Lq2Tt6JuC9psreg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923988; 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=FVIKiuyX6gcV1AdDNPXjuRWrnZ1LCjdHpB4dO/xVCYc=; b=bob1bZYQYffP7iH8wx21wP2jWkucnSN7+gJfNiarMEKVrJfk9XUBhy4X1vOszxfv1yRSX5 wSUmOim7UrGAqCrvOxbpLeH4rE7OvujKTbXwuZzOzlIdp7VYgXVXoehW/kp/OyTROUHt5+ 0Az9gDPL8PShuKBBQT+ts2n6f5RGkif9GJqDHXv9TzLK6WksF3DykDuQ2zJyeZOQWKCrIn 0wT/wqHWAvXTs7guAO4JvSl4h1MfRY5cClfZX2CUk9fbl4ROglHhMyvdf5w5JbedZd8tyl kkFa0vR+H2uVySsMQRmgIBmQ2ppdJODHjop+DOFWdvQ3p+0r5JqiBu0UBKUqqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676923988; a=rsa-sha256; cv=none; b=rGs9ezmDd4UDIeQJrIN2Vk2Za3fMLEzz+G1IEiTcfFK4O7dJ+qwQZ/2F6jTm0d3CIm1C94 poxvg3Y8iFMK2/CIMjPOj8gpl6TdtcYVmqKThbwfXE51/Eb98jikjWZXJ+PK/CzC8Sr/5g AA8Jog3XPlnwlJu33yjI+/QIeQ7ZIiNVF/3TvCoyZdvZPyVXr2iomyO4bY74ToYtLHUwiX s0bG9hUok74kyq9xwKFLAp/Nr0AB+vDEmzimUy2G0G1HxIMPYEEU4MaAigu+LHkq1GM18N KmLFsU3ENxKeN9dqGdvQDngTg9BYWbKCQQ/5i43qLI8VS4k+RNOUEZVXOMy+Xw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLDBD5cQbzv50; Mon, 20 Feb 2023 20:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KKD8RO094115; Mon, 20 Feb 2023 20:13:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KKD8ew094114; Mon, 20 Feb 2023 20:13:08 GMT (envelope-from git) Date: Mon, 20 Feb 2023 20:13:08 GMT Message-Id: <202302202013.31KKD8ew094114@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 94eb891ce9f5 - releng/13.2 - netlink: use ifmedia to provide vlan interface operstate. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 94eb891ce9f58b650a6a0219a2c7d55ed7fb358b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=94eb891ce9f58b650a6a0219a2c7d55ed7fb358b commit 94eb891ce9f58b650a6a0219a2c7d55ed7fb358b Author: Alexander V. Chernikov AuthorDate: 2023-02-15 20:22:47 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 19:48:26 +0000 netlink: use ifmedia to provide vlan interface operstate. Netlink customers rely on admin and operational state when working with interfaces. The current implementation retuns "unknown" operstate for all interface types except IFT_ETHER and IFT_LOOP. This change updates the code to fetch vlan operstate in the same way as for the ether interfaces. For the rest of the interface types, operstate is now mapped to the admin state. Reported by: Marek Zarychta Approved by: re(cperciva) MFC after: 3 days (cherry picked from commit 5dd48f718433959c283a8a4d6e46512426f1e200) (cherry picked from commit c169fb625ee0800ad1e6046440d67eef598581c2) --- sys/netlink/route/iface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index f4936bb2c35b..9cd7e6e80f3c 100644 --- a/sys/netlink/route/iface.c +++ b/sys/netlink/route/iface.c @@ -174,9 +174,11 @@ get_operstate(struct ifnet *ifp, struct if_state *pstate) switch (ifp->if_type) { case IFT_ETHER: + case IFT_L2VLAN: get_operstate_ether(ifp, pstate); break; - case IFT_LOOP: + default: + /* Map admin state to the operstate */ if (ifp->if_flags & IFF_UP) { pstate->ifla_operstate = IF_OPER_UP; pstate->ifla_carrier = 1; From nobody Mon Feb 20 20:13:09 2023 X-Original-To: dev-commits-src-branches@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 4PLDBG2vMRz3s6d3; Mon, 20 Feb 2023 20:13:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLDBG0bKJz3Kvd; Mon, 20 Feb 2023 20:13:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923990; 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=XggDYwgBWmc+QLObOokGuLx2xNkachrx2p0i5ltH5OM=; b=aKXeWc2RqmCUio5KntmdCmFx1otSS/vAbw3dmamYrOpYMbrRWVq74ZEmZ9gIsvkLzhex45 g7iQfwPfm2bRUE06y2CWhuCoXKptVJiXVB8h+MLjlzPHdpDfY1ydrcOhJ3kYHsOT7diTLh 8bRBS9LpGxvk8b+SscAC/B6C7hFFsrJtoirLW7akQQUjeHcrHIxB2aTVEzN1+M3VAbfcxN pjA3vzKvFeOIDRmfoDZZHzqS+n8p0ZUa+kaHDwJ2JRFiB/8YME+pgJJ4A3+FoH1WQ6AGIp XK/iE9iw1h+c354ByFbwlSexDOp1b4uGxIkxzIF1kcMuw0FRs2q6SQ3fIdVfHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923990; 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=XggDYwgBWmc+QLObOokGuLx2xNkachrx2p0i5ltH5OM=; b=SXPa46QaGO1cHpAtb/oVDYGgWHwaSgFam4Z3zprhphGdPWZzmJaCc5hSGlZKm1ziGImybJ pXMHxySqZDdFKS0Eh+J80U8QMSK7npwgSyRVmYCh07eAESAYeQBlqbr23U1+UgV4tE/dSt 0xuEMF/NMw3owDsrffvJyzbBSVc4Yre8yoPsxu1jKAI8x9VAExFJ/Znljc8GC7hdjEbTt1 /sXNh3hXH7R2AjnrxZcUJTvI6mnoefuFx/0MdO6QfZEetzKhjdQVWXjnP5sYJ1QbhX4hhW MckOgMRI1JDtqX7sPtAEnct6OAjWR/h19/jtX/ofeisHxrL3M7u0LDWxhITddg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676923990; a=rsa-sha256; cv=none; b=kI6e+j9HVSpIHoqz+usbdC90JyEdrgGYvy3q1KyB4FnFNANWKAmMM/1zB6xOwbRSULGDQE BA09YiQpcGBhm9K+e/ay7uUi5o+TNzBGbicCjfFgHORxBPE6AtyOwZIlreKYX+xCVLWvpg X1kr5HTDH+YQtUgSLc2JENxBi7ox5630wiiTDJphQKjm0AQIRW/esFgpCGQSef+EfGYZ4p wwJApha39l5upYGLpZ7pwUhbb8XmoDtUhmMl9vDo3tbt02z7RJOgbYh5GP+7jiPWTVT1Zr td2SZsnrOVDB0Hbls3vd6e0qwnuVW1KABJWSPpsker4tR34Xrlr3J8Kagb/1Aw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLDBF6mv8ztZJ; Mon, 20 Feb 2023 20:13:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KKD9m1094140; Mon, 20 Feb 2023 20:13:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KKD9Si094139; Mon, 20 Feb 2023 20:13:09 GMT (envelope-from git) Date: Mon, 20 Feb 2023 20:13:09 GMT Message-Id: <202302202013.31KKD9Si094139@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 16d16c4fcd72 - releng/13.2 - routing: always pass rtentry to add_route_flags(). List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 16d16c4fcd72f8ce86fce64eb10a4a466c46b8e0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=16d16c4fcd72f8ce86fce64eb10a4a466c46b8e0 commit 16d16c4fcd72f8ce86fce64eb10a4a466c46b8e0 Author: Alexander V. Chernikov AuthorDate: 2023-02-17 17:20:38 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 19:48:31 +0000 routing: always pass rtentry to add_route_flags(). add_route_flags() uses `rt` prefix data to lookup the the current rtentry from the routing table. Update rib_add_route_px() to always pass rtentry regardless of the op_flags. Reported by: Stefan Grundmann Approved by: re(cperciva) MFC after: 1 day (cherry picked from commit a0aa160b6d261f67b29a25c7cc5e04668fb6faf7) (cherry picked from commit 45ced2987df29a8587df2ad3c9ea0ddb1998aa16) --- sys/net/route/route_ctl.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index eaabe901b3cb..9bb02c99ddce 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -454,7 +454,7 @@ fill_pxmask_family(int family, int plen, struct sockaddr *_dst, * Attempts to add @dst/plen prefix with nexthop/nexhopgroup data @rnd * to the routing table. * - * @fibnum: rtable id to insert route to + * @fibnum: verified kernel rtable id to insert route to * @dst: verified kernel-originated sockaddr, can be masked if plen non-empty * @plen: prefix length (or -1 if host route or not applicable for AF) * @op_flags: combination of RTM_F_ flags @@ -489,6 +489,16 @@ rib_add_route_px(uint32_t fibnum, struct sockaddr *dst, int plen, FIB_RH_LOG(LOG_INFO, rnh, "rtentry allocation failed"); return (ENOMEM); } + } else { + struct route_nhop_data rnd_tmp; + RIB_RLOCK_TRACKER; + + RIB_RLOCK(rnh); + rt = lookup_prefix_bysa(rnh, dst, netmask, &rnd_tmp); + RIB_RUNLOCK(rnh); + + if (rt == NULL) + return (ESRCH); } return (add_route_flags(rnh, rt, rnd, op_flags, rc)); @@ -765,6 +775,8 @@ add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data struct rtentry *rt_orig; int error = 0; + MPASS(rt != NULL); + nh = rnd_add->rnd_nhop; RIB_WLOCK(rnh); From nobody Mon Feb 20 20:13:10 2023 X-Original-To: dev-commits-src-branches@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 4PLDBH2CPMz3s70y; Mon, 20 Feb 2023 20:13:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLDBH1XQ6z3Kqg; Mon, 20 Feb 2023 20:13:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923991; 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=+55vh4PgmjUgOw+4U6CPEupLCIhCXdmxyFdyWKSWCd0=; b=x82FEFsZ6U+rIgc9bb5aNhKGOibz3r2ahWS25TnlaxuEj5YeyOOvCXEqNKklJfSPekLQQ3 /eppmmRU9R+zcXvuMPoHWrPURxVNj7hTjA4Nq8v/SAXBokPkMiKaTA1MPqKmeuZIGrDskM HDCQsehIBpJsCdeAG1UK3sHSdnaDUPqk3UjJSBGJvd7tViOZPsLs5AFpChbAI3vVeyPr1f ghGHEhrWvdGfWjG6gfZJT3SnI5Qk+YlnfOTkOwvy2Dq3quIMdkem503iDbP8bQiBpXTcHP ZUaS9+A1eijRTxEAx4GA4NwuRA4t+ua0Idq4I4BoCq8I8EcuWmPwKcZfcSbbKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676923991; 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=+55vh4PgmjUgOw+4U6CPEupLCIhCXdmxyFdyWKSWCd0=; b=Y3X/sAPzTRrtaSZ4XDKokIaebPl4aurwYHqhiBYG6YTRV4sJV6jqkIup0Zi59wgyaZrn8x uDgt5SmNyH923kOb/vUgYP7dRryhCnYATk7JzGLysAtkH4Zj5BAEwdf9/fzaIH3jHoPu7M G9ucJKxFRdGZKCz9f1EbYtHBLF22bi48LDoyDrqJnDDlwBc+Itgx7Q0UeGvettopqOwJUt unf+LmLBhVxXXFYoi/14PuSBv0oGewI5W5ToY92eR6nQCQfORLrGskeGB/kJ/39H/aReaP AJLYwW6Doe2sg5Lw2tNrKLsIavI2UUC5pUQ+D/3PuJQ1kUyas0Em23+C7bzq9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676923991; a=rsa-sha256; cv=none; b=Vth0KZW172R46KQODwvcQcbXnPphNtS+JPXXEofZpzYxEyk0NQPwmDGxM3cEc/8eya/8wT Jqmyppz/uaC0VkoReo47piWR9tHsXmgE+0v0qo8iWnkYuCElujDV9GPFXaNwbLY1TBLQtp uPuVVypcj9mJLdMc2VKuILXOo/futGjQmpjIBDLwQ7+ERl9wUyv/hr4eGv1OdcgY9tv78v aowcWbZUWdhoOfod6fGXc5pesr1NQPOf38641uPu0sGFv7PBFAWXTRsKSKPQi7R4GnbKWm d4iNc5zUEf8NtWezREW8sEH8GcV67bLpofqrYwoiTWL8SqqcLV8c0moFN8CGzQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLDBH0ZbZztZK; Mon, 20 Feb 2023 20:13:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31KKDAtJ094160; Mon, 20 Feb 2023 20:13:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KKDAhO094159; Mon, 20 Feb 2023 20:13:10 GMT (envelope-from git) Date: Mon, 20 Feb 2023 20:13:10 GMT Message-Id: <202302202013.31KKDAhO094159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: e28e779b1f4e - releng/13.2 - netlink: validate rtable value in RTM_ROUTE. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: e28e779b1f4ebef32070e06854336cdf15ad095d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=e28e779b1f4ebef32070e06854336cdf15ad095d commit e28e779b1f4ebef32070e06854336cdf15ad095d Author: Alexander V. Chernikov AuthorDate: 2023-02-17 17:31:40 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 19:48:35 +0000 netlink: validate rtable value in RTM_ROUTE. Reported by: Stefan Grundmann Approved by: re(cperciva) MFC after: 1 day (cherry picked from commit f2f7911c5513096e46422ad7756bc90c13c6e6d8) (cherry picked from commit e9296dc1bcd21cd9d719389cd04235ce4513e84d) --- sys/netlink/route/rt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 59b34c53ad4b..aca69e75fea8 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -840,6 +840,11 @@ rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp, return (EINVAL); } + if (attrs.rta_table >= V_rt_numfibs) { + NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); + return (EINVAL); + } + if (attrs.rta_nh_id != 0) { /* Referenced uindex */ int pxflag = get_pxflag(&attrs); @@ -898,6 +903,11 @@ rtnl_handle_delroute(struct nlmsghdr *hdr, struct nlpcb *nlp, return (ESRCH); } + if (attrs.rta_table >= V_rt_numfibs) { + NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); + return (EINVAL); + } + error = rib_del_route_px(attrs.rta_table, attrs.rta_dst, attrs.rtm_dst_len, path_match_func, &attrs, 0, &rc); if (error == 0) @@ -915,6 +925,11 @@ rtnl_handle_getroute(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * if (error != 0) return (error); + if (attrs.rta_table >= V_rt_numfibs) { + NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); + return (EINVAL); + } + if (hdr->nlmsg_flags & NLM_F_DUMP) error = handle_rtm_dump(nlp, attrs.rta_table, attrs.rtm_family, hdr, npt->nw); else From nobody Tue Feb 21 01:19:42 2023 X-Original-To: dev-commits-src-branches@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 4PLLzy5gJxz3slbG; Tue, 21 Feb 2023 01:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLLzy58tNz4Cxv; Tue, 21 Feb 2023 01:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676942382; 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=eCPDyLf/WfAhqN5H7BF3PUNidvBZDJ5OQfGG/vS2leE=; b=x5WaBNUpcmq5eaHOc1FhY7GoLV1ILOw6my0vkiJdvtRWCM83T3bUVNYf7KUlW7dNcMyqzJ ucKMCbSPvRNQMYkOeu682v/DSLnBmJIiQpWoMjgbnu8ClKR/uGENAUoTKxo/I0rQq3krcf CG/DcPIMP2NdExl4czIZCR4JNePtivNuGVWzX411f+jStElzdCgLJVCsbJe3takMfWdrSJ y9aRu+3DNdQIbg+7QpDUh1h16722xpUbXsD32fUggbIOq9Ju7I0ETIDeah0EGIHz0D3gj5 +lRMeLvPpW6I+x8oDV/cyOHi/fwuPzACNAMMwqVIFSbciySgMbqbIH5V8oSESg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676942382; 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=eCPDyLf/WfAhqN5H7BF3PUNidvBZDJ5OQfGG/vS2leE=; b=CgyWSNU+2yxrEKYHwINyDnMNtMEghbGBCJBY0DY6aSr/pEfcL7PIFBz23EuItQiYA8k9Nx 5C03ZBFbUWWiSa+TvtW3EZ+3MYIFUOwaf+/Z//kYgnJ2QsitpTWZ/qybyc/DGUN1WJcKWn ROzGVCpSgMt+cEVMJSIrbrGsCIZuxT3JVqv3GqOYtWvXHbdXz+vc2Drlt8BXBoUjtrsJ2w X0DlMP/Z63GfPQgkrqS4PWJUuEAQ7E2LLNy/JCK8wXzYQx7DZq9HUgOGf/q3FzKWnbPyvW bNEMIAYysnCzck63qfazl311vdL8vkvqCig6kS1b8Npx63yNvYh3mc7FsxZtpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676942382; a=rsa-sha256; cv=none; b=B78dGcCVCkLbnUCWr8wwAktFZ+WM+iv7arlxjiQvYBao7mG07ywOQYUi9O3lWcB4xTAAox qCZ/2B6RAtY1KBYy/yQo4OPYXIzhwHNxsuwf4jspW4HTlgQV7Dob2HdjZzOdMK5H6ymAiN qMsh/TKHssnmpfMerRN4cNDooWTubsQ/gcdKCxjhsUvodpjL1hQyO+g4yxUDzcDPiVJ0D1 kC6K4YSEsAWIP4H3M/V0dehdIv9lADmxjLREpI1JeG8oFyXw7zVJPe9rY+9LvOJLW8tdaf 0DKbLhnK8Z0vBD5EZBvojj1rHaEO4omAsqE85OE7EKQK1XIgLkI7NrJJ7/ddsg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLLzy449cz12c6; Tue, 21 Feb 2023 01:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31L1JgFT026058; Tue, 21 Feb 2023 01:19:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31L1JgXv026057; Tue, 21 Feb 2023 01:19:42 GMT (envelope-from git) Date: Tue, 21 Feb 2023 01:19:42 GMT Message-Id: <202302210119.31L1JgXv026057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Kubaj Subject: git: 8f39cbf4f30c - stable/13 - llvm: make sure to use ELFv2 ABI on powerpc64 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8f39cbf4f30c9a8cd3f593dc2b373a289785d4b6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=8f39cbf4f30c9a8cd3f593dc2b373a289785d4b6 commit 8f39cbf4f30c9a8cd3f593dc2b373a289785d4b6 Author: Piotr Kubaj AuthorDate: 2023-02-16 23:49:43 +0000 Commit: Piotr Kubaj CommitDate: 2023-02-21 01:19:33 +0000 llvm: make sure to use ELFv2 ABI on powerpc64 Currently LLVM is more or less set up to use ELFv2, but it still defaults to ELFv1 in some places. This causes lld to generate broken binaries when used with LTO. PR: 269455 Approved by: dim MFC after: 3 days (cherry picked from commit a1ffc2fe9ce54a498c410dcab86495569dbaa7cc) --- contrib/llvm-project/clang/lib/Basic/Targets/PPC.h | 3 +++ contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h index ac52eb219f54..cd9bf0d8e359 100644 --- a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h +++ b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h @@ -425,6 +425,9 @@ public: } else if ((Triple.getArch() == llvm::Triple::ppc64le)) { DataLayout = "e-m:e-i64:64-n32:64"; ABI = "elfv2"; + } else if (Triple.isOSFreeBSD() && (Triple.getOSMajorVersion() == 0 || Triple.getOSMajorVersion() >= 13)) { + DataLayout = "E-m:e-i64:64-n32:64"; + ABI = "elfv2"; } else { DataLayout = "E-m:e-i64:64-n32:64"; ABI = "elfv1"; diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index 3eff00fc3c05..9b7145aafead 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -221,8 +221,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, assert(Options.MCOptions.getABIName().empty() && "Unknown target-abi option!"); - if (TT.isMacOSX()) + if (TT.isMacOSX()) { return PPCTargetMachine::PPC_ABI_UNKNOWN; + } else if (TT.isOSFreeBSD() && TT.getArch() == Triple::ppc64 && (TT.getOSMajorVersion() == 0 || TT.getOSMajorVersion() >= 13)) { + return PPCTargetMachine::PPC_ABI_ELFv2; + } switch (TT.getArch()) { case Triple::ppc64le: From nobody Tue Feb 21 08:22:06 2023 X-Original-To: dev-commits-src-branches@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 4PLXML6PCZz3tDyJ; Tue, 21 Feb 2023 08:22:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLXML5g9Bz3n4B; Tue, 21 Feb 2023 08:22:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676967726; 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=9GfQFJ0HBUB8Th/kTbOHkxxCD8uXdGOHfjcbtYvqQTs=; b=X6lYzOFgR+98PekhUbMsLWvkt8FWUS6y0sNrXsADmMJR79YH9zFa+t7JinCrevTR65eVSA JoylNBzEp3eLT55oDxNoecUjRRHjLzv+XJ//UcySZn/FiGdcCi/G7WTi3CKAvNEmB4PyP6 q0j5iEGL7J78wzTG6v+NRpIjNACyUnP1OuvE6ZZ5ft9QJIqMujSmtc8RhFaDf4P/JQ2mhz HfpiMO4QHqE9EpvdlOaNFVQU/4qPwfzoFbK1JgLCD7DiabZIshM0xI4oMuvhi5cDzlXYSN cuCSGJGPKB3P1cQE+rwLELrvaVV6zwPtH+EbhP+hymMA4LgLIdODLrDSGpT5Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676967726; 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=9GfQFJ0HBUB8Th/kTbOHkxxCD8uXdGOHfjcbtYvqQTs=; b=XthH58zF1p8UA8eGs82Mujk4Dja5huvjzZAkVqcfcyWDMs3UEo2xvnlXz8cwZZfUMOTz/w zL/yvGpSuwZJB1QG+49PeNNRKVbCcA0fEi1AQWhrHowdzGFvkRKh5yuyZz4O2PcaxiQBQO O7xixuvWGA2IHNj459sLooMuQL1+HtlIux7Gld+bK1Hrjr20aucWwSeSU/dvGyxaP+/deQ RtrGHUu9tBNwt+XPidgunJblq4jIoIHaek1PWQ+jAaBNNe+MqJYoNmif0hTdwUmkHG6HFA MpKqHGq8TdRn9wYCZB4zUsFVA1UiALSLq2JB9dFGyeCv2xTl6hHRQK5JI5aJjA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676967726; a=rsa-sha256; cv=none; b=d8exd3kMw2VP4a83eWyhIpSBnadGyrbgM7ua2iHvNHIf7/kUM2KHZGKkVtNFJx6l73P8wL jbCIosX1pfgRZMfxEaE8Z3dimlh9/ylQP1hvYhdS8wDDM/y48JCnmXwE82N6AYW/AOo7ue o8VCiJr5ed8Ew0w132xPp+QA9KsT9rQqWPkwxEmOsrbVd0vL9DPl4V8zLU43RGAHRj2wSu 1V5gKaQam+Am95kF+kfbMF8TkxrZamogO6maBDo5yJC1+BJDV6cAlpLpwcVNHi8Ax4pxx4 1cZyF6axl+N9InbWFkX89yj0TRWsnsjel/R1H7wuwZaj/UmZ74h9w/QG/T3MCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLXML4lZKzDnc; Tue, 21 Feb 2023 08:22:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31L8M6gD036672; Tue, 21 Feb 2023 08:22:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31L8M6dA036671; Tue, 21 Feb 2023 08:22:06 GMT (envelope-from git) Date: Tue, 21 Feb 2023 08:22:06 GMT Message-Id: <202302210822.31L8M6dA036671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 81e5b344273c - stable/13 - linuxkpi: Add more suspend defines List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 81e5b344273ca11808b4e694d684fd0c09a6a5f7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=81e5b344273ca11808b4e694d684fd0c09a6a5f7 commit 81e5b344273ca11808b4e694d684fd0c09a6a5f7 Author: Emmanuel Vadot AuthorDate: 2023-02-17 13:49:52 +0000 Commit: Emmanuel Vadot CommitDate: 2023-02-21 08:21:04 +0000 linuxkpi: Add more suspend defines Needed by drm 5.15-lts Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit a0fdaf9a7b34b6f8fdab747f7a198158e66b57ab) --- sys/compat/linuxkpi/common/include/linux/suspend.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/suspend.h b/sys/compat/linuxkpi/common/include/linux/suspend.h index 8458a6f6d4c5..8ceafaf35f56 100644 --- a/sys/compat/linuxkpi/common/include/linux/suspend.h +++ b/sys/compat/linuxkpi/common/include/linux/suspend.h @@ -9,6 +9,10 @@ extern suspend_state_t pm_suspend_target_state; #define PM_SUSPEND_ON 0 #define PM_SUSPEND_TO_IDLE 1 +#define PM_SUSPEND_STANDBY 2 +#define PM_SUSPEND_MEM 3 +#define PM_SUSPEND_MIN PM_SUSPEND_TO_IDLE +#define PM_SUSPEND_MAX 4 static inline int pm_suspend_via_firmware() From nobody Tue Feb 21 08:22:07 2023 X-Original-To: dev-commits-src-branches@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 4PLXMN0TM1z3tFNG; Tue, 21 Feb 2023 08:22:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLXMM6gjmz3nNW; Tue, 21 Feb 2023 08:22:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676967727; 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=oLtlyOicGSL3Qp9+Z2ugFmZyu2D51/siQmRiW6RNoUs=; b=mRLwj9NH2/S0tOXwCA6E3xDDEeCixEtjzLCD7Zty99x9ZlY05zmED8oIeZOsGrchlc02/X GNKpTjrUfkYLbxMXQlY/Kol2KImAfkeleFkoXZ1/sPYoSzFtvxzY4EAPcXgeaCe1OsNhmD J5YyZvuYVTJ3yOI6QTaZ5BE8qzFFsrX43wzpcC0NG7I/O4WpydbnvtGvVEG1v+Wjg1RI3o mH8TYQdbE0VeKxo3oyp98eOttgqD6lxkEcXqetXI/nXZKHmjDuoRZYDD9j4mV7P4J0dUc7 3R0rIb+fmrMd4s4LI2f+xf1AUSuc/AgGuSJz3jvXaTKGiRrrH9PEcczRcq0RYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676967727; 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=oLtlyOicGSL3Qp9+Z2ugFmZyu2D51/siQmRiW6RNoUs=; b=NmLBqJ2lDZ0K4oeg4hV7j+NzYxwaHWwwWviSzxxyu/n9zuEOqwEdrRav1i9RWZ1GzYWygc lEPEtObeCSO6+pRBR4SJDM2mC9f2kU6J7DHRu6MVheAfUMZnWgwllFYdnnBjbEsL6I83VW NhKa2zrfUShu2nCii3SBnOufifIe5HUTf80e27HwBXA/kSXTQTFe+F92dXnXrR8tRj+OYS aJXUgLnB4and4VsU9l0TyZzOtcfKSgMeL1aE1tTrIKAS5Kcemgngy+dMsYVCFcb98AtOKZ qK3xrTS8mL0CtLQGtfp01iVZWgwmkF9AtfNd130QvnTdDRDyiRlZ8jpIXccBMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676967727; a=rsa-sha256; cv=none; b=iRm7uCY67/cg6JTkMet2+Ds+7r5bBzQ4R0PiNKjFgAHU6PzHcq2gZ1irf0+x/j2rL9zAQK KyvsUR3/0BoFH4tyBvEXe13z38vfUImg23cFsIWqFUS6nKQGo8Ew2D002cUwn7J/8WX1Ij R9TY8N4CmXfZN1jFXljggz+ZxuIrvcSG7Ocvo03pjeXMCTqkK0H/XZq71Tox0EXfFwXtte OlRr0fHM1TtVCGACF9q3oCRpXFjufutTkVbmVQQH+hq1b1IecISL1o3ei9LltKuRUxEGnu f299J0E9SdsoGovM7U0fgSv6GYggvVMxWgJR6pdZLCbjzIXFfXvvgV7Z2W6Uqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLXMM5MVnzDqm; Tue, 21 Feb 2023 08:22:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31L8M7PF036700; Tue, 21 Feb 2023 08:22:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31L8M7wK036699; Tue, 21 Feb 2023 08:22:07 GMT (envelope-from git) Date: Tue, 21 Feb 2023 08:22:07 GMT Message-Id: <202302210822.31L8M7wK036699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: aaca677fee21 - stable/13 - Bump __FreeBSD_version after linuxkpi changes. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aaca677fee21f202db4bb974fc5056f4dcbbb598 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=aaca677fee21f202db4bb974fc5056f4dcbbb598 commit aaca677fee21f202db4bb974fc5056f4dcbbb598 Author: Emmanuel Vadot AuthorDate: 2023-02-21 08:21:29 +0000 Commit: Emmanuel Vadot CommitDate: 2023-02-21 08:21:29 +0000 Bump __FreeBSD_version after linuxkpi changes. Needed to have graphics/drm-515-kmod working. Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 6c95088e783d..12a407dd0464 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1302502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1302503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Tue Feb 21 13:38:59 2023 X-Original-To: dev-commits-src-branches@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 4PLgP00SKyz3sfkk; Tue, 21 Feb 2023 13:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLgNz6xgvz4L0d; Tue, 21 Feb 2023 13:38:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676986740; 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=Uy24Vh0uz882O6ttRaTz42ABAi/ycupWoKCcVfyVNiM=; b=Pgy3w4zi39k549rWK4svWIjr8xsQb2KVQsAiKwNEYLbrBdf9R6Y5JfZtET5qyHdIgNGU9w x42fYiK00Jw0QqQxjq8xvTOOtlLf27OPPDlkbLZKpNHOi0phza5D2Xf1BDAurZ6DQulCmP +CSdt4De24mWUcxh1UoI5yh1K4OWH5USGpwIykJvu/5wRYcnmR+kTQjrkLfxKV788N8YBb pNc94jk+x7S+ArkVpoAIjPPzZLWIaXpKIR9Mz/fAjaef3wTEjxw4R9SLe7mjUpY/UNucg7 mp40wiwn8g9JhpvOf2eppRMThk2jbu9nXBKEIam43u3hGsj4BNtsBhhQzGkkCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676986740; 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=Uy24Vh0uz882O6ttRaTz42ABAi/ycupWoKCcVfyVNiM=; b=WXm+Pia2B8/HuWdytwRzFWv06TWhn2lE1MRAnTC1QCB42/xxzsfYEZTBFtSY7aV0Vb+/RV 3WwhS2Qg6qHfXav1H8UJXXxuWffjFIM378pbju574AjvRR5/zQCC67VJ8cwmfJpbJmZCmg 1L74Em1XzrCdT9NaK6uGLF/aICuG9R4niF1OIy5bAyaSIuLUQhz8b0l6fchU5exJBEj6a1 Slv4k4tpiLHJOQ7Gysyn8DdieCDMtio2MxAoB7FptDFFyQ8ESu9C0U5kMm8TdZtTVDsbIT N7N4l19doosiHhfyT1ge0e2Zkq6NtYIYd8CTjXyOm6GSOYeKrMcxbyAVY9v7OQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676986740; a=rsa-sha256; cv=none; b=OAn/kVGMsKbEwAH15mgRySCoCnMG6fmYcdyCh4X1QndIk+cAq9Hg4j7XmiOudzBvAjf6C9 VBz/MLwcXC7ul9jGocubPipjWd25ffbOGHi/DAfiVxZ7y1/2KrSDGwrKUUwliK/6VlVBac HvSZ8h0RQYsvJK2GalAEOp5n4BKiM59sLBy+7cUZBr/AAbHU8uEeAA1VpiHpo/DAXL/1wc iIt6QleN/fs1PP7bsL4VGjAR6Kxpajq6NFsuWubzar/V0Zqz6W77wOKJKuvOqo/i0+9zDv 40YmIZ8qc1Cm3kEMQlQXH8cy7LPN7BSl8SGmS7jrt8wuBSy83/4N+8TTXXsPug== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLgNz5mpvzNGF; Tue, 21 Feb 2023 13:38:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LDcxYU079499; Tue, 21 Feb 2023 13:38:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LDcxPF079498; Tue, 21 Feb 2023 13:38:59 GMT (envelope-from git) Date: Tue, 21 Feb 2023 13:38:59 GMT Message-Id: <202302211338.31LDcxPF079498@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Kubaj Subject: git: 50796dea719a - releng/13.2 - llvm: make sure to use ELFv2 ABI on powerpc64 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 50796dea719a4ca2e26376eaab67eafd94532fee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=50796dea719a4ca2e26376eaab67eafd94532fee commit 50796dea719a4ca2e26376eaab67eafd94532fee Author: Piotr Kubaj AuthorDate: 2023-02-16 23:49:43 +0000 Commit: Piotr Kubaj CommitDate: 2023-02-21 13:38:43 +0000 llvm: make sure to use ELFv2 ABI on powerpc64 Currently LLVM is more or less set up to use ELFv2, but it still defaults to ELFv1 in some places. This causes lld to generate broken binaries when used with LTO. PR: 269455 Approved by: dim, re (cpercival) MFC after: 3 days (cherry picked from commit a1ffc2fe9ce54a498c410dcab86495569dbaa7cc) (cherry picked from commit 8f39cbf4f30c9a8cd3f593dc2b373a289785d4b6) --- contrib/llvm-project/clang/lib/Basic/Targets/PPC.h | 3 +++ contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h index ac52eb219f54..cd9bf0d8e359 100644 --- a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h +++ b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h @@ -425,6 +425,9 @@ public: } else if ((Triple.getArch() == llvm::Triple::ppc64le)) { DataLayout = "e-m:e-i64:64-n32:64"; ABI = "elfv2"; + } else if (Triple.isOSFreeBSD() && (Triple.getOSMajorVersion() == 0 || Triple.getOSMajorVersion() >= 13)) { + DataLayout = "E-m:e-i64:64-n32:64"; + ABI = "elfv2"; } else { DataLayout = "E-m:e-i64:64-n32:64"; ABI = "elfv1"; diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index 3eff00fc3c05..9b7145aafead 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -221,8 +221,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, assert(Options.MCOptions.getABIName().empty() && "Unknown target-abi option!"); - if (TT.isMacOSX()) + if (TT.isMacOSX()) { return PPCTargetMachine::PPC_ABI_UNKNOWN; + } else if (TT.isOSFreeBSD() && TT.getArch() == Triple::ppc64 && (TT.getOSMajorVersion() == 0 || TT.getOSMajorVersion() >= 13)) { + return PPCTargetMachine::PPC_ABI_ELFv2; + } switch (TT.getArch()) { case Triple::ppc64le: From nobody Tue Feb 21 15:38:08 2023 X-Original-To: dev-commits-src-branches@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 4PLk2T2D1Lz3snh4; Tue, 21 Feb 2023 15:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLk2T1VPMz3Gft; Tue, 21 Feb 2023 15:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676993889; 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=gYCoq9dk7tuLVOBVFqHuuxDpIVa43XIEeZGeAWLZoKM=; b=pFzdJwR1UrFQutS9fUhnwmkvkjOMdCc+JNpJ4nMKpZ/LpLoJ1dQ+VvRu0IH1fJThAl8k8v bOVPhFcgc4uPbEAVzbVRgYRB9sl19EiNfVGrgqqs7XQrc6wNdngDLKFwp2yffLr57z8/Ea jtk3Dy5g94xNf7wIowNch6DVXNnSrLWr5CjFpLR9HdEs5X3DLsEjZ7ImtZAg4gszl0wXRr no3bAGq/ZVLBvNLpHdJNCno9C8g8TMq0tllK18MdomjhoNQyB0IFQhtg+/6OTdDcKsBfIR wwdSYdjAFsT4GRzclQlWrHtpVqJa2kXrJTn/9ydfJOp0qGG2CSuwTTp2x79sNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676993889; 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=gYCoq9dk7tuLVOBVFqHuuxDpIVa43XIEeZGeAWLZoKM=; b=DtQPSXviGfcz5m3RbzrO1phVxbqXY2PU8BsRtnsNrZlVYubJG6B1JGqQP73Edl6xsE3qsQ M7lIqOoIoSmixxedZRiMZu8S3yMLs1fAHpa5hAATJkxDg0NlTLPzpBKxbGhRIsgVyp5bS4 hIwGlj1OR2meX42LotinBARBnALI147wvDgJPwrGm9yxVsjz5bPrQvKxGHyyAUsBxbTVlI ZsV3qaAF07JrPalz/Q0GtUDS+ho6Q5hwgu+d8Ks8B1KHEK6A76n3zvA1sZh4eW+0QfuXYn 8Fwbxec6+gLVgAycxlvtOTpasKs1KgiKFz5HYiIs9BcDXeS5qkpNWw6iTWAUrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676993889; a=rsa-sha256; cv=none; b=T/htfU2DWAkf0gs8IHHLkc9nzYhrJRD+62/i8On04K/tABT+z5PjG59T1uFAQD6iGdoLt3 nyEc1IhtvZbSS4rsazDDmJR/bnNm3TUnWgm9WuG5piIeiid1dU67ZG7WXFn6IB9tneKgau U0tYSsQ0mPwI4aJNfOlt03+q+Kb4zvG/O4oll0YetKGl81PaGykD2rv1XoDfEZEu0gSYSu hOo3JAfgdHClftGELZEHzseP/6rKZAOFmrhehTnoyJGWRV8C1AX9W2btAy+Uxu5088SL7o MAzdg8nSLAZwYZr7BwGgQltmQUpl3MtAPQO9jmBvYIO5QfquIVfJvSl3rHrVUw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLk2T0ZLpzQc0; Tue, 21 Feb 2023 15:38:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LFc8RO050867; Tue, 21 Feb 2023 15:38:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LFc8oE050866; Tue, 21 Feb 2023 15:38:08 GMT (envelope-from git) Date: Tue, 21 Feb 2023 15:38:08 GMT Message-Id: <202302211538.31LFc8oE050866@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 57c37babde36 - releng/13.2 - cleanvar: Be more careful when cleaning up /var. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 57c37babde3664c81bc30ec5086092ae950aab49 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=57c37babde3664c81bc30ec5086092ae950aab49 commit 57c37babde3664c81bc30ec5086092ae950aab49 Author: Xin LI AuthorDate: 2023-02-13 04:56:17 +0000 Commit: Xin LI CommitDate: 2023-02-21 15:37:30 +0000 cleanvar: Be more careful when cleaning up /var. The cleanvar script uses find -delete to remove stale files under /var, which could lead to unwanted removal of files in some unusual scenarios. For example, when a mounted fdescfs(5) is present under /var/run/samba/fd, find(1) could descend into a directory that is out of /var/run and remove files that should not be removed. To mitigate this, modify the script to use find -x, which restricts the find scope to one file system only instead of descending into mounted file systems. PR: 269213 Approved by: re (cperciva) (cherry picked from commit 39e8c2a29a860bdb69ffcfbc06de4d4ad103b458) (cherry picked from commit 0699f0d43416776d87d20d7953b7d686f1e2e572) --- libexec/rc/rc.d/cleanvar | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.d/cleanvar b/libexec/rc/rc.d/cleanvar index fcfd365268c3..a682021ce5f6 100755 --- a/libexec/rc/rc.d/cleanvar +++ b/libexec/rc/rc.d/cleanvar @@ -31,15 +31,15 @@ cleanvar_start() { if [ -d /var/run -a ! -f /var/run/clean_var ]; then # Skip over logging sockets - find /var/run \( -type f -or -type s ! -name log -and ! -name logpriv \) -delete + find -x /var/run \( -type f -or -type s ! -name log -and ! -name logpriv \) -delete >/var/run/clean_var fi if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then - find /var/spool/lock -type f -delete + find -x /var/spool/lock -type f -delete >/var/spool/lock/clean_var fi if [ -d /var/spool/uucp/.Temp ]; then - find /var/spool/uucp/.Temp -delete + find -x /var/spool/uucp/.Temp -delete fi } From nobody Tue Feb 21 17:03:12 2023 X-Original-To: dev-commits-src-branches@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 4PLlwc4spJz3stKR; Tue, 21 Feb 2023 17:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLlwc2fXrz3Pv8; Tue, 21 Feb 2023 17:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676998992; 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=9qW3a3hZsk63AFz9VfU6/Kx+s1SWHCbGbShKpVbqyDo=; b=jZcNKsxUOEuYzLTrGxaJAO73KORHI0yhelmUGh2cP/A8AYvOv2uaw6lZUuQpPskeTgha5W bnG6NTpl68qZGfMDjqraGgAdT6gtOjZBchEEhX0AxYvM9VM7xnuynBkFxfvMulyEOkyfOs PriMD5/cvZVcL5Bnl475wfizr4+yM3xMIPNQVUcZcqhoGEynpNy1BNXr9HjlyGdMXSMs3o G7uaESOTQejGmuK5+ElVEYF8MZxgJmzGVrgJ7nkBE8+fX8IkUlTT/pBG9ER0uwvIKhffe7 f58qJf3z+GGpXe6DSHgr4nEscNGUvAkA/I2pu+BkZ6ZVpyWqhfUBPUQ/JraAdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676998992; 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=9qW3a3hZsk63AFz9VfU6/Kx+s1SWHCbGbShKpVbqyDo=; b=PpDQ8TTPPq4iiPXmwOQoE6M2/wPFbBBYW4O2jcMFn/15+mqQYeDNEqvD2YCPsoa/zGLAOi FlQk4SK5mgEwDZfuJJnIlyu6R/4nWnavqJIzI27Il7EMamtpu+vE5va76NO/PFF4+DWWbH O/R4Rk/3a4jwv6VOBIa/GzqQbIZhwW0tnCEVRcLzRbcTFU6dqQb/1ImyMECGN2VO4OMZpw s3tcJ97Ti5RBBgElrqUdyYMLq7XJSZ+0IOYUhjtv+KYHk3LDK8mSQP/4tRe0ELOlxrMxPW wECI84MX/FGUGMRxuoOtsqcPv3t7qNMREmsbEl5b/DgyqCqwyjDxAsJR1G5RFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676998992; a=rsa-sha256; cv=none; b=wyK/h76/+4yRPyvWEwdSMQlYvLMGG0mjePYVMZ+5JynLAVegBElptppr8cF0OPQ9z7Tj3J RoFiZJZXsOnXq3j5Z2t23H+UbXVMsGCcO0nOKigQOXYyqRYvgrTtzj5RJW0tyDt5gx+sFb EOFC9HpGzgcdl3PHhYxT8vBXCHW6mmjDzuHj+hGMTGgRv3C+REwM+TmOFPd3Ak2y6SB2zD awub+02ymZ92Ym0NRF5QvLYHZyVnrcyFhtiZrdbQl1WMGjUF+AFG+ANodB6gZyf0QpLL59 UD3EDNR+YSR1cTfhZw7RkgaO5OtP1h3VYrvQ5JJWBaGqLWA728cmPWhOZcW7bg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLlwc1kZ8zSdL; Tue, 21 Feb 2023 17:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LH3C7B079728; Tue, 21 Feb 2023 17:03:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LH3CnE079727; Tue, 21 Feb 2023 17:03:12 GMT (envelope-from git) Date: Tue, 21 Feb 2023 17:03:12 GMT Message-Id: <202302211703.31LH3CnE079727@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 42657d65d8aa - releng/13.2 - kern: physmem: improve region coalescing logic List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 42657d65d8aabf201209b8472ef664c6dba5b6ca Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=42657d65d8aabf201209b8472ef664c6dba5b6ca commit 42657d65d8aabf201209b8472ef664c6dba5b6ca Author: Kyle Evans AuthorDate: 2021-10-28 04:40:08 +0000 Commit: Kyle Evans CommitDate: 2023-02-21 17:02:49 +0000 kern: physmem: improve region coalescing logic The existing logic didn't take into account newly inserted mappings wholly contained by an existing region (or vice versa), nor did it account for weird overlap scenarios. The latter is probably unlikely to happen, but the former may happen in UEFI: BootServicesData allocated within a large chunk of ConventionalMemory. This situation blows up vm initialization. While we're here, remove the "exact match" logic as it's likely wrong; if an exact match exists with conflicting flags, for instance, then we should probably be doing something else. The new logic takes into account exact matches as part of the overlapping efforts. Reviewed by: kib, mhorne (both earlier version) Approved by: re (cperciva) (cherry picked from commit 7771f2a0c94fc2f7b9ce1565a49e52dba1e7381d) (cherry picked from commit 13f1d1bd86476393b8a2ec2c79cb0b1637fcdec6) --- sys/kern/subr_physmem.c | 92 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_physmem.c b/sys/kern/subr_physmem.c index 99b4c2141612..2c7837019ea2 100644 --- a/sys/kern/subr_physmem.c +++ b/sys/kern/subr_physmem.c @@ -295,6 +295,67 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail, return (acnt); } +/* + * Check if the region at idx can be merged with the region above it. + */ +static size_t +merge_upper_regions(struct region *regions, size_t rcnt, size_t idx) +{ + struct region *lower, *upper; + vm_paddr_t lend, uend; + size_t i, mergecnt, movecnt; + + lower = ®ions[idx]; + lend = lower->addr + lower->size; + + /* + * Continue merging in upper entries as long as we have entries to + * merge; the new block could have spanned more than one, although one + * is likely the common case. + */ + for (i = idx + 1; i < rcnt; i++) { + upper = ®ions[i]; + if (lend < upper->addr || lower->flags != upper->flags) + break; + + uend = upper->addr + upper->size; + if (uend > lend) { + lower->size += uend - lend; + lend = lower->addr + lower->size; + } + + if (uend >= lend) { + /* + * If we didn't move past the end of the upper region, + * then we don't need to bother checking for another + * merge because it would have been done already. Just + * increment i once more to maintain the invariant that + * i is one past the last entry merged. + */ + i++; + break; + } + } + + /* + * We merged in the entries from [idx + 1, i); physically move the tail + * end at [i, rcnt) if we need to. + */ + mergecnt = i - (idx + 1); + if (mergecnt > 0) { + movecnt = rcnt - i; + if (movecnt == 0) { + /* Merged all the way to the end, just decrease rcnt. */ + rcnt = idx + 1; + } else { + memmove(®ions[idx + 1], ®ions[idx + mergecnt + 1], + movecnt * sizeof(*regions)); + rcnt -= mergecnt; + } + } + return (rcnt); +} + /* * Insertion-sort a new entry into a regions list; sorted by start address. */ @@ -303,19 +364,38 @@ insert_region(struct region *regions, size_t rcnt, vm_paddr_t addr, vm_size_t size, uint32_t flags) { size_t i; + vm_paddr_t nend, rend; struct region *ep, *rp; + nend = addr + size; ep = regions + rcnt; for (i = 0, rp = regions; i < rcnt; ++i, ++rp) { - if (rp->addr == addr && rp->size == size) /* Pure dup. */ - return (rcnt); if (flags == rp->flags) { - if (addr + size == rp->addr) { + rend = rp->addr + rp->size; + if (addr <= rp->addr && nend >= rp->addr) { + /* + * New mapping overlaps at the beginning, shift + * for any difference in the beginning then + * shift if the new mapping extends past. + */ + rp->size += rp->addr - addr; rp->addr = addr; - rp->size += size; + if (nend > rend) { + rp->size += nend - rend; + rcnt = merge_upper_regions(regions, + rcnt, i); + } return (rcnt); - } else if (rp->addr + rp->size == addr) { - rp->size += size; + } else if (addr <= rend && nend > rp->addr) { + /* + * New mapping is either entirely contained + * within or it's overlapping at the end. + */ + if (nend > rend) { + rp->size += nend - rend; + rcnt = merge_upper_regions(regions, + rcnt, i); + } return (rcnt); } } From nobody Tue Feb 21 22:41:41 2023 X-Original-To: dev-commits-src-branches@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 4PLvR93St8z3tZkJ; Tue, 21 Feb 2023 22:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLvR92yGgz4N0K; Tue, 21 Feb 2023 22:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677019301; 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=kfkCpDLtbSCZBR1l5+3FjLIcWK/hsBMpih0fo94CqvE=; b=VvwJdsS8+ArRE8O7NI95IYKRhUxKNVhDBkNDEkZxfltbjjTHloSv3xbkDWvuPtSNsX1SZi ko/EdTi3UH4sLfhOqXBIscHvlZG8sO7xJrO6Su52JVnHlnN7ekzrTqH8QRAEnqAk6IphNv CdAqPiNwlZg1kR0XzGCh+h+e5Fqj7u1hJqsORNcIzB7QoUkeIGHLLI4e0yS4IFehY0+dKD hutejLhSCw4y8m+ItqfnlKzbVqy4tHOl8NW+40UhkRTM/LcQLJDudfF7LsWLuO3DYNlitx XsYUeDc6Mg7JIf9XGIbsnLZA0Q3FfKdTAopAmcTItUSfNDadcY7L0FS1TrlfFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677019301; 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=kfkCpDLtbSCZBR1l5+3FjLIcWK/hsBMpih0fo94CqvE=; b=WmN8MCNxW25MmPpfsScH1JOVQraT3szzJ/Y6Jl3Y4ekxxU9304pkA+jeO3qKsYfZhZy7Bw SZrYMttRqruLIech9NcPcc/QjlR1B/foALgxa+n79bSae0bH9Ya18Oh0Ym/18tMPbpPTFS j9qqT6PA5A4FVgSvuObTyIxFjb2PP2vFwjxdZhDhUy3dCr2KnpMVzLr+8pQtjzlPKZveOA UWB4UhOshDIM5vBCDYM1q3rrUyrdZ1pRDGFChi/dT/dtPuzG8E5wT1zNdCPY2UheSy/M0j 1hbTeAoNhOOtIWxfzuiWFCrmus0slqlOsiud5l8bT5r+wRGWGlRCNRlQwQRS7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677019301; a=rsa-sha256; cv=none; b=uLV8MPdZlNlQgOrAbGJSCaCvBFs/3cHTsUlVWQE/sXWb2sfYv8OOou81lIzoAxL0O2Moo8 Xlr6z8zSZ6HTRQ6AUSjdG7VNxn60lt6UUAr6gmgM+MyayvFMcy5dLd9hZ8dAdgznBKVOEs JPrLZ2//jvwarB0aSnKKYXrwv27nQ0gEmGmV8B9TV+SLD7uh9axDI2VEeo7wNNcfpdJ7IP 5pWqFsuIas3wjClXErvh67jcMZbXKr9SjeBUJV3dudMg63ogmyk4m5CyL5tMFYBIHRMkz4 Dibcu/xNjwvOp4I93gJLhguoN9zgKPmQApt+Nc5QTG/hLBySiBc7XcaBmVJhOA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLvR91jkrzcwQ; Tue, 21 Feb 2023 22:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LMffeC066868; Tue, 21 Feb 2023 22:41:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LMff7n066867; Tue, 21 Feb 2023 22:41:41 GMT (envelope-from git) Date: Tue, 21 Feb 2023 22:41:41 GMT Message-Id: <202302212241.31LMff7n066867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: a8c86b2e05ca - releng/13.2 - irdma: fix LINT-NOIP/NOINET/NOINET6 builds List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: a8c86b2e05ca703b3975134bf74f852a1a7aaf21 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=a8c86b2e05ca703b3975134bf74f852a1a7aaf21 commit a8c86b2e05ca703b3975134bf74f852a1a7aaf21 Author: Mitchell Horne AuthorDate: 2022-05-30 20:47:32 +0000 Commit: Eric Joyner CommitDate: 2023-02-21 22:40:49 +0000 irdma: fix LINT-NOIP/NOINET/NOINET6 builds This module depends on the presence of both INET and INET6 options in order to compile. Reviewed by: erj Fixes: cdcd52d41e24 ("irdma: Add RDMA driver for Intel(R) Ethernet...") Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D35343 (cherry picked from commit acdfbc6cbe0a8a976d446216be84994c8ee8d5c1) (cherry picked from commit 7333d34e5ec96db747648ab7b245d814d3140738) --- sys/conf/files | 30 +++++++++++++++--------------- sys/modules/Makefile | 2 ++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index c15f87d9f830..0c3a553c3dad 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4764,35 +4764,35 @@ ofed/drivers/infiniband/ulp/sdp/sdp_cma.c optional sdp inet \ ofed/drivers/infiniband/ulp/sdp/sdp_tx.c optional sdp inet \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -dev/irdma/icrdma.c optional irdma ice pci ofed \ +dev/irdma/icrdma.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_cm.c optional irdma ice pci ofed \ +dev/irdma/irdma_cm.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_ctrl.c optional irdma ice pci ofed \ +dev/irdma/irdma_ctrl.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_hmc.c optional irdma ice pci ofed \ +dev/irdma/irdma_hmc.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_hw.c optional irdma ice pci ofed \ +dev/irdma/irdma_hw.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/icrdma_hw.c optional irdma ice pci ofed \ +dev/irdma/icrdma_hw.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/fbsd_kcompat.c optional irdma ice pci ofed \ +dev/irdma/fbsd_kcompat.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_kcompat.c optional irdma ice pci ofed \ +dev/irdma/irdma_kcompat.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_pble.c optional irdma ice pci ofed \ +dev/irdma/irdma_pble.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_puda.c optional irdma ice pci ofed \ +dev/irdma/irdma_puda.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_uda.c optional irdma ice pci ofed \ +dev/irdma/irdma_uda.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_uk.c optional irdma ice pci ofed \ +dev/irdma/irdma_uk.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_utils.c optional irdma ice pci ofed \ +dev/irdma/irdma_utils.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_verbs.c optional irdma ice pci ofed \ +dev/irdma/irdma_verbs.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" -dev/irdma/irdma_ws.c optional irdma ice pci ofed \ +dev/irdma/irdma_ws.c optional irdma ice inet inet6 pci ofed \ compile-with "${OFED_C} -I$S/dev/ice/" dev/mthca/mthca_allocator.c optional mthca pci ofed \ diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 975ca2d84e57..3e2cc835dc99 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -621,9 +621,11 @@ _ice= ice _ice_ddp= ice_ddp .endif .if ${MK_OFED} != "no" || defined(ALL_MODULES) +.if ${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no" _irdma= irdma .endif .endif +.endif .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ ${MACHINE_CPUARCH} == "riscv" From nobody Tue Feb 21 22:45:08 2023 X-Original-To: dev-commits-src-branches@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 4PLvW83Rkhz3tZTv; Tue, 21 Feb 2023 22:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLvW82xPlz4PC2; Tue, 21 Feb 2023 22:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677019508; 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=WF1ImqSSCC9Pg2uhph6PEULkHyvwn8vm6z8Hhzj6Lw0=; b=W/hSUURA3Qe2bGnnxJsmPJz9vqivQ72EY/eN8d9urUz8v6R1EWUfuip0jYDiSYklrYTZoA I9MKgKWK2Mq+qIAy20TeXcKu7ZBdg0YnynLXNq+gjSeg2ixL2wOt6CAi5Drc0+9ToOE/U5 SddvAVt47l075a8FTf+2nUawU3mzQ7Lp72lBT9fVs5VkJGUISwkVjAO2ulJPEVl6zGZvFI JuRjd/8x3NubMaxXs93mCi5t8BUTDHZDJzCOr7ATOchsLeQgQG42PvuYD0zge5CzsAKKnt wUIG8TBB3JAlVMGS5eqxIO5Tp9Od248hvgZdblK1cXlHuhPuRd/78wl2x3//cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677019508; 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=WF1ImqSSCC9Pg2uhph6PEULkHyvwn8vm6z8Hhzj6Lw0=; b=DGmHpR1KJXg83wcA8tMnpvVftSkgXv1OYmrPlovwrXyo3gWuZRIuawvZq1HfNm8E3oQjz7 iL51BOSC39gv7SRBX5GF2uyVSB3L56qgWX42M57kTkYYBjbe+VppxrGxdIxcNRTsH/cxB+ G610Rgc0bu7WOqV+75bfkmk0DTZhOHO7Cg3fP/9BtqL2Zk8MsOz4Qa6u+bipTTfexrvycH qc3l4p6Gc7RoS6xYzfQ6/gzUMVE5dbRlICg8olXSNjnZUtsy0JMV2Y8V3y/5OPCozQHLG2 zP0EXbhNxTBpFDR3/q0C8XzcxL+a9pSUsJNJvtHfgxe5l9zrB87ld77CxZ7JLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677019508; a=rsa-sha256; cv=none; b=r6lVFfpTBO5xqDI817L6Yn/UnIvyiOaM2X+1+nsuMcufnwPgB5SRVRDXAbi4wZewRBvaKB jfXw3u/OzDY9tbBytw2g8rflAq9GGdjj1KK34+0avF9wHetpNfI6jAa66ppM/s2VXFtzxx QsjFIeEWZHUACqhbplVMse8SegR1Qv45+GeuN6t5Hk4Ef4xhjjdpT6jMKSyHgeE3Z41j+k +Si2agEtfPs3sQM7BukbIvEKJzlVKxhM1+nJXbqwPHMVOJeZsGiATp2q91hdsx5jHUq8IM lzt8+eTC+498OmofvteJWpsfDnoduZDiVrJYmWLYl0Szz88kTr7SXHmgArv+pg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLvW81zykzd2x; Tue, 21 Feb 2023 22:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LMj8KT067567; Tue, 21 Feb 2023 22:45:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LMj8tJ067566; Tue, 21 Feb 2023 22:45:08 GMT (envelope-from git) Date: Tue, 21 Feb 2023 22:45:08 GMT Message-Id: <202302212245.31LMj8tJ067566@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 25d43e3c6b36 - stable/13 - ixgbe(4): Filter out spurious link up indication List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 25d43e3c6b365c3fb68c594fe1b9a40b98bf4f00 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=25d43e3c6b365c3fb68c594fe1b9a40b98bf4f00 commit 25d43e3c6b365c3fb68c594fe1b9a40b98bf4f00 Author: Krzysztof Galazka AuthorDate: 2023-02-15 22:35:40 +0000 Commit: Eric Joyner CommitDate: 2023-02-21 22:42:25 +0000 ixgbe(4): Filter out spurious link up indication Extend SFP+ cage crosstalk fix by re-checking link state after 5ms delay to filter out spurious link up indication by transceiver with no fiber cable connected. Signed-off-by: Krzysztof Galazka Signed-off-by: Eric Joyner Reviewed by: erj@ Tested by: Gowtham Kumar Ks Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D38395 (cherry picked from commit 04a5e6d7cadd06b10169c3c3a560649e7dc7444c) --- sys/dev/ixgbe/ixgbe_common.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 3f38f5e27123..86301dab80ed 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -4232,10 +4232,25 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed, links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); } } else { - if (links_reg & IXGBE_LINKS_UP) + if (links_reg & IXGBE_LINKS_UP) { + if (ixgbe_need_crosstalk_fix(hw)) { + /* Check the link state again after a delay + * to filter out spurious link up + * notifications. + */ + msec_delay(5); + links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); + if (!(links_reg & IXGBE_LINKS_UP)) { + *link_up = false; + *speed = IXGBE_LINK_SPEED_UNKNOWN; + return IXGBE_SUCCESS; + } + + } *link_up = true; - else + } else { *link_up = false; + } } switch (links_reg & IXGBE_LINKS_SPEED_82599) { From nobody Tue Feb 21 22:45:09 2023 X-Original-To: dev-commits-src-branches@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 4PLvW94V6Hz3tZWW; Tue, 21 Feb 2023 22:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLvW93fsWz4P4T; Tue, 21 Feb 2023 22:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677019509; 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=dJ13rMONWc0U3wuZkQrZWOljDDBxCP9UHqeXnUIUzlI=; b=oP8VkGsJYhPeVDdGi2xMszd/CE4NlzGarqvQpBLOc8Nb3KdAMghhKTB+0iB8dqcqgNuF8g rUPBrIYT0fseAg/HdV8GKQfcmVSMcr7wHy5Wr95H5j9MwyJnQKkIPIg85FUscIfUIoillF pGQPCXHU059CWX3n4uDkKoEVM4CZADfFDa25vQLxGMpuDtnIrjgQjIWZGEMogHvACL56o7 FGddGiWOnktPStm+0EK2dAQ4Alw4cT5bYvS1UJHUiRC97MqP21HzHpsTLKM3fb18G4u0Be uw8Qw/iQ2/ECeiTx7354rRf2ckzhclqiZSxEWVdzsieh6Ed0TJ3jOGJfVKJiQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677019509; 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=dJ13rMONWc0U3wuZkQrZWOljDDBxCP9UHqeXnUIUzlI=; b=RZYKqE4GxRHm0xbbRmZoqmnRxmlMTRV3Zl5pBETEal7iX06g3WglyKQyYpXo1nJTDEcO6g FiVysBrcfmIjV/fF+U/KT64z71SJ2Oj1Vsh8Jh119LwaKh+7g8jHBD1ml9TjgrZyAyfZiY +369Oi913GEOcuR9p0nOFCHX4Wp0ZkqCESCpnvqXQWKSkCPvfpwt47QbM79cJ+Xk+GlB+f bkRKop2iutfxhvaO6HIHzbm2xFOXOPmGz7prEA6SpTHuRAiBgO1SfOe/JFO9Bxv/7Fr6gV kddwShG6tkXs25XOsMnibWw66AHM2D0rpCw/MhQ7gKR6kKLMBp+9L+I+fTZCVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677019509; a=rsa-sha256; cv=none; b=PSA9LPAMX5HQ8QZklr+h7Q3OB9Amq4AUs65YeacvbvVIu2qSg+1jhcsSvgy3JjjPZt4dmE E/kQ5lbUf5mVAJhAquH4ZF5Wjlg4kmJVJQO0Pf8SmB3fLkFzGQoJNQ6mVlhlEKM3EE6uBT wOKA1yQY7nFh88C/iD7PBWgNzx/tXxgiOtdF/NgwLYkQb3yilQOZlioydYkB8Hfw1d+amX 5j9zC4fRL546k3+9yx+qKTW6LfOc9095mojsbC+jArOeSusj+4wVDgfLY0m9gscOe5C1Br AV5/qdrAX2UZHPWDCsjSyHlBF12GnEUknbTiIO9/okBjm3506VBDn6qcCLFWNA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLvW92kfPzcYR; Tue, 21 Feb 2023 22:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LMj9x0067592; Tue, 21 Feb 2023 22:45:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LMj9nA067591; Tue, 21 Feb 2023 22:45:09 GMT (envelope-from git) Date: Tue, 21 Feb 2023 22:45:09 GMT Message-Id: <202302212245.31LMj9nA067591@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: a6fa27eb5267 - stable/13 - ixl(4): Fix MAC/VLAN filters accounting List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a6fa27eb5267bfaceb626d90ead84b4d9a4f5655 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=a6fa27eb5267bfaceb626d90ead84b4d9a4f5655 commit a6fa27eb5267bfaceb626d90ead84b4d9a4f5655 Author: Krzysztof Galazka AuthorDate: 2023-02-15 22:28:01 +0000 Commit: Eric Joyner CommitDate: 2023-02-21 22:42:51 +0000 ixl(4): Fix MAC/VLAN filters accounting - Account for a filter required to enable reception of untagged frames while registering and unregistering VLANs to avoid trying to add more filters than HW supports - While adding MAC/VLAN filters, pre-set matching method field in the Admin Queue Command response buffer to expected error value to work around an issue with some FW versions, which do not update that field if operation fails, and be able correctly track which filters were configured in HW. - Remove unused IXL_MAX_FILTERS macro definition - Update number of available MAC/VLAN filters as in newer FW versions it was decreased by one. - Simplify i40e_dma_mem structure Signed-off-by: Krzysztof Galazka Signed-off-by: Eric Joyner Reviewed by: erj@ Tested by: Gowtham Kumar Ks Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D37457 (cherry picked from commit 1d02c6b1b859e9f611bc8fe27ca3d2c16ec128c1) --- sys/dev/ixl/i40e_osdep.c | 1 - sys/dev/ixl/i40e_osdep.h | 3 --- sys/dev/ixl/if_ixl.c | 7 ++++--- sys/dev/ixl/ixl.h | 5 +---- sys/dev/ixl/ixl_pf_main.c | 5 +++++ 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/dev/ixl/i40e_osdep.c b/sys/dev/ixl/i40e_osdep.c index 20eb02c85d67..b3fd53af9e23 100644 --- a/sys/dev/ixl/i40e_osdep.c +++ b/sys/dev/ixl/i40e_osdep.c @@ -109,7 +109,6 @@ i40e_allocate_dma_mem(struct i40e_hw *hw, struct i40e_dma_mem *mem, "error %u\n", err); goto fail_2; } - mem->nseg = 1; mem->size = size; bus_dmamap_sync(mem->tag, mem->map, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); diff --git a/sys/dev/ixl/i40e_osdep.h b/sys/dev/ixl/i40e_osdep.h index e7a1c1226a0e..1146ece279b5 100644 --- a/sys/dev/ixl/i40e_osdep.h +++ b/sys/dev/ixl/i40e_osdep.h @@ -160,10 +160,7 @@ struct i40e_dma_mem { u64 pa; bus_dma_tag_t tag; bus_dmamap_t map; - bus_dma_segment_t seg; bus_size_t size; - int nseg; - int flags; }; struct i40e_virt_mem { diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index cbf6f9444c18..985843d546fa 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -49,7 +49,7 @@ *********************************************************************/ #define IXL_DRIVER_VERSION_MAJOR 2 #define IXL_DRIVER_VERSION_MINOR 3 -#define IXL_DRIVER_VERSION_BUILD 2 +#define IXL_DRIVER_VERSION_BUILD 3 #define IXL_DRIVER_VERSION_STRING \ __XSTRING(IXL_DRIVER_VERSION_MAJOR) "." \ @@ -1722,9 +1722,10 @@ ixl_if_vlan_unregister(if_ctx_t ctx, u16 vtag) if ((if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) == 0) return; - if (vsi->num_vlans < IXL_MAX_VLAN_FILTERS) + /* One filter is used for untagged frames */ + if (vsi->num_vlans < IXL_MAX_VLAN_FILTERS - 1) ixl_del_filter(vsi, hw->mac.addr, vtag); - else if (vsi->num_vlans == IXL_MAX_VLAN_FILTERS) { + else if (vsi->num_vlans == IXL_MAX_VLAN_FILTERS - 1) { ixl_del_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); ixl_add_vlan_filters(vsi, hw->mac.addr); } diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h index 9828760e4ea6..9b49520a8851 100644 --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -164,9 +164,6 @@ #define IXL_VF_MAX_HDR_BUFFER 0x840 #define IXL_VF_MAX_FRAME 0x3FFF -/* ERJ: hardware can support ~2k (SW5+) filters between all functions */ -#define IXL_MAX_FILTERS 256 - #define IXL_NVM_VERSION_LO_SHIFT 0 #define IXL_NVM_VERSION_LO_MASK (0xff << IXL_NVM_VERSION_LO_SHIFT) #define IXL_NVM_VERSION_HI_SHIFT 12 @@ -195,7 +192,7 @@ #define IXL_VLAN_ANY -1 /* Maximum number of MAC/VLAN filters supported by HW */ -#define IXL_MAX_VLAN_FILTERS 256 +#define IXL_MAX_VLAN_FILTERS 255 #define CSUM_OFFLOAD_IPV4 (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) #define CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6) diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index f783ae5ed31a..0b4e69a5ce37 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -1396,6 +1396,11 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, struct ixl_ftl_head *to_add, int cnt) b->flags = 0; } b->flags |= I40E_AQC_MACVLAN_ADD_PERFECT_MATCH; + /* Some FW versions do not set match method + * when adding filters fails. Initialize it with + * expected error value to allow detection which + * filters were not added */ + b->match_method = I40E_AQC_MM_ERR_NO_RES; ixl_dbg_filter(pf, "ADD: " MAC_FORMAT "\n", MAC_FORMAT_ARGS(f->macaddr)); From nobody Tue Feb 21 22:47:30 2023 X-Original-To: dev-commits-src-branches@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 4PLvYv19Mpz3tZpX; Tue, 21 Feb 2023 22:47:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLvYv0d29z4Psr; Tue, 21 Feb 2023 22:47:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677019651; 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=LdGrZcuPgvLOwY+jgfwdsPIybvu8ciCIgAAUd0ICg6s=; b=vnMGtoaBWqYSJxOJlMSw5aLs+vyY7tunn6iusWAPcJLnmexP757lJvxvmAY5QPkfuXUEgp BZOcxC2/Lh8NiOuCCRP0/8UfYa1iRSeNS6/g530361rHIGNWMU7PqoWPH6D7PKn0b/h5z9 tsUGbFs6UzmQScQInJNeqg8CYkPnXHdxQGqNmAy1n+QKV9lFLErCAiuuzI7Q7A9bvUoo4L /8OKIdVnyYJIj7onuYcEiFKX1eGh669wS5wJnX8og2Dc8LE1XlwGWsdK3THRZf5+FsQMFE J3YgP+lpotIhA6muOE3vxJ5UC/zH8Y728wG2oJWTpOFJyPPJmYSchj71UOkuhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677019651; 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=LdGrZcuPgvLOwY+jgfwdsPIybvu8ciCIgAAUd0ICg6s=; b=OGRWF/twbmaB16SLLCZL7pVWN9CzzKZnw11dR8ERMxujlm+6TGzpqqSMfYxrom5pMAUyoK wsAiYOQsQaoxp5qm48p6pq+t3GMvb6fMBuB06L2A1t9wxFwUrNaNsZR4P86DlPDjReiE9d lWwDtUsbquqi7n77rpk8MYMI5JSxAsGZfdrp7MoXAzEzw2dtJgvfBeYIEXR3og4O0Xzp2z AJQPOOHwtDw1xqfkGii/6JfemuuLbZE8ZBN0tvIjTMC2uajDCydH2+5FHcg4+ckTPz466o es3PfRgEJBaoAvSxRXtBpjY6eW9HAiZL25G01vU6NoXZpjXZ3KVgC5RdDfFZdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677019651; a=rsa-sha256; cv=none; b=igfg6/H4wk+chI9z3/a/baF86U7N4RgwDmhwQPqIqLN58nlARrpvSnH42NBpK2CBhf86u7 OvszB3yGHB15uelqa1vI+ZSTCUtZKDXeh9/RvGMP0/3s2ZNl139bE+SvaG5nB4AG6GgT1o sde13XNrc3Vk8IpsUk60mOso3h4REwnNTIKF41pQ8C8pDAqyWFjdLKoyD6wMyeRF2tsHyE pCIFGlSOVCAg6vdnd49Saih1aCezVnwWGhBqydaUCtX9bwtZLLYx+8VVe/Q1nN1r4C28DF GP/Emc7Hv7pPHshII657/5GiL4SzBLlrecEH+prIXw/qGqXHLZibr3zYxa77yg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLvYt6p8gzcwh; Tue, 21 Feb 2023 22:47:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LMlUqA068018; Tue, 21 Feb 2023 22:47:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LMlUPJ068017; Tue, 21 Feb 2023 22:47:30 GMT (envelope-from git) Date: Tue, 21 Feb 2023 22:47:30 GMT Message-Id: <202302212247.31LMlUPJ068017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Allan Jude Subject: git: 426ed0052540 - stable/13 - Fix per-jail zfs.mount_snapshot setting List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 426ed00525409d084e97dc44397722aff2cc0bb3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=426ed00525409d084e97dc44397722aff2cc0bb3 commit 426ed00525409d084e97dc44397722aff2cc0bb3 Author: Allan Jude AuthorDate: 2023-02-18 01:44:34 +0000 Commit: Allan Jude CommitDate: 2023-02-21 22:47:21 +0000 Fix per-jail zfs.mount_snapshot setting When jail.conf set the nopersist flag during startup, it was incorrectly destroying the per-jail ZFS settings. PR: 260160 Reported by: imp (previous version), mm (upstream), freqlabs (upstream) MFC after: immediately Sponsored by: Modirum MDPay Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38662 (cherry picked from commit 8b04c1cbfc1cb71a1ce53b3a7855f1d45866fcfb) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 85449ebb9d97..6ffd36885655 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -2525,7 +2525,9 @@ zfs_jailparam_set(void *obj, void *data) mount_snapshot = -1; else jsys = JAIL_SYS_NEW; - if (jsys == JAIL_SYS_NEW) { + switch (jsys) { + case JAIL_SYS_NEW: + { /* "zfs=new" or "zfs.*": the prison gets its own ZFS info. */ struct zfs_jailparam *zjp; @@ -2543,12 +2545,22 @@ zfs_jailparam_set(void *obj, void *data) if (mount_snapshot != -1) zjp->mount_snapshot = mount_snapshot; mtx_unlock(&pr->pr_mtx); - } else { + break; + } + case JAIL_SYS_INHERIT: /* "zfs=inherit": inherit the parent's ZFS info. */ mtx_lock(&pr->pr_mtx); osd_jail_del(pr, zfs_jailparam_slot); mtx_unlock(&pr->pr_mtx); + break; + case -1: + /* + * If the setting being changed is not ZFS related + * then do nothing. + */ + break; } + return (0); } From nobody Tue Feb 21 23:33:59 2023 X-Original-To: dev-commits-src-branches@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 4PLwbW2Vp2z3tdQy; Tue, 21 Feb 2023 23:33:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLwbW1yThz4Tkk; Tue, 21 Feb 2023 23:33:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677022439; 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=79ImOHXuY+sRVsJWH73KN2Og5MYtSg6OkhmJ+i51o2I=; b=xowDgm2nHi/yU7qkJE5v32IM2kEgw+NSJX1UBJaANvciry+zZ8awYnLvEyCYtcaOEtwOBV jF4EtI3GugKT29uApwtph2mBqUEsUpFNwgVHqp+UCEbjnbLxv7u9zvUe1IuIfg0BdBYeeB fsS2tt3zegh5jsJLY+kOWlC3I0rmiQacpATjPoyOjMMDJlvy5uWx9WXywt9LU6tBdHccBT 69BlV18vsU+ji2cNX52DxPQ8WHKR1XERqszQTFzNjnPqqJ3WB2e2uyllyI9oWDXYJ3VJxO C80mgP5KKVY1I3yZOtSAvqr0OTHQY0SJ/+xX8brlt7hTmiIEL6cALQwiv0hV1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677022439; 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=79ImOHXuY+sRVsJWH73KN2Og5MYtSg6OkhmJ+i51o2I=; b=BlByCUhAaPt6/Hlvphmqk9Rye8P8Dbq2C1/LmL29DAi/wd/KtXQubFVClwYaEuRA3b7fcV zwP8dcWjG35S5p2MTY+bng+ggi1xwYFEK56HF+GM2FvCSBZIgqX9E8VWcx72yIO6KhVjPw cMWIAliDiMx9ycItODTOA0rcCQnrPReNd3Cq1iebls7BCPtPgsbxehxSND2pSoq8xPd3Tq dci0vawWeF0Jr02YAdRb/6eV+pF+0Dox01DO68ucXSu3MQZ6vNKh0MVvrPpHtT+y2TAe2h KXGV7RktAJzMR7eZf4RxGek4YzBntCAoLsjb+FV4VfKYnm4lDg5ItDyaVkJtsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677022439; a=rsa-sha256; cv=none; b=rKvGQlYMwScqwfTt1AgceX0OHhBE95JSM4ASeuysnwClj7mPzN/BgP2KlIPbZSjtvrJ6r3 dN+fM0Vvlftdo0wFLzmDqp7RdBAoHBO9CQlYXRSbKAexPa4RIeSCPt7NFNbCdy+tzJa6LR Jb9qSC9/wNoC6xRr1ntbx2pq7yklTqxoGL79Vff2wLM+F+TRGPU3yZBIQckGr1VXRc6sPN NQLf1tW+BM8fbqNYjz5qddQ5axWZ28q9KxmScIflzFq9qbwdGoBXT7yG5utYgjnuy/jeYE hn3LxmYGN0c4StDZ6lKfrMMfnuW7SBZOG/n5UZVQXvn8lTgDrltAiBVk4TVnZw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLwbW10rjzf4W; Tue, 21 Feb 2023 23:33:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LNXxMa039420; Tue, 21 Feb 2023 23:33:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LNXxGE039419; Tue, 21 Feb 2023 23:33:59 GMT (envelope-from git) Date: Tue, 21 Feb 2023 23:33:59 GMT Message-Id: <202302212333.31LNXxGE039419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 335517b9b02b - stable/13 - nfscl: Fix interaction between mmap'd and VOP_WRITE file updates List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 335517b9b02bc37f4d532998dc8e3ce5757cdef6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=335517b9b02bc37f4d532998dc8e3ce5757cdef6 commit 335517b9b02bc37f4d532998dc8e3ce5757cdef6 Author: Rick Macklem AuthorDate: 2023-02-08 22:25:01 +0000 Commit: Rick Macklem CommitDate: 2023-02-21 23:32:40 +0000 nfscl: Fix interaction between mmap'd and VOP_WRITE file updates asomers@ found a problem with the NFS client, where a write to an NFS mounted file done via mmap(2) was lost when fspacectl(2) was done before it. This turned out to be caused by clearing the dirty bit on pages when the client was doing commit RPCs, due to the second argument to vfs_busy_pages() being set to 1. Commit RPCs tell the server to commit previously written data to stable storage. However, Commit RPCs do not write data from the client to the server. As such, if the dirty bit on the page has been set by a mmap'd write to an address in the page, it should not be cleared. Clearing it causes the mmap'd write to by lost. This patch fixes the problem by changing the 2nd argument to vfs_busy_pages() to 0 for this case. I doubt this bug has affected many, since it was inherited from the old NFS client and was in 4.3 FreeBSD twenty years ago. Although fspacectl(2) is FreeBSD 14 specific, a write(2) would cause the same failure. PR: 269328 (cherry picked from commit 847967bc4e198a258b030a5864e64e029e7452e5) --- sys/fs/nfsclient/nfs_clvnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 02e5e3540d72..d1d84b05bbd7 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3023,7 +3023,7 @@ again: wcred = bp->b_wcred; else if (wcred != bp->b_wcred) wcred = NOCRED; - vfs_busy_pages(bp, 1); + vfs_busy_pages(bp, 0); BO_LOCK(bo); /* From nobody Tue Feb 21 23:57:14 2023 X-Original-To: dev-commits-src-branches@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 4PLx6L5hdGz3tfnn; Tue, 21 Feb 2023 23:57:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLx6L4d2Mz4Z9M; Tue, 21 Feb 2023 23:57:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677023834; 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=gDmCdv3/4llf+dr3fUkK/llIRwnnpZCCtkcoFLit64U=; b=v5NT3PlnmwHajw4HvIDSUzIS3YwMP1Q0UhVKNcGMT/6I6MAvhwQgUCDx+W0unEMSBWsZmw YvZcnjqeCwrggVrxh9zfQ6e30OvplA1zdsn7OtT+wIDt8oB5cYIEytckzm9hMh2zgrTSxS i5XyK7Uqd9pMd9K5IfoItxmacMtlrKUzWo+Ega4eReqQ0CLeQdF6vg7pPVUvJtD9MCqg7/ mL2Gg66cMj7YLDeZObyNnCg7tyTFuXQBYRalC5iRokdh9gMdaakJLeQ7QgqzPYjwj3y/He nIiuJdg8GHQSgIXqfcGwun8XQBJLYfFXJrh6fKPz6WASuUUnj/yUde60jxw6qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677023834; 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=gDmCdv3/4llf+dr3fUkK/llIRwnnpZCCtkcoFLit64U=; b=W3eQqeFLTskA2qOzwwbrFZd1IRSuMsUYOS0OryUmRrpep176oj/cxHQirgq/3BF/HL0F8z R3gqTglHbBC+GwzQ9+DgS157hoXjtNbbxROXXcAvYmstpMtS7BXB1MmgCdnUOV8zPUycpg x8OfRjGKMs5/npfN+qzvZPWsPzKoaIX8ipPHQgATE/WUTwXzmvMqfTjCTJEtK/RnJPIC1D AKV1AJQwqR6kbhWK4TBVhnzx/c0puftzWY/lXBkQ6ixrzoDgO8Fm5C9llUNsTHu94sW3SQ joTWziACerpfxU7B7y3cAkUorVt1169ifD65cb6VDrIUpXXvvGmWZ8D0O4Y9iQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677023834; a=rsa-sha256; cv=none; b=qKMMbfA/lGKjs5r1TnW/Mw4y5nn3wWS+LD+9oxBvMjgMYNBs/nHMn9gCn+IxhzJlQJ9Q21 yFf5+N9CPL9RjAcCb8iyjJumNtQm/FJkPXOG80KWGvY9/l/DboDDjCHsvGGczEC22Gvi8S O0wXqjFSEycchOKq4V09Jnu8xsoDTJWQZr37QNlUQd5RdfOdgwcJJDtvSNUAKnrvf9Tazx ub2VPZVtTi3A67bDCBoZeWfwCwfV2HpX5mv4U7dM5abA0mqX45SeAtoTjeKQD6hVqQa/3v jpqUfokHXyAqzApcsVaayLRNwYuSQ9SBLPoH2ThZx6sER8Hc1aqNgcxej5INkw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLx6L3gj1zftp; Tue, 21 Feb 2023 23:57:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LNvEa1068431; Tue, 21 Feb 2023 23:57:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LNvEB1068430; Tue, 21 Feb 2023 23:57:14 GMT (envelope-from git) Date: Tue, 21 Feb 2023 23:57:14 GMT Message-Id: <202302212357.31LNvEB1068430@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: e8046d1cc4b9 - releng/13.2 - ice_ddp: Update package to 1.3.30.0 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: e8046d1cc4b93ed844b75524f80f94bcd88f2c14 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=e8046d1cc4b93ed844b75524f80f94bcd88f2c14 commit e8046d1cc4b93ed844b75524f80f94bcd88f2c14 Author: Eric Joyner AuthorDate: 2023-01-24 22:01:57 +0000 Commit: Eric Joyner CommitDate: 2023-02-21 23:55:14 +0000 ice_ddp: Update package to 1.3.30.0 This updated DDP is intended to be used with the forthcoming ice(4) driver update to 1.37.7-k. (But it will still work with the current version.) Co-authored-by: Piotr Kubaj Signed-off-by: Eric Joyner Approved by: re (cperciva) Sponsored by: Intel Corporation (cherry picked from commit 2508da22cd6f0904fe55d2d5f6cab7c6011f918c) (cherry picked from commit cd280c60a5b85875b8aeff8d522793914e60d19d) --- sys/conf/files.amd64 | 6 +- sys/conf/files.arm64 | 6 +- sys/conf/files.powerpc | 12 +- sys/contrib/dev/ice/README | 168 ++++++++++++++++----- .../dev/ice/{ice-1.3.27.0.pkg => ice-1.3.30.0.pkg} | Bin 676216 -> 692660 bytes sys/modules/ice_ddp/Makefile | 2 +- 6 files changed, 142 insertions(+), 52 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index d8f7a1837f6a..464c7af84bfa 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -206,7 +206,7 @@ dev/ice/irdma_if.m optional ice pci \ dev/ice/irdma_di_if.m optional ice pci \ compile-with "${NORMAL_M} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031b00 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031e00 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -215,8 +215,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.27.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.27.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.30.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.30.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/ioat/ioat.c optional ioat pci diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 563d62859258..88cb483f178f 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -236,7 +236,7 @@ dev/ice/irdma_if.m optional ice pci \ dev/ice/irdma_di_if.m optional ice pci \ compile-with "${NORMAL_M} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031b00 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031e00 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -245,8 +245,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.27.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.27.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.30.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.30.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 889310c0afaa..c01e0e81ab1a 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -80,18 +80,18 @@ dev/ice/irdma_if.m optional ice pci powerpc64 \ compile-with "${NORMAL_M} -I$S/dev/ice" dev/ice/irdma_di_if.m optional ice pci powerpc64 \ compile-with "${NORMAL_M} -I$S/dev/ice" -ice_ddp.c optional ice_ddp powerpc64 \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031b00 -mice_ddp -c${.TARGET}" \ +ice_ddp.c optional ice_ddp powerpc64 | ice pci powerpc64le \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031e00 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" -ice_ddp.fwo optional ice_ddp powerpc64 \ +ice_ddp.fwo optional ice_ddp powerpc64 | ice pci powerpc64le \ dependency "ice_ddp.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "ice_ddp.fwo" -ice_ddp.fw optional ice_ddp powerpc64 \ - dependency "$S/contrib/dev/ice/ice-1.3.27.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.27.0.pkg ice_ddp.fw" \ +ice_ddp.fw optional ice_ddp powerpc64 | ice pci powerpc64le \ + dependency "$S/contrib/dev/ice/ice-1.3.30.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.30.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/ixl/if_ixl.c optional ixl pci powerpc64 \ diff --git a/sys/contrib/dev/ice/README b/sys/contrib/dev/ice/README index e6d126d62877..e2ce84d72e71 100644 --- a/sys/contrib/dev/ice/README +++ b/sys/contrib/dev/ice/README @@ -1,14 +1,16 @@ -OS Default Dynamic Device Personalization (DDP) Package +OS Default Dynamic Device Personalization (DDP) Package ====================================================================== -July 7, 2020 +May 12, 2022 Contents ======== - Overview +- Supported Operating Systems - Safe Mode - Notes -- Installation & Troubleshooting +- Installation +- Troubleshooting - Legal @@ -16,7 +18,7 @@ Overview ======== Devices based on the Intel(R) Ethernet 800 Series require a Dynamic Device Personalization (DDP) package file to enable advanced features (such as dynamic -tunneling, Intel(R) Ethernet Flow Director, RSS, and ADQ). +tunneling, Intel(R) Ethernet Flow Director, RSS, and ADQ). DDP allows you to change the packet processing pipeline of a device by applying a profile package to the device at runtime. Profiles can be used to, for @@ -24,12 +26,13 @@ example, add support for new protocols, change existing protocols, or change default settings. DDP profiles can also be rolled back without rebooting the system. -The DDP package loads during device initialization. The driver checks to see if -the DDP package is present and compatible. If this file exists, the driver will -load it into the device. If the DDP package file is missing or incompatible -with the driver, the driver will go into Safe Mode where it will use the -configuration contained in the device's NVM. Refer to the Intel(R) Ethernet -Adapters and Devices User Guide for more information on Safe Mode. +The DDP package loads during device initialization or driver runtime, depending +on the operating system. The driver checks to see if the DDP package is present +and compatible. If this file exists, the driver will load it into the device. +If the DDP package file is missing or incompatible with the driver, the driver +will go into Safe Mode where it will use the configuration contained in the +device's NVM. Refer to the Intel(R) Ethernet Adapters and Devices User Guide +for more information on Safe Mode. A general-purpose, default DDP package is automatically installed with all supported Intel Ethernet 800 Series drivers on supported operating systems. @@ -59,6 +62,18 @@ The default DDP package supports the following: - MPLS (up to 5 consecutive MPLS labels in the outermost Layer 2 header group) +Supported Operating Systems +=========================== +This DDP package is supported on the following operating systems: +- Microsoft* Windows Server* +- Linux* +- FreeBSD* +- VMware* ESXi* + +Refer to the Intel(R) Ethernet Adapters and Devices User Guide for currently +supported versions of these operating systems. + + Safe Mode ========= Safe Mode disables advanced and performance features, and supports only basic @@ -66,45 +81,44 @@ traffic and minimal functionality, such as updating the NVM or downloading a new driver or DDP package. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for more details -on DDP and Safe Mode. +on DDP and Safe Mode. Notes ===== -- You cannot update the DDP package if any PF drivers are already loaded. To -overwrite a package, unload all PFs and then reload the driver with the new -package. +- In Linux, FreeBSD, and Windows, you cannot update the DDP package if any PF +drivers are already loaded. To overwrite a package, unload all PFs and then +reload the driver with the new package. -- Except for Linux, you can only use one DDP package per driver, even if you -have more than one device installed that uses the driver. +- In ESXi, use esxcli to load and unload DDP packages for specific market +segments during driver runtime. + +- In FreeBSD and Windows, you can only use one DDP package per driver, even if +you have more than one device installed that uses the driver. -- Only the first loaded PF per device can download a package for that device. +- In Linux, FreeBSD, and Windows, only the first loaded PF per device can +download a package for that device. In ESXi, you can load different DDP +packages for different PFs associated with a device. - If you are using DPDK, see the DPDK documentation at https://www.dpdk.org/ for installation instructions and more information. -Installation and Troubleshooting -================================ - -Microsoft* Windows* -------------------- -The DDP package is installed as part of the driver binary. You don't need to -take additional steps to install the DDP package file. +Installation +============ -If you encounter issues with the DDP package file, download the latest driver. - - -ESX ---- -The DDP package is installed as part of the driver binary. You don't need to -take additional steps to install the DDP package file. +Microsoft Windows +----------------- +TO INSTALL THE OS DEFAULT DDP PACKAGE: -If you encounter issues with the DDP package file, download the latest driver. +The default DDP package is installed as part of the driver binary. You don't +need to take additional steps to install the DDP package file. FreeBSD ------- +TO INSTALL THE OS DEFAULT DDP PACKAGE: + The FreeBSD driver automatically installs the default DDP package file during driver installation. See the base driver README for general installation and building instructions. @@ -112,15 +126,14 @@ building instructions. The DDP package loads during device initialization. The driver looks for the ice_ddp module and checks that it contains a valid DDP package file. -If you encounter issues with the DDP package file, you may need to download an -updated driver or ice_ddp module. See the log messages for more information. - NOTE: It's important to do 'make install' during initial ice driver installation so that the driver loads the DDP package automatically. Linux ----- +TO INSTALL THE OS DEFAULT DDP PACKAGE: + The Linux driver automatically installs the default DDP package file during driver installation. Read the base driver README for general installation and building instructions. @@ -131,9 +144,8 @@ intel/ice/ddp/ice.pkg in your firmware root (typically /lib/firmware/ or The ice.pkg file is a symbolic link to the default DDP package file installed by the linux-firmware software package or the out-of-tree driver installation. -If you encounter issues with the DDP package file, you may need to download an -updated driver or DDP package file. Refer to the log messages for more -information. + +TO INSTALL A DDP PACKAGE FOR SPECIFIC MARKET SEGMENTS: You can install specific DDP package files for different physical devices in the same system. To install a specific DDP package: @@ -177,9 +189,87 @@ NOTE: The presence of a device-specific DDP package file overrides the loading of the default DDP package file. +ESX +--- +TO INSTALL THE OS DEFAULT DDP PACKAGE: + +The default DDP package is installed as part of the driver binary. You don't +need to take additional steps to install the DDP package file. + +TO INSTALL A DDP PACKAGE FOR SPECIFIC MARKET SEGMENTS: + +You must first install the Intel(R) ESXCLI Plug-In for Managing Intel(R) +Ethernet Network Adapters to be able to install and load market-specific DDP +packages. Download it from: +https://www.intel.com/content/www/us/en/download/19380/intel-esxcli-plug-in-for- +managing-intel-ethernet-network-adapters.html + +NOTE: ESXi support for DDP packages for specific market segments requires the +following: +- OS: ESXi 6.7 or higher +- Driver: icen 1.9.1.x or higher +- Tool: intnet 1.8.3.x or higher + +To install and load this DDP package: + +1. Download and install the esxcli plug-in from the URL above. + +2. Download the DDP package. + +3. Copy the DDP package file to the following location: /store/intel/icen/ddp/. + If the directory does not yet exist, create it before copying the file. + +4. From the command prompt, run the following command to load the DDP package: + + # esxcli intnet ddp load -n -p -f + + Where: + = the name of the NIC + = the name of the DDP package to load + -f = forces the package to load + + NOTE: This operation will cause the driver to reset. + +5. Wait for the load result status. + + +To list all active DDP packages for all virtual NICs, run the following: + +# esxcli intnet ddp list + +To unload (roll back) a DDP package, run the following: + +# esxcli intnet ddp rollback -n -f + +NOTE: This operation will cause the driver to reset. + + +Troubleshooting +=============== + +Microsoft Windows +----------------- +If you encounter issues with the DDP package file, download the latest driver. + +FreeBSD +------- +If you encounter issues with the DDP package file, you may need to download an +updated driver or ice_ddp module. See the log messages for more information. + +Linux +----- +If you encounter issues with the DDP package file, you may need to download an +updated driver or DDP package file. Refer to the log messages for more +information. + +ESX +--- +If you encounter issues with the DDP package file, download the latest driver. + + Legal / Disclaimers =================== -Copyright (c) 2019 - 2020, Intel Corporation. +Copyright (c) 2019 - 2022, Intel Corporation. Intel and the Intel logo are trademarks of Intel Corporation or its subsidiaries in the U.S. and/or other countries. diff --git a/sys/contrib/dev/ice/ice-1.3.27.0.pkg b/sys/contrib/dev/ice/ice-1.3.30.0.pkg similarity index 79% rename from sys/contrib/dev/ice/ice-1.3.27.0.pkg rename to sys/contrib/dev/ice/ice-1.3.30.0.pkg index 2fcc57d47d5f..454a2a6ea193 100644 Binary files a/sys/contrib/dev/ice/ice-1.3.27.0.pkg and b/sys/contrib/dev/ice/ice-1.3.30.0.pkg differ diff --git a/sys/modules/ice_ddp/Makefile b/sys/modules/ice_ddp/Makefile index ef0b064503bb..2735a2ba4da2 100644 --- a/sys/modules/ice_ddp/Makefile +++ b/sys/modules/ice_ddp/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ KMOD= ice_ddp -FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.27.0.pkg:ice_ddp:0x01031b00 +FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.30.0.pkg:ice_ddp:0x01031e00 .include From nobody Tue Feb 21 23:57:15 2023 X-Original-To: dev-commits-src-branches@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 4PLx6N0Z3lz3tfr3; Tue, 21 Feb 2023 23:57:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLx6M6ms6z4ZNr; Tue, 21 Feb 2023 23:57:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677023835; 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=cUmlHFbwcBftUQ8GtF5V7FWiCkt/qIafRmKxnS6BHMQ=; b=O3wXyltd4PHyRv1mPyvRAdPYwYIe/P+5hHUq6WuIUdZyMB7MxOIegBODcXxYMlR/lBGzJK pcTnIBw6xquzqSD/PrSqoPW+r0g1EshCs5MnF4TANMlKE7Kbftz7IAqFoFEC93oy0m2qbT kQvZ0Ao6K/BFsor8PcG+EThTEIEwFNfTNWae5i4KyZWKCpHvlRFvSEs+bcQBnE03Dty6vs cE4Q4tBpI3AyaBPCFTHcQJHK3JGanHDlxfJwJvKvAb9h/fHwlOpCRqaacI9NsKMXguq88H /ZpAUcrZnFupcTuF5j7SOuJB2LZrxTzy1DaRh9aZkjHHKhCWusIGbRLa2pXvuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677023835; 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=cUmlHFbwcBftUQ8GtF5V7FWiCkt/qIafRmKxnS6BHMQ=; b=LYkO222X96KhvU5UZCLAq/OWXpc+7kzzhWEv1kTA4BltDdJrZoMburz6oZV+iSGzK8kqY2 ssIEmrzstbletTFO510EehPzg5m8e9vLPF1rtLI4B1y3LmlxNjg4DfIo90WGF8gRQvb5J9 d/oQ1QsCAmHpCWIPgFBSEZmHcNYHJcl1OSXoi8dpQwJcuLLjbMVffonMiCkKHW9ZEEcy4B 78+nQ2dRf4EuvLAgomgFqHVJFgelgM3PVg6n79MGS4x7S+SzR8YO+nPJKMC8yBwnbjrZOg lZX53Ux6glkbN2ZoKfKJc13CcJvpCsUz4UGo3+FpRVr0FViuHKxLDs8Jki5alg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677023835; a=rsa-sha256; cv=none; b=b/vkFalyrJR6r/duaZGFdt8XwIeJGRvEG9ES+b+wETWpj8etw0ULQFfPcxa9H+efBCJHjQ dIzSU8l3I51piL9ZrHKOosMbH6zrE2T0E0RLo15pqCvbYzJYRLGbA754rXGzMxC6DgC44F bBk6widGlU0kP6/EZlLj2PY5XOjhrMsEQZP3HX76BU93L2FkmQu7wi4W7nfz5AUAosvM92 UfEx1E4AZN9qILgcJEbDFf65VgOKhR58Lorr9P8Ox1XC/K2o1WtJaDh8QzM1QN6hAUNvab vg+nyqPGKJ4mMHLqCqbQ+gcDDEBQoqTsZOLMlpfs0HodojW0eVS4kBWNKVhHMw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLx6M5N47zftq; Tue, 21 Feb 2023 23:57:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LNvFoE068450; Tue, 21 Feb 2023 23:57:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LNvF7D068449; Tue, 21 Feb 2023 23:57:15 GMT (envelope-from git) Date: Tue, 21 Feb 2023 23:57:15 GMT Message-Id: <202302212357.31LNvF7D068449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 576955dd669e - releng/13.2 - ice(4): Update to 1.37.7-k List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 576955dd669e381c59c06168fda6b73f930b191f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=576955dd669e381c59c06168fda6b73f930b191f commit 576955dd669e381c59c06168fda6b73f930b191f Author: Piotr Kubaj AuthorDate: 2023-02-14 01:29:44 +0000 Commit: Eric Joyner CommitDate: 2023-02-21 23:55:41 +0000 ice(4): Update to 1.37.7-k Notable changes include: - DSCP QoS Support (leveraging support added in rG9c950139051298831ce19d01ea5fb33ec6ea7f89) - Improved PFC handling and TC queue assignments (now all remaining queues are assigned to TC 0 when more than one TC is enabled and the number of available queues does not evenly divide between them) - Support for dumping the internal FW state for additional debugging by Intel support - Support for allowing "No FEC" to be a valid state for the LESM to negotiate when using non-standard compliant modules Also includes various bug fixes and smaller enhancements, too. Signed-off-by: Eric Joyner Reviewed by: erj@ Tested by: Jeff Pieper Approved by: re (cperciva) Relnotes: yes Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D38109 (cherry picked from commit 8923de59054358980102ea5acda6c6dd58273957) (cherry picked from commit ebc914f942f6655ff4c27f8717630f81c74624cb) --- sys/conf/files.amd64 | 2 + sys/conf/files.arm64 | 2 + sys/conf/files.powerpc | 44 +- sys/dev/ice/ice_adminq_cmd.h | 142 +- sys/dev/ice/ice_alloc.h | 2 +- sys/dev/ice/ice_bitops.h | 14 +- sys/dev/ice/ice_common.c | 453 ++++-- sys/dev/ice/ice_common.h | 7 +- sys/dev/ice/ice_common_sysctls.h | 17 +- sys/dev/ice/ice_common_txrx.h | 2 +- sys/dev/ice/ice_controlq.c | 31 +- sys/dev/ice/ice_controlq.h | 2 +- sys/dev/ice/ice_dcb.c | 52 +- sys/dev/ice/ice_dcb.h | 4 +- sys/dev/ice/ice_ddp_common.c | 2532 +++++++++++++++++++++++++++++++++ sys/dev/ice/ice_ddp_common.h | 478 +++++++ sys/dev/ice/ice_defs.h | 71 + sys/dev/ice/ice_devids.h | 9 +- sys/dev/ice/ice_drv_info.h | 15 +- sys/dev/ice/ice_features.h | 4 +- sys/dev/ice/ice_flex_pipe.c | 2474 +++++--------------------------- sys/dev/ice/ice_flex_pipe.h | 44 +- sys/dev/ice/ice_flex_type.h | 291 +--- sys/dev/ice/ice_flow.c | 18 +- sys/dev/ice/ice_flow.h | 2 +- sys/dev/ice/ice_fw_logging.c | 2 +- sys/dev/ice/ice_fwlog.c | 2 +- sys/dev/ice/ice_fwlog.h | 4 +- sys/dev/ice/ice_hw_autogen.h | 2 +- sys/dev/ice/ice_iflib.h | 12 +- sys/dev/ice/ice_iflib_recovery_txrx.c | 2 +- sys/dev/ice/ice_iflib_sysctls.h | 2 +- sys/dev/ice/ice_iflib_txrx.c | 27 +- sys/dev/ice/ice_lan_tx_rx.h | 10 +- sys/dev/ice/ice_lib.c | 1489 ++++++++++++++++--- sys/dev/ice/ice_lib.h | 43 +- sys/dev/ice/ice_nvm.c | 37 +- sys/dev/ice/ice_nvm.h | 5 +- sys/dev/ice/ice_opts.h | 2 +- sys/dev/ice/ice_osdep.c | 2 +- sys/dev/ice/ice_osdep.h | 2 +- sys/dev/ice/ice_protocol_type.h | 25 +- sys/dev/ice/ice_rdma.c | 15 +- sys/dev/ice/ice_rdma.h | 2 +- sys/dev/ice/ice_resmgr.c | 2 +- sys/dev/ice/ice_resmgr.h | 2 +- sys/dev/ice/ice_rss.h | 2 +- sys/dev/ice/ice_sbq_cmd.h | 2 +- sys/dev/ice/ice_sched.c | 94 +- sys/dev/ice/ice_sched.h | 13 +- sys/dev/ice/ice_status.h | 2 +- sys/dev/ice/ice_strings.c | 8 +- sys/dev/ice/ice_switch.c | 257 ++-- sys/dev/ice/ice_switch.h | 54 +- sys/dev/ice/ice_type.h | 112 +- sys/dev/ice/ice_vlan_mode.c | 3 +- sys/dev/ice/ice_vlan_mode.h | 2 +- sys/dev/ice/if_ice_iflib.c | 66 +- sys/dev/ice/irdma_di_if.m | 2 +- sys/dev/ice/irdma_if.m | 2 +- sys/dev/ice/virtchnl.h | 186 ++- sys/dev/ice/virtchnl_inline_ipsec.h | 11 +- sys/dev/ice/virtchnl_lan_desc.h | 550 ------- sys/modules/ice/Makefile | 2 +- 64 files changed, 5963 insertions(+), 3806 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 464c7af84bfa..b973827d6632 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -205,6 +205,8 @@ dev/ice/irdma_if.m optional ice pci \ compile-with "${NORMAL_M} -I$S/dev/ice" dev/ice/irdma_di_if.m optional ice pci \ compile-with "${NORMAL_M} -I$S/dev/ice" +dev/ice/ice_ddp_common.c optional ice pci \ + compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031e00 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 88cb483f178f..6b96de28128d 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -235,6 +235,8 @@ dev/ice/irdma_if.m optional ice pci \ compile-with "${NORMAL_M} -I$S/dev/ice" dev/ice/irdma_di_if.m optional ice pci \ compile-with "${NORMAL_M} -I$S/dev/ice" +dev/ice/ice_ddp_common.c optional ice pci \ + compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031e00 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index c01e0e81ab1a..05f331e2c3e0 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -38,48 +38,50 @@ dev/iicbus/max6690.c optional max6690 powermac dev/iicbus/ofw_iicbus.c optional iicbus aim dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_opal.c optional powernv ipmi -dev/ice/if_ice_iflib.c optional ice pci powerpc64 \ +dev/ice/if_ice_iflib.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_lib.c optional ice pci powerpc64 \ +dev/ice/ice_lib.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_osdep.c optional ice pci powerpc64 \ +dev/ice/ice_osdep.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_resmgr.c optional ice pci powerpc64 \ +dev/ice/ice_resmgr.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_strings.c optional ice pci powerpc64 \ +dev/ice/ice_strings.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_iflib_recovery_txrx.c optional ice pci powerpc64 \ +dev/ice/ice_iflib_recovery_txrx.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_iflib_txrx.c optional ice pci powerpc64 \ +dev/ice/ice_iflib_txrx.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_common.c optional ice pci powerpc64 \ +dev/ice/ice_common.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_controlq.c optional ice pci powerpc64 \ +dev/ice/ice_controlq.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_dcb.c optional ice pci powerpc64 \ +dev/ice/ice_dcb.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_flex_pipe.c optional ice pci powerpc64 \ +dev/ice/ice_flex_pipe.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_flow.c optional ice pci powerpc64 \ +dev/ice/ice_flow.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_nvm.c optional ice pci powerpc64 \ +dev/ice/ice_nvm.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_sched.c optional ice pci powerpc64 \ +dev/ice/ice_sched.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_switch.c optional ice pci powerpc64 \ +dev/ice/ice_switch.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_vlan_mode.c optional ice pci powerpc64 \ +dev/ice/ice_vlan_mode.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_fw_logging.c optional ice pci powerpc64 \ +dev/ice/ice_fw_logging.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_fwlog.c optional ice pci powerpc64 \ +dev/ice/ice_fwlog.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/ice_rdma.c optional ice pci powerpc64 \ +dev/ice/ice_rdma.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" -dev/ice/irdma_if.m optional ice pci powerpc64 \ +dev/ice/irdma_if.m optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_M} -I$S/dev/ice" -dev/ice/irdma_di_if.m optional ice pci powerpc64 \ +dev/ice/irdma_di_if.m optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_M} -I$S/dev/ice" +dev/ice/ice_ddp_common.c optional ice pci powerpc64 | ice pci powerpc64le \ + compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp powerpc64 | ice pci powerpc64le \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031e00 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ diff --git a/sys/dev/ice/ice_adminq_cmd.h b/sys/dev/ice/ice_adminq_cmd.h index a07ca6780a3c..92ad8055b666 100644 --- a/sys/dev/ice/ice_adminq_cmd.h +++ b/sys/dev/ice/ice_adminq_cmd.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2021, Intel Corporation +/* Copyright (c) 2022, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,10 +37,19 @@ * descriptor format. It is shared between Firmware and Software. */ +#include "ice_osdep.h" +#include "ice_defs.h" +#include "ice_bitops.h" + #define ICE_MAX_VSI 768 #define ICE_AQC_TOPO_MAX_LEVEL_NUM 0x9 #define ICE_AQ_SET_MAC_FRAME_SIZE_MAX 9728 +enum ice_aq_res_access_type { + ICE_RES_READ = 1, + ICE_RES_WRITE +}; + struct ice_aqc_generic { __le32 param0; __le32 param1; @@ -155,9 +164,6 @@ struct ice_aqc_list_caps_elem { #define ICE_AQC_CAPS_TXQS 0x0042 #define ICE_AQC_CAPS_MSIX 0x0043 #define ICE_AQC_CAPS_MAX_MTU 0x0047 -#define ICE_AQC_CAPS_NVM_VER 0x0048 -#define ICE_AQC_CAPS_OROM_VER 0x004A -#define ICE_AQC_CAPS_NET_VER 0x004C #define ICE_AQC_CAPS_CEM 0x00F2 #define ICE_AQC_CAPS_IWARP 0x0051 #define ICE_AQC_CAPS_LED 0x0061 @@ -173,6 +179,10 @@ struct ice_aqc_list_caps_elem { #define ICE_AQC_CAPS_EXT_TOPO_DEV_IMG1 0x0082 #define ICE_AQC_CAPS_EXT_TOPO_DEV_IMG2 0x0083 #define ICE_AQC_CAPS_EXT_TOPO_DEV_IMG3 0x0084 +#define ICE_AQC_CAPS_TX_SCHED_TOPO_COMP_MODE 0x0085 +#define ICE_AQC_CAPS_NAC_TOPOLOGY 0x0087 +#define ICE_AQC_CAPS_DYN_FLATTENING 0x0090 +#define ICE_AQC_CAPS_ROCEV2_LAG 0x0092 u8 major_ver; u8 minor_ver; @@ -526,6 +536,7 @@ struct ice_aqc_vsi_props { #define ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_S 0 #define ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_M (0xF << ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_S) #define ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA BIT(0) +#define ICE_AQ_VSI_SW_FLAG_RX_PASS_PRUNE_ENA BIT(3) #define ICE_AQ_VSI_SW_FLAG_LAN_ENA BIT(4) u8 veb_stat_id; #define ICE_AQ_VSI_SW_VEB_STAT_ID_S 0 @@ -836,6 +847,8 @@ struct ice_sw_rule_lkup_rx_tx { #define ICE_SINGLE_ACT_PTR 0x2 #define ICE_SINGLE_ACT_PTR_VAL_S 4 #define ICE_SINGLE_ACT_PTR_VAL_M (0x1FFF << ICE_SINGLE_ACT_PTR_VAL_S) + /* Bit 17 should be set if pointed action includes a FWD cmd */ +#define ICE_SINGLE_ACT_PTR_HAS_FWD BIT(17) /* Bit 18 should be set to 1 */ #define ICE_SINGLE_ACT_PTR_BIT BIT(18) @@ -1017,6 +1030,24 @@ struct ice_aqc_get_topo { __le32 addr_low; }; +/* Get/Set Tx Topology (indirect 0x0418/0x0417) */ +struct ice_aqc_get_set_tx_topo { + u8 set_flags; +#define ICE_AQC_TX_TOPO_FLAGS_CORRER BIT(0) +#define ICE_AQC_TX_TOPO_FLAGS_SRC_RAM BIT(1) +#define ICE_AQC_TX_TOPO_FLAGS_SET_PSM BIT(2) +#define ICE_AQC_TX_TOPO_FLAGS_LOAD_NEW BIT(4) +#define ICE_AQC_TX_TOPO_FLAGS_ISSUED BIT(5) + u8 get_flags; +#define ICE_AQC_TX_TOPO_GET_NO_UPDATE 0 +#define ICE_AQC_TX_TOPO_GET_PSM 1 +#define ICE_AQC_TX_TOPO_GET_RAM 2 + __le16 reserved1; + __le32 reserved2; + __le32 addr_high; + __le32 addr_low; +}; + /* Update TSE (indirect 0x0403) * Get TSE (indirect 0x0404) * Add TSE (indirect 0x0401) @@ -1170,6 +1201,22 @@ struct ice_aqc_rl_profile_elem { __le16 rl_encode; }; +/* Config Node Attributes (indirect 0x0419) + * Query Node Attributes (indirect 0x041A) + */ +struct ice_aqc_node_attr { + __le16 num_entries; /* Number of attributes structures in the buffer */ + u8 reserved[6]; + __le32 addr_high; + __le32 addr_low; +}; + +struct ice_aqc_node_attr_elem { + __le32 node_teid; + __le16 max_children; + __le16 children_level; +}; + /* Configure L2 Node CGD (indirect 0x0414) * This indirect command allows configuring a congestion domain for given L2 * node TEIDs in the scheduler topology. @@ -1335,7 +1382,7 @@ struct ice_aqc_get_phy_caps { #define ICE_PHY_TYPE_HIGH_100G_CAUI2 BIT_ULL(2) #define ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC BIT_ULL(3) #define ICE_PHY_TYPE_HIGH_100G_AUI2 BIT_ULL(4) -#define ICE_PHY_TYPE_HIGH_MAX_INDEX 5 +#define ICE_PHY_TYPE_HIGH_MAX_INDEX 4 struct ice_aqc_get_phy_caps_data { __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */ @@ -1376,6 +1423,7 @@ struct ice_aqc_get_phy_caps_data { #define ICE_AQC_PHY_FEC_25G_RS_528_REQ BIT(2) #define ICE_AQC_PHY_FEC_25G_KR_REQ BIT(3) #define ICE_AQC_PHY_FEC_25G_RS_544_REQ BIT(4) +#define ICE_AQC_PHY_FEC_DIS BIT(5) #define ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN BIT(6) #define ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN BIT(7) #define ICE_AQC_PHY_FEC_MASK MAKEMASK(0xdf, 0) @@ -1484,6 +1532,12 @@ struct ice_aqc_get_link_status { __le32 addr_low; }; +enum ice_get_link_status_data_version { + ICE_GET_LINK_STATUS_DATA_V1 = 1, +}; + +#define ICE_GET_LINK_STATUS_DATALEN_V1 32 + /* Get link status response data structure, also used for Link Status Event */ struct ice_aqc_get_link_status_data { u8 topo_media_conflict; @@ -2078,6 +2132,12 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_PERST_FLAG 1 #define ICE_AQC_NVM_EMPR_FLAG 2 #define ICE_AQC_NVM_EMPR_ENA BIT(0) /* Write Activate reply only */ + /* For Write Activate, several flags are sent as part of a separate + * flags2 field using a separate byte. For simplicity of the software + * interface, we pass the flags as a 16 bit value so these flags are + * all offset by 8 bits + */ +#define ICE_AQC_NVM_ACTIV_REQ_EMPR BIT(8) /* NVM Write Activate only */ __le16 module_typeid; __le16 length; #define ICE_AQC_NVM_ERASE_LEN 0xFFFF @@ -2108,6 +2168,7 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_LLDP_STATUS_RD_LEN 4 /* In Bytes */ #define ICE_AQC_NVM_MINSREV_MOD_ID 0x130 +#define ICE_AQC_NVM_TX_TOPO_MOD_ID 0x14B /* Used for reading and writing MinSRev using 0x0701 and 0x0703. Note that the * type field is excluded from the section when reading and writing from @@ -2124,6 +2185,13 @@ struct ice_aqc_nvm_minsrev { __le16 orom_minsrev_h; }; +struct ice_aqc_nvm_tx_topo_user_sel { + __le16 length; + u8 data; +#define ICE_AQC_NVM_TX_TOPO_USER_SEL BIT(4) + u8 reserved; +}; + /* Used for 0x0704 as well as for 0x0705 commands */ struct ice_aqc_nvm_cfg { u8 cmd_flags; @@ -2218,14 +2286,25 @@ struct ice_aqc_lldp_get_mib { #define ICE_AQ_LLDP_TX_ACTIVE 0 #define ICE_AQ_LLDP_TX_SUSPENDED 1 #define ICE_AQ_LLDP_TX_FLUSHED 3 +/* DCBX mode */ +#define ICE_AQ_LLDP_DCBX_S 6 +#define ICE_AQ_LLDP_DCBX_M (0x3 << ICE_AQ_LLDP_DCBX_S) +#define ICE_AQ_LLDP_DCBX_NA 0 +#define ICE_AQ_LLDP_DCBX_CEE 1 +#define ICE_AQ_LLDP_DCBX_IEEE 2 /* The following bytes are reserved for the Get LLDP MIB command (0x0A00) * and in the LLDP MIB Change Event (0x0A01). They are valid for the * Get LLDP MIB (0x0A00) response only. */ - u8 reserved1; + u8 state; +#define ICE_AQ_LLDP_MIB_CHANGE_STATE_S 0 +#define ICE_AQ_LLDP_MIB_CHANGE_STATE_M \ + (0x1 << ICE_AQ_LLDP_MIB_CHANGE_STATE_S) +#define ICE_AQ_LLDP_MIB_CHANGE_EXECUTED 0 +#define ICE_AQ_LLDP_MIB_CHANGE_PENDING 1 __le16 local_len; __le16 remote_len; - u8 reserved2[2]; + u8 reserved[2]; __le32 addr_high; __le32 addr_low; }; @@ -2236,6 +2315,11 @@ struct ice_aqc_lldp_set_mib_change { u8 command; #define ICE_AQ_LLDP_MIB_UPDATE_ENABLE 0x0 #define ICE_AQ_LLDP_MIB_UPDATE_DIS 0x1 +#define ICE_AQ_LLDP_MIB_PENDING_S 1 +#define ICE_AQ_LLDP_MIB_PENDING_M \ + (0x1 << ICE_AQ_LLDP_MIB_PENDING_S) +#define ICE_AQ_LLDP_MIB_PENDING_DISABLE 0 +#define ICE_AQ_LLDP_MIB_PENDING_ENABLE 1 u8 reserved[15]; }; @@ -2580,6 +2664,9 @@ struct ice_aqc_add_rdma_qset_data { /* Move RDMA Queue Set (indirect 0x0C34) */ struct ice_aqc_move_rdma_qset_cmd { u8 num_rdma_qset; /* Used by commands and response */ +#define ICE_AQC_PF_MODE_SAME_PF 0x0 +#define ICE_AQC_PF_MODE_GIVE_OWNERSHIP 0x1 +#define ICE_AQC_PF_MODE_KEEP_OWNERSHIP 0x2 u8 flags; u8 reserved[6]; __le32 addr_high; @@ -2656,8 +2743,8 @@ struct ice_aqc_get_pkg_info_resp { struct ice_aqc_driver_shared_params { u8 set_or_get_op; #define ICE_AQC_DRIVER_PARAM_OP_MASK BIT(0) -#define ICE_AQC_DRIVER_PARAM_SET 0 -#define ICE_AQC_DRIVER_PARAM_GET 1 +#define ICE_AQC_DRIVER_PARAM_SET ((u8)0) +#define ICE_AQC_DRIVER_PARAM_GET ((u8)1) u8 param_indx; #define ICE_AQC_DRIVER_PARAM_MAX_IDX 15 u8 rsvd[2]; @@ -2676,16 +2763,18 @@ struct ice_aqc_event_lan_overflow { /* Debug Dump Internal Data (indirect 0xFF08) */ struct ice_aqc_debug_dump_internals { u8 cluster_id; -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_SW 0 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_TXSCHED 2 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_PROFILES 3 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_SW 0 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_TXSCHED 2 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_PROFILES 3 /* EMP_DRAM only dumpable in device debug mode */ -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_EMP_DRAM 4 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_LINK 5 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_EMP_DRAM 4 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_LINK 5 /* AUX_REGS only dumpable in device debug mode */ -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_AUX_REGS 6 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_DCB 7 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_L2P 8 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_AUX_REGS 6 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_DCB 7 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_L2P 8 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_QUEUE_MNG 9 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_FULL_CSR_SPACE 21 u8 reserved; __le16 table_id; /* Used only for non-memory clusters */ __le32 idx; /* In table entries for tables, in bytes for memory */ @@ -2729,7 +2818,6 @@ enum ice_aqc_fw_logging_mod { ICE_AQC_FW_LOG_ID_MAX, }; - /* Set Health Status (direct 0xFF20) */ struct ice_aqc_set_health_status_config { u8 event_source; @@ -2747,6 +2835,7 @@ struct ice_aqc_set_health_status_config { #define ICE_AQC_HEALTH_STATUS_ERR_MOD_NOT_PRESENT 0x106 #define ICE_AQC_HEALTH_STATUS_INFO_MOD_UNDERUTILIZED 0x107 #define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_LENIENT 0x108 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_DIAGNOSTIC_FEATURE 0x109 #define ICE_AQC_HEALTH_STATUS_ERR_INVALID_LINK_CFG 0x10B #define ICE_AQC_HEALTH_STATUS_ERR_PORT_ACCESS 0x10C #define ICE_AQC_HEALTH_STATUS_ERR_PORT_UNREACHABLE 0x10D @@ -2768,7 +2857,16 @@ struct ice_aqc_set_health_status_config { #define ICE_AQC_HEALTH_STATUS_ERR_DDP_AUTH 0x504 #define ICE_AQC_HEALTH_STATUS_ERR_NVM_COMPAT 0x505 #define ICE_AQC_HEALTH_STATUS_ERR_OROM_COMPAT 0x506 +#define ICE_AQC_HEALTH_STATUS_ERR_NVM_SEC_VIOLATION 0x507 +#define ICE_AQC_HEALTH_STATUS_ERR_OROM_SEC_VIOLATION 0x508 #define ICE_AQC_HEALTH_STATUS_ERR_DCB_MIB 0x509 +#define ICE_AQC_HEALTH_STATUS_ERR_MNG_TIMEOUT 0x50A +#define ICE_AQC_HEALTH_STATUS_ERR_BMC_RESET 0x50B +#define ICE_AQC_HEALTH_STATUS_ERR_LAST_MNG_FAIL 0x50C +#define ICE_AQC_HEALTH_STATUS_ERR_RESOURCE_ALLOC_FAIL 0x50D +#define ICE_AQC_HEALTH_STATUS_ERR_FW_LOOP 0x1000 +#define ICE_AQC_HEALTH_STATUS_ERR_FW_PFR_FAIL 0x1001 +#define ICE_AQC_HEALTH_STATUS_ERR_LAST_FAIL_AQ 0x1002 /* Get Health Status codes (indirect 0xFF21) */ struct ice_aqc_get_supported_health_status_codes { @@ -2923,6 +3021,7 @@ struct ice_aq_desc { struct ice_aqc_cfg_l2_node_cgd cfg_l2_node_cgd; struct ice_aqc_query_port_ets port_ets; struct ice_aqc_rl_profile rl_profile; + struct ice_aqc_node_attr node_attr; struct ice_aqc_nvm nvm; struct ice_aqc_nvm_cfg nvm_cfg; struct ice_aqc_nvm_checksum nvm_checksum; @@ -2949,6 +3048,7 @@ struct ice_aq_desc { struct ice_aqc_dis_txqs dis_txqs; struct ice_aqc_move_txqs move_txqs; struct ice_aqc_add_rdma_qset add_rdma_qset; + struct ice_aqc_move_rdma_qset_cmd move_rdma_qset; struct ice_aqc_txqs_cleanup txqs_cleanup; struct ice_aqc_add_get_update_free_vsi vsi_cmd; struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res; @@ -2975,6 +3075,7 @@ struct ice_aq_desc { struct ice_aqc_clear_health_status clear_health_status; struct ice_aqc_prog_topo_dev_nvm prog_topo_dev_nvm; struct ice_aqc_read_topo_dev_nvm read_topo_dev_nvm; + struct ice_aqc_get_set_tx_topo get_set_tx_topo; } params; }; @@ -3125,6 +3226,10 @@ enum ice_adminq_opc { ice_aqc_opc_query_node_to_root = 0x0413, ice_aqc_opc_cfg_l2_node_cgd = 0x0414, ice_aqc_opc_remove_rl_profiles = 0x0415, + ice_aqc_opc_set_tx_topo = 0x0417, + ice_aqc_opc_get_tx_topo = 0x0418, + ice_aqc_opc_cfg_node_attr = 0x0419, + ice_aqc_opc_query_node_attr = 0x041A, /* PHY commands */ ice_aqc_opc_get_phy_caps = 0x0600, @@ -3196,6 +3301,7 @@ enum ice_adminq_opc { ice_aqc_opc_lldp_set_local_mib = 0x0A08, ice_aqc_opc_lldp_stop_start_specific_agent = 0x0A09, ice_aqc_opc_lldp_filter_ctrl = 0x0A0A, + ice_execute_pending_lldp_mib = 0x0A0B, /* RSS commands */ ice_aqc_opc_set_rss_key = 0x0B02, diff --git a/sys/dev/ice/ice_alloc.h b/sys/dev/ice/ice_alloc.h index b281958be793..bfcb376d45b2 100644 --- a/sys/dev/ice/ice_alloc.h +++ b/sys/dev/ice/ice_alloc.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2021, Intel Corporation +/* Copyright (c) 2022, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_bitops.h b/sys/dev/ice/ice_bitops.h index 0e04cab87be9..c29963d0a318 100644 --- a/sys/dev/ice/ice_bitops.h +++ b/sys/dev/ice/ice_bitops.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2021, Intel Corporation +/* Copyright (c) 2022, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,15 +33,25 @@ #ifndef _ICE_BITOPS_H_ #define _ICE_BITOPS_H_ +#include "ice_defs.h" +#include "ice_osdep.h" + /* Define the size of the bitmap chunk */ typedef u32 ice_bitmap_t; +/* NOTE! + * Do not use any of the functions declared in this file + * on memory that was not declared with ice_declare_bitmap. + * Not following this rule might cause issues like split + * locks. + */ + /* Number of bits per bitmap chunk */ #define BITS_PER_CHUNK (BITS_PER_BYTE * sizeof(ice_bitmap_t)) /* Determine which chunk a bit belongs in */ #define BIT_CHUNK(nr) ((nr) / BITS_PER_CHUNK) /* How many chunks are required to store this many bits */ -#define BITS_TO_CHUNKS(sz) DIVIDE_AND_ROUND_UP((sz), BITS_PER_CHUNK) +#define BITS_TO_CHUNKS(sz) (((sz) + BITS_PER_CHUNK - 1) / BITS_PER_CHUNK) /* Which bit inside a chunk this bit corresponds to */ #define BIT_IN_CHUNK(nr) ((nr) % BITS_PER_CHUNK) /* How many bits are valid in the last chunk, assumes nr > 0 */ diff --git a/sys/dev/ice/ice_common.c b/sys/dev/ice/ice_common.c index 3ae266b72d1f..c2efddeb4f7c 100644 --- a/sys/dev/ice/ice_common.c +++ b/sys/dev/ice/ice_common.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2021, Intel Corporation +/* Copyright (c) 2022, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,118 +39,110 @@ #define ICE_PF_RESET_WAIT_COUNT 300 -/** - * dump_phy_type - helper function that prints PHY type strings - * @hw: pointer to the HW structure - * @phy: 64 bit PHY type to decipher - * @i: bit index within phy - * @phy_string: string corresponding to bit i in phy - * @prefix: prefix string to differentiate multiple dumps - */ -static void -dump_phy_type(struct ice_hw *hw, u64 phy, u8 i, const char *phy_string, - const char *prefix) -{ - if (phy & BIT_ULL(i)) - ice_debug(hw, ICE_DBG_PHY, "%s: bit(%d): %s\n", prefix, i, - phy_string); -} +static const char * const ice_link_mode_str_low[] = { + [0] = "100BASE_TX", + [1] = "100M_SGMII", + [2] = "1000BASE_T", + [3] = "1000BASE_SX", + [4] = "1000BASE_LX", + [5] = "1000BASE_KX", + [6] = "1G_SGMII", + [7] = "2500BASE_T", + [8] = "2500BASE_X", + [9] = "2500BASE_KX", + [10] = "5GBASE_T", + [11] = "5GBASE_KR", + [12] = "10GBASE_T", + [13] = "10G_SFI_DA", + [14] = "10GBASE_SR", + [15] = "10GBASE_LR", + [16] = "10GBASE_KR_CR1", + [17] = "10G_SFI_AOC_ACC", + [18] = "10G_SFI_C2C", + [19] = "25GBASE_T", + [20] = "25GBASE_CR", + [21] = "25GBASE_CR_S", + [22] = "25GBASE_CR1", + [23] = "25GBASE_SR", + [24] = "25GBASE_LR", + [25] = "25GBASE_KR", + [26] = "25GBASE_KR_S", + [27] = "25GBASE_KR1", + [28] = "25G_AUI_AOC_ACC", + [29] = "25G_AUI_C2C", + [30] = "40GBASE_CR4", + [31] = "40GBASE_SR4", + [32] = "40GBASE_LR4", + [33] = "40GBASE_KR4", + [34] = "40G_XLAUI_AOC_ACC", + [35] = "40G_XLAUI", + [36] = "50GBASE_CR2", + [37] = "50GBASE_SR2", + [38] = "50GBASE_LR2", + [39] = "50GBASE_KR2", + [40] = "50G_LAUI2_AOC_ACC", + [41] = "50G_LAUI2", + [42] = "50G_AUI2_AOC_ACC", + [43] = "50G_AUI2", + [44] = "50GBASE_CP", + [45] = "50GBASE_SR", + [46] = "50GBASE_FR", + [47] = "50GBASE_LR", + [48] = "50GBASE_KR_PAM4", + [49] = "50G_AUI1_AOC_ACC", + [50] = "50G_AUI1", + [51] = "100GBASE_CR4", + [52] = "100GBASE_SR4", + [53] = "100GBASE_LR4", + [54] = "100GBASE_KR4", + [55] = "100G_CAUI4_AOC_ACC", + [56] = "100G_CAUI4", + [57] = "100G_AUI4_AOC_ACC", + [58] = "100G_AUI4", + [59] = "100GBASE_CR_PAM4", + [60] = "100GBASE_KR_PAM4", + [61] = "100GBASE_CP2", + [62] = "100GBASE_SR2", + [63] = "100GBASE_DR", +}; + +static const char * const ice_link_mode_str_high[] = { + [0] = "100GBASE_KR2_PAM4", + [1] = "100G_CAUI2_AOC_ACC", + [2] = "100G_CAUI2", + [3] = "100G_AUI2_AOC_ACC", + [4] = "100G_AUI2", +}; /** - * ice_dump_phy_type_low - helper function to dump phy_type_low + * ice_dump_phy_type - helper function to dump phy_type * @hw: pointer to the HW structure * @low: 64 bit value for phy_type_low + * @high: 64 bit value for phy_type_high * @prefix: prefix string to differentiate multiple dumps */ static void -ice_dump_phy_type_low(struct ice_hw *hw, u64 low, const char *prefix) +ice_dump_phy_type(struct ice_hw *hw, u64 low, u64 high, const char *prefix) { + u32 i; + ice_debug(hw, ICE_DBG_PHY, "%s: phy_type_low: 0x%016llx\n", prefix, (unsigned long long)low); - dump_phy_type(hw, low, 0, "100BASE_TX", prefix); - dump_phy_type(hw, low, 1, "100M_SGMII", prefix); - dump_phy_type(hw, low, 2, "1000BASE_T", prefix); - dump_phy_type(hw, low, 3, "1000BASE_SX", prefix); - dump_phy_type(hw, low, 4, "1000BASE_LX", prefix); - dump_phy_type(hw, low, 5, "1000BASE_KX", prefix); - dump_phy_type(hw, low, 6, "1G_SGMII", prefix); - dump_phy_type(hw, low, 7, "2500BASE_T", prefix); - dump_phy_type(hw, low, 8, "2500BASE_X", prefix); - dump_phy_type(hw, low, 9, "2500BASE_KX", prefix); - dump_phy_type(hw, low, 10, "5GBASE_T", prefix); - dump_phy_type(hw, low, 11, "5GBASE_KR", prefix); - dump_phy_type(hw, low, 12, "10GBASE_T", prefix); - dump_phy_type(hw, low, 13, "10G_SFI_DA", prefix); - dump_phy_type(hw, low, 14, "10GBASE_SR", prefix); - dump_phy_type(hw, low, 15, "10GBASE_LR", prefix); - dump_phy_type(hw, low, 16, "10GBASE_KR_CR1", prefix); - dump_phy_type(hw, low, 17, "10G_SFI_AOC_ACC", prefix); - dump_phy_type(hw, low, 18, "10G_SFI_C2C", prefix); - dump_phy_type(hw, low, 19, "25GBASE_T", prefix); - dump_phy_type(hw, low, 20, "25GBASE_CR", prefix); - dump_phy_type(hw, low, 21, "25GBASE_CR_S", prefix); - dump_phy_type(hw, low, 22, "25GBASE_CR1", prefix); - dump_phy_type(hw, low, 23, "25GBASE_SR", prefix); - dump_phy_type(hw, low, 24, "25GBASE_LR", prefix); - dump_phy_type(hw, low, 25, "25GBASE_KR", prefix); - dump_phy_type(hw, low, 26, "25GBASE_KR_S", prefix); - dump_phy_type(hw, low, 27, "25GBASE_KR1", prefix); - dump_phy_type(hw, low, 28, "25G_AUI_AOC_ACC", prefix); - dump_phy_type(hw, low, 29, "25G_AUI_C2C", prefix); - dump_phy_type(hw, low, 30, "40GBASE_CR4", prefix); - dump_phy_type(hw, low, 31, "40GBASE_SR4", prefix); - dump_phy_type(hw, low, 32, "40GBASE_LR4", prefix); - dump_phy_type(hw, low, 33, "40GBASE_KR4", prefix); - dump_phy_type(hw, low, 34, "40G_XLAUI_AOC_ACC", prefix); - dump_phy_type(hw, low, 35, "40G_XLAUI", prefix); - dump_phy_type(hw, low, 36, "50GBASE_CR2", prefix); - dump_phy_type(hw, low, 37, "50GBASE_SR2", prefix); - dump_phy_type(hw, low, 38, "50GBASE_LR2", prefix); - dump_phy_type(hw, low, 39, "50GBASE_KR2", prefix); - dump_phy_type(hw, low, 40, "50G_LAUI2_AOC_ACC", prefix); - dump_phy_type(hw, low, 41, "50G_LAUI2", prefix); - dump_phy_type(hw, low, 42, "50G_AUI2_AOC_ACC", prefix); - dump_phy_type(hw, low, 43, "50G_AUI2", prefix); - dump_phy_type(hw, low, 44, "50GBASE_CP", prefix); - dump_phy_type(hw, low, 45, "50GBASE_SR", prefix); - dump_phy_type(hw, low, 46, "50GBASE_FR", prefix); - dump_phy_type(hw, low, 47, "50GBASE_LR", prefix); - dump_phy_type(hw, low, 48, "50GBASE_KR_PAM4", prefix); - dump_phy_type(hw, low, 49, "50G_AUI1_AOC_ACC", prefix); - dump_phy_type(hw, low, 50, "50G_AUI1", prefix); - dump_phy_type(hw, low, 51, "100GBASE_CR4", prefix); - dump_phy_type(hw, low, 52, "100GBASE_SR4", prefix); - dump_phy_type(hw, low, 53, "100GBASE_LR4", prefix); - dump_phy_type(hw, low, 54, "100GBASE_KR4", prefix); - dump_phy_type(hw, low, 55, "100G_CAUI4_AOC_ACC", prefix); - dump_phy_type(hw, low, 56, "100G_CAUI4", prefix); - dump_phy_type(hw, low, 57, "100G_AUI4_AOC_ACC", prefix); - dump_phy_type(hw, low, 58, "100G_AUI4", prefix); - dump_phy_type(hw, low, 59, "100GBASE_CR_PAM4", prefix); - dump_phy_type(hw, low, 60, "100GBASE_KR_PAM4", prefix); - dump_phy_type(hw, low, 61, "100GBASE_CP2", prefix); - dump_phy_type(hw, low, 62, "100GBASE_SR2", prefix); - dump_phy_type(hw, low, 63, "100GBASE_DR", prefix); -} - -/** - * ice_dump_phy_type_high - helper function to dump phy_type_high - * @hw: pointer to the HW structure - * @high: 64 bit value for phy_type_high - * @prefix: prefix string to differentiate multiple dumps - */ -static void -ice_dump_phy_type_high(struct ice_hw *hw, u64 high, const char *prefix) -{ + for (i = 0; i < ARRAY_SIZE(ice_link_mode_str_low); i++) { + if (low & BIT_ULL(i)) + ice_debug(hw, ICE_DBG_PHY, "%s: bit(%d): %s\n", + prefix, i, ice_link_mode_str_low[i]); + } + ice_debug(hw, ICE_DBG_PHY, "%s: phy_type_high: 0x%016llx\n", prefix, (unsigned long long)high); - dump_phy_type(hw, high, 0, "100GBASE_KR2_PAM4", prefix); - dump_phy_type(hw, high, 1, "100G_CAUI2_AOC_ACC", prefix); - dump_phy_type(hw, high, 2, "100G_CAUI2", prefix); - dump_phy_type(hw, high, 3, "100G_AUI2_AOC_ACC", prefix); - dump_phy_type(hw, high, 4, "100G_AUI2", prefix); + for (i = 0; i < ARRAY_SIZE(ice_link_mode_str_high); i++) { + if (high & BIT_ULL(i)) + ice_debug(hw, ICE_DBG_PHY, "%s: bit(%d): %s\n", + prefix, i, ice_link_mode_str_high[i]); + } } /** @@ -227,13 +219,23 @@ bool ice_is_e810t(struct ice_hw *hw) { switch (hw->device_id) { case ICE_DEV_ID_E810C_SFP: - if (hw->subsystem_device_id == ICE_SUBDEV_ID_E810T || - hw->subsystem_device_id == ICE_SUBDEV_ID_E810T2) + switch (hw->subsystem_device_id) { + case ICE_SUBDEV_ID_E810T: + case ICE_SUBDEV_ID_E810T2: + case ICE_SUBDEV_ID_E810T3: + case ICE_SUBDEV_ID_E810T4: + case ICE_SUBDEV_ID_E810T5: + case ICE_SUBDEV_ID_E810T7: return true; + } break; case ICE_DEV_ID_E810C_QSFP: - if (hw->subsystem_device_id == ICE_SUBDEV_ID_E810T2) + switch (hw->subsystem_device_id) { + case ICE_SUBDEV_ID_E810T2: + case ICE_SUBDEV_ID_E810T5: + case ICE_SUBDEV_ID_E810T6: return true; + } break; default: break; @@ -242,6 +244,31 @@ bool ice_is_e810t(struct ice_hw *hw) return false; } +/** + * ice_is_e823 + * @hw: pointer to the hardware structure + * + * returns true if the device is E823-L or E823-C based, false if not. + */ +bool ice_is_e823(struct ice_hw *hw) +{ + switch (hw->device_id) { + case ICE_DEV_ID_E823L_BACKPLANE: + case ICE_DEV_ID_E823L_SFP: + case ICE_DEV_ID_E823L_10G_BASE_T: + case ICE_DEV_ID_E823L_1GBE: + case ICE_DEV_ID_E823L_QSFP: + case ICE_DEV_ID_E823C_BACKPLANE: + case ICE_DEV_ID_E823C_QSFP: + case ICE_DEV_ID_E823C_SFP: + case ICE_DEV_ID_E823C_10G_BASE_T: + case ICE_DEV_ID_E823C_SGMII: + return true; + default: + return false; + } +} + /** * ice_clear_pf_cfg - Clear PF configuration * @hw: pointer to the hardware structure @@ -308,10 +335,10 @@ ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size, if (resp[i].addr_type == ICE_AQC_MAN_MAC_ADDR_TYPE_LAN) { ice_memcpy(hw->port_info->mac.lan_addr, resp[i].mac_addr, ETH_ALEN, - ICE_DMA_TO_NONDMA); + ICE_NONDMA_TO_NONDMA); ice_memcpy(hw->port_info->mac.perm_addr, resp[i].mac_addr, - ETH_ALEN, ICE_DMA_TO_NONDMA); + ETH_ALEN, ICE_NONDMA_TO_NONDMA); break; } return ICE_SUCCESS; @@ -355,23 +382,30 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, cmd->param0 |= CPU_TO_LE16(ICE_AQC_GET_PHY_RQM); cmd->param0 |= CPU_TO_LE16(report_mode); + status = ice_aq_send_cmd(hw, &desc, pcaps, pcaps_size, cd); ice_debug(hw, ICE_DBG_LINK, "get phy caps dump\n"); - if (report_mode == ICE_AQC_REPORT_TOPO_CAP_MEDIA) + switch (report_mode) { + case ICE_AQC_REPORT_TOPO_CAP_MEDIA: prefix = "phy_caps_media"; - else if (report_mode == ICE_AQC_REPORT_TOPO_CAP_NO_MEDIA) + break; + case ICE_AQC_REPORT_TOPO_CAP_NO_MEDIA: prefix = "phy_caps_no_media"; - else if (report_mode == ICE_AQC_REPORT_ACTIVE_CFG) + break; + case ICE_AQC_REPORT_ACTIVE_CFG: prefix = "phy_caps_active"; - else if (report_mode == ICE_AQC_REPORT_DFLT_CFG) + break; + case ICE_AQC_REPORT_DFLT_CFG: prefix = "phy_caps_default"; - else + break; + default: prefix = "phy_caps_invalid"; + } - ice_dump_phy_type_low(hw, LE64_TO_CPU(pcaps->phy_type_low), prefix); - ice_dump_phy_type_high(hw, LE64_TO_CPU(pcaps->phy_type_high), prefix); + ice_dump_phy_type(hw, LE64_TO_CPU(pcaps->phy_type_low), + LE64_TO_CPU(pcaps->phy_type_high), prefix); ice_debug(hw, ICE_DBG_LINK, "%s: report_mode = 0x%x\n", prefix, report_mode); @@ -444,7 +478,7 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, * * Find and return the node handle for a given node type and part number in the * netlist. When found ICE_SUCCESS is returned, ICE_ERR_DOES_NOT_EXIST - * otherwise. If @node_handle provided, it would be set to found node handle. + * otherwise. If node_handle provided, it would be set to found node handle. */ enum ice_status ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, @@ -452,11 +486,12 @@ ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, { struct ice_aqc_get_link_topo cmd; u8 rec_node_part_number; - enum ice_status status; u16 rec_node_handle; u8 idx; for (idx = 0; idx < MAX_NETLIST_SIZE; idx++) { + enum ice_status status; + memset(&cmd, 0, sizeof(cmd)); cmd.addr.topo_params.node_type_ctx = @@ -545,7 +580,6 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi) case ICE_PHY_TYPE_LOW_1000BASE_LX: case ICE_PHY_TYPE_LOW_10GBASE_SR: case ICE_PHY_TYPE_LOW_10GBASE_LR: - case ICE_PHY_TYPE_LOW_10G_SFI_C2C: case ICE_PHY_TYPE_LOW_25GBASE_SR: case ICE_PHY_TYPE_LOW_25GBASE_LR: case ICE_PHY_TYPE_LOW_40GBASE_SR4: @@ -602,6 +636,7 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi) case ICE_PHY_TYPE_LOW_2500BASE_X: case ICE_PHY_TYPE_LOW_5GBASE_KR: case ICE_PHY_TYPE_LOW_10GBASE_KR_CR1: + case ICE_PHY_TYPE_LOW_10G_SFI_C2C: case ICE_PHY_TYPE_LOW_25GBASE_KR: case ICE_PHY_TYPE_LOW_25GBASE_KR1: case ICE_PHY_TYPE_LOW_25GBASE_KR_S: @@ -629,6 +664,8 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi) return ICE_MEDIA_UNKNOWN; } +#define ice_get_link_status_datalen(hw) ICE_GET_LINK_STATUS_DATALEN_V1 + /** * ice_aq_get_link_info * @pi: port information structure @@ -668,8 +705,8 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, resp->cmd_flags = CPU_TO_LE16(cmd_flags); resp->lport_num = pi->lport; - status = ice_aq_send_cmd(hw, &desc, &link_data, sizeof(link_data), cd); - + status = ice_aq_send_cmd(hw, &desc, &link_data, + ice_get_link_status_datalen(hw), cd); *** 12050 LINES SKIPPED *** From nobody Tue Feb 21 23:57:16 2023 X-Original-To: dev-commits-src-branches@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 4PLx6P2G3dz3tfcM; Tue, 21 Feb 2023 23:57:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLx6P0vYsz4ZXD; Tue, 21 Feb 2023 23:57:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677023837; 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=/0jj8H58mS7E+7Ampam2f2a1FZm08e5f2nvcMPANcc8=; b=J451Co6mKFFLxCuwEH1XB97eZj54P/K8MibG92hao+t4rSsixPLOzyfAOUDFp9Z/MvsuJX 9neiniVx0UGpMiKe+nPSSJIufouWFAYQtPox5rDUQ3NWtMAObkiklv4ceBvjbin+936znC QCqI1dUNErPTEgBAeAT1pD2RWT0kNBqs1wnf95ibRj4+4KZoLzBacUQ2m954HIvFd7L3Ei 8Q77e98HbLPpCJ8OEI+sad46+3596aR7v9JYeAomBnAtwaxDlo9tqVmwDFuku5SbmdFpFU ZsKo0EL9GWc1fSidmYJvAeVJXQSt8LrTX+3ezOZbKNZUp54ux91Mli0DtG/heQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677023837; 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=/0jj8H58mS7E+7Ampam2f2a1FZm08e5f2nvcMPANcc8=; b=USyQSe6DMvyBRXX6owHsCrc432YSzPjjg1L3mtfFIvYUmjT+swDY0Ssri3o4JAW6I39B2p YtNHmwC+SAzWozCr+mVD7ukmw1++v6yuDlbXORFKiytHOrY4tQ143WTMg4w2vUEpbzFNow 3rk15z8D7XUCpewyBhrQS+fx9E2rFsl6BlMy+aHZA3KO84iSTyuuRaEPiyMxJsfoNLs5JP oClL+ZHNbPQskmHsIhFVOci0aeW22YpS7+FdsIRTbqJhs4zXlTz4VPmYSZ2/KdArlUAJoc S+eUxbW45rKWr5/H9T21/tYWEusbRX8tcuB6H6/cKMFO6rzNT0BPACbAjWWsRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677023837; a=rsa-sha256; cv=none; b=FHsuTcB4IXh5iLCgsI9wDHWjpyas96Mf2pRR86xL+92rJUqxoHek0bVuE6/1pl+awfxdhV +cCp1alHP2cMBZHQ+2TYnDizTqh8oc42qfdXXHMf5YoVSL95afinnyerTvmiuFXC90IVl0 CR2hvLUb27yEYaqqVg1cRFyVbdQNbkzyE6t0F56T+desI36yjj/M4Gp7t4Zj1TURcZTot0 Qu6Ia6bja6JwgclvugjRiWLd1e/44N2AUmo/ddVq9UW5NYGfdTDX40l5utF0BQLVnnK+Ly KKzyHIvR+pP3IYvJn02ouopSb341cL1Ms3cvzH7CACkj/UvWi8JIK+fBJX/OtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLx6N6TXQzftr; Tue, 21 Feb 2023 23:57:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LNvGM3068469; Tue, 21 Feb 2023 23:57:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LNvGQm068468; Tue, 21 Feb 2023 23:57:16 GMT (envelope-from git) Date: Tue, 21 Feb 2023 23:57:16 GMT Message-Id: <202302212357.31LNvGQm068468@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 7006923991c6 - releng/13.2 - ixgbe(4): Filter out spurious link up indication List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 7006923991c6e56399b07dd839378c81844df8ef Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=7006923991c6e56399b07dd839378c81844df8ef commit 7006923991c6e56399b07dd839378c81844df8ef Author: Krzysztof Galazka AuthorDate: 2023-02-15 22:35:40 +0000 Commit: Eric Joyner CommitDate: 2023-02-21 23:56:00 +0000 ixgbe(4): Filter out spurious link up indication Extend SFP+ cage crosstalk fix by re-checking link state after 5ms delay to filter out spurious link up indication by transceiver with no fiber cable connected. Signed-off-by: Krzysztof Galazka Signed-off-by: Eric Joyner Reviewed by: erj@ Tested by: Gowtham Kumar Ks Approved by: re (cperciva) Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D38395 (cherry picked from commit 04a5e6d7cadd06b10169c3c3a560649e7dc7444c) (cherry picked from commit 25d43e3c6b365c3fb68c594fe1b9a40b98bf4f00) --- sys/dev/ixgbe/ixgbe_common.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 3f38f5e27123..86301dab80ed 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -4232,10 +4232,25 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed, links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); } } else { - if (links_reg & IXGBE_LINKS_UP) + if (links_reg & IXGBE_LINKS_UP) { + if (ixgbe_need_crosstalk_fix(hw)) { + /* Check the link state again after a delay + * to filter out spurious link up + * notifications. + */ + msec_delay(5); + links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); + if (!(links_reg & IXGBE_LINKS_UP)) { + *link_up = false; + *speed = IXGBE_LINK_SPEED_UNKNOWN; + return IXGBE_SUCCESS; + } + + } *link_up = true; - else + } else { *link_up = false; + } } switch (links_reg & IXGBE_LINKS_SPEED_82599) { From nobody Tue Feb 21 23:57:17 2023 X-Original-To: dev-commits-src-branches@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 4PLx6Q2Z5Wz3tfww; Tue, 21 Feb 2023 23:57:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLx6Q1V0yz4ZdD; Tue, 21 Feb 2023 23:57:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677023838; 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=CZjZ80HO4702kP0wFjDeQlnpErEHcudfvquItUDqspA=; b=Ki/7pwzt0Yz6/wtDwggyeDjfGAoTTgzwsLupMkqpqJYFkIn5+UUbRN5HC4+CSVhoXjFrpB YoidB5YG4iUWXQiGph8mdP/+jIa5BglwboLFanwI0De39OSJnLAFkv5dbvD6M/dRD/F2UP SvLLzHc59XgKKL8aGrVZJJRKP+wYiDCbIMATa1G6KxuSxHrh9j8+ehcVeK/Sr7jbZOGbjR PB0r7p9uo1ohSJfGcNi8H3FOd62srf5jPI7onaSVo/CUi67P63vDOkSXuggWzBcDyEZIDU QhpTTq8uC5AW7KZ+5mXXWd+BftbFVcBCsm/06t902CrRPyE3wzJafwlRohaBxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677023838; 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=CZjZ80HO4702kP0wFjDeQlnpErEHcudfvquItUDqspA=; b=U2HBA2KS8hfWhWsd0HlFydKmNAEU4M0qEjweg2unZbGaULijk4LOk1poJ1HBybir52XSJJ gPgV94PrzZzUWBRlw0yi0Qh9RqsSRPsE89ilAz6sRa2WmIVBgALls4vTMGSO4iATJhyYRC p6UAch1acjC3+jHQclzknWtJMaBvgRLKaSO6slXuK0jDZHJo6F9CkuyktXkYQrrxH/Y4/e QYT2+uzGpN06Xm2cAXIBYbLaBUYRIhakh8JQEvmxmHgwPYxQ92FctQ4xSUc8v7aLX/xKn3 JKsVHQ0S0mfAZMRAxSQyCTMhwlU30Cydf1HbW06+id2Lsz5a4U/eVLmbpLnN5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677023838; a=rsa-sha256; cv=none; b=eJWnQQpMEJ6ZGszXHQMUp8Rq9kUh8gFAmvRcLjp1P5Dk1VPWbiHL3vn/SArg7Bf+PR9to/ C7399O5HuBqRFm3BUDs+sQDgCvtMf/fxKn4RwOyVjnI2StVHsTJItaGKkfeq4owJy6VwMj OzzYltlQGkSmuqbKyFNvfljy+UtiZdNVNDmGUpBFi9NMhMsYdrPTjXAUK0XYK1J7XGTR0P B9mSsuFrdD6TrD91t6GvI4W3JrJzQkNOcDP2T5gPWtSDapdwY2gBFEqYwK9CEXIrK4ctlU jbZ/92eX+skuT9/oHt54o+MrSfNLa/PtVh2P6fgO1dHscdUNaJgiOGWmuAzBQg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLx6Q0HsCzfwS; Tue, 21 Feb 2023 23:57:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31LNvHpu068494; Tue, 21 Feb 2023 23:57:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LNvHbH068493; Tue, 21 Feb 2023 23:57:17 GMT (envelope-from git) Date: Tue, 21 Feb 2023 23:57:17 GMT Message-Id: <202302212357.31LNvHbH068493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 0f59de6879b8 - releng/13.2 - ixl(4): Fix MAC/VLAN filters accounting List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 0f59de6879b8590177c050a1dd02a5383271f33b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=0f59de6879b8590177c050a1dd02a5383271f33b commit 0f59de6879b8590177c050a1dd02a5383271f33b Author: Krzysztof Galazka AuthorDate: 2023-02-15 22:28:01 +0000 Commit: Eric Joyner CommitDate: 2023-02-21 23:56:18 +0000 ixl(4): Fix MAC/VLAN filters accounting - Account for a filter required to enable reception of untagged frames while registering and unregistering VLANs to avoid trying to add more filters than HW supports - While adding MAC/VLAN filters, pre-set matching method field in the Admin Queue Command response buffer to expected error value to work around an issue with some FW versions, which do not update that field if operation fails, and be able correctly track which filters were configured in HW. - Remove unused IXL_MAX_FILTERS macro definition - Update number of available MAC/VLAN filters as in newer FW versions it was decreased by one. - Simplify i40e_dma_mem structure Signed-off-by: Krzysztof Galazka Signed-off-by: Eric Joyner Reviewed by: erj@ Tested by: Gowtham Kumar Ks Approved by: re (cperciva) Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D37457 (cherry picked from commit 1d02c6b1b859e9f611bc8fe27ca3d2c16ec128c1) (cherry picked from commit a6fa27eb5267bfaceb626d90ead84b4d9a4f5655) --- sys/dev/ixl/i40e_osdep.c | 1 - sys/dev/ixl/i40e_osdep.h | 3 --- sys/dev/ixl/if_ixl.c | 7 ++++--- sys/dev/ixl/ixl.h | 5 +---- sys/dev/ixl/ixl_pf_main.c | 5 +++++ 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/dev/ixl/i40e_osdep.c b/sys/dev/ixl/i40e_osdep.c index 20eb02c85d67..b3fd53af9e23 100644 --- a/sys/dev/ixl/i40e_osdep.c +++ b/sys/dev/ixl/i40e_osdep.c @@ -109,7 +109,6 @@ i40e_allocate_dma_mem(struct i40e_hw *hw, struct i40e_dma_mem *mem, "error %u\n", err); goto fail_2; } - mem->nseg = 1; mem->size = size; bus_dmamap_sync(mem->tag, mem->map, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); diff --git a/sys/dev/ixl/i40e_osdep.h b/sys/dev/ixl/i40e_osdep.h index e7a1c1226a0e..1146ece279b5 100644 --- a/sys/dev/ixl/i40e_osdep.h +++ b/sys/dev/ixl/i40e_osdep.h @@ -160,10 +160,7 @@ struct i40e_dma_mem { u64 pa; bus_dma_tag_t tag; bus_dmamap_t map; - bus_dma_segment_t seg; bus_size_t size; - int nseg; - int flags; }; struct i40e_virt_mem { diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index cbf6f9444c18..985843d546fa 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -49,7 +49,7 @@ *********************************************************************/ #define IXL_DRIVER_VERSION_MAJOR 2 #define IXL_DRIVER_VERSION_MINOR 3 -#define IXL_DRIVER_VERSION_BUILD 2 +#define IXL_DRIVER_VERSION_BUILD 3 #define IXL_DRIVER_VERSION_STRING \ __XSTRING(IXL_DRIVER_VERSION_MAJOR) "." \ @@ -1722,9 +1722,10 @@ ixl_if_vlan_unregister(if_ctx_t ctx, u16 vtag) if ((if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) == 0) return; - if (vsi->num_vlans < IXL_MAX_VLAN_FILTERS) + /* One filter is used for untagged frames */ + if (vsi->num_vlans < IXL_MAX_VLAN_FILTERS - 1) ixl_del_filter(vsi, hw->mac.addr, vtag); - else if (vsi->num_vlans == IXL_MAX_VLAN_FILTERS) { + else if (vsi->num_vlans == IXL_MAX_VLAN_FILTERS - 1) { ixl_del_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); ixl_add_vlan_filters(vsi, hw->mac.addr); } diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h index 9828760e4ea6..9b49520a8851 100644 --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -164,9 +164,6 @@ #define IXL_VF_MAX_HDR_BUFFER 0x840 #define IXL_VF_MAX_FRAME 0x3FFF -/* ERJ: hardware can support ~2k (SW5+) filters between all functions */ -#define IXL_MAX_FILTERS 256 - #define IXL_NVM_VERSION_LO_SHIFT 0 #define IXL_NVM_VERSION_LO_MASK (0xff << IXL_NVM_VERSION_LO_SHIFT) #define IXL_NVM_VERSION_HI_SHIFT 12 @@ -195,7 +192,7 @@ #define IXL_VLAN_ANY -1 /* Maximum number of MAC/VLAN filters supported by HW */ -#define IXL_MAX_VLAN_FILTERS 256 +#define IXL_MAX_VLAN_FILTERS 255 #define CSUM_OFFLOAD_IPV4 (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) #define CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6) diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index f783ae5ed31a..0b4e69a5ce37 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -1396,6 +1396,11 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, struct ixl_ftl_head *to_add, int cnt) b->flags = 0; } b->flags |= I40E_AQC_MACVLAN_ADD_PERFECT_MATCH; + /* Some FW versions do not set match method + * when adding filters fails. Initialize it with + * expected error value to allow detection which + * filters were not added */ + b->match_method = I40E_AQC_MM_ERR_NO_RES; ixl_dbg_filter(pf, "ADD: " MAC_FORMAT "\n", MAC_FORMAT_ARGS(f->macaddr)); From nobody Wed Feb 22 00:48:40 2023 X-Original-To: dev-commits-src-branches@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 4PLyFh6vkBz3tjqP; Wed, 22 Feb 2023 00:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLyFh5tV3z3F42; Wed, 22 Feb 2023 00:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677026920; 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=j/973yX4zx8s/qCLRs3g0dgug/+UoNt0gLhsYqDZrnM=; b=l8S6GN/V3C7iYWD9pnMk4K6ag/uG3mThV6ALBJLCEEVGkEhaDNb5ImDNORzyclZEdDv6Rv PwQ6DjZ9znuXVY9AmLZOit7rjrWopMueNCyS6YgFmh8CC53/bdtVFa2xiY5QVe4ZNxdsTh 18s0kG9ssiPoE4H4meDhBDNIxpSXD0S0Hfs93UYegoH9WUjeC+3HEKVp/0VYT/Yw4+pq19 BSxAEeUmOyLH+bYU9wRJnB86mKx98FJ/9vmzezLBEjggYAOFbiJN+1Ms3KhaCe3uXNDG+P G45mD26qvU7eJiEhqro90LmCN+Iha0VApqTeOnI20DUM83dy6jrdIIj4a4T94A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677026920; 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=j/973yX4zx8s/qCLRs3g0dgug/+UoNt0gLhsYqDZrnM=; b=m0N3WkjEdSxSjbP9hWUO/yt7yvPMWXHPswI6Oi18PlQsfJvPRX8MCDrWwfTKupLEhIDx/O vfsaDVlcLhBxyA88gCt9JDXkomzaWlSjCuYTvLyRZqO7Ku/mcW5W+6pdyz/sUAvoDnF0oS 988fTgAFgjcQcsTiZr9T6CkHuE1JJqh9ptknGlnQf+Bim1t3S8B8KLiykhVAJbpq5LTmyF hb/ZqsfMD7R5uGmPitA8KBuXS3tTrbd0N9PWGPC3ZimgBBtZVVTap5DJjyVTMfTSRq3TFa PfU//LJGJM4ltRRsfCwTCpqk+Jofponio4lzM+3xeCTK9ETsbgT+oR1XGo5+Jg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677026920; a=rsa-sha256; cv=none; b=SzuZMF95zjQRE1N+kDoa2n+sWBY7MGIsnbcot9xU0k5ZO71xG6t3Uyy2QMWMcJQsTkjQt4 Xl4t7ymwT33NzIyQqERS7FXosT+HNWCvkQyonbICqw6ZDqvTgbD62JB3HFjypjxAcDdZMr N5Kr2LyImtFpXtuDF4zaUuU6ZZVGW0lyRRswSeHQdvdmd0He2UcZN0YdxqrYkih+etwhnr aNnB5asmb9lskR/hXHkxSGg96QAHqjJuvqkCmOZWup4koOYXB0DLzEdIPzU/I7w0iTUcUY sS12q34dio324VkTlHaPZkCQGQKjiBXRrTmOkutX/eDoRG6B3xqs472X1ohHdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLyFh4x3jzh55; Wed, 22 Feb 2023 00:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31M0meJh040984; Wed, 22 Feb 2023 00:48:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31M0meXw040983; Wed, 22 Feb 2023 00:48:40 GMT (envelope-from git) Date: Wed, 22 Feb 2023 00:48:40 GMT Message-Id: <202302220048.31M0meXw040983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 17d1b8eef7d1 - stable/13 - e1000: fix I219 hang on reset List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 17d1b8eef7d18ad6093c5024bd25a9bca7c3febe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=17d1b8eef7d18ad6093c5024bd25a9bca7c3febe commit 17d1b8eef7d18ad6093c5024bd25a9bca7c3febe Author: Kevin Bowling AuthorDate: 2023-02-08 19:21:45 +0000 Commit: Kevin Bowling CommitDate: 2023-02-22 00:48:25 +0000 e1000: fix I219 hang on reset Clear the rings before reset to avoid a HW hang. Inspired by em-7.7.8 and DPDK (1fc9701238edcf0541289b9ae15565b6d9d7ab30) Reviewed by: erj Sponsored by: BBOX.io Pull Request: https://github.com/freebsd/freebsd-src/pull/540 (cherry picked from commit ae1dca798e0f826de46f4ec11914ba4c91928d7a) --- sys/dev/e1000/if_em.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index c17714dbd566..80a3bbee7814 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -343,6 +343,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS); static void lem_smartspeed(struct e1000_softc *); static void igb_configure_queues(struct e1000_softc *); +static void em_flush_desc_rings(struct e1000_softc *); /********************************************************************* @@ -1907,6 +1908,10 @@ em_if_stop(if_ctx_t ctx) INIT_DEBUGOUT("em_if_stop: begin"); + /* I219 needs special flushing to avoid hangs */ + if (sc->hw.mac.type >= e1000_pch_spt && sc->hw.mac.type < igb_mac_min) + em_flush_desc_rings(sc); + e1000_reset_hw(&sc->hw); if (sc->hw.mac.type >= e1000_82544) E1000_WRITE_REG(&sc->hw, E1000_WUFC, 0); @@ -1972,8 +1977,7 @@ em_allocate_pci_resources(if_ctx_t ctx) sc->hw.hw_addr = (u8 *)&sc->osdep.mem_bus_space_handle; /* Only older adapters use IO mapping */ - if (sc->hw.mac.type < em_mac_min && - sc->hw.mac.type > e1000_82543) { + if (sc->hw.mac.type < em_mac_min && sc->hw.mac.type > e1000_82543) { /* Figure our where our IO BAR is ? */ for (rid = PCIR_BAR(0); rid < PCIR_CIS;) { val = pci_read_config(dev, rid, 4); @@ -2461,6 +2465,113 @@ igb_init_dmac(struct e1000_softc *sc, u32 pba) E1000_WRITE_REG(hw, E1000_DMACR, 0); } } +/********************************************************************* + * The 3 following flush routines are used as a workaround in the + * I219 client parts and only for them. + * + * em_flush_tx_ring - remove all descriptors from the tx_ring + * + * We want to clear all pending descriptors from the TX ring. + * zeroing happens when the HW reads the regs. We assign the ring itself as + * the data of the next descriptor. We don't care about the data we are about + * to reset the HW. + **********************************************************************/ +static void +em_flush_tx_ring(struct e1000_softc *sc) +{ + struct e1000_hw *hw = &sc->hw; + struct tx_ring *txr = &sc->tx_queues->txr; + struct e1000_tx_desc *txd; + u32 tctl, txd_lower = E1000_TXD_CMD_IFCS; + u16 size = 512; + + tctl = E1000_READ_REG(hw, E1000_TCTL); + E1000_WRITE_REG(hw, E1000_TCTL, tctl | E1000_TCTL_EN); + + txd = &txr->tx_base[txr->tx_cidx_processed]; + + /* Just use the ring as a dummy buffer addr */ + txd->buffer_addr = txr->tx_paddr; + txd->lower.data = htole32(txd_lower | size); + txd->upper.data = 0; + + /* flush descriptors to memory before notifying the HW */ + wmb(); + + E1000_WRITE_REG(hw, E1000_TDT(0), txr->tx_cidx_processed); + mb(); + usec_delay(250); +} + +/********************************************************************* + * em_flush_rx_ring - remove all descriptors from the rx_ring + * + * Mark all descriptors in the RX ring as consumed and disable the rx ring + **********************************************************************/ +static void +em_flush_rx_ring(struct e1000_softc *sc) +{ + struct e1000_hw *hw = &sc->hw; + u32 rctl, rxdctl; + + rctl = E1000_READ_REG(hw, E1000_RCTL); + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + E1000_WRITE_FLUSH(hw); + usec_delay(150); + + rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); + /* zero the lower 14 bits (prefetch and host thresholds) */ + rxdctl &= 0xffffc000; + /* + * update thresholds: prefetch threshold to 31, host threshold to 1 + * and make sure the granularity is "descriptors" and not "cache lines" + */ + rxdctl |= (0x1F | (1 << 8) | E1000_RXDCTL_THRESH_UNIT_DESC); + E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl); + + /* momentarily enable the RX ring for the changes to take effect */ + E1000_WRITE_REG(hw, E1000_RCTL, rctl | E1000_RCTL_EN); + E1000_WRITE_FLUSH(hw); + usec_delay(150); + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); +} + +/********************************************************************* + * em_flush_desc_rings - remove all descriptors from the descriptor rings + * + * In I219, the descriptor rings must be emptied before resetting the HW + * or before changing the device state to D3 during runtime (runtime PM). + * + * Failure to do this will cause the HW to enter a unit hang state which can + * only be released by PCI reset on the device + * + **********************************************************************/ +static void +em_flush_desc_rings(struct e1000_softc *sc) +{ + struct e1000_hw *hw = &sc->hw; + device_t dev = sc->dev; + u16 hang_state; + u32 fext_nvm11, tdlen; + + /* First, disable MULR fix in FEXTNVM11 */ + fext_nvm11 = E1000_READ_REG(hw, E1000_FEXTNVM11); + fext_nvm11 |= E1000_FEXTNVM11_DISABLE_MULR_FIX; + E1000_WRITE_REG(hw, E1000_FEXTNVM11, fext_nvm11); + + /* do nothing if we're not in faulty state, or if the queue is empty */ + tdlen = E1000_READ_REG(hw, E1000_TDLEN(0)); + hang_state = pci_read_config(dev, PCICFG_DESC_RING_STATUS, 2); + if (!(hang_state & FLUSH_DESC_REQUIRED) || !tdlen) + return; + em_flush_tx_ring(sc); + + /* recheck, maybe the fault is caused by the rx ring */ + hang_state = pci_read_config(dev, PCICFG_DESC_RING_STATUS, 2); + if (hang_state & FLUSH_DESC_REQUIRED) + em_flush_rx_ring(sc); +} + /********************************************************************* * @@ -2692,6 +2803,10 @@ em_reset(if_ctx_t ctx) break; } + /* I219 needs some special flushing to avoid hangs */ + if (sc->hw.mac.type >= e1000_pch_spt && sc->hw.mac.type < igb_mac_min) + em_flush_desc_rings(sc); + /* Issue a global reset */ e1000_reset_hw(hw); if (hw->mac.type >= igb_mac_min) { From nobody Wed Feb 22 00:49:43 2023 X-Original-To: dev-commits-src-branches@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 4PLyGv61jWz3tjqb; Wed, 22 Feb 2023 00:49:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLyGv5Wfdz3FLd; Wed, 22 Feb 2023 00:49:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677026983; 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=bEQLuDaKY6KNRAZb7ALNkSD+n3vLGVVxERKBI8BoEBM=; b=axIirnf6Fo9GDHLuRzP3WV6qAFEpS/QBTeUQMCQfJOdIctnLClmI8xmhViK/MitYUSBL/1 F3R4rFpQaaZpe4eQRZZChlA4LslBGI7+Eps2mfG9bO12VICd87l4bHM07mXxg0hLf3yu9f XptsFJg6z4QyjgiiYneQ8v/ybSDzDZGLaOkQFXcViV0kxDtsdpPCBop+2vcXVfDYwkZqww wUlxKjsErTFSoStEckoYBDVn3/ho3oBlPR4xjSQ9tXVEQT7aSCQtL9YOVeXmXIvMi1Z7sm UBARuoMOcs85UN/Wf9ecSeYiAJbz94TzdMTX8W9f/B+ZX1kUivPsJZr4XDrtYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677026983; 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=bEQLuDaKY6KNRAZb7ALNkSD+n3vLGVVxERKBI8BoEBM=; b=AnVgKyBT8wq6x/3BYTh3D+9ibJBkpxTF3vN/W/xLAuUbYasFixMjT+Xhoy/u/QV/gORavV vfo1Is7y1lXqj+5bRuJR9AAs1cWRdJ2FA5jpWehLBzpySoofTW4DX4edJ+kf4+Khawq/Ze OW2VIawrAo8jEZHAUbYfDh6gfSM6QevS4ReiP1QQksXPckaGfjGmw6VDzoM6eEtJXpS/pq YzQc5UpMcts0TNn1KG/vSX/rXN19F05ZwuEGi0QYjsaCwHxyoWqPgY38WnUBq7HihPYrPo iR8gIWF3s08iBP9pQRXt1fbwPC3x9wA8KfMop5rivOLd9nnnXAqf0RmXWhYI7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677026983; a=rsa-sha256; cv=none; b=ZdbfDubKr/DPDuWUSZqXJcvnDUz3fNUymD/18n3exLTz/yw8MpUxI78LnXDWJDFfMqUw05 AhT/+5l25NtDM4b54F/sffppLJ8dEHjK1h/rlrnF9DFEHH/qrgmuHnHsiMZJ0TC6nu0MQy Y9S14GRRcL/ORiXnHKTWmiv8G2I9Jmvcp2R5zpLnra6izbaMfvf0MJWS2/hweiYbfXCQw8 5oraf+UnBUb/aRjmPNu/eCxwmhMHhvrMOTX7t6aUzgiPxgVbHHzXUhjpXB9t8vLcWjYenJ 3jY0K3dM+o1T81mZHA0xrmSMe2DAFx9VKn0CXn/PSTRdqsi9cAIZM3O6UjYiSg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLyGv4bnjzh7M; Wed, 22 Feb 2023 00:49:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31M0nhZd041208; Wed, 22 Feb 2023 00:49:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31M0nhMg041207; Wed, 22 Feb 2023 00:49:43 GMT (envelope-from git) Date: Wed, 22 Feb 2023 00:49:43 GMT Message-Id: <202302220049.31M0nhMg041207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: e646dced5931 - stable/12 - e1000: fix I219 hang on reset List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/12 X-Git-Reftype: branch X-Git-Commit: e646dced5931a1e51177688d0bd8f1ace90711e5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=e646dced5931a1e51177688d0bd8f1ace90711e5 commit e646dced5931a1e51177688d0bd8f1ace90711e5 Author: Kevin Bowling AuthorDate: 2023-02-08 19:21:45 +0000 Commit: Kevin Bowling CommitDate: 2023-02-22 00:49:29 +0000 e1000: fix I219 hang on reset Clear the rings before reset to avoid a HW hang. Inspired by em-7.7.8 and DPDK (1fc9701238edcf0541289b9ae15565b6d9d7ab30) Reviewed by: erj Sponsored by: BBOX.io Pull Request: https://github.com/freebsd/freebsd-src/pull/540 (cherry picked from commit ae1dca798e0f826de46f4ec11914ba4c91928d7a) --- sys/dev/e1000/if_em.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index a9ab2fb21535..3f6087404f36 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -343,6 +343,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS); static void lem_smartspeed(struct e1000_softc *); static void igb_configure_queues(struct e1000_softc *); +static void em_flush_desc_rings(struct e1000_softc *); /********************************************************************* @@ -1895,6 +1896,10 @@ em_if_stop(if_ctx_t ctx) INIT_DEBUGOUT("em_if_stop: begin"); + /* I219 needs special flushing to avoid hangs */ + if (sc->hw.mac.type >= e1000_pch_spt && sc->hw.mac.type < igb_mac_min) + em_flush_desc_rings(sc); + e1000_reset_hw(&sc->hw); if (sc->hw.mac.type >= e1000_82544) E1000_WRITE_REG(&sc->hw, E1000_WUFC, 0); @@ -1960,8 +1965,7 @@ em_allocate_pci_resources(if_ctx_t ctx) sc->hw.hw_addr = (u8 *)&sc->osdep.mem_bus_space_handle; /* Only older adapters use IO mapping */ - if (sc->hw.mac.type < em_mac_min && - sc->hw.mac.type > e1000_82543) { + if (sc->hw.mac.type < em_mac_min && sc->hw.mac.type > e1000_82543) { /* Figure our where our IO BAR is ? */ for (rid = PCIR_BAR(0); rid < PCIR_CIS;) { val = pci_read_config(dev, rid, 4); @@ -2449,6 +2453,113 @@ igb_init_dmac(struct e1000_softc *sc, u32 pba) E1000_WRITE_REG(hw, E1000_DMACR, 0); } } +/********************************************************************* + * The 3 following flush routines are used as a workaround in the + * I219 client parts and only for them. + * + * em_flush_tx_ring - remove all descriptors from the tx_ring + * + * We want to clear all pending descriptors from the TX ring. + * zeroing happens when the HW reads the regs. We assign the ring itself as + * the data of the next descriptor. We don't care about the data we are about + * to reset the HW. + **********************************************************************/ +static void +em_flush_tx_ring(struct e1000_softc *sc) +{ + struct e1000_hw *hw = &sc->hw; + struct tx_ring *txr = &sc->tx_queues->txr; + struct e1000_tx_desc *txd; + u32 tctl, txd_lower = E1000_TXD_CMD_IFCS; + u16 size = 512; + + tctl = E1000_READ_REG(hw, E1000_TCTL); + E1000_WRITE_REG(hw, E1000_TCTL, tctl | E1000_TCTL_EN); + + txd = &txr->tx_base[txr->tx_cidx_processed]; + + /* Just use the ring as a dummy buffer addr */ + txd->buffer_addr = txr->tx_paddr; + txd->lower.data = htole32(txd_lower | size); + txd->upper.data = 0; + + /* flush descriptors to memory before notifying the HW */ + wmb(); + + E1000_WRITE_REG(hw, E1000_TDT(0), txr->tx_cidx_processed); + mb(); + usec_delay(250); +} + +/********************************************************************* + * em_flush_rx_ring - remove all descriptors from the rx_ring + * + * Mark all descriptors in the RX ring as consumed and disable the rx ring + **********************************************************************/ +static void +em_flush_rx_ring(struct e1000_softc *sc) +{ + struct e1000_hw *hw = &sc->hw; + u32 rctl, rxdctl; + + rctl = E1000_READ_REG(hw, E1000_RCTL); + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + E1000_WRITE_FLUSH(hw); + usec_delay(150); + + rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); + /* zero the lower 14 bits (prefetch and host thresholds) */ + rxdctl &= 0xffffc000; + /* + * update thresholds: prefetch threshold to 31, host threshold to 1 + * and make sure the granularity is "descriptors" and not "cache lines" + */ + rxdctl |= (0x1F | (1 << 8) | E1000_RXDCTL_THRESH_UNIT_DESC); + E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl); + + /* momentarily enable the RX ring for the changes to take effect */ + E1000_WRITE_REG(hw, E1000_RCTL, rctl | E1000_RCTL_EN); + E1000_WRITE_FLUSH(hw); + usec_delay(150); + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); +} + +/********************************************************************* + * em_flush_desc_rings - remove all descriptors from the descriptor rings + * + * In I219, the descriptor rings must be emptied before resetting the HW + * or before changing the device state to D3 during runtime (runtime PM). + * + * Failure to do this will cause the HW to enter a unit hang state which can + * only be released by PCI reset on the device + * + **********************************************************************/ +static void +em_flush_desc_rings(struct e1000_softc *sc) +{ + struct e1000_hw *hw = &sc->hw; + device_t dev = sc->dev; + u16 hang_state; + u32 fext_nvm11, tdlen; + + /* First, disable MULR fix in FEXTNVM11 */ + fext_nvm11 = E1000_READ_REG(hw, E1000_FEXTNVM11); + fext_nvm11 |= E1000_FEXTNVM11_DISABLE_MULR_FIX; + E1000_WRITE_REG(hw, E1000_FEXTNVM11, fext_nvm11); + + /* do nothing if we're not in faulty state, or if the queue is empty */ + tdlen = E1000_READ_REG(hw, E1000_TDLEN(0)); + hang_state = pci_read_config(dev, PCICFG_DESC_RING_STATUS, 2); + if (!(hang_state & FLUSH_DESC_REQUIRED) || !tdlen) + return; + em_flush_tx_ring(sc); + + /* recheck, maybe the fault is caused by the rx ring */ + hang_state = pci_read_config(dev, PCICFG_DESC_RING_STATUS, 2); + if (hang_state & FLUSH_DESC_REQUIRED) + em_flush_rx_ring(sc); +} + /********************************************************************* * @@ -2680,6 +2791,10 @@ em_reset(if_ctx_t ctx) break; } + /* I219 needs some special flushing to avoid hangs */ + if (sc->hw.mac.type >= e1000_pch_spt && sc->hw.mac.type < igb_mac_min) + em_flush_desc_rings(sc); + /* Issue a global reset */ e1000_reset_hw(hw); if (hw->mac.type >= igb_mac_min) { From nobody Wed Feb 22 00:50:56 2023 X-Original-To: dev-commits-src-branches@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 4PLyJJ6mJLz3tjtk; Wed, 22 Feb 2023 00:50:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLyJJ6LTxz3FW2; Wed, 22 Feb 2023 00:50:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677027056; 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=3IBPXJwsIpSukOMI3qFMDXstUof8sIm5Xfq/WJGP48s=; b=ft6TZG1LnsB1FgDroMytmP9ph/u9FFzwuELB+IjH5fNywwsic3OysF9vrdiojRNtsadTv8 HS9hg47RXNfQwNMCum7OlCXOzOJLUZxO91CDDRbenvLoKxp7Y9Fuc+34qCdqv2mcE7sDPu 8K4el8YKkdvD7TDkTy9HtZq72waG13I1W4MZ1Ji7BFUig8EwOLi+mMWAbExwy2UlIkA5HV BNyUFmkNTOGG3fYRzId8TxsEvUpKrJjKwysh8TPE6dc7ambTKK/huv8P46LZnOSXt50kMx OnaLn8H3Bvmk653Cu00zqfnpqqOUNMk//kWgpemizCfIBd/EKJPIl0K6Z9VsxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677027056; 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=3IBPXJwsIpSukOMI3qFMDXstUof8sIm5Xfq/WJGP48s=; b=B20tpiWHNgwOVtRdr2A1XiBU3H5ZrfSdWJFlM20Z+mwojxfm0B7wCa9RNnGbIhJSaqV3k7 W9/9QMuh3QBmeujPaD04aWGPtwH00FG/Pi9jUJRu7PMo/l0Wd2CZWjLeezO36sqjfhsZcK dOeSefrEes0gKz4cjNmGjxaParYdfJKF/LGK9TH7nVuYYdCNhpuyIu7Kun+Zt+0fWbcsOQ tMInGj/MhijjymjdhYyZtFshJPOSN0KtNSZlhhMYb/FP+J4miW7eXxQuBE9ynINX2UwfZJ 5zOjQZAhamh6WHCGhwbBiGOotp9vtBxKUX+F954B8U4BSz1nb4bWthJ2M51Rpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677027056; a=rsa-sha256; cv=none; b=oXhz4w6c0MMbdm0/cwYQ/ud7Dpz7wISksGvZjkNVSjzhRec+i1lvQDZVypS8LqKplVanKz iWB6UR23q8zs9CYgtrrT4+Y8dlQiFYjYzZzKCD/x+X/Ez1DW8HyuvEIak431IJSVAdlkfN H05+GAhm2HgQ9A7IvynXI38ZJLNOFzDF1eUOsogK6uQNN6OlrqAaZvloNzwQkPN5al8oMb 5rqi5QQ2CxpCzg+tdxIeHhOo7N6K5Z33V1EvHpTPNaVqUjgchJ7DZEkQI7v8N4iGn8rnuN 8Y7npoUi19Xi6J/Xalpma8jm6RVnKl4nzCYkUUujTZu934BP8rbHeYlHIJ4Q2g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PLyJJ5QSmzghL; Wed, 22 Feb 2023 00:50:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31M0ou7D050644; Wed, 22 Feb 2023 00:50:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31M0oull050643; Wed, 22 Feb 2023 00:50:56 GMT (envelope-from git) Date: Wed, 22 Feb 2023 00:50:56 GMT Message-Id: <202302220050.31M0oull050643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 8c2eeb1c1cd6 - stable/13 - e1000: bump driver version List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8c2eeb1c1cd67accad434303bc9f2cd6ec401733 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=8c2eeb1c1cd67accad434303bc9f2cd6ec401733 commit 8c2eeb1c1cd67accad434303bc9f2cd6ec401733 Author: Kevin Bowling AuthorDate: 2023-02-08 19:25:58 +0000 Commit: Kevin Bowling CommitDate: 2023-02-22 00:50:23 +0000 e1000: bump driver version Incrementing these to avoid confusion in users; we are on par with these out of tree versions. Reviewed by: erj Sponsored by: BBOX.io Pull Request: https://github.com/freebsd/freebsd-src/pull/540 (cherry picked from commit 647f2d2bc0cb9357ac083bf2aae4b669167dd66b) --- sys/dev/e1000/if_em.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 80a3bbee7814..408b76c6876f 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -37,7 +37,8 @@ /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.6.1-k"; +char em_driver_version[] = "7.7.8-fbsd"; +char igb_driver_version[] = "2.5.19-fbsd"; /********************************************************************* * PCI Device ID Table @@ -593,7 +594,7 @@ static struct if_shared_ctx igb_sctx_init = { .isc_ntxqs = 1, .isc_admin_intrcnt = 1, .isc_vendor_info = igb_vendor_info_array, - .isc_driver_version = em_driver_version, + .isc_driver_version = igb_driver_version, .isc_driver = &igb_if_driver, .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_TSO_INIT_IP | IFLIB_NEED_ZERO_CSUM, From nobody Wed Feb 22 00:51:50 2023 X-Original-To: dev-commits-src-branches@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 4PLyKL5D2Sz3tjpK; Wed, 22 Feb 2023 00:51:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLyKL4k9Hz3GM8; Wed, 22 Feb 2023 00:51:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677027110; 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=osp7qLIet9DL6cOA8xWx2YLA81k68dDE4ZYkx9Zxzvg=; b=kzagqxQrJRo9i7ga78gypU9Mfk4WlZolFIGGCYJvvqoJRuGsUnEJwwv/kmvmtgTH2pN8BT obgi8DZ7NTnbxrCAiQyAmlQLhVcavvH8A0QE7vdrK09wtS0jBeSANMaHECajg9A/D5bVLI lCoVrnkM7hLdzFr7WXwxO2LbcvurFL0khp1L2y8W9b3wXs5gDcaHF7ZpxnJN1rp/TZWZaD wDjnIs33JT40YTGAYIfj8C9Hg4/h1DfuR67gzQH4+OWYWybAxGaJkOmiVYxu0CNjxoN2S5 EvQ527vghPp152Flamy2f367wBWSYU7krNEDzTHFt50sbamWK5LsS1F9cEAD2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677027110; 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=osp7qLIet9DL6cOA8xWx2YLA81k68dDE4ZYkx9Zxzvg=; b=tqB0X1PcatuRXE4D9G6E2SsdfkkQ1KYhGjOl6WxuuBlG6daPcg097a/QRPl58AedcSkMT2 eWJA/LNDKpwLYKOpbtd+SmqiHajXi4nB2QgHusJNkeMIHNrvsnMG354BhZmkNPP2GmOm0n LMZFBiI5lZ3js9fRUkPbd+AZqBZkf60HLe0CJHzo92laLMjq3abgsST2i6e2O2yzIUqOSq 4pZT1m9Ul7gF8446+UMgJVZpJGka0IxtyneFnniWsWnw9K5tGCdx43H3B6BhMgGKrg/LdM IEvQsCBB7XnKS2okNGt9S6w/vyLWQJnho6LbGnJHAvzfZ7H5hhPste+HrP4HOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677027110; a=rsa-sha256; cv=none; b=xj4CmC/WgwF1N5qJX92O8juXYkz2ws7RZEmaA9zEfW8I+qSI5RVSVEhjQ4c3I6L/guBT42 rgeEar3l44cJ6/SIhbbCUzhTp5Ce47zmw7i7uxR1y0bUcf22Oh4DYNAtTTfqPzskO6O6qD 6r1nn6SiSTPO01I6fWRHlMCMJONIIn4XNVZ1gXjk6owJNGYKwjcnExUdNVxY+umSiluSbz 8sI2IZBZsJg8HjjnC6NQWO66ZoHRDmv/WEMR1D+jwVujxmmPJGxgmBrrf8UANakACeRcgE bJQSyKtXFZCDpV5xCwfBLcZWENCxuB6dzipVPgbFykykz49JJ46ymM8vayeS/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 4PLyKL3pFpzh9f; Wed, 22 Feb 2023 00:51:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31M0po9u050845; Wed, 22 Feb 2023 00:51:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31M0po32050844; Wed, 22 Feb 2023 00:51:50 GMT (envelope-from git) Date: Wed, 22 Feb 2023 00:51:50 GMT Message-Id: <202302220051.31M0po32050844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 1fb11c84caa8 - stable/12 - e1000: bump driver version List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/12 X-Git-Reftype: branch X-Git-Commit: 1fb11c84caa89453d6a1b15c38252ac464980193 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=1fb11c84caa89453d6a1b15c38252ac464980193 commit 1fb11c84caa89453d6a1b15c38252ac464980193 Author: Kevin Bowling AuthorDate: 2023-02-08 19:25:58 +0000 Commit: Kevin Bowling CommitDate: 2023-02-22 00:51:20 +0000 e1000: bump driver version Incrementing these to avoid confusion in users; we are on par with these out of tree versions. Reviewed by: erj Sponsored by: BBOX.io Pull Request: https://github.com/freebsd/freebsd-src/pull/540 (cherry picked from commit 647f2d2bc0cb9357ac083bf2aae4b669167dd66b) --- sys/dev/e1000/if_em.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 3f6087404f36..869ce4fb4cf4 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -37,7 +37,8 @@ /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.6.1-k"; +char em_driver_version[] = "7.7.8-fbsd"; +char igb_driver_version[] = "2.5.19-fbsd"; /********************************************************************* * PCI Device ID Table @@ -592,7 +593,7 @@ static struct if_shared_ctx igb_sctx_init = { .isc_ntxqs = 1, .isc_admin_intrcnt = 1, .isc_vendor_info = igb_vendor_info_array, - .isc_driver_version = em_driver_version, + .isc_driver_version = igb_driver_version, .isc_driver = &igb_if_driver, .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_TSO_INIT_IP | IFLIB_NEED_ZERO_CSUM, From nobody Wed Feb 22 12:29:16 2023 X-Original-To: dev-commits-src-branches@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 4PMFp53PKkz3sxC1; Wed, 22 Feb 2023 12:29:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMFp5100pz3KK0; Wed, 22 Feb 2023 12:29:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677068957; 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=GBDzAdBH4/m22ztjLDSxhPqGi66nUchQQfiHY8zEbYE=; b=bqtiE6A2/T+U7l49j8bZYiBjEuaD2l/mcBXergtVljc/OMwmO5Tzg4l2S8VjFjJ0JqgVp/ wVlT22Uj6EwSlLuye3m2z2KBr8fNbRPtN+4li7Xcgcxz34PWCN9YZSefYNEUyWAQRX4HLA N5k6pn+cc+nZI6Lx7YNgjFNZzbuvWlIXzXC+1c0pIO1cLd1D0bVuplYuqb0wmG/6HUVPAD db5t22k2G/w1X4Gb1sJOwEwL0tvkZ/7+sCHTUDFLbdAfHZfG6I5BuWgb/3X3WT54x8omUN C2RtqHEXjQiObqak+eElHI1mvUSCSqwguw2nwebqqoEH58b9YrfISgQIg8+Dcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677068957; 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=GBDzAdBH4/m22ztjLDSxhPqGi66nUchQQfiHY8zEbYE=; b=RjZ/mpjoIaHvpx8WqGvJiZfIkGld4V9h9ilQf0OpBsUoAa/5dC0R8X2Gh/cpJS2olFEYvy 0Ve6Qf0+bst6In2ET0XBS4F/P4mwtchZmUQWnU9nKlfQb7Gx4SDqm6rnB0dk/ZWQa2mn8d Myo6Qye+I+hQMxcYyTOdiQFWzyXdWi5BQcLMjVhMpkpnNEJkCLeT4A1lMCJj6dTwPaVlm3 FItdwFi7TauMAsUx+VCTYuniuxCWBESGWCAXbxNeGig4GG3qOGjfGLH57XYmaodw6I0TC9 2i59jQlNaFZyh6oCIi1AIz1U8XzTb26wUKw/weypid7XeqMlcVzpU6ku1FtcIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677068957; a=rsa-sha256; cv=none; b=IrEjRHHE6JpYrCYk8fGUbJaxpGMPFYc++UJDX+VC2sI7csfiyC1lquxxvtxUrSyLdeWa0A n5ub3Rh2H5SiLaY4s7+FAKPvbKpVMxjrRnNlrwb1ys4PW8mg3kOIrR+Am5lhuohVEw5kIL kMXrRkRILGRpkyVQYE4w0G51Omiq2xBh7n1Tl627ONuGTId8bcbChui6iY0sWgly+Iwq/c b9opXAD+S3TfXQYSTD3bcnkSGcPzhGNHrNdH1g6+uU+n5SOqXUGVvSbYDweGA3VxaXqQzV MeqrZ4Uy9Fg92sqL30BgnNtV9fD8xQ6p5rEV7xxPDq/GhS/7aaEkYCu2Kxd3Mg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMFp504Ngz115F; Wed, 22 Feb 2023 12:29:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31MCTGN9042523; Wed, 22 Feb 2023 12:29:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MCTGtj042522; Wed, 22 Feb 2023 12:29:16 GMT (envelope-from git) Date: Wed, 22 Feb 2023 12:29:16 GMT Message-Id: <202302221229.31MCTGtj042522@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 8f2bb173bfc6 - stable/13 - Introduce startmsg and use it in rc scripts List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8f2bb173bfc6e1a03a56b5098f8d2af740ce743f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=8f2bb173bfc6e1a03a56b5098f8d2af740ce743f commit 8f2bb173bfc6e1a03a56b5098f8d2af740ce743f Author: Jose Luis Duran AuthorDate: 2022-03-13 17:48:06 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2023-02-22 12:27:16 +0000 Introduce startmsg and use it in rc scripts startmsg is a new rc.subr(8) function function to be used instead of echo(1) when for boot messages. It replaces the often forgotten check_startmsgs && echo ... with startmsg ... No functional change intended. I adjusted the commit message and did some final clean-ups of the patch before committing. PR: 255207 Reported by: Jose Luis Duran Reviewed by: imp, 0mp Approved by: imp (src) Differential Revision: https://reviews.freebsd.org/D34514 (cherry picked from commit 325ebf37d8efc6488754051fcc2b1aaa40cefd8b) --- libexec/rc/rc.d/bgfsck | 2 +- libexec/rc/rc.d/cleartmp | 4 ++-- libexec/rc/rc.d/fsck | 4 ++-- libexec/rc/rc.d/hostid | 4 ++-- libexec/rc/rc.d/hostname | 4 ++-- libexec/rc/rc.d/ldconfig | 5 ++--- libexec/rc/rc.d/motd | 4 ++-- libexec/rc/rc.d/mountcritlocal | 4 ++-- libexec/rc/rc.d/moused | 4 ++-- libexec/rc/rc.d/newsyslog | 4 ++-- libexec/rc/rc.d/nfsclient | 3 +-- libexec/rc/rc.d/os-release | 4 ++-- libexec/rc/rc.d/pf | 4 ++-- libexec/rc/rc.d/savecore | 2 +- libexec/rc/rc.subr | 11 ++++++++++- share/man/man8/rc.subr.8 | 13 +++++++++++++ 16 files changed, 48 insertions(+), 28 deletions(-) diff --git a/libexec/rc/rc.d/bgfsck b/libexec/rc/rc.d/bgfsck index e83f6fb3634f..aae8ba086f4d 100755 --- a/libexec/rc/rc.d/bgfsck +++ b/libexec/rc/rc.d/bgfsck @@ -39,7 +39,7 @@ bgfsck_start() bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds" fi if [ -z "${rc_force}" ]; then - check_startmsgs && echo "${bgfsck_msg}." + startmsg "${bgfsck_msg}." fi (sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \ diff --git a/libexec/rc/rc.d/cleartmp b/libexec/rc/rc.d/cleartmp index 72e6c3ee881a..cc5777484305 100755 --- a/libexec/rc/rc.d/cleartmp +++ b/libexec/rc/rc.d/cleartmp @@ -26,7 +26,7 @@ cleartmp_start() ${tmp}/.ICE-unix ${tmp}/.font-unix" if checkyesno ${rcvar1}; then - check_startmsgs && echo "Clearing ${tmp}." + startmsg "Clearing ${tmp}." # This is not needed for mfs, but doesn't hurt anything. # Things to note: @@ -48,7 +48,7 @@ cleartmp_start() elif checkyesno clear_tmp_X; then # Remove X lock files, since they will prevent you from # restarting X. Remove other X related directories. - check_startmsgs && echo "Clearing ${tmp} (X related)." + startmsg "Clearing ${tmp} (X related)." rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs} fi if checkyesno clear_tmp_X; then diff --git a/libexec/rc/rc.d/fsck b/libexec/rc/rc.d/fsck index a7fe9a15d5c3..c46c11af240e 100755 --- a/libexec/rc/rc.d/fsck +++ b/libexec/rc/rc.d/fsck @@ -24,7 +24,7 @@ fsck_start() # During fsck ignore SIGQUIT trap : 3 - check_startmsgs && echo "Starting file system checks:" + startmsg "Starting file system checks:" # Background fsck can only be run with -p if checkyesno background_fsck; then fsck -F -p @@ -37,7 +37,7 @@ fsck_start() echo "Warning! Some of the devices might not be" \ "available; retrying" root_hold_wait - check_startmsgs && echo "Restarting file system checks:" + startmsg "Restarting file system checks:" # Background fsck can only be run with -p if checkyesno background_fsck; then fsck -F -p diff --git a/libexec/rc/rc.d/hostid b/libexec/rc/rc.d/hostid index 3cf7dd42eb6c..01697a1d1e11 100755 --- a/libexec/rc/rc.d/hostid +++ b/libexec/rc/rc.d/hostid @@ -50,9 +50,9 @@ hostid_set() # Set both kern.hostuuid and kern.hostid. # - check_startmsgs && echo "Setting hostuuid: ${uuid}." + startmsg "Setting hostuuid: ${uuid}." ${SYSCTL} kern.hostuuid="${uuid}" >/dev/null - check_startmsgs && echo "Setting hostid: ${id}." + startmsg "Setting hostid: ${id}." ${SYSCTL} kern.hostid=${id} >/dev/null } diff --git a/libexec/rc/rc.d/hostname b/libexec/rc/rc.d/hostname index 148b61fd68f2..9d4c0221ccf6 100755 --- a/libexec/rc/rc.d/hostname +++ b/libexec/rc/rc.d/hostname @@ -72,9 +72,9 @@ hostname_start() # All right, it is safe to invoke hostname(1) now. # - check_startmsgs && echo -n "Setting hostname: ${hostname}" + startmsg -n "Setting hostname: ${hostname}" /bin/hostname "${hostname}" - check_startmsgs && echo '.' + startmsg '.' } load_rc_config $name diff --git a/libexec/rc/rc.d/ldconfig b/libexec/rc/rc.d/ldconfig index 03627df6da06..6e59bc641a0a 100755 --- a/libexec/rc/rc.d/ldconfig +++ b/libexec/rc/rc.d/ldconfig @@ -37,7 +37,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - check_startmsgs && echo 'ELF ldconfig path:' ${_LDC} + startmsg 'ELF ldconfig path:' ${_LDC} ${ldconfig} -elf ${_ins} ${_LDC} machine_arch=$(sysctl -n hw.machine_arch) @@ -58,8 +58,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - check_startmsgs && - echo '32-bit compatibility ldconfig path:' ${_LDC} + startmsg '32-bit compatibility ldconfig path:' ${_LDC} ${ldconfig} -32 ${_ins} ${_LDC} ;; esac diff --git a/libexec/rc/rc.d/motd b/libexec/rc/rc.d/motd index e63973945f9d..d9dd60a0f59a 100755 --- a/libexec/rc/rc.d/motd +++ b/libexec/rc/rc.d/motd @@ -26,7 +26,7 @@ motd_start() # Must be done *before* interactive logins are possible # to prevent possible race conditions. # - check_startmsgs && echo -n 'Updating motd:' + startmsg -n 'Updating motd:' if [ ! -f "${TEMPLATE}" ]; then # Create missing template from existing regular motd file, if # one exists. @@ -51,7 +51,7 @@ motd_start() install -C -o root -g wheel -m "${PERMS}" "$T" "${TARGET}" rm -f "$T" - check_startmsgs && echo '.' + startmsg '.' } load_rc_config $name diff --git a/libexec/rc/rc.d/mountcritlocal b/libexec/rc/rc.d/mountcritlocal index f52c565d65c6..c3df4cdbea69 100755 --- a/libexec/rc/rc.d/mountcritlocal +++ b/libexec/rc/rc.d/mountcritlocal @@ -29,7 +29,7 @@ mountcritlocal_start() esac # Mount everything except nfs filesystems. - check_startmsgs && echo -n 'Mounting local filesystems:' + startmsg -n 'Mounting local filesystems:' mount_excludes='no' for i in ${netfs_types}; do fstype=${i%:*} @@ -47,7 +47,7 @@ mountcritlocal_start() err=$? fi - check_startmsgs && echo '.' + startmsg '.' case ${err} in 0) diff --git a/libexec/rc/rc.d/moused b/libexec/rc/rc.d/moused index 84f886c0d9c3..b9ac9e0bd3aa 100755 --- a/libexec/rc/rc.d/moused +++ b/libexec/rc/rc.d/moused @@ -52,9 +52,9 @@ moused_start() mytype="$moused_type" fi - check_startmsgs && echo -n "Starting ${ms} moused" + startmsg -n "Starting ${ms} moused" /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg} - check_startmsgs && echo '.' + startmsg '.' mousechar_arg= case ${mousechar_start} in diff --git a/libexec/rc/rc.d/newsyslog b/libexec/rc/rc.d/newsyslog index 740fcfeefaf4..38ad64b3d4a0 100755 --- a/libexec/rc/rc.d/newsyslog +++ b/libexec/rc/rc.d/newsyslog @@ -18,9 +18,9 @@ stop_cmd=":" newsyslog_start() { - check_startmsgs && echo -n 'Creating and/or trimming log files' + startmsg -n 'Creating and/or trimming log files' ${command} ${rc_flags} - check_startmsgs && echo '.' + startmsg '.' } load_rc_config $name diff --git a/libexec/rc/rc.d/nfsclient b/libexec/rc/rc.d/nfsclient index 2acfb84d8b09..7516ab6703f4 100755 --- a/libexec/rc/rc.d/nfsclient +++ b/libexec/rc/rc.d/nfsclient @@ -23,8 +23,7 @@ nfsclient_start() # if [ -n "${nfs_access_cache}" ]; then - check_startmsgs && - echo "NFS access cache time=${nfs_access_cache}" + startmsg "NFS access cache time=${nfs_access_cache}" if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then warn "failed to set access cache timeout" fi diff --git a/libexec/rc/rc.d/os-release b/libexec/rc/rc.d/os-release index 16f8cb178db8..4614fb8cc18b 100755 --- a/libexec/rc/rc.d/os-release +++ b/libexec/rc/rc.d/os-release @@ -21,7 +21,7 @@ osrelease_start() { local _version _version_id - check_startmsgs && echo -n "Updating ${osrelease_file} " + startmsg -n "Updating ${osrelease_file} " _version=$(freebsd-version -u) _version_id=${_version%%[^0-9.]*} t=$(mktemp -t os-release) @@ -38,7 +38,7 @@ osrelease_start() __EOF__ install -C -o root -g wheel -m ${osrelease_perms} "$t" "${osrelease_file}" rm -f "$t" - check_startmsgs && echo 'done.' + startmsg 'done.' } load_rc_config $name diff --git a/libexec/rc/rc.d/pf b/libexec/rc/rc.d/pf index fa1b49643cc5..eb9cea6c271e 100755 --- a/libexec/rc/rc.d/pf +++ b/libexec/rc/rc.d/pf @@ -42,13 +42,13 @@ pf_fallback() pf_start() { - check_startmsgs && echo -n 'Enabling pf' + startmsg -n 'Enabling pf' $pf_program -F all > /dev/null 2>&1 $pf_program -f "$pf_rules" $pf_flags || pf_fallback if ! $pf_program -s info | grep -q "Enabled" ; then $pf_program -eq fi - check_startmsgs && echo '.' + startmsg '.' } pf_stop() diff --git a/libexec/rc/rc.d/savecore b/libexec/rc/rc.d/savecore index c39872cf1729..5d8204a1e805 100755 --- a/libexec/rc/rc.d/savecore +++ b/libexec/rc/rc.d/savecore @@ -74,7 +74,7 @@ savecore_start() fi sync else - check_startmsgs && echo 'No core dumps found.' + startmsg 'No core dumps found.' fi } diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index df91737566d5..db49e79ccaf8 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -715,6 +715,15 @@ check_startmsgs() fi } +# +# startmsg +# Preferred method to use when displaying start messages in lieu of echo. +# +startmsg() +{ + check_startmsgs && echo "$@" +} + # # run_rc_command argument # Search for argument in the list of supported commands, which is: @@ -1106,7 +1115,7 @@ run_rc_command() # setup the full command to run # - check_startmsgs && echo "Starting ${name}." + startmsg "Starting ${name}." if [ -n "$_chroot" ]; then _cd= _doit="\ diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8 index b4de4ea060ad..130962ecdcdf 100644 --- a/share/man/man8/rc.subr.8 +++ b/share/man/man8/rc.subr.8 @@ -73,6 +73,8 @@ .It .Ic run_rc_script Ar file Ar argument .It +.Ic startmsg Oo Fl n Oc Ar message +.It .Ic wait_for_pids Op Ar pid ... .It .Ic warn Ar message @@ -882,6 +884,17 @@ otherwise source .Ar file into the current shell. .El +.It Ic startmsg Oo Fl n Oc Ar message +Display a start message to +.Va stdout . +It should be used instead of +.Xr echo 1 . +The display of this output can be turned off if the +.Xr rc.conf 5 +variable +.Va rc_startmsgs +is set to +.Dq Li NO . .It Ic stop_boot Op Ar always Prevent booting to multiuser mode. If the From nobody Wed Feb 22 12:29:18 2023 X-Original-To: dev-commits-src-branches@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 4PMFp63GZRz3sxFL; Wed, 22 Feb 2023 12:29:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMFp61sF9z3K5b; Wed, 22 Feb 2023 12:29:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677068958; 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=l08Lzzsg7eFrzN0CNqBZNzpLMs3FuMY0wvM3l+2KnGQ=; b=qFYvXBMeyqIr1HVjU4tz6TcePJbisTEPs4CEs3B0XJF0dteCQBlRaW/rGNpU4tOMEpeGrb a+C5UxIWVDcpJsn4zuU8PiL3S7ZOSJeDTUAaHA9fmyI04srBm2tFT2tgxwi7nguPsnxjEc q50acGKMI6trczHWE2R1+kYZ0XaYBWVk9lILGxzwuuJt0MFseBVYZ3ShhZ3I4dCNVPtsEa Dc4nTnhUtAmG+LwTuBLX+8oft6tkWxxlXn0/Ol0qzd1R28YJWkK9DUBbuyJQ9dSGLybotf EOMBdmK3mN2YTMg3UEKa1NwyLIpOtaJZ3SuzwDbevGyhqnvH/l0tlJJ+UU913Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677068958; 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=l08Lzzsg7eFrzN0CNqBZNzpLMs3FuMY0wvM3l+2KnGQ=; b=NTZ2DEoF/UWP1qMvoCltGRliXeiNr1Cke+3YMWz+eGKg+kQJtl6O5h4bTvlmJ5MzOuYxkJ 1cIUQY0F3gCXNODJLJGV4xFyF+bP1cNdbgIMlom4VNOZAlTU+Cs28nNfP+XO3idwgOt7ZI BiLw6+1kMHvj1VoG+KvXr+BLGmONqM3c0LmU61MboEvH5PZnAvierN+f2RgeH4p2y5ZNla Az7D7ldSqazumI/6s9ZRetDz2hVWoLw6iJp5W+dpyto8GQVJPyJ6JKd4oBXLSp9A/49zv8 iYNLrhfK5uuJOCbzeNxf7/JUUimsDWD/fT3GsblQOpvX45F9BIcV9bcCndbHbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677068958; a=rsa-sha256; cv=none; b=B188qHbm014frCAbo5COchXFmh7tv7s/DWzr9cEkloKIi0KOcWik0hEPoCEEF13xkfElB5 eg1mxcNJLI2dB5m44Wz9IRL8lziOkc3240QEcnyiU4sivekXBS4rj5VbzqHavgORWlfGIz AqEDvD4T00IM05aC9z+n5qQRjwGHjJWNe143CdeGxf9KhTdQGZYxFqyrRxs4rEC8iOdZ92 WjYJZAhc+VnoLpxqMPEtcxkFeU3WnsaNNnbwXPW8wp705Q9syT7ln0sjWeTfg10e0hHsrX i7rZQqXDbd7imFa+mNj6jZekRQcvvEUnE+Dmhuigd66czeGiSJc1DvvqM+23Nw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMFp60y4yz11bk; Wed, 22 Feb 2023 12:29:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31MCTITR042551; Wed, 22 Feb 2023 12:29:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MCTIfY042550; Wed, 22 Feb 2023 12:29:18 GMT (envelope-from git) Date: Wed, 22 Feb 2023 12:29:18 GMT Message-Id: <202302221229.31MCTIfY042550@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: e8396a9592ab - stable/13 - rc.d/*: Use startmsg instead of echo on start messages List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e8396a9592abb08069009e48b84ead2636681b16 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=e8396a9592abb08069009e48b84ead2636681b16 commit e8396a9592abb08069009e48b84ead2636681b16 Author: Jose Luis Duran AuthorDate: 2022-03-13 17:54:39 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2023-02-22 12:27:50 +0000 rc.d/*: Use startmsg instead of echo on start messages By rc.conf(5), setting rc_startmsgs="NO" should silence start messages. Fix a few rc scripts by using startmsg. PR: 255207 Reported by: Jose Luis Duran Reviewed by: imp, 0mp Approved by: imp (src) Differential Revision: https://reviews.freebsd.org/D34514 (cherry picked from commit 19a6267d61a0c3bd6cd56f19ca3f8a67a54f675c) --- libexec/rc/rc.d/jail | 16 ++++++++-------- libexec/rc/rc.d/local | 4 ++-- libexec/rc/rc.d/netif | 2 +- libexec/rc/rc.d/ppp | 6 +++--- libexec/rc/rc.d/pppoed | 2 +- libexec/rc/rc.d/rfcomm_pppd_server | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libexec/rc/rc.d/jail b/libexec/rc/rc.d/jail index 1d544501e32b..d95af40f459e 100755 --- a/libexec/rc/rc.d/jail +++ b/libexec/rc/rc.d/jail @@ -450,7 +450,7 @@ jail_start() if [ $# = 0 ]; then return fi - echo -n 'Starting jails:' + startmsg -n 'Starting jails:' case $1 in _ALL) command=$jail_program @@ -462,14 +462,14 @@ jail_start() _tmp=`mktemp -t jail` || exit 3 if $command $rc_flags $command_args >> $_tmp 2>&1; then $jail_jls jid name | while read _id _name; do - echo -n " $_name" + startmsg -n " $_name" echo $_id > /var/run/jail_${_name}.id done else cat $_tmp fi rm -f $_tmp - echo '.' + startmsg '.' return ;; esac @@ -490,11 +490,11 @@ jail_start() _tmp=`mktemp -t jail_${_j}` || exit 3 if $command $rc_flags $command_args \ >> $_tmp 2>&1 /var/run/jail_${_j}.id else - echo " cannot start jail " \ + startmsg " cannot start jail " \ "\"${_hostname:-${_j}}\": " cat $_tmp fi @@ -517,18 +517,18 @@ jail_start() _tmp=`mktemp -t jail` || exit 3 if $command $rc_flags $command_args \ >> $_tmp 2>&1 /var/run/jail_${_j}.id else - echo " cannot start jail " \ + startmsg " cannot start jail " \ "\"${_hostname:-${_j}}\": " cat $_tmp fi rm -f $_tmp done fi - echo '.' + startmsg '.' } jail_stop() diff --git a/libexec/rc/rc.d/local b/libexec/rc/rc.d/local index ba17a674ae9d..53907ad27011 100755 --- a/libexec/rc/rc.d/local +++ b/libexec/rc/rc.d/local @@ -18,9 +18,9 @@ stop_cmd="local_stop" local_start() { if [ -f /etc/rc.local ]; then - echo -n 'Starting local daemons:' + startmsg -n 'Starting local daemons:' . /etc/rc.local - echo '.' + startmsg '.' fi } diff --git a/libexec/rc/rc.d/netif b/libexec/rc/rc.d/netif index 3dbb3e1a9588..bb401a6d5ce4 100755 --- a/libexec/rc/rc.d/netif +++ b/libexec/rc/rc.d/netif @@ -247,7 +247,7 @@ netif_common() _str='Reclaiming' ;; esac - echo "${_str} Network:${_ok}." + startmsg "${_str} Network:${_ok}." case ${_func} in ifn_vnetup) # Clear _ok not to do "ifconfig $ifn" diff --git a/libexec/rc/rc.d/ppp b/libexec/rc/rc.d/ppp index 93d0655b296f..8dbff30a7e32 100755 --- a/libexec/rc/rc.d/ppp +++ b/libexec/rc/rc.d/ppp @@ -82,14 +82,14 @@ ppp_start() _ppp_profile=$ppp_profile fi - echo -n "Starting PPP profile:" + startmsg -n "Starting PPP profile:" for _p in $_ppp_profile; do - echo -n " $_p" + startmsg -n " $_p" ppp_start_profile $_p done - echo "." + startmsg "." } ppp_poststart() diff --git a/libexec/rc/rc.d/pppoed b/libexec/rc/rc.d/pppoed index 7e848595e833..c368b32008a1 100755 --- a/libexec/rc/rc.d/pppoed +++ b/libexec/rc/rc.d/pppoed @@ -24,7 +24,7 @@ pppoed_start() if [ -n "${pppoed_provider}" ]; then pppoed_flags="${pppoed_flags} -p ${pppoed_provider}" fi - echo 'Starting pppoed' + startmsg 'Starting pppoed' _opts=$-; set -f /usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface} set +f; set -${_opts} diff --git a/libexec/rc/rc.d/rfcomm_pppd_server b/libexec/rc/rc.d/rfcomm_pppd_server index 990a22475b0e..a7035f6e4ea7 100755 --- a/libexec/rc/rc.d/rfcomm_pppd_server +++ b/libexec/rc/rc.d/rfcomm_pppd_server @@ -90,14 +90,14 @@ rfcomm_pppd_server_start() _profile=${rfcomm_pppd_server_profile} fi - echo -n "Starting RFCOMM PPP profile:" + startmsg -n "Starting RFCOMM PPP profile:" for _p in ${_profile} ; do - echo -n " ${_p}" + startmsg -n " ${_p}" rfcomm_pppd_server_start_profile ${_p} done - echo "." + startmsg "." } rfcomm_pppd_server_stop() From nobody Wed Feb 22 13:48:49 2023 X-Original-To: dev-commits-src-branches@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 4PMHYs3ThPz3t281; Wed, 22 Feb 2023 13:48:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMHYs2v6Yz3kjx; Wed, 22 Feb 2023 13:48:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677073729; 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=vd6bq8xf2FJMjH7D+DnrIbeNq6XSPRUKmysMpQW9HG4=; b=gsprw5qWDPkI60dJBX9ewdKexlxr+0sNerXXjap061sWH1P5y7bdoEQLHrimTN+w/7Fcog hvtwYq4cYQE5tpJv0oOa0kTtslGqUTB6oNPJYWej2/Sfnaqv6ZhWLQf3ueQHqSr4tK96SG izsmrAfOw/WufBCiImCrJ2O37SQ0xLXF45xREuYTyoJeE8PCG27LMKiBw3HLD625/UH3mp jso51i3TiKOsu4fGA512EwN6wBAzwvgOGD+cXNeb+2Na3U3kvMrnREO/kKMydhi2lMIkRO 7IH/OqTbpn7Spzza3Mo8+/1076+WHGacabj0P31808r3DJfY7XF4GxzLgZ2H0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677073729; 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=vd6bq8xf2FJMjH7D+DnrIbeNq6XSPRUKmysMpQW9HG4=; b=xQc82g3D0At2fIfyT2q37LW34f8dpSl28195l92JmZwX6atYIOaZUfbR7yyJ9/cUmpubKn UxsRJToDylwZKmt52D1aKr8asbyJcdxJ8MOqn8Jwjxr9UHLxIrq4c5Sg/wtXaxf4woA8E3 0lm2Of7Kc1I1duvZiU62D7OFYLk7mfNlX6I+LlGxxeY7PkVL26nEObu+VF5ONQMp2HewVY pLMepJUiTfahXMRMPcLgnbVrb4wfs5l/jSDdvo4GnF8ViKXuXZt+gy/baw8SNAReEE8XFB Qa720aUb/11ZGsYu+fN3GjIZLtHHVB9T8nfSL72eTqw3aWh7EHJZt0AVAJa8VA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677073729; a=rsa-sha256; cv=none; b=JfWHasyUEYTjlpIExr4oz/WrpMXwkjcHH+I+E3POM8DJ2QZKwHTUn0Cka2LSw7t+p2avQF +Wobbm9x8lK5Uii08+VqPvRIDGF1uLjhCV63UdqNOyppJlAGDRt6zWOgShvpcEeqvtH/K/ H5L4MCIRUK22lFpZCI4Uw+CCxvUfECF4teWmYqH2RxSOjYKuSJTNhKcN0pKbe9fPkV8Iji 0yBWZsBTigGeJOuIuXQJZkVej99ZJY+2+fxL9bymp99DQrnhB2INexfSTNoyTx8Pjr42cS U1dGN+2cl1JbN3zQKu/1hcJ5z9NZus/tp2OeaSxWefdxN9FnmLPfpd1N1o300g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMHYs1p4hz13FW; Wed, 22 Feb 2023 13:48:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31MDmn8e056741; Wed, 22 Feb 2023 13:48:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MDmnvG056740; Wed, 22 Feb 2023 13:48:49 GMT (envelope-from git) Date: Wed, 22 Feb 2023 13:48:49 GMT Message-Id: <202302221348.31MDmnvG056740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Allan Jude Subject: git: b772fe0d6626 - releng/13.2 - Fix per-jail zfs.mount_snapshot setting List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: b772fe0d662650d8a517bc07f3c433486c24b347 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=b772fe0d662650d8a517bc07f3c433486c24b347 commit b772fe0d662650d8a517bc07f3c433486c24b347 Author: Allan Jude AuthorDate: 2023-02-18 01:44:34 +0000 Commit: Allan Jude CommitDate: 2023-02-22 13:48:20 +0000 Fix per-jail zfs.mount_snapshot setting When jail.conf set the nopersist flag during startup, it was incorrectly destroying the per-jail ZFS settings. PR: 260160 Reviewed by: imp (previous version), mm (upstream), freqlabs (upstream) Approved by: re (cperciva) Sponsored by: Modirum MDPay Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38662 (cherry picked from commit 8b04c1cbfc1cb71a1ce53b3a7855f1d45866fcfb) (cherry picked from commit 426ed00525409d084e97dc44397722aff2cc0bb3) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 85449ebb9d97..6ffd36885655 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -2525,7 +2525,9 @@ zfs_jailparam_set(void *obj, void *data) mount_snapshot = -1; else jsys = JAIL_SYS_NEW; - if (jsys == JAIL_SYS_NEW) { + switch (jsys) { + case JAIL_SYS_NEW: + { /* "zfs=new" or "zfs.*": the prison gets its own ZFS info. */ struct zfs_jailparam *zjp; @@ -2543,12 +2545,22 @@ zfs_jailparam_set(void *obj, void *data) if (mount_snapshot != -1) zjp->mount_snapshot = mount_snapshot; mtx_unlock(&pr->pr_mtx); - } else { + break; + } + case JAIL_SYS_INHERIT: /* "zfs=inherit": inherit the parent's ZFS info. */ mtx_lock(&pr->pr_mtx); osd_jail_del(pr, zfs_jailparam_slot); mtx_unlock(&pr->pr_mtx); + break; + case -1: + /* + * If the setting being changed is not ZFS related + * then do nothing. + */ + break; } + return (0); } From nobody Wed Feb 22 21:22:44 2023 X-Original-To: dev-commits-src-branches@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 4PMTdc4l2Zz3sCxy; Wed, 22 Feb 2023 21:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMTdc4D1Mz3NWK; Wed, 22 Feb 2023 21:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100964; 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=9R23zo62Hq/I+zzVB1FJD958oNhY2MEASl8Uog7tzG0=; b=i+S9s6ia1hQkaQ+V03Dk0WmaZIDfQ+pOZ0eyWgXHNNw3h57tApatpruP4PN8Bu4jEVaDPB 20jpBdPCQxLJlg5XzF9T9oihWqBs98QV9RWjScGCH/liBjP2h4jFkvExrtWjeCcWtE2VLk 9vNJd/MyT5VReg2TMkNffbR0JNha57bBnzIuNbiovUGZWyXG9JRkyjW6VLbxfZYQ9l3e9Z gcQdVTSzREtn9udrIh/tgEPNUR1er1qIM9Vu9PfnX0Bb7yrp9ihCgpk8N6rTNCvmL1A29s Cv7J6lkKP40jwgIFPePjL4L+4+fsDqlt5slgCQa0sGk7Pi+ezXu1nqnO5IYYNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100964; 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=9R23zo62Hq/I+zzVB1FJD958oNhY2MEASl8Uog7tzG0=; b=qEgd08IHiJsHa6TK5cknF4349hfHJjSmSlQH/Ab8CzrpctFZ3VadeNwl3+aXq+IWn9pIoi DV668qe/CZc593VUYVixaC9R/hZkHmtACULJpng08ElwRputHZxC2KAd0cvNzZvKrfBbUt fCE2TI8Jwc54CjnLVyTcrEtrenFv/VOl32m8azxena+CrUDoWSE3bFPhnDkkEGCa4XClAs RUmCG1ZfCcfpBnFP/i0fsEF/Tqq+ngeN1z2LP3fXrn/i4lIDeVsH9sFEU8P34BdJMQShLA PujYZVk0d9xUhR+FZEYqLXGCT3AkQV6gD16bBGq4Wcogj2jpzX/qMzZWwp2fzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677100964; a=rsa-sha256; cv=none; b=bdWyO/INn3LOMTIlnTt3BhfLJrjztf0ziVhjIJUzJ0thYWpHDZKgSIL1P/eqc5+uvqILBX y02WCqxOU2jsItU+wc0QUdb+9SGFZ2YtUtNnKORiO9kcFg11arGVODCwuv4W09i19uEt5F FXSObjeojW+0U6o4hlssoX95elJx8l1iQrihAvuy5dQx8jCxvIcflFLOWUocB7x8swQN3H wa+7+waPD7Ao2yNxecrBnTybzcs4XY1e3xociZYCqnBRJvy4mEn1Z5Ss441Qm6j4w0Aub1 gzIuCrUCxkTg2Y/0mNa2w1MLf33a3ona63pTahgSZcYGF1FcmSi1v3XYxwB8rw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMTdc3HS8zGcx; Wed, 22 Feb 2023 21:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31MLMiUs014897; Wed, 22 Feb 2023 21:22:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MLMiZw014896; Wed, 22 Feb 2023 21:22:44 GMT (envelope-from git) Date: Wed, 22 Feb 2023 21:22:44 GMT Message-Id: <202302222122.31MLMiZw014896@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: df2b1d059158 - stable/13 - ptrace.2: Fix warnings from igor. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: df2b1d0591584d9e63456349080357d00ccb94d8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=df2b1d0591584d9e63456349080357d00ccb94d8 commit df2b1d0591584d9e63456349080357d00ccb94d8 Author: John Baldwin AuthorDate: 2022-12-15 19:25:27 +0000 Commit: John Baldwin CommitDate: 2023-02-22 20:43:39 +0000 ptrace.2: Fix warnings from igor. Reviewed by: pauamma, imp Differential Revision: https://reviews.freebsd.org/D37689 (cherry picked from commit 120eff994aeb31671c144a1835c62d9d8789a5a0) --- lib/libc/sys/ptrace.2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2 index a5e67c745422..06c427419c41 100644 --- a/lib/libc/sys/ptrace.2 +++ b/lib/libc/sys/ptrace.2 @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd January 27, 2022 +.Dd December 15, 2022 .Dt PTRACE 2 .Os .Sh NAME @@ -151,7 +151,7 @@ The following controls are provided for this: .Bl -tag -width security.bsd.unprivileged_proc_debug .It Dv security.bsd.allow_ptrace Setting this sysctl to zero value makes -.Xr ptrace 2 +.Nm return .Er ENOSYS always as if the syscall is not implemented by the kernel. @@ -450,11 +450,11 @@ given as the signal to be delivered. .It Dv PT_ATTACH This request allows a process to gain control of an otherwise unrelated process and begin tracing it. -It does not need any cooperation from the to-be-traced process. +It does not need any cooperation from the process to trace. In this case, .Fa pid -specifies the process ID of the to-be-traced process, and the other +specifies the process ID of the process to trace, and the other two arguments are ignored. This request requires that the target process must have the same real UID as the tracing process, and that it must not be executing a setuid From nobody Wed Feb 22 21:22:45 2023 X-Original-To: dev-commits-src-branches@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 4PMTdd5pJnz3sDbj; Wed, 22 Feb 2023 21:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMTdd57Dmz3NX2; Wed, 22 Feb 2023 21:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100965; 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=ZO4NDZcNqX8FvuRCaSlYDIoiDve3x8qwxwb3a+EsU48=; b=ewJebeapPCF8A2d9iT7l/NEbRUhfd9yAxG7REh/J5IiQe2GKlBW5i9HVHEktJFI4caJeYh XFsMqx1e3uNKxdGU0j+iLtLOz0gZ2/Rd+mg4ujHQqSNB25OoYsctnRM6ytTqiOL9EBGv3f VmhoaO4iNnJx/LoQrtZOHX+gp+gKHp/Ol9Rv3oG+Q/0rhZra0BJAUT4WF0e2sc0Jt9c8Uo xkmRu8b9Q/vdVWd+LNiSfVqoluuZja5+d6KExFcnPAhNtByNFJDM342keyFic2vflmtEYG v0IIKCM1/E4tmyhdQxnG2qYOEPMuelN4iyJ0rjybWoIqTL670m3FldoyNitxbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100965; 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=ZO4NDZcNqX8FvuRCaSlYDIoiDve3x8qwxwb3a+EsU48=; b=JGOSP7fGF4bVRnHwdiAnaMCenk3OIYe1t3plXOi/iaShWvfESQoAKt6m6BZJ3IGuJoaphz mRkENEtn50E/ihvYIrc9e5wJhW4/B4YKACBj+3Pd+QT6AABsqZ1a/OsU8RyjsmgOPetb22 53FtIIjGCrEDoy7jw9uOMVmjyI65OmM2UpnZYpdnj5oEqfNk5+ob6Af+AgQQ6RpyN7c4Z3 QR34o729DfevVhKLFeVtfySEV0Rw6dDMX9SicPDlyWKDATawHXB2HEPrEofGAZwFl8LK// Uf4ixmRls4KVQfath7Ge6t3hqNNhvE3KjREkKQ3oHWbM76vjUKae17VOvvTL+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677100965; a=rsa-sha256; cv=none; b=V5B1JY3WF9et1LQ5S96YV8LLantO/3EbDydXYVepMlv6xw+O4C/BySYMr1ipFkCCpbG+/S ZWQ2GRhn+IBV4+mc1q1mbcRJw4DMxt497U3cQA4kODf7LEKddu09TfD/TlQ9oDBO4vWuyu nO2ZMNZcoAJCqQlGF1aWy+mc27tonZomNFfoI1jiCfTCqWZ7J+M0dqnODu6tWvH358/+mw /cuF1UN/40krPdZ77BmBvGcoA5OXF+e+Wz7IqnGQFpmsyziVTN69Ke3nGH/Mez1BbafDlm 0fKo9NcT8D57YUG0sa+9mIxE9TMLBzW3UdkZMCk/h17SvFM1N15ICYKavVjY4g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMTdd4D7vzGmg; Wed, 22 Feb 2023 21:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31MLMjvS014916; Wed, 22 Feb 2023 21:22:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MLMjtG014915; Wed, 22 Feb 2023 21:22:45 GMT (envelope-from git) Date: Wed, 22 Feb 2023 21:22:45 GMT Message-Id: <202302222122.31MLMjtG014915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: f9345b915b26 - stable/13 - .github: Switch to v3 of actions/checkout. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9345b915b26b2eb9393687e6d2617f320004a04 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f9345b915b26b2eb9393687e6d2617f320004a04 commit f9345b915b26b2eb9393687e6d2617f320004a04 Author: John Baldwin AuthorDate: 2022-12-21 00:27:17 +0000 Commit: John Baldwin CommitDate: 2023-02-22 20:44:23 +0000 .github: Switch to v3 of actions/checkout. GitHub is emitting a warning that v2 is deprecated due to using Node.js 12. Reported by: GitHub Reviewed by: arichardson, emaste Differential Revision: https://reviews.freebsd.org/D37769 (cherry picked from commit 54f3a781a2ff980034dfe13ff6323c96fc587f1b) --- .github/workflows/cross-bootstrap-tools.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-bootstrap-tools.yml b/.github/workflows/cross-bootstrap-tools.yml index 2d981b3fdff2..4ef496f4636b 100644 --- a/.github/workflows/cross-bootstrap-tools.yml +++ b/.github/workflows/cross-bootstrap-tools.yml @@ -34,7 +34,7 @@ jobs: - target_arch: aarch64 target: arm64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: install packages (Ubuntu) if: runner.os == 'Linux' run: | From nobody Wed Feb 22 21:22:46 2023 X-Original-To: dev-commits-src-branches@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 4PMTdf6bGVz3sDM4; Wed, 22 Feb 2023 21:22:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMTdf69vpz3NLn; Wed, 22 Feb 2023 21:22:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100966; 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=I9HvVail79//ul9amRAxHKomLTzNH4u6NVFwm8OEvRU=; b=IRYPIzTx9k7Sc5VTOT9NRsZqZ7Ns0P+ZMx+AHORdvD9rFurD9zZnF02XGrZXRm2DXnVmL9 HEddMCz72dq7HhGajLBvaJC0E1RAT0JCV81ZnZO7yKqADbSk1AqyHwwg4UiuZkI/EOr+H8 mQ5pSmhRdCXUh+oPUoC7XueDqZL8XFwsLhYI70iNvcrCHlF6Ls7+uriV/C8/M5t6mOvW+D MHEGa6XUao6btE405oJcEf/o1rJqnPV2MzKwmezVLaxzKeQlueDnZb4JhmPx8CATC9USEl OnuOSxjESKjTidvqwvsVwcUmLo/GMppzaQkPD6H/Jkm50oRl4iTGx9SH3A3xQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100966; 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=I9HvVail79//ul9amRAxHKomLTzNH4u6NVFwm8OEvRU=; b=yE1JQFEsDsSKwIzS54BgPXFyyjcz14oFk+qTym1YolyYPBCh1d/cRrsrPkmFhEBsEG8kVY JsGqhQsXTLvr8xecid67V0i6xbIfOsyZ4SykwYs61tdUVVgnMQ2vmD4KjvrY1oxC4of/lI XAzPaxJ09RkxdKDRFnqJfH20T5o5xUwFXqeksGFz4EdMrRZSkdUGFEp+D+vNrqbGeLXe/V PSurFvlv4d3tJurTVyfX29BSufzgMqQyBkrs1LlL+0BmXq+WKxRw10lBo8RHkgEqQBHa6G et6Ymhk+ScA5wj/XwGL8QOgB+fMoh8DssJT0pezRHQk6GltjjektIU4+vmrwCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677100966; a=rsa-sha256; cv=none; b=gXlBu19CGP90VEKazuS7ZuZse+c9IuJp9nAxAJW+UWsv686GtfYBsBjO4ZNs3OlQZPVxTd 4Sw5HkC7IjLJ1XZrojO+m1lGnNPo8F8Sox3QBJL5yg3GRJTpM1FDJVHmYGhNeNwZ/tGGaU F7zROwxRUoLlJtSleXs+JtJuTNOhPiFIoqM1sEuTJ7xQet/Rv6E5h3avT6AF5gJGDRtU6c UXQw2iyYGhrgDMxeISSg9U9xuULE9EilvseWobNSkUsha7VIwsmKKnzaLogHIPxVVvpGDU cHKptmmJ2QgQO7n+3LjLIjLAxoJ3IRMcR0B26xCYQ/KdfPjQImdRe/bCrsvC+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMTdf57wdzH7k; Wed, 22 Feb 2023 21:22:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31MLMkLT014935; Wed, 22 Feb 2023 21:22:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MLMkqJ014934; Wed, 22 Feb 2023 21:22:46 GMT (envelope-from git) Date: Wed, 22 Feb 2023 21:22:46 GMT Message-Id: <202302222122.31MLMkqJ014934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: fe67dc3e0797 - stable/13 - ccr,ccp: Fix argument order to sglist_append_vmpages. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fe67dc3e0797bacd009cd8e632e21ccfb83099d6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fe67dc3e0797bacd009cd8e632e21ccfb83099d6 commit fe67dc3e0797bacd009cd8e632e21ccfb83099d6 Author: John Baldwin AuthorDate: 2023-02-06 21:51:57 +0000 Commit: John Baldwin CommitDate: 2023-02-22 20:45:28 +0000 ccr,ccp: Fix argument order to sglist_append_vmpages. The offset comes before the byte count. Reported by: br Reviewed by: asomers, markj MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D38375 (cherry picked from commit 70efe1a2fe13642732e56c7f040fe63f62bc6a6b) --- sys/crypto/ccp/ccp.c | 2 +- sys/dev/cxgbe/crypto/t4_crypto.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/crypto/ccp/ccp.c b/sys/crypto/ccp/ccp.c index 2b059dcee2ca..6e224d5f1544 100644 --- a/sys/crypto/ccp/ccp.c +++ b/sys/crypto/ccp/ccp.c @@ -112,7 +112,7 @@ ccp_populate_sglist(struct sglist *sg, struct crypto_buffer *cb) break; case CRYPTO_BUF_VMPAGE: error = sglist_append_vmpages(sg, cb->cb_vm_page, - cb->cb_vm_page_len, cb->cb_vm_page_offset); + cb->cb_vm_page_offset, cb->cb_vm_page_len); break; default: error = EINVAL; diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 3d667ac5a405..a7d69d2d2bb0 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -295,7 +295,7 @@ ccr_populate_sglist(struct sglist *sg, struct crypto_buffer *cb) break; case CRYPTO_BUF_VMPAGE: error = sglist_append_vmpages(sg, cb->cb_vm_page, - cb->cb_vm_page_len, cb->cb_vm_page_offset); + cb->cb_vm_page_offset, cb->cb_vm_page_len); break; default: error = EINVAL; From nobody Wed Feb 22 21:22:47 2023 X-Original-To: dev-commits-src-branches@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 4PMTdh0LF9z3sDM6; Wed, 22 Feb 2023 21:22:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMTdg6yVHz3NlT; Wed, 22 Feb 2023 21:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100968; 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=4y1aGYHCZfLgW4Se0rs5u1Ipo16wbTBxhU7iP0r2Lwk=; b=VwJZ1XfnMuJrnzUa6fkDvcyrxWzVJBc2Yi1WomhmI0hfyC09V38BTAmVF18TTwDGj87Mpz Fthgx8GZv4NE78cBp4cAMyHu53siCM+wfSQRaGuc2vMlIaKz/lVLmf1yun7P8s0ucthgos AOUYo2/8vUsnViyJ0IdDyQdDUQDTkNefSnBXC3Tb9X1Q4w59PM7elr3ZEq+n4ygg/uazvm OyH8bC11mYwBOMRLyHEAUBjR1/fvTE5pq4vYPtZ8DmRqERlx8r9p/DGztEQWV1tPPmRFOl VG8ptrhUKj/lC1rcuR6zhw9J2UuTSTXK25belp9Yp23F9wtNsx0KoQOoKUx8oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100968; 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=4y1aGYHCZfLgW4Se0rs5u1Ipo16wbTBxhU7iP0r2Lwk=; b=RyJeCa6xsb4gaQbAaWZBX7lqnRyupyf8y9mNiuQ/NvzrxY4mEXUN400nsvyQYQ+5qVWP6r mq6kNnLtQfFpKvFhVZUjRT5aTKBZbe+wrcMn5AlH8nOmCTQljLd7X1uNkEDeXg759bD2Zz m0Asego8814c22hunb9la3LjBAvjeMU7b92PBTFszrSFBRl0GV9iPJ5Vyngdc7UN90AYfl tS8zVK6/5rUTk5TJn1sw8qzif+9rE4zBLXyOERJma8+zm+r+ljSxGn4YaNq7+9fmUZZnAF qkgToIBfoL/Mzww6mOpWTFir/VxXTS89eUiS4HewuNuYtf9KIV/LbtbswZeopQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677100968; a=rsa-sha256; cv=none; b=d+/X9tKzFcqHukuTLsXQ7TT2p3qhz9GIbKGsQQcjwJ6eHXoptRNioWdqGJvnGqcTL/yZcX uufpBR/dzaRl+/ko0ZiIxe6y+UXB38kCVAijOycJoryDpZqIQJPnJyG64GiF6V45x4645e tZ7TaQ8IKrDGxhdQ/+EqOxJEMNxgjDn1cp2fm6UkEdiWxldKwDXBUBCuxtVU06wPPSVjAr V7hEsfyHbZMwDbEJlSHEYGKGqHLPqSc2T77zwGxf8CFyF/awf2USQB3bDXH4Wcacrr+vj0 otCkZsdD6Wz98npCrYY1jyJaRFtIt1qUwdKbxxedsR9IaqgxgTegevPBgh3zMg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMTdg631ZzGxj; Wed, 22 Feb 2023 21:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31MLMlaF014960; Wed, 22 Feb 2023 21:22:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MLMlvc014959; Wed, 22 Feb 2023 21:22:47 GMT (envelope-from git) Date: Wed, 22 Feb 2023 21:22:47 GMT Message-Id: <202302222122.31MLMlvc014959@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: ff5b04fddebd - stable/13 - .github: Restrict permissions on cross-build jobs. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ff5b04fddebd129be42a60e7ee8666c9286db57c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ff5b04fddebd129be42a60e7ee8666c9286db57c commit ff5b04fddebd129be42a60e7ee8666c9286db57c Author: Alex AuthorDate: 2023-02-09 20:12:17 +0000 Commit: John Baldwin CommitDate: 2023-02-22 20:46:09 +0000 .github: Restrict permissions on cross-build jobs. (cherry picked from commit aca7ff471acffb59f0f9e2cc4de6363872444fcc) --- .github/workflows/cross-bootstrap-tools.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cross-bootstrap-tools.yml b/.github/workflows/cross-bootstrap-tools.yml index 4ef496f4636b..c6df31e4fbee 100644 --- a/.github/workflows/cross-bootstrap-tools.yml +++ b/.github/workflows/cross-bootstrap-tools.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: build: name: ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) From nobody Wed Feb 22 21:22:48 2023 X-Original-To: dev-commits-src-branches@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 4PMTdj3JNxz3sD8l; Wed, 22 Feb 2023 21:22:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMTdj0lNrz3Ndv; Wed, 22 Feb 2023 21:22:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100969; 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=vQ1D2NB0OAvWH5VCg6fejaYz4UdvsYaKlQmuSUO3cWM=; b=j3DAHd5U0CCx/FWx7FBkcc3rTYP+LeLLG9sYy/p+IHsQm8muGIzBbU8WzJGCHWaohbqoji wnzLzexPqaAQ7aS8pRt6zH6hqFfCiPnVU8SL4wjmjZ0NdyNkJyYGD3RW54F8vlk43bMfjl hGcAUlwf7CdvM6y5QnMdRL7S92RDXRJWeJ/nV/OBE1Uosm1UrlDZQds3NhI0TafsYWWGF9 648QHVXse+WFaDJnz3hataPnL+Qy3h+WUv9QHMRqqNo3X/xSAlceE/wXCzV9F0bg/XNUSb 6uxQjyVVmGB9fYIQnbrO+4gZWl1GKhZIIc55YhJhDtFrdgXXoLDSU//OEhJnQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677100969; 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=vQ1D2NB0OAvWH5VCg6fejaYz4UdvsYaKlQmuSUO3cWM=; b=wmChdi2xtvfh/qrgQ+LLDQQhQ/ZaJbNzfH5TFZ6RQ1+RN3vt5QIzLZNfeJKjtN0ur2a0Li pngtQlu2HKkj18q3AshDiPQSV22Ib+XlKugiuWUF/uX4JWDDY70rxRJEKyhSHCbu6XGpjd BEGzpfKNxkJWvS1jJ0U+awl/tVDeuU4qFXvV/fgzS/pMmjZn1HCPUKYEOdNv5Tt29XxmnX PjvMwieB18CH25uSuih4yxMjDZiwwagzRjZIv4GnhwODXGaDis9z3dRxvwDqeB0jc6O781 0NELm2ssGmIMtb6h8i0MxMw9Vl8QddOuNfl/voT1xnf+ngEOSpVHwW8obdJrfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677100969; a=rsa-sha256; cv=none; b=IBMO44P8qZgYZxFJGTiJnexFEBMBWHnkI9Irybi8M9AW13eJ3zF9R1NjUUp9cgkMKeTNfF 8qPvki3GUBUZrLpz1QAy+kSJby9IsjJHhROHkuWUGebmqkQdX8wvPR1J+ssNhtCYpsR1R8 N9hjKelDFDE1Wke3NorAlzt0f6MPDKS/oB9Y24CtjLgPCg15mtmmxlaH6/0zJCxEmOuBLg SeE7JGYaE2saa84pIHxKjKhHgz9f7m376O1cc3k+WUoWS8bdFZOub1Yj/yiVtVuxpRgDLN 154j/dGgy+cVkBCzZIQTvJmv0oN6HVxKmGdPmDEY7EgqLmC8ArZDB0pVEztrHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMTdh6yqtzH8J; Wed, 22 Feb 2023 21:22:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31MLMmhn014981; Wed, 22 Feb 2023 21:22:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MLMmRI014980; Wed, 22 Feb 2023 21:22:48 GMT (envelope-from git) Date: Wed, 22 Feb 2023 21:22:48 GMT Message-Id: <202302222122.31MLMmRI014980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: bc68c55166ad - stable/13 - .github: Attempt to fix and increase robustness of macOS action List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bc68c55166ada973141542c9c719f562475cb80c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bc68c55166ada973141542c9c719f562475cb80c commit bc68c55166ada973141542c9c719f562475cb80c Author: Jessica Clarke AuthorDate: 2022-06-30 20:03:26 +0000 Commit: John Baldwin CommitDate: 2023-02-22 20:47:12 +0000 .github: Attempt to fix and increase robustness of macOS action Homebrew has added LLVM 14 and made that the default version, but GitHub continues to install LLVM 13 for now, so it ends up only accessible via the versioned name and not the unversioned one. We also add an explicit installation of llvm@13 so that, if GitHub updates the image to using LLVM 14, the action continues to work, albeit slightly more slowly. This also ensures the compiler label remains correct rather than outdated, as has occurred in the past, and that we don't get new versions of LLVM before we're ready for them, which is especially relevant for stable branches. This all mirrors how the Ubuntu jobs are configured. (cherry picked from commit 22f731486e80fdbf679712b2a99605ba97a50264) --- .github/workflows/cross-bootstrap-tools.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cross-bootstrap-tools.yml b/.github/workflows/cross-bootstrap-tools.yml index c6df31e4fbee..9630470d0420 100644 --- a/.github/workflows/cross-bootstrap-tools.yml +++ b/.github/workflows/cross-bootstrap-tools.yml @@ -30,8 +30,8 @@ jobs: pkgs: bmake libarchive-dev clang-14 lld-14 - os: macos-latest compiler: clang-13 - cross-bindir: /usr/local/opt/llvm/bin - pkgs: bmake libarchive + cross-bindir: /usr/local/opt/llvm@13/bin + pkgs: bmake libarchive llvm@13 - target_arch: amd64 target: amd64 - target_arch: aarch64 From nobody Thu Feb 23 00:23:20 2023 X-Original-To: dev-commits-src-branches@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 4PMYf04pljz3sfdk; Thu, 23 Feb 2023 00:23:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMYf04Jmdz3ww2; Thu, 23 Feb 2023 00:23:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677111800; 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=Dzcf66wgy6zIR0tIOdQRZBEC6VXvSBOI+RxfXEnYSz4=; b=GlpTiD+7a4h7GsKOPMp4nsFYeDydCuLcpJmC++n3z6rgNuiYM1w/9RTSVttKs2o1G3WyuC 0JFicviBZKgUaSYKBz8RPDukB4fc6dut+XIrZWyhbp61/kIbOY2LURZMibNmIp9MY+QoZ6 vBSq2H4b7ZyuBXy4PrcB/EvuK8Io5O9pRqVjytW/VasuEj36FRc+sl7wHjpmeYqVYgWegG sEahre8he07eWiE7ftsFmDvhB/pXf1OOy/qpSg+rHoRP70Ss9GMA0fibL6ubGygb4wHYuf z3XsvA3cdkp9wkebXBti6UMizJd5cVFWMvCKble0S82caeOp+BaWchLnK4PJ8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677111800; 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=Dzcf66wgy6zIR0tIOdQRZBEC6VXvSBOI+RxfXEnYSz4=; b=WCsa/VXZG+D3QsBP136b0pWZKSCWl7YJO+4+TybXKsA5CXtZ7uoYtvipBLj+FWAByN3j2z 9PUqHte7JPmChu8RNb7blVp3ASv1mYlKRdharLtZrs2cFDJrZAp1On6J4JbKQrQiFuVpT0 CKOf5EopZ7nUF/ACfSAUsahxMW4F80RB+Csfp3xSJJkm6ftvvPuKnxbrmqGZ8yLZWJ4Pzq YrvW36IxBW8e9YYDbwCd5bVFj8kObRJNn1ttoaj8DMxULQRM8cQjT22IOdO0O1f5nhDqgU PVMEoyNvdgvtL76I45vMDfz+O2apTSx/BLUSUy8AqFru57rQxDcG1M5+zjuIdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677111800; a=rsa-sha256; cv=none; b=gm6bqg84XMnZkFf47YDxEKpfBKW1DNqMEth0wYVqKSFRdNIMV/9dob9lQz54/F7j9o+yHa GvUxWRD4bkfEiI40DSzbyMMqGwQGf45nE8eV7tkAolQWw9aC32zulOUjgUHymr1Us6VVgL J1u4udSZeOh0iYCEtCz95E/PKMVFbiN0kuvhsYFJi9sspP0NQx0nAM4+JRKgDULU8uZodV Wavvre2CNz/S69yHxctv19dRuvqYe2kqHzarzxA4Uyu2nUBNRAJwGFCa/uvryYLuuk4/RC 2IOCnPHdgipKXJXt1rHyA39yfx/a3u7QuUpP5cIL3SnN8UqCcx8hNyNxU0Dovg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMYf03MNbzMWQ; Thu, 23 Feb 2023 00:23:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N0NKWs071346; Thu, 23 Feb 2023 00:23:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N0NK7i071345; Thu, 23 Feb 2023 00:23:20 GMT (envelope-from git) Date: Thu, 23 Feb 2023 00:23:20 GMT Message-Id: <202302230023.31N0NK7i071345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 5e8a9a8193f9 - stable/13 - e1000: Remove redundant disable_ulp for ich8lan List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5e8a9a8193f99bb0266f45546f1dbb6349c797db Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=5e8a9a8193f99bb0266f45546f1dbb6349c797db commit 5e8a9a8193f99bb0266f45546f1dbb6349c797db Author: Kevin Bowling AuthorDate: 2023-02-08 23:17:03 +0000 Commit: Kevin Bowling CommitDate: 2023-02-23 00:23:06 +0000 e1000: Remove redundant disable_ulp for ich8lan This call only makes sense for ich8lan, and the shared code does it in e1000_setup_init_funcs() above this deletion. Obtained from: DPDK Sponsored by: BBOX.io Pull Request: https://github.com/freebsd/freebsd-src/pull/539 (cherry picked from commit d36fbdb08ff567393a698aaf16f726275901ec96) --- sys/dev/e1000/e1000_ich8lan.c | 10 +++++----- sys/dev/e1000/if_em.c | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 3f3e2307f83f..9c640e7b9667 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -72,6 +72,7 @@ #include "e1000_api.h" +static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state); static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw); static void e1000_release_swflag_ich8lan(struct e1000_hw *hw); static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw); @@ -330,7 +331,9 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) * so forcibly disable it. */ hw->dev_spec.ich8lan.ulp_state = e1000_ulp_state_unknown; - e1000_disable_ulp_lpt_lp(hw, TRUE); + ret_val = e1000_disable_ulp_lpt_lp(hw, true); + if (ret_val) + ERROR_REPORT("Failed to disable ULP\n"); ret_val = hw->phy.ops.acquire(hw); if (ret_val) { @@ -1290,14 +1293,12 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) if (!to_sx) { int i = 0; - /* Poll up to 5 seconds for Cable Disconnected indication */ while (!(E1000_READ_REG(hw, E1000_FEXT) & E1000_FEXT_PHY_CABLE_DISCONNECTED)) { /* Bail if link is re-acquired */ if (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU) return -E1000_ERR_PHY; - if (i++ == 100) break; @@ -1310,7 +1311,6 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) if (!(E1000_READ_REG(hw, E1000_FEXT) & E1000_FEXT_PHY_CABLE_DISCONNECTED)) return 0; - } ret_val = hw->phy.ops.acquire(hw); @@ -4318,7 +4318,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) (u8)(data >> 8)); if (ret_val) break; - } + } /* Don't bother writing the segment valid bits if sector * programming failed. diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 408b76c6876f..25f0c533094a 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1105,9 +1105,6 @@ em_if_attach_pre(if_ctx_t ctx) em_print_fw_version(sc); - /* Disable ULP support */ - e1000_disable_ulp_lpt_lp(hw, true); - /* * Get Wake-on-Lan and Management info for later use */ From nobody Thu Feb 23 00:24:01 2023 X-Original-To: dev-commits-src-branches@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 4PMYfn4097z3sfkQ; Thu, 23 Feb 2023 00:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMYfn3RWmz3x7y; Thu, 23 Feb 2023 00:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677111841; 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=aYo/wpeIOLgCGcAE/P5bO3E+8eF6gCDd8oYexdZu3ZE=; b=t4yN7Lnm/LHKujl7t3YpjlTjk8RkTEcwFkWm7dKR1DnuX6a0chknKpWhx97U1dJwkG+9Ue oWB0H278goyqVqDHo2OKW0IOX6/WIZOeeHo2L9JzDMG71p6lOo7eZE/GkgT5Dcseh4H/+a VC8BKzZG/UwSBHxg9jRUF3tJJpcDfCp/bLWPZoaDBKGBNf4thcYef43HuaPkaBSyJ3QyIf 7DhGRYvlNqPEPsIugNEYJcddcapweWzULKRw2yQvxNAEHM40GNrgkCfKNIlaDfcnBUvPv/ 4fFC4nCmr4ocHZRsCKNtJ7MHrBOBSbiKwTJAKHt0OO9qA0XKvkjiOyM9swRhow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677111841; 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=aYo/wpeIOLgCGcAE/P5bO3E+8eF6gCDd8oYexdZu3ZE=; b=VC4z7VC+sRTUE62m5AKEH7ygKR+PGgOC9nHnzWAj+0HFA4IWEjG9cwiRZZ+86iQH/RlpU1 0wld6s44WI7/EqAtQvFQHtJwT6LO+5eXKZZ2iR+oed3e/d7mFwwimwjZiqQcWT06IORW+m oVLGNp/Arg/fdiA1BJT5jBq8tLqYHaCjJYiSrStlgBUTE3zdC23pjKXI4NZ9KQ2PDRo9rh A5z9hwarhI86pIl0HJW75EMh63AhOAqY8JWZRol5NAH3Fz8USusBMwiSgiyCF34yWaasYh OPhppX0YPu/uzz8Q0R4nt5wVZTWftmsdvIFhmF9wNdvegmSsrVFWa7VRUzXqfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677111841; a=rsa-sha256; cv=none; b=gzOnh1ew+znQxSaoHNYIdRg1SjbTTSXezAzUEARNvGyyApwvK2A2UxLLz1D8pHe8W3MRfn 44i3YdRRoT5h1i/Dlhw8a+4KzXVZe6PbyIvJ6qsi2sBEjqoFriY4u4mrmCeRGr68AlskVJ uNQLHlUuqoaFl4QLnJjvQbdsfeSagEo+v/ITSoNy6kfObqntUQM4Rofm3+sjFscv6LeiNB UuNLWq1beJoMnJxMCoqAP4Yv83lJeXp6D3hRk/LEZxZUVbW+n+7jIH/heNKECuHhYVSdxJ 7pwST6WQrW0BiqlkVUV6cEqf+UA1LThpVietSxQ97wy8W9XkHVO9iheBZ8XfXg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMYfn2VwdzM8b; Thu, 23 Feb 2023 00:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N0O1EK071527; Thu, 23 Feb 2023 00:24:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N0O1S8071526; Thu, 23 Feb 2023 00:24:01 GMT (envelope-from git) Date: Thu, 23 Feb 2023 00:24:01 GMT Message-Id: <202302230024.31N0O1S8071526@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 15d2f480b604 - stable/12 - e1000: Remove redundant disable_ulp for ich8lan List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/12 X-Git-Reftype: branch X-Git-Commit: 15d2f480b604b4e2b7ca2cf51c7244d4ffa148e3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=15d2f480b604b4e2b7ca2cf51c7244d4ffa148e3 commit 15d2f480b604b4e2b7ca2cf51c7244d4ffa148e3 Author: Kevin Bowling AuthorDate: 2023-02-08 23:17:03 +0000 Commit: Kevin Bowling CommitDate: 2023-02-23 00:23:46 +0000 e1000: Remove redundant disable_ulp for ich8lan This call only makes sense for ich8lan, and the shared code does it in e1000_setup_init_funcs() above this deletion. Obtained from: DPDK Sponsored by: BBOX.io Pull Request: https://github.com/freebsd/freebsd-src/pull/539 (cherry picked from commit d36fbdb08ff567393a698aaf16f726275901ec96) --- sys/dev/e1000/e1000_ich8lan.c | 10 +++++----- sys/dev/e1000/if_em.c | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 4dec3e22c3a9..b7c30555b55c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -72,6 +72,7 @@ #include "e1000_api.h" +static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state); static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw); static void e1000_release_swflag_ich8lan(struct e1000_hw *hw); static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw); @@ -330,7 +331,9 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) * so forcibly disable it. */ hw->dev_spec.ich8lan.ulp_state = e1000_ulp_state_unknown; - e1000_disable_ulp_lpt_lp(hw, TRUE); + ret_val = e1000_disable_ulp_lpt_lp(hw, true); + if (ret_val) + ERROR_REPORT("Failed to disable ULP\n"); ret_val = hw->phy.ops.acquire(hw); if (ret_val) { @@ -1290,14 +1293,12 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) if (!to_sx) { int i = 0; - /* Poll up to 5 seconds for Cable Disconnected indication */ while (!(E1000_READ_REG(hw, E1000_FEXT) & E1000_FEXT_PHY_CABLE_DISCONNECTED)) { /* Bail if link is re-acquired */ if (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU) return -E1000_ERR_PHY; - if (i++ == 100) break; @@ -1310,7 +1311,6 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) if (!(E1000_READ_REG(hw, E1000_FEXT) & E1000_FEXT_PHY_CABLE_DISCONNECTED)) return 0; - } ret_val = hw->phy.ops.acquire(hw); @@ -4318,7 +4318,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) (u8)(data >> 8)); if (ret_val) break; - } + } /* Don't bother writing the segment valid bits if sector * programming failed. diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 869ce4fb4cf4..c4a4f54cb80d 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1106,9 +1106,6 @@ em_if_attach_pre(if_ctx_t ctx) em_print_fw_version(sc); - /* Disable ULP support */ - e1000_disable_ulp_lpt_lp(hw, true); - /* * Get Wake-on-Lan and Management info for later use */ From nobody Thu Feb 23 00:26:55 2023 X-Original-To: dev-commits-src-branches@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 4PMYk807nzz3sgFg; Thu, 23 Feb 2023 00:26:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMYk76g6Fz3xbd; Thu, 23 Feb 2023 00:26:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677112015; 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=mg3ACBeHYRrktW9oghw2FrxmNcsjlhukCixWcw1WY28=; b=T02m+4z1bMnm3Dz/jMlptoknMmoJSs0qBQ1kchlhFZ26PESrMpzXWgQF0pWNS40UBiYFXH yzs4nGY8pTPDHO6hntW24zzcx+qihe//FGkvUegahJkMo3i/EGqwnIdaMteB1j8SsCXNJ7 0VoqAoPMYZx9/SqDCksQtgFPCesSK+H0dpZ68MG5lpFq7aHNOADWjTvh1pbiMzQf6qjDUw IrVYNyZ0NR/8Rg4bKHb51M6fFsPVY+KYi41RVz5C3ov+SQSEJfkWXaazbRq3JfDsQQRRqX dGrDDt+ucibku0UHr3M+ffl7lQcoP0Oveh7/tVR+SO66rBgshWyGgX0QHVCeXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677112015; 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=mg3ACBeHYRrktW9oghw2FrxmNcsjlhukCixWcw1WY28=; b=vXlaF8+DWzZnDjVWyi9vuN+xmv2d94o83ZG7GUoe3VQJqJxPPQ8mWh5t3WCkNc34TnKyjM MZG3QTM5sEg9rfJ+wgYIpZd8XQU/ftoe/bkYJBZocXBe5I8TEYtkUxr5c2w+XsNCO62ilo UMae/TzgKozx2clW+3Ijn+ikRkpP1oP0Em3p+ZLM/OizxnvmpltnnkozvyXbNm9xUpp9ST +L9zUwAnUqDVJBdByLQ1io17X/wwBKOCYKuxId1nycDUU+J1TCrTedxlcS1PIc729mNr3r EendJ+ZJZVNMRbOEryvwJSefNexCMs8k7atflqf60EzKO5wPaSk5hgBFh8w46Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677112015; a=rsa-sha256; cv=none; b=Hj01kUEO0u74+KoxpUem/9PQxvHNmZmA5G8I0KQP1wchmP+q5Z51Yb9+wTzFlGwZJiatyn kci6p0tsRDjkKNIZ7vmjwiw6fheuoPnopuGiQqxicC1mJ1v2QPpfPLIEu3dwtew7Krip35 NxNHgZU0Fw8OndwqdtYARHZ+2Vk/AbndSjtJjCc7w5lC/foZj1vDZ4esfg0/FZ6NbRkris wihuy8erGxJuEHmb9v2ACaI9ZHd2WituBwa+LQ0RCzHTk2RD1FRI0R+DNrcgjKgwNcFUDW oRqZ1GQEx15wQVdvUllsbVQgYLe+2ozIpTSyPAjUk9yQFYtutixH9Is/SVAeFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMYk75gTGzMVB; Thu, 23 Feb 2023 00:26:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N0Qtcp071976; Thu, 23 Feb 2023 00:26:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N0QtPX071975; Thu, 23 Feb 2023 00:26:55 GMT (envelope-from git) Date: Thu, 23 Feb 2023 00:26:55 GMT Message-Id: <202302230026.31N0QtPX071975@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 25b788e49782 - stable/13 - e1000: Add support for future client platforms List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 25b788e4978255dad726ff3d264473ce01527f09 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=25b788e4978255dad726ff3d264473ce01527f09 commit 25b788e4978255dad726ff3d264473ce01527f09 Author: Kevin Bowling AuthorDate: 2023-02-09 01:14:41 +0000 Commit: Kevin Bowling CommitDate: 2023-02-23 00:26:05 +0000 e1000: Add support for future client platforms Sponsored by: BBOX.io (cherry picked from commit 905ae5881bdc1b9742e08d660d787204c08d6022) --- sys/dev/e1000/e1000_api.c | 11 +++++++++++ sys/dev/e1000/e1000_hw.h | 17 +++++++++++++++++ sys/dev/e1000/e1000_ich8lan.c | 7 +++++++ sys/dev/e1000/if_em.c | 19 +++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index 5c778a48bba0..19ba4f1cf377 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -347,6 +347,16 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_PCH_MTP_I219_V19: mac->type = e1000_pch_mtp; break; + case E1000_DEV_ID_PCH_ARL_I219_LM24: + case E1000_DEV_ID_PCH_ARL_I219_V24: + case E1000_DEV_ID_PCH_PTP_I219_LM25: + case E1000_DEV_ID_PCH_PTP_I219_V25: + case E1000_DEV_ID_PCH_PTP_I219_LM26: + case E1000_DEV_ID_PCH_PTP_I219_V26: + case E1000_DEV_ID_PCH_PTP_I219_LM27: + case E1000_DEV_ID_PCH_PTP_I219_V27: + mac->type = e1000_pch_ptp; + break; case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: @@ -503,6 +513,7 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: e1000_init_function_pointers_ich8lan(hw); break; case e1000_82575: diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index 6ee252e147a4..463bd6bd8a5b 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -175,6 +175,22 @@ struct e1000_hw; #define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B #define E1000_DEV_ID_PCH_MTP_I219_LM19 0x550C #define E1000_DEV_ID_PCH_MTP_I219_V19 0x550D +#define E1000_DEV_ID_PCH_LNL_I219_LM20 0x550E +#define E1000_DEV_ID_PCH_LNL_I219_V20 0x550F +#define E1000_DEV_ID_PCH_LNL_I219_LM21 0x5510 +#define E1000_DEV_ID_PCH_LNL_I219_V21 0x5511 +#define E1000_DEV_ID_PCH_RPL_I219_LM22 0x0DC7 +#define E1000_DEV_ID_PCH_RPL_I219_V22 0x0DC8 +#define E1000_DEV_ID_PCH_RPL_I219_LM23 0x0DC5 +#define E1000_DEV_ID_PCH_RPL_I219_V23 0x0DC6 +#define E1000_DEV_ID_PCH_ARL_I219_LM24 0x57A0 +#define E1000_DEV_ID_PCH_ARL_I219_V24 0x57A1 +#define E1000_DEV_ID_PCH_PTP_I219_LM25 0x57B3 +#define E1000_DEV_ID_PCH_PTP_I219_V25 0x57B4 +#define E1000_DEV_ID_PCH_PTP_I219_LM26 0x57B5 +#define E1000_DEV_ID_PCH_PTP_I219_V26 0x57B6 +#define E1000_DEV_ID_PCH_PTP_I219_LM27 0x57B7 +#define E1000_DEV_ID_PCH_PTP_I219_V27 0x57B8 #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 @@ -266,6 +282,7 @@ enum e1000_mac_type { e1000_pch_tgp, e1000_pch_adp, e1000_pch_mtp, + e1000_pch_ptp, e1000_82575, e1000_82576, e1000_82580, diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 9c640e7b9667..f74ef5f9c7b3 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -352,6 +352,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: if (e1000_phy_is_accessible_pchlan(hw)) break; @@ -504,6 +505,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: /* In case the PHY needs to be in mdio slow mode, * set slow mode and try to get the PHY id again. */ @@ -806,6 +808,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; @@ -1851,6 +1854,7 @@ void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: hw->phy.ops.init_params = e1000_init_phy_params_pchlan; break; default: @@ -2310,6 +2314,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; break; default: @@ -3435,6 +3440,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: bank1_offset = nvm->flash_bank_size; act_offset = E1000_ICH_NVM_SIG_WORD; @@ -4409,6 +4415,7 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: word = NVM_COMPAT; valid_csum_mask = NVM_COMPAT_VALID_CSUM; break; diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 25f0c533094a..527789622169 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -195,6 +195,22 @@ static pci_vendor_info_t em_vendor_info_array[] = PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V18, "Intel(R) I219-V MTP(18)"), PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_LM19, "Intel(R) I219-LM MTP(19)"), PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V19, "Intel(R) I219-V MTP(19)"), + PVID(0x8086, E1000_DEV_ID_PCH_LNL_I219_LM20, "Intel(R) I219-LM LNL(20)"), + PVID(0x8086, E1000_DEV_ID_PCH_LNL_I219_V20, "Intel(R) I219-V LNL(20)"), + PVID(0x8086, E1000_DEV_ID_PCH_LNL_I219_LM21, "Intel(R) I219-LM LNL(21)"), + PVID(0x8086, E1000_DEV_ID_PCH_LNL_I219_V21, "Intel(R) I219-V LNL(21)"), + PVID(0x8086, E1000_DEV_ID_PCH_RPL_I219_LM22, "Intel(R) I219-LM RPL(22)"), + PVID(0x8086, E1000_DEV_ID_PCH_RPL_I219_V22, "Intel(R) I219-V RPL(22)"), + PVID(0x8086, E1000_DEV_ID_PCH_RPL_I219_LM23, "Intel(R) I219-LM RPL(23)"), + PVID(0x8086, E1000_DEV_ID_PCH_RPL_I219_V23, "Intel(R) I219-V RPL(23)"), + PVID(0x8086, E1000_DEV_ID_PCH_ARL_I219_LM24, "Intel(R) I219-LM ARL(24)"), + PVID(0x8086, E1000_DEV_ID_PCH_ARL_I219_V24, "Intel(R) I219-V ARL(24)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_LM25, "Intel(R) I219-LM PTP(25)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_V25, "Intel(R) I219-V PTP(25)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_LM26, "Intel(R) I219-LM PTP(26)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_V26, "Intel(R) I219-V PTP(26)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_LM27, "Intel(R) I219-LM PTP(27)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_V27, "Intel(R) I219-V PTP(27)"), /* required last entry */ PVID_END }; @@ -1250,6 +1266,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: case e1000_82574: case e1000_82583: case e1000_80003es2lan: @@ -2649,6 +2666,7 @@ em_reset(if_ctx_t ctx) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: pba = E1000_PBA_26K; break; case e1000_82575: @@ -2762,6 +2780,7 @@ em_reset(if_ctx_t ctx) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; From nobody Thu Feb 23 00:29:02 2023 X-Original-To: dev-commits-src-branches@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 4PMYmZ33k5z3sgLh; Thu, 23 Feb 2023 00:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMYmZ2KSJz3xd9; Thu, 23 Feb 2023 00:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677112142; 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=Ky1iewNtHRFc/sA3GkZP+S0Ji5ZUdpVmOUxnzRtmKCI=; b=KfI6mlIvi1ptfRMz6Kll44Zg+WlrykcmLfvvAvGMHsJHIMJFhETz7HUFKgUiI9gROxd/Ho 1RDbYlRu7T/bJIZRT+g0p7fTV2cLgBYEsGZlLqjZswRuSyhA26NZ1fd+8iZur5VlqutTHU +Ku0pmbZHCvOQ28g8I4XgTpAkFl+hfhQKJVGmak2oDhyG9LKqEGhLpgmCKulh4jMZw8g6H 6IP3hAimtbJ8JtAINYOdeivJ/1uRocbyOENQewOT+isE6fKYuFgvYGJky7Uemir8YP7Gxp cnWOL+a75a+9VR1i67ys0O9LzAQqrsLkhBe6UnCbuvqj9SWadQACyYrz4DxSdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677112142; 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=Ky1iewNtHRFc/sA3GkZP+S0Ji5ZUdpVmOUxnzRtmKCI=; b=Nwh3biRlI3dmRHCyzBFOKGtwFPRThhRP5I70MhSkUtnfn16ryvwaooc+yOILQx1SRYVNmU 947BOeKcanItxMxi3APIuFFA5XnDGsedOfzygHHezP9ThD6QHCYgpqikgSyskTcXVdVRL9 x7Dsiy0Mb2D5FobkfP6vf2KUYq2CfBNMz4uCp9AyhKFWeRy+tT1pvsoXOuoF815f4nUgpp GCKQPlHNqfXXSv1P4eH6Z1wxP1T/QHzHPZwDNN5Bd3wjFVnF7MuRmIzJZrGJtEBrcNHtHr Kh1oK35UZJXO+LIVI+D1WeR6PhRAyMtC3zIVHOxPl0UpiG60QL5yclrdRfffZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677112142; a=rsa-sha256; cv=none; b=AqonGqncJLcU0BVKCXqd4+L3QSS0jsY4opH8REf7fT1zRb7gwPIdWWn439+nc7SgIYQYgt 1rxCoAeegPGccG1jAzV9gdUfjCtmTF5BlrsH3AuO1d1PQjXEk6ZJlNaKPcL55uooGoTZfb yzKu8teOK4LIDVXhKOxkyiqrDl20tApFwmm7w/50uSYZqioC9d0iKUQ0Lfpyj+D5rK+/5i NSQJnuFWvg3+kZzUXK+F4nzHf3mi4LV84iXytRNs6MsMGHDSWn19xL1AcRu3Gsz8buHOs5 8y7ecFQuh5uw46aCmnLHdJ7s4f1UDb/l3rvx6voFsrVF8bQvdln+CaTHWnqing== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMYmZ1QjvzLtw; Thu, 23 Feb 2023 00:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N0T2YM072325; Thu, 23 Feb 2023 00:29:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N0T2ex072324; Thu, 23 Feb 2023 00:29:02 GMT (envelope-from git) Date: Thu, 23 Feb 2023 00:29:02 GMT Message-Id: <202302230029.31N0T2ex072324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 0aacd7084394 - stable/12 - e1000: Add support for future client platforms List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/12 X-Git-Reftype: branch X-Git-Commit: 0aacd70843949f793a8cc9cbba76472137644032 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=0aacd70843949f793a8cc9cbba76472137644032 commit 0aacd70843949f793a8cc9cbba76472137644032 Author: Kevin Bowling AuthorDate: 2023-02-09 01:14:41 +0000 Commit: Kevin Bowling CommitDate: 2023-02-23 00:28:49 +0000 e1000: Add support for future client platforms Sponsored by: BBOX.io (cherry picked from commit 905ae5881bdc1b9742e08d660d787204c08d6022) --- sys/dev/e1000/e1000_api.c | 11 +++++++++++ sys/dev/e1000/e1000_hw.h | 17 +++++++++++++++++ sys/dev/e1000/e1000_ich8lan.c | 7 +++++++ sys/dev/e1000/if_em.c | 19 +++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index 5c778a48bba0..19ba4f1cf377 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -347,6 +347,16 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_PCH_MTP_I219_V19: mac->type = e1000_pch_mtp; break; + case E1000_DEV_ID_PCH_ARL_I219_LM24: + case E1000_DEV_ID_PCH_ARL_I219_V24: + case E1000_DEV_ID_PCH_PTP_I219_LM25: + case E1000_DEV_ID_PCH_PTP_I219_V25: + case E1000_DEV_ID_PCH_PTP_I219_LM26: + case E1000_DEV_ID_PCH_PTP_I219_V26: + case E1000_DEV_ID_PCH_PTP_I219_LM27: + case E1000_DEV_ID_PCH_PTP_I219_V27: + mac->type = e1000_pch_ptp; + break; case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: @@ -503,6 +513,7 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: e1000_init_function_pointers_ich8lan(hw); break; case e1000_82575: diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index dc46c590d7c0..2baf6b99a33c 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -175,6 +175,22 @@ struct e1000_hw; #define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B #define E1000_DEV_ID_PCH_MTP_I219_LM19 0x550C #define E1000_DEV_ID_PCH_MTP_I219_V19 0x550D +#define E1000_DEV_ID_PCH_LNL_I219_LM20 0x550E +#define E1000_DEV_ID_PCH_LNL_I219_V20 0x550F +#define E1000_DEV_ID_PCH_LNL_I219_LM21 0x5510 +#define E1000_DEV_ID_PCH_LNL_I219_V21 0x5511 +#define E1000_DEV_ID_PCH_RPL_I219_LM22 0x0DC7 +#define E1000_DEV_ID_PCH_RPL_I219_V22 0x0DC8 +#define E1000_DEV_ID_PCH_RPL_I219_LM23 0x0DC5 +#define E1000_DEV_ID_PCH_RPL_I219_V23 0x0DC6 +#define E1000_DEV_ID_PCH_ARL_I219_LM24 0x57A0 +#define E1000_DEV_ID_PCH_ARL_I219_V24 0x57A1 +#define E1000_DEV_ID_PCH_PTP_I219_LM25 0x57B3 +#define E1000_DEV_ID_PCH_PTP_I219_V25 0x57B4 +#define E1000_DEV_ID_PCH_PTP_I219_LM26 0x57B5 +#define E1000_DEV_ID_PCH_PTP_I219_V26 0x57B6 +#define E1000_DEV_ID_PCH_PTP_I219_LM27 0x57B7 +#define E1000_DEV_ID_PCH_PTP_I219_V27 0x57B8 #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 @@ -266,6 +282,7 @@ enum e1000_mac_type { e1000_pch_tgp, e1000_pch_adp, e1000_pch_mtp, + e1000_pch_ptp, e1000_82575, e1000_82576, e1000_82580, diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index b7c30555b55c..7d079ee5d1b3 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -352,6 +352,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: if (e1000_phy_is_accessible_pchlan(hw)) break; @@ -504,6 +505,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: /* In case the PHY needs to be in mdio slow mode, * set slow mode and try to get the PHY id again. */ @@ -806,6 +808,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; @@ -1851,6 +1854,7 @@ void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: hw->phy.ops.init_params = e1000_init_phy_params_pchlan; break; default: @@ -2310,6 +2314,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; break; default: @@ -3435,6 +3440,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: bank1_offset = nvm->flash_bank_size; act_offset = E1000_ICH_NVM_SIG_WORD; @@ -4409,6 +4415,7 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: word = NVM_COMPAT; valid_csum_mask = NVM_COMPAT_VALID_CSUM; break; diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index c4a4f54cb80d..8a489c48bf85 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -195,6 +195,22 @@ static pci_vendor_info_t em_vendor_info_array[] = PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V18, "Intel(R) I219-V MTP(18)"), PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_LM19, "Intel(R) I219-LM MTP(19)"), PVID(0x8086, E1000_DEV_ID_PCH_MTP_I219_V19, "Intel(R) I219-V MTP(19)"), + PVID(0x8086, E1000_DEV_ID_PCH_LNL_I219_LM20, "Intel(R) I219-LM LNL(20)"), + PVID(0x8086, E1000_DEV_ID_PCH_LNL_I219_V20, "Intel(R) I219-V LNL(20)"), + PVID(0x8086, E1000_DEV_ID_PCH_LNL_I219_LM21, "Intel(R) I219-LM LNL(21)"), + PVID(0x8086, E1000_DEV_ID_PCH_LNL_I219_V21, "Intel(R) I219-V LNL(21)"), + PVID(0x8086, E1000_DEV_ID_PCH_RPL_I219_LM22, "Intel(R) I219-LM RPL(22)"), + PVID(0x8086, E1000_DEV_ID_PCH_RPL_I219_V22, "Intel(R) I219-V RPL(22)"), + PVID(0x8086, E1000_DEV_ID_PCH_RPL_I219_LM23, "Intel(R) I219-LM RPL(23)"), + PVID(0x8086, E1000_DEV_ID_PCH_RPL_I219_V23, "Intel(R) I219-V RPL(23)"), + PVID(0x8086, E1000_DEV_ID_PCH_ARL_I219_LM24, "Intel(R) I219-LM ARL(24)"), + PVID(0x8086, E1000_DEV_ID_PCH_ARL_I219_V24, "Intel(R) I219-V ARL(24)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_LM25, "Intel(R) I219-LM PTP(25)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_V25, "Intel(R) I219-V PTP(25)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_LM26, "Intel(R) I219-LM PTP(26)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_V26, "Intel(R) I219-V PTP(26)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_LM27, "Intel(R) I219-LM PTP(27)"), + PVID(0x8086, E1000_DEV_ID_PCH_PTP_I219_V27, "Intel(R) I219-V PTP(27)"), /* required last entry */ PVID_END }; @@ -1251,6 +1267,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: case e1000_82574: case e1000_82583: case e1000_80003es2lan: @@ -2637,6 +2654,7 @@ em_reset(if_ctx_t ctx) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: pba = E1000_PBA_26K; break; case e1000_82575: @@ -2750,6 +2768,7 @@ em_reset(if_ctx_t ctx) case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_mtp: + case e1000_pch_ptp: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; From nobody Thu Feb 23 00:29:43 2023 X-Original-To: dev-commits-src-branches@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 4PMYnM72PYz3sg55; Thu, 23 Feb 2023 00:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMYnM6bx3z3y1V; Thu, 23 Feb 2023 00:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677112183; 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=2Y6khRJ/urNFduiZHdAQniCaRa9MtZbij4llsDafWVk=; b=r+jOLOz/lO5My8K6qc3GGmSLF7eOtpi8Wjyfq1f3SfY4h3/bwEM4tEinaWPFRlNGBVgghZ 8csAzb7epluklkIc8DrDYGVfIWk6QzWD1EqWOMu+OQVWVJk+HlN6IVmcLgBs+6zMc2EhuI k1zD1mThdFCekQOr/i0D8pHyu2klzOXiArsPPs6Lcy4v6j+8Fd0wz1Gx0Zb0hS7zzw4LFn pDxeQrQA4e1fO+ztsxvYdXtRMw3Tb0Kv/1HHT5QhaoDRpGLY72nt11mqvt9nwNTypD+aR7 YanOVvUMRJyWYTPRefDk0Xg2M/RHeLcgN7x2FEDvQWll6uk8JPtOaPzwUyne1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677112183; 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=2Y6khRJ/urNFduiZHdAQniCaRa9MtZbij4llsDafWVk=; b=hcvD5eJt4usAbPd9nli6w4ijc7QsiJ+HAX6RMImaGM5Og2ZujVCI/aTevDwvINElomG5my fK08T6Tt8n8RajiMpNivEyjhLaQudDkasnp7B4dSWYDDusbk4g4bXg4pqgLWaBMxY30IXb /tcHFLAbloX10vx3Ja2g5wr95sFktX8DbuzSIYQ2jxYv05TBzoP/umu3lDZOYMC5B7y1RJ bS733HtVfK0HNb8+0DINaK+FxWik72GYloFdGfsr4m3/lC/jOqZTXPuEVPF19feD+7kN19 UnXMRAtSJcAQcAvK8gr3s8e2fBzY6uIKGKsgUAtr7tRyh9OPzgEPA6E/olmWhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677112183; a=rsa-sha256; cv=none; b=TvYut7u6Bsttj2K0bef9U74InCgesWHihfoHu/qkICsHkllTFuAV1CMhHqakljk6L66g6P uiulhov0rzgkaM0cZ8qfu/oF2df4LYTMeD+CpMojXLkefCFNc8wxOriC4GoHg27Jxj4Jpn hyxkEIKal/ubPwAEhR6MUlQoto6Q8GJ1d1Fx0V1+VnSCsh1uE/AZXOeKKvcsylxT/PeOOu +Y3CtbiEXVurc242RLWHAz/w3hG74vyFe9V8FXPk1g0pCP7IEdDGhlUaYvAfco9oqyUHMm ZCTUhTHKiUmEG1gigme0zgpwOsauHvu2q07w/VYqwBhOEya3KvkrUi9QMrINqQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMYnM5fBvzLph; Thu, 23 Feb 2023 00:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N0ThV6072523; Thu, 23 Feb 2023 00:29:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N0Thin072522; Thu, 23 Feb 2023 00:29:43 GMT (envelope-from git) Date: Thu, 23 Feb 2023 00:29:43 GMT Message-Id: <202302230029.31N0Thin072522@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: b0b1fa9efed8 - stable/13 - e1000: Fix packet loss on 11th gen and later List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: b0b1fa9efed8d3a4aeb8e365c4f3356de9cc0f6d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=b0b1fa9efed8d3a4aeb8e365c4f3356de9cc0f6d commit b0b1fa9efed8d3a4aeb8e365c4f3356de9cc0f6d Author: Kevin Bowling AuthorDate: 2023-02-09 00:32:54 +0000 Commit: Kevin Bowling CommitDate: 2023-02-23 00:29:33 +0000 e1000: Fix packet loss on 11th gen and later Ungate DMA clock on TGP and later to avoid packet loss. A similar fix appears in Linux 639e298f432fb058a9496ea16863f53b1ce935fe This may be needed as far back as SPT but no confirmation from intel or other OS yet. Obtained from: OpenBSD (if_em_hw.c 1.116) Sponsored by: BBOX.io (cherry picked from commit 56365902147791994157c3a8f75784dafd46dbd8) --- sys/dev/e1000/e1000_ich8lan.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index f74ef5f9c7b3..86b3d1194edd 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -5174,6 +5174,13 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) snoop = (u32) ~(PCIE_NO_SNOOP_ALL); e1000_set_pcie_no_snoop_generic(hw, snoop); + /* ungate DMA clock to avoid packet loss */ + if (mac->type >= e1000_pch_tgp) { + uint32_t fflt_dbg = E1000_READ_REG(hw, E1000_FFLT_DBG); + fflt_dbg |= (1 << 12); + E1000_WRITE_REG(hw, E1000_FFLT_DBG, fflt_dbg); + } + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); ctrl_ext |= E1000_CTRL_EXT_RO_DIS; E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); From nobody Thu Feb 23 00:30:08 2023 X-Original-To: dev-commits-src-branches@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 4PMYnr4PtWz3sgRq; Thu, 23 Feb 2023 00:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMYnr3sVXz40bP; Thu, 23 Feb 2023 00:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677112208; 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=gyOH/ge0pDkgcG2oGvYAG6zDtk10UjJB5AU+BIM+LYg=; b=KtlNuA5N/RxsI0tP3ITC1RVGBm25qjrA+6oLzGgKRjru/LQGrDYGcQwX+v9jiQSJf78nQI W4H4L8/WR0S0ZTIkCNF9+M1Zd1K6CfZZw1/hsVwrmQum+1+gLtSe6WSM4M+yvi7UAyHdF0 yATc+9yWWyfwKsXYYOno7tzsm+NAkMhH9PpUawRSR5TQG/n2Z8modITNaJsGUBaZ/WBZTw 6eddVMMXeQ0T2dmnVO4pSKyiPIxbM2qk3RR2Sd9xxt3G8ExbJMzT1m91BuKK7hVBCht0MH pUmmLuzJHPGxP9lBRTI9wIPZ34sMoZa6iEW++VNaxWW/suViqCJcNq92+AGGDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677112208; 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=gyOH/ge0pDkgcG2oGvYAG6zDtk10UjJB5AU+BIM+LYg=; b=l+u7Q53Xg5CoDss+AtL/NFDrr+YQDe5O9P21HKQ3cbhMg8CMB7mf58K8uZYuX2mlZUB5Dt 4MzwT67s6N3H2xbDh3e5wGPZC36NZLXhzblM+wLkiAiQm8k6vi07omnDUWjmy0ILEiW63W CupNdBYqTVeQEj1s901YPGMXwdVTGexop/bR3AeQuxHAJmXtFpt+qKYkErIr77tN3WtU7n FRLcmDPE8xv81GdOP05SpVhjLFrSljtiWUA23KsJ+7+5T9wbhtIoiG19zeRqp27gcnzKR8 N6AcWBxbqKV4sAS7cnOQhtRdgG4W9Wl68OW1Y2lM1QqxpBByR6HmfEVwo1QzsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677112208; a=rsa-sha256; cv=none; b=yg8u2E/YbYpTCDAveyPOdokHaFC3eYO4ydJTUfnaRvF+WTciUwqzVR3bnvVXTqhflwPASy n8ysibDQxDusyZYMgUohAdFcMHeR+olLhqUPHFIL45HaOEVzD2p7zfcE5h5PXX8io2o1w9 SRAldoPQWNX+t8/dEZ5KGptrVfp91jOLS96SrlIsj9dcchXjFGeuBNK4Hqbuiu3mNII29r dMZf5MDqO8WJOURVK83gn+UbPGUKHJoBaw3U1yECCvJj2NNRt+I4qW1QUvlbZ8Xw1pviYr UKzF6MThfuGKzrGl8wuNfMwegon4Ap5BgDzNn5YNnzDVqLVjuAzAEX7d/m35uw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMYnr2x8pzMWX; Thu, 23 Feb 2023 00:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N0U8MB076003; Thu, 23 Feb 2023 00:30:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N0U8U0076001; Thu, 23 Feb 2023 00:30:08 GMT (envelope-from git) Date: Thu, 23 Feb 2023 00:30:08 GMT Message-Id: <202302230030.31N0U8U0076001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: e7de5b89b72d - stable/12 - e1000: Fix packet loss on 11th gen and later List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/12 X-Git-Reftype: branch X-Git-Commit: e7de5b89b72da29933f0e7f2852b33b1ba0eb442 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=e7de5b89b72da29933f0e7f2852b33b1ba0eb442 commit e7de5b89b72da29933f0e7f2852b33b1ba0eb442 Author: Kevin Bowling AuthorDate: 2023-02-09 00:32:54 +0000 Commit: Kevin Bowling CommitDate: 2023-02-23 00:29:58 +0000 e1000: Fix packet loss on 11th gen and later Ungate DMA clock on TGP and later to avoid packet loss. A similar fix appears in Linux 639e298f432fb058a9496ea16863f53b1ce935fe This may be needed as far back as SPT but no confirmation from intel or other OS yet. Obtained from: OpenBSD (if_em_hw.c 1.116) Sponsored by: BBOX.io (cherry picked from commit 56365902147791994157c3a8f75784dafd46dbd8) --- sys/dev/e1000/e1000_ich8lan.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 7d079ee5d1b3..9893aa413b2c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -5174,6 +5174,13 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) snoop = (u32) ~(PCIE_NO_SNOOP_ALL); e1000_set_pcie_no_snoop_generic(hw, snoop); + /* ungate DMA clock to avoid packet loss */ + if (mac->type >= e1000_pch_tgp) { + uint32_t fflt_dbg = E1000_READ_REG(hw, E1000_FFLT_DBG); + fflt_dbg |= (1 << 12); + E1000_WRITE_REG(hw, E1000_FFLT_DBG, fflt_dbg); + } + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); ctrl_ext |= E1000_CTRL_EXT_RO_DIS; E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); From nobody Thu Feb 23 05:03:48 2023 X-Original-To: dev-commits-src-branches@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 4PMgsc3Q1Xz3syZ8; Thu, 23 Feb 2023 05:03:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMgsc2VTpz4WvG; Thu, 23 Feb 2023 05:03:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677128628; 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=8vDqw21LpmJGwKPKFd0RaZQ3ox2vOi49YkDvGTCcEQo=; b=CsrGR4gGXZIKPoVgnCGvC78K+BucYDtJe8PnxAHnhvFIlLZla7EQp3az3OWZ7JD8AGRUI2 umMUCo27xDJIERBtlG2nxiqAOmNGeJyUNW1jBUoGwue57cgJEYLS0ASgQy95nSxDja/QOq U1Ic+RgECsBgHeglD0l+CRdk/j+3I683Ho4Ix134T8VJjoBad0W0wE5yMqHjqAU1bmoUYu pTbM3CkoaiarZOlsYtbpUk18hSokJMS+cD7Eg5ta+p/HGm1hJG2i40GP6kyMIogjgju3/Q TEe+AIJZVG7BRXkSruv7NnDlV92OrZ6uwgb1Bls0YrA4YqXDPgsfp2vBlptj7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677128628; 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=8vDqw21LpmJGwKPKFd0RaZQ3ox2vOi49YkDvGTCcEQo=; b=WaZYdeuQfUgCSoc6UH//STaqAacQKCnSeInf71J/K2/wzxTDZYSxtLukwGHXLRzthn/P0H RNCOYOb2GN0YkdSXfOUdvbZvwYWMyRx85j0aYpc/cwcuRbngOLPv9aGnZtgDiIyz5KCG1r x+NvixsQ8CxwlZ0gZIoX6wn1LiY2IggOQkCBYoYhIfZJy5lwwhTv5PVpASLc+rgaFP5MOe aSu+ulqlzX7uAIGpHd0fET7QDT+EqEVYAazT0M3W/tRfApYISUUEnfnm5Obi6qTSVWol6z aPk23g53sEc3qYoQsAVn+rn7mtLhDZpwFtmljAPVXW/OQ+Ggt32tXwd8rpqxrQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677128628; a=rsa-sha256; cv=none; b=vLpTaq8ebuSBKeeoTM1XDR+hpIhxULxZ2rWX7k8PZNLqZPwR059WgesINd8D6zhoDeKRsF kia2uUvDoZJxzCVE7L3IrLrKnS9sCYEF4YtcJ9FTT6+gHp5pDo/68ZC/ApkTbHGA0Y1Hr8 XTuTu4/93kECWe+Xd/eV/JVW9K+4JSY7tBBeOH2HgzGSE1osr0GPA30sZ5wffNKpwKzb18 07qy4dMo43r05yVV3MHtGOhNH0MbaYFcyPtqMC+2r7GxBIVVb3CZWMnHZr8nycwCcjhS2i AmIf1WkfksinTfFG9REQAWU1oCXi8Qpa0pTKp6UM9pVbi793TL67QRobH+SkEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMgsc1DtCzVL2; Thu, 23 Feb 2023 05:03:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N53mJE072831; Thu, 23 Feb 2023 05:03:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N53mTT072830; Thu, 23 Feb 2023 05:03:48 GMT (envelope-from git) Date: Thu, 23 Feb 2023 05:03:48 GMT Message-Id: <202302230503.31N53mTT072830@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 7dbedbcfe079 - stable/13 - hastd and hastctl: use zlib's crc32 implementation. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7dbedbcfe079cfbd1d192ca80cb151443bc8a675 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=7dbedbcfe079cfbd1d192ca80cb151443bc8a675 commit 7dbedbcfe079cfbd1d192ca80cb151443bc8a675 Author: Xin LI AuthorDate: 2023-02-03 07:14:21 +0000 Commit: Xin LI CommitDate: 2023-02-23 05:03:11 +0000 hastd and hastctl: use zlib's crc32 implementation. (cherry picked from commit 6998572a74a98721781ecd5b6829435259f9825a) (cherry picked from commit fdbfaefefa585537273955fc88d7daf5e86c6f2d) --- sbin/hastctl/Makefile | 3 +- sbin/hastd/Makefile | 4 +- sbin/hastd/crc32.c | 115 --------------------------------------------- sbin/hastd/crc32.h | 28 ----------- sbin/hastd/hast_checksum.c | 6 ++- 5 files changed, 7 insertions(+), 149 deletions(-) diff --git a/sbin/hastctl/Makefile b/sbin/hastctl/Makefile index 00c89ef4f743..3f2198e74df6 100644 --- a/sbin/hastctl/Makefile +++ b/sbin/hastctl/Makefile @@ -7,7 +7,6 @@ PACKAGE=hast PROG= hastctl SRCS= activemap.c -SRCS+= crc32.c SRCS+= ebuf.c SRCS+= hast_checksum.c hast_compression.c hast_proto.c hastctl.c SRCS+= lzf.c @@ -33,7 +32,7 @@ CFLAGS+=-DINET6 CFLAGS+=-DYY_NO_UNPUT CFLAGS+=-DYY_NO_INPUT -LIBADD= md util +LIBADD= md util z YFLAGS+=-v diff --git a/sbin/hastd/Makefile b/sbin/hastd/Makefile index d3854850d3b3..20a9c8333d2a 100644 --- a/sbin/hastd/Makefile +++ b/sbin/hastd/Makefile @@ -5,7 +5,7 @@ PACKAGE=hast PROG= hastd SRCS= activemap.c -SRCS+= control.c crc32.c +SRCS+= control.c SRCS+= ebuf.c event.c SRCS+= hast_checksum.c hast_compression.c hast_proto.c hastd.c hooks.c SRCS+= lzf.c @@ -31,7 +31,7 @@ CFLAGS+=-DINET CFLAGS+=-DINET6 .endif -LIBADD= geom md pthread util +LIBADD= geom md pthread util z YFLAGS+=-v diff --git a/sbin/hastd/crc32.c b/sbin/hastd/crc32.c deleted file mode 100644 index e8bc74a97f2b..000000000000 --- a/sbin/hastd/crc32.c +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or - * code or tables extracted from it, as desired without restriction. - */ - -/* - * First, the polynomial itself and its table of feedback terms. The - * polynomial is - * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 - * - * Note that we take it "backwards" and put the highest-order term in - * the lowest-order bit. The X^32 term is "implied"; the LSB is the - * X^31 term, etc. The X^0 term (usually shown as "+1") results in - * the MSB being 1 - * - * Note that the usual hardware shift register implementation, which - * is what we're using (we're merely optimizing it by doing eight-bit - * chunks at a time) shifts bits into the lowest-order term. In our - * implementation, that means shifting towards the right. Why do we - * do it this way? Because the calculated CRC must be transmitted in - * order from highest-order term to lowest-order term. UARTs transmit - * characters in order from LSB to MSB. By storing the CRC this way - * we hand it to the UART in the order low-byte to high-byte; the UART - * sends each low-bit to hight-bit; and the result is transmission bit - * by bit from highest- to lowest-order term without requiring any bit - * shuffling on our part. Reception works similarly - * - * The feedback terms table consists of 256, 32-bit entries. Notes - * - * The table can be generated at runtime if desired; code to do so - * is shown later. It might not be obvious, but the feedback - * terms simply represent the results of eight shift/xor opera - * tions for all combinations of data and CRC register values - * - * The values must be right-shifted by eight bits by the "updcrc - * logic; the shift must be unsigned (bring in zeroes). On some - * hardware you could probably optimize the shift in assembler by - * using byte-swap instructions - * polynomial $edb88320 - * - * - * CRC32 code derived from work by Gary S. Brown. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include - -#include - -uint32_t crc32_tab[] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, - 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, - 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, - 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, - 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, - 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, - 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, - 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, - 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, - 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, - 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - -/* - * A function that calculates the CRC-32 based on the table above is - * given below for documentation purposes. An equivalent implementation - * of this function that's actually used in the kernel can be found - * in sys/libkern.h, where it can be inlined. - * - * uint32_t - * crc32(const void *buf, size_t size) - * { - * const uint8_t *p = buf; - * uint32_t crc; - * - * crc = ~0U; - * while (size--) - * crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); - * return crc ^ ~0U; - * } - */ diff --git a/sbin/hastd/crc32.h b/sbin/hastd/crc32.h deleted file mode 100644 index 3812a83f971f..000000000000 --- a/sbin/hastd/crc32.h +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or - * code or tables extracted from it, as desired without restriction. - * - * $FreeBSD$ - */ - -#ifndef _CRC32_H_ -#define _CRC32_H_ - -#include /* uint32_t */ -#include /* size_t */ - -extern uint32_t crc32_tab[]; - -static __inline uint32_t -crc32(const void *buf, size_t size) -{ - const uint8_t *p = buf; - uint32_t crc; - - crc = ~0U; - while (size--) - crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); - return (crc ^ ~0U); -} - -#endif /* !_CRC32_H_ */ diff --git a/sbin/hastd/hast_checksum.c b/sbin/hastd/hast_checksum.c index f7ef6a64b4e1..dccba3752cb1 100644 --- a/sbin/hastd/hast_checksum.c +++ b/sbin/hastd/hast_checksum.c @@ -33,10 +33,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include +#include #include #include "hast_checksum.h" @@ -49,7 +49,9 @@ hast_crc32_checksum(const unsigned char *data, size_t size, { uint32_t crc; - crc = crc32(data, size); + crc = crc32(0L, Z_NULL, 0); + crc = crc32(crc, data, size); + /* XXXPJD: Do we have to use htole32() on crc first? */ bcopy(&crc, hash, sizeof(crc)); *hsizep = sizeof(crc); From nobody Thu Feb 23 05:05:40 2023 X-Original-To: dev-commits-src-branches@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 4PMgvn1kV0z3synY; Thu, 23 Feb 2023 05:05:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMgvn17yxz4XTQ; Thu, 23 Feb 2023 05:05:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677128741; 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=jmbcswcC+Is6iACKC3TK/0oIixpH+BXTY0XXIt+/AVg=; b=V1vtWLFqGywHne7awo3dej25YSBH3gdS4xt+k5LMhBted5XO3EWx7RJMatlvo3Q7JWi2Df UJgN2pG45bOap1p/BKbOd3FDeYkH+etML1f4RAeoqhxWZROSin8TOrNrY7oLfHgqrt1Fux 7lp7LhdjXhLJEebQtd6abwob0Ywv0WqMwB0dgzKb9IjWpbmAktvsNW9WDHoUuh77YPs0+m +VJrCHIf0kqaew5GOlL3WpFlZtvdoUrg8mV6SytsMJkZveRHj2gG25Q9yHNUqn/4/y7p7b zCVFCaSvY57wuTOv4GqUbabmxcOF1cqXzH3hWFIfoeHca6NeBrtAcNEz0/QVEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677128741; 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=jmbcswcC+Is6iACKC3TK/0oIixpH+BXTY0XXIt+/AVg=; b=ac6sWkszw6vVNcFPOTMkfe7vyWV0R18HGRtlxq0MoA0sn7bGPjlivwzlMWZays3vrxNort zDGbdCuv5ohjKUHVWGHgEh/zYUTQRvPktYzzsry+jDywyLKTweE/NrBeF4o1NU0zBnpuA+ bqjwkWWaR0zGybiDIQbAJutfvfKvW4MCGrIPIETTSXMHtfkjpUfhxSRHBCSAnvKyUg0ENx toJc1jkbP8P5JahyPUQUpuRy2JrPyxfrBqntfm40rvbk3VdhSgTamh+wBxBvBD6r8P6YTq HMafRB1X5H1ZZdupo2YfyjHleTBFTvIP7BaTZVTS+t3s3WYPzTxr3lLSqar8ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677128741; a=rsa-sha256; cv=none; b=hnWi61j0PyHz5MZSv2B/2UcaKy7SFDgwLkeGeH7HTaL1vzSRQTKpCb+6bRyu5kMkhyFLYI 2ZSf0yy8lXvOxk7Kqf7dZscBO1RO1Ork5o/W0safGVmR0RVv4fWx0/i3bn8q3keUjoL5+T FxmIy2CVDBLWH7l31pIWEVu8F5DYdZzO0vcZIixaYjSYE3y8hZUouafn3Wh6QmMEc53M9+ XDiFKOlRbKtGOxQKYrqDOwYwr1sB1cNJDsHb63Q9FXt8z+ST70TNvbTGzWTVLOm1wHD8SI 4yVjwstS/HueItkUo+y+N/Jb7bF3ACQpeTRBFJ21bEKGxtPEC7D2C5vij8rTGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMgvm754FzVNT; Thu, 23 Feb 2023 05:05:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N55eRh073165; Thu, 23 Feb 2023 05:05:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N55edY073164; Thu, 23 Feb 2023 05:05:40 GMT (envelope-from git) Date: Thu, 23 Feb 2023 05:05:40 GMT Message-Id: <202302230505.31N55edY073164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 3a7d654ed82b - stable/13 - MFV: zlib 1.2.13. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a7d654ed82bc2b379549f8b2ac1e8ac6a638fa5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=3a7d654ed82bc2b379549f8b2ac1e8ac6a638fa5 commit 3a7d654ed82bc2b379549f8b2ac1e8ac6a638fa5 Author: Xin LI AuthorDate: 2023-02-17 07:57:24 +0000 Commit: Xin LI CommitDate: 2023-02-23 05:05:28 +0000 MFV: zlib 1.2.13. Relnotes: yes (cherry picked from commit e37bb444aa945ed0725766e986698a09bd61b1b2) --- sys/contrib/zlib/ChangeLog | 24 +++- sys/contrib/zlib/LICENSE | 22 ++++ sys/contrib/zlib/README | 4 +- sys/contrib/zlib/compress.c | 6 +- sys/contrib/zlib/contrib/README.contrib | 2 +- sys/contrib/zlib/crc32.c | 25 ++-- sys/contrib/zlib/deflate.c | 218 ++++++++++++++++---------------- sys/contrib/zlib/deflate.h | 4 +- sys/contrib/zlib/gzlib.c | 2 +- sys/contrib/zlib/gzread.c | 8 +- sys/contrib/zlib/gzwrite.c | 2 +- sys/contrib/zlib/infback.c | 17 ++- sys/contrib/zlib/inflate.c | 2 + sys/contrib/zlib/inftrees.c | 4 +- sys/contrib/zlib/inftrees.h | 2 +- sys/contrib/zlib/test/example.c | 3 +- sys/contrib/zlib/test/minigzip.c | 2 +- sys/contrib/zlib/trees.c | 123 +++++++++--------- sys/contrib/zlib/uncompr.c | 4 +- sys/contrib/zlib/zconf.h | 19 ++- sys/contrib/zlib/zconf.h.in | 19 ++- sys/contrib/zlib/zlib.3 | 4 +- sys/contrib/zlib/zlib.h | 20 +-- sys/contrib/zlib/zutil.c | 16 ++- sys/contrib/zlib/zutil.h | 1 + 25 files changed, 317 insertions(+), 236 deletions(-) diff --git a/sys/contrib/zlib/ChangeLog b/sys/contrib/zlib/ChangeLog index f0b0e6180921..457526bc6a51 100644 --- a/sys/contrib/zlib/ChangeLog +++ b/sys/contrib/zlib/ChangeLog @@ -1,6 +1,18 @@ ChangeLog file for zlib +Changes in 1.2.13 (13 Oct 2022) +- Fix configure issue that discarded provided CC definition +- Correct incorrect inputs provided to the CRC functions +- Repair prototypes and exporting of new CRC functions +- Fix inflateBack to detect invalid input with distances too far +- Have infback() deliver all of the available output up to any error +- Fix a bug when getting a gzip header extra field with inflate() +- Fix bug in block type selection when Z_FIXED used +- Tighten deflateBound bounds +- Remove deleted assembler code references +- Various portability and appearance improvements + Changes in 1.2.12 (27 Mar 2022) - Cygwin does not have _wopen(), so do not create gzopen_w() there - Permit a deflateParams() parameter change as soon as possible @@ -159,7 +171,7 @@ Changes in 1.2.7.1 (24 Mar 2013) - Fix types in contrib/minizip to match result of get_crc_table() - Simplify contrib/vstudio/vc10 with 'd' suffix - Add TOP support to win32/Makefile.msc -- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Support i686 and amd64 assembler builds in CMakeLists.txt - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h - Add vc11 and vc12 build files to contrib/vstudio - Add gzvprintf() as an undocumented function in zlib @@ -359,14 +371,14 @@ Changes in 1.2.5.1 (10 Sep 2011) - Use u4 type for crc_table to avoid conversion warnings - Apply casts in zlib.h to avoid conversion warnings - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] -- Improve inflateSync() documentation to note indeterminancy +- Improve inflateSync() documentation to note indeterminacy - Add deflatePending() function to return the amount of pending output - Correct the spelling of "specification" in FAQ [Randers-Pehrson] - Add a check in configure for stdarg.h, use for gzprintf() - Check that pointers fit in ints when gzprint() compiled old style - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] -- Add debug records in assmebler code [Londer] +- Add debug records in assembler code [Londer] - Update RFC references to use http://tools.ietf.org/html/... [Li] - Add --archs option, use of libtool to configure for Mac OS X [Borstel] @@ -1033,7 +1045,7 @@ Changes in 1.2.0.1 (17 March 2003) - Include additional header file on VMS for off_t typedef - Try to use _vsnprintf where it supplants vsprintf [Vollant] - Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to +- Enhance comments in zlib.h on what happens if gzprintf() tries to write more than 4095 bytes before compression - Remove unused state from inflateBackEnd() - Remove exit(0) from minigzip.c, example.c @@ -1211,7 +1223,7 @@ Changes in 1.0.9 (17 Feb 1998) - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) + the declaration of FAR (Gilles Vollant) - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) - read_buf buf parameter of type Bytef* instead of charf* - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) @@ -1567,7 +1579,7 @@ Changes in 0.4: - renamed deflateOptions as deflateInit2, call one or the other but not both - added the method parameter for deflateInit2 - added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting +- simplified considerably deflateInit and inflateInit by not supporting user-provided history buffer. This is supported only in deflateInit2 and inflateInit2 diff --git a/sys/contrib/zlib/LICENSE b/sys/contrib/zlib/LICENSE new file mode 100644 index 000000000000..ab8ee6f71428 --- /dev/null +++ b/sys/contrib/zlib/LICENSE @@ -0,0 +1,22 @@ +Copyright notice: + + (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu diff --git a/sys/contrib/zlib/README b/sys/contrib/zlib/README index 024b79d3d8c8..ba34d1894a9b 100644 --- a/sys/contrib/zlib/README +++ b/sys/contrib/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.12 is a general purpose data compression library. All the code is +zlib 1.2.13 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.12 are documented in the file ChangeLog. +The changes made in version 1.2.13 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . diff --git a/sys/contrib/zlib/compress.c b/sys/contrib/zlib/compress.c index e2db404abf88..2ad5326c14ec 100644 --- a/sys/contrib/zlib/compress.c +++ b/sys/contrib/zlib/compress.c @@ -19,7 +19,7 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) +int ZEXPORT compress2(dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) /* =========================================================================== */ -int ZEXPORT compress (dest, destLen, source, sourceLen) +int ZEXPORT compress(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ -uLong ZEXPORT compressBound (sourceLen) +uLong ZEXPORT compressBound(sourceLen) uLong sourceLen; { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + diff --git a/sys/contrib/zlib/contrib/README.contrib b/sys/contrib/zlib/contrib/README.contrib index 335e43508be2..5e5f95054090 100644 --- a/sys/contrib/zlib/contrib/README.contrib +++ b/sys/contrib/zlib/contrib/README.contrib @@ -1,4 +1,4 @@ -All files under this contrib directory are UNSUPPORTED. There were +All files under this contrib directory are UNSUPPORTED. They were provided by users of zlib and were not tested by the authors of zlib. Use at your own risk. Please contact the authors of the contributions for help about these, not the zlib authors. Thanks. diff --git a/sys/contrib/zlib/crc32.c b/sys/contrib/zlib/crc32.c index 382b9a322fda..7b0e60462dda 100644 --- a/sys/contrib/zlib/crc32.c +++ b/sys/contrib/zlib/crc32.c @@ -98,13 +98,22 @@ # endif #endif +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 +# define ARMCRC32 +#endif + /* Local functions. */ local z_crc_t multmodp OF((z_crc_t a, z_crc_t b)); local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); -/* If available, use the ARM processor CRC32 instruction. */ -#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 -# define ARMCRC32 +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) + local z_word_t byte_swap OF((z_word_t word)); +#endif + +#if defined(W) && !defined(ARMCRC32) + local z_crc_t crc_word OF((z_word_t data)); + local z_word_t crc_word_big OF((z_word_t data)); #endif #if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) @@ -647,8 +656,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) len &= 7; /* Do three interleaved CRCs to realize the throughput of one crc32x - instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three - CRCs are combined into a single CRC after each set of batches. */ + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ while (num >= 3 * Z_BATCH) { crc1 = 0; crc2 = 0; @@ -1092,7 +1101,7 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong crc2; z_off_t len2; { - return crc32_combine64(crc1, crc2, len2); + return crc32_combine64(crc1, crc2, (z_off64_t)len2); } /* ========================================================================= */ @@ -1109,11 +1118,11 @@ uLong ZEXPORT crc32_combine_gen64(len2) uLong ZEXPORT crc32_combine_gen(len2) z_off_t len2; { - return crc32_combine_gen64(len2); + return crc32_combine_gen64((z_off64_t)len2); } /* ========================================================================= */ -uLong crc32_combine_op(crc1, crc2, op) +uLong ZEXPORT crc32_combine_op(crc1, crc2, op) uLong crc1; uLong crc2; uLong op; diff --git a/sys/contrib/zlib/deflate.c b/sys/contrib/zlib/deflate.c index af9e4bcf2918..cffe335093d6 100644 --- a/sys/contrib/zlib/deflate.c +++ b/sys/contrib/zlib/deflate.c @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -87,13 +87,7 @@ local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV -# pragma message("Assembler code may have bugs -- use at your own risk") - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif #ifdef ZLIB_DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, @@ -160,7 +154,7 @@ local const config configuration_table[10] = { * characters, so that a running hash key can be computed from the previous * key instead of complete recalculation each time. */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) +#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== @@ -191,9 +185,9 @@ local const config configuration_table[10] = { */ #define CLEAR_HASH(s) \ do { \ - s->head[s->hash_size-1] = NIL; \ + s->head[s->hash_size - 1] = NIL; \ zmemzero((Bytef *)s->head, \ - (unsigned)(s->hash_size-1)*sizeof(*s->head)); \ + (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \ } while (0) /* =========================================================================== @@ -285,6 +279,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; + if (windowBits < -15) + return Z_STREAM_ERROR; windowBits = -windowBits; } #ifdef GZIP @@ -314,7 +310,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); @@ -340,11 +336,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, * sym_buf value to read moves forward three bytes. From that symbol, up to * 31 bits are written to pending_buf. The closest the written pending_buf * bits gets to the next sym_buf symbol to read is just before the last - * code is written. At that time, 31*(n-2) bits have been written, just - * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at - * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1 + * code is written. At that time, 31*(n - 2) bits have been written, just + * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at + * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1 * symbols are written.) The closest the writing gets to what is unread is - * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and + * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and * can range from 128 to 32768. * * Therefore, at a minimum, there are 142 bits of space between what is @@ -390,7 +386,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, /* ========================================================================= * Check for a valid deflate stream state. Return 0 if ok, 1 if not. */ -local int deflateStateCheck (strm) +local int deflateStateCheck(strm) z_streamp strm; { deflate_state *s; @@ -413,7 +409,7 @@ local int deflateStateCheck (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; @@ -482,7 +478,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) z_streamp strm; Bytef *dictionary; uInt *dictLength; @@ -504,7 +500,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) +int ZEXPORT deflateResetKeep(strm) z_streamp strm; { deflate_state *s; @@ -542,7 +538,7 @@ int ZEXPORT deflateResetKeep (strm) } /* ========================================================================= */ -int ZEXPORT deflateReset (strm) +int ZEXPORT deflateReset(strm) z_streamp strm; { int ret; @@ -554,7 +550,7 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) +int ZEXPORT deflateSetHeader(strm, head) z_streamp strm; gz_headerp head; { @@ -565,7 +561,7 @@ int ZEXPORT deflateSetHeader (strm, head) } /* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) +int ZEXPORT deflatePending(strm, pending, bits) unsigned *pending; int *bits; z_streamp strm; @@ -579,7 +575,7 @@ int ZEXPORT deflatePending (strm, pending, bits) } /* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) +int ZEXPORT deflatePrime(strm, bits, value) z_streamp strm; int bits; int value; @@ -674,36 +670,50 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) } /* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. + * For the default windowBits of 15 and memLevel of 8, this function returns a + * close to exact, as well as small, upper bound on the compressed size. This + * is an expansion of ~0.03%, plus a small constant. + * + * For any setting other than those defaults for windowBits and memLevel, one + * of two worst case bounds is returned. This is at most an expansion of ~4% or + * ~13%, plus a small constant. * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. + * Both the 0.03% and 4% derive from the overhead of stored blocks. The first + * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second + * is for stored blocks of 127 bytes (the worst case memLevel == 1). The + * expansion results from five bytes of header for each stored block. * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. + * The larger expansion of 13% results from a window size less than or equal to + * the symbols buffer size (windowBits <= memLevel + 7). In that case some of + * the data being compressed may have slid out of the sliding window, impeding + * a stored block from being emitted. Then the only choice is a fixed or + * dynamic block, where a fixed block limits the maximum expansion to 9 bits + * per 8-bit byte, plus 10 bits for every block. The smallest block size for + * which this can occur is 255 (memLevel == 2). + * + * Shifts are used to approximate divisions, for speed. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; - uLong complen, wraplen; + uLong fixedlen, storelen, wraplen; + + /* upper bound for fixed blocks with 9-bit literals and length 255 + (memLevel == 2, which is the lowest that may not use stored blocks) -- + ~13% overhead plus a small constant */ + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) + + (sourceLen >> 9) + 4; - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + /* upper bound for stored blocks with length 127 (memLevel == 1) -- + ~4% overhead plus a small constant */ + storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) + + (sourceLen >> 11) + 7; - /* if can't get parameters, return conservative bound plus zlib wrapper */ + /* if can't get parameters, return larger bound plus a zlib wrapper */ if (deflateStateCheck(strm)) - return complen + 6; + return (fixedlen > storelen ? fixedlen : storelen) + 6; /* compute wrapper length */ s = strm->state; @@ -740,11 +750,12 @@ uLong ZEXPORT deflateBound(strm, sourceLen) wraplen = 6; } - /* if not default parameters, return conservative bound */ + /* if not default parameters, return one of the conservative bounds */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; + return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen; - /* default settings: return tight bound for that case */ + /* default settings: return tight bound for that case -- ~0.03% overhead + plus a small constant */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } @@ -754,7 +765,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ -local void putShortMSB (s, b) +local void putShortMSB(s, b) deflate_state *s; uInt b; { @@ -801,7 +812,7 @@ local void flush_pending(strm) } while (0) /* ========================================================================= */ -int ZEXPORT deflate (strm, flush) +int ZEXPORT deflate(strm, flush) z_streamp strm; int flush; { @@ -856,7 +867,7 @@ int ZEXPORT deflate (strm, flush) s->status = BUSY_STATE; if (s->status == INIT_STATE) { /* zlib header */ - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) @@ -1116,7 +1127,7 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ -int ZEXPORT deflateEnd (strm) +int ZEXPORT deflateEnd(strm) z_streamp strm; { int status; @@ -1142,7 +1153,7 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ -int ZEXPORT deflateCopy (dest, source) +int ZEXPORT deflateCopy(dest, source) z_streamp dest; z_streamp source; { @@ -1231,7 +1242,7 @@ local unsigned read_buf(strm, buf, size) /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ -local void lm_init (s) +local void lm_init(s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; @@ -1252,11 +1263,6 @@ local void lm_init (s) s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif } #ifndef FASTEST @@ -1269,10 +1275,6 @@ local void lm_init (s) * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ @@ -1297,10 +1299,10 @@ local uInt longest_match(s, cur_match) */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); + register ush scan_end = *(ushf*)(scan + best_len - 1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end1 = scan[best_len - 1]; register Byte scan_end = scan[best_len]; #endif @@ -1318,7 +1320,8 @@ local uInt longest_match(s, cur_match) */ if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); @@ -1336,43 +1339,44 @@ local uInt longest_match(s, cur_match) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ - if (*(ushf*)(match+best_len-1) != scan_end || + if (*(ushf*)(match + best_len - 1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient + * strstart + 3, + 5, up to strstart + 257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + /* Here, scan <= window + strstart + 257 */ + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); if (*scan == *match) scan++; - len = (MAX_MATCH - 1) - (int)(strend-scan); + len = (MAX_MATCH - 1) - (int)(strend - scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; + if (match[best_len] != scan_end || + match[best_len - 1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1382,7 +1386,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1391,7 +1395,8 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; @@ -1403,9 +1408,9 @@ local uInt longest_match(s, cur_match) best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); + scan_end = *(ushf*)(scan + best_len - 1); #else - scan_end1 = scan[best_len-1]; + scan_end1 = scan[best_len - 1]; scan_end = scan[best_len]; #endif } @@ -1415,7 +1420,6 @@ local uInt longest_match(s, cur_match) if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } -#endif /* ASMV */ #else /* FASTEST */ @@ -1436,7 +1440,8 @@ local uInt longest_match(s, cur_match) */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); Assert(cur_match < s->strstart, "no future"); @@ -1446,7 +1451,7 @@ local uInt longest_match(s, cur_match) */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1456,7 +1461,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1465,7 +1470,7 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); @@ -1501,7 +1506,7 @@ local void check_match(s, start, match, length) z_error("invalid match"); } if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); + fprintf(stderr,"\\[%d,%d]", start - match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } @@ -1547,9 +1552,9 @@ local void fill_window(s) /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ - if (s->strstart >= wsize+MAX_DIST(s)) { + if (s->strstart >= wsize + MAX_DIST(s)) { - zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); + zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; @@ -1682,7 +1687,7 @@ local void fill_window(s) * * deflate_stored() is written to minimize the number of times an input byte is * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. + * maximizes the opportunities to have a single copy from next_in to next_out. */ local block_state deflate_stored(s, flush) deflate_state *s; @@ -1892,7 +1897,7 @@ local block_state deflate_fast(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1940,7 +1945,7 @@ local block_state deflate_fast(s, flush) s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); + UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif @@ -1951,7 +1956,7 @@ local block_state deflate_fast(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -1995,7 +2000,7 @@ local block_state deflate_slow(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -2037,17 +2042,17 @@ local block_state deflate_slow(s, flush) uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - check_match(s, s->strstart-1, s->prev_match, s->prev_length); + check_match(s, s->strstart - 1, s->prev_match, s->prev_length); - _tr_tally_dist(s, s->strstart -1 - s->prev_match, + _tr_tally_dist(s, s->strstart - 1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not + * strstart - 1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ - s->lookahead -= s->prev_length-1; + s->lookahead -= s->prev_length - 1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { @@ -2065,8 +2070,8 @@ local block_state deflate_slow(s, flush) * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } @@ -2084,8 +2089,8 @@ local block_state deflate_slow(s, flush) } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); s->match_available = 0; } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; @@ -2142,7 +2147,8 @@ local block_state deflate_rle(s, flush) if (s->match_length > s->lookahead) s->match_length = s->lookahead; } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (uInt)(s->window_size - 1), + "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ @@ -2157,7 +2163,7 @@ local block_state deflate_rle(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -2197,7 +2203,7 @@ local block_state deflate_huff(s, flush) /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); diff --git a/sys/contrib/zlib/deflate.h b/sys/contrib/zlib/deflate.h index 17c226113b08..1a06cd5f25d1 100644 --- a/sys/contrib/zlib/deflate.h +++ b/sys/contrib/zlib/deflate.h @@ -329,8 +329,8 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (uch)(length); \ ush dist = (ush)(distance); \ - s->sym_buf[s->sym_next++] = dist; \ - s->sym_buf[s->sym_next++] = dist >> 8; \ + s->sym_buf[s->sym_next++] = (uch)dist; \ + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \ s->sym_buf[s->sym_next++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ diff --git a/sys/contrib/zlib/gzlib.c b/sys/contrib/zlib/gzlib.c index 9370974647b4..40830201e4e9 100644 --- a/sys/contrib/zlib/gzlib.c +++ b/sys/contrib/zlib/gzlib.c @@ -34,7 +34,7 @@ local gzFile gz_open OF((const void *, int, const char *)); The gz_strwinerror function does not change the current setting of GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) +char ZLIB_INTERNAL *gz_strwinerror(error) DWORD error; { static char buf[1024]; diff --git a/sys/contrib/zlib/gzread.c b/sys/contrib/zlib/gzread.c index a0d48949e681..3cc1f84ad690 100644 --- a/sys/contrib/zlib/gzread.c +++ b/sys/contrib/zlib/gzread.c @@ -160,11 +160,9 @@ local int gz_look(state) the output buffer is larger than the input buffer, which also assures space for gzungetc() */ state->x.next = state->out; - if (strm->avail_in) { - memcpy(state->x.next, strm->next_in, strm->avail_in); - state->x.have = strm->avail_in; - strm->avail_in = 0; - } + memcpy(state->x.next, strm->next_in, strm->avail_in); + state->x.have = strm->avail_in; + strm->avail_in = 0; state->how = COPY; state->direct = 1; return 0; diff --git a/sys/contrib/zlib/gzwrite.c b/sys/contrib/zlib/gzwrite.c index a02b87e565ed..5a9aebb6ff8d 100644 --- a/sys/contrib/zlib/gzwrite.c +++ b/sys/contrib/zlib/gzwrite.c @@ -477,7 +477,7 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) #else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, +int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) gzFile file; const char *format; diff --git a/sys/contrib/zlib/infback.c b/sys/contrib/zlib/infback.c index 3a1282bb88ce..ab9810070c09 100644 --- a/sys/contrib/zlib/infback.c +++ b/sys/contrib/zlib/infback.c @@ -66,6 +66,7 @@ int stream_size; state->window = window; state->wnext = 0; state->whave = 0; + state->sane = 1; return Z_OK; } @@ -605,25 +606,27 @@ void FAR *out_desc; break; case DONE: - /* inflate stream terminated properly -- write leftover output */ + /* inflate stream terminated properly */ ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; - default: /* can't happen, but makes compilers happy */ + default: + /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } - /* Return unused input */ + /* Write leftover output and return unused input */ inf_leave: + if (left < state->wsize) { *** 782 LINES SKIPPED *** From nobody Thu Feb 23 05:06:14 2023 X-Original-To: dev-commits-src-branches@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 4PMgwR214Tz3syr5; Thu, 23 Feb 2023 05:06:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMgwR1NnLz4Xrm; Thu, 23 Feb 2023 05:06:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677128775; 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=B/XXTqKoLd7w9dqDHnWcbVybEJ/CSFwhLasuvXNvxyI=; b=Cm09oFWlHVn8umx5dRhobXmG/vXX6UB5fKWHoBo9ramp/HHtlwpWJBgYJu5+jHDPzIAmYJ RGGqGi0s9gwR6a1N1AlVaenqyeKWgNwsOzKOhMBLo6HITcpWmSdh1dVqCzcs+NUYhrnMzi KNgu+Zbn9HrA/Wq9uHa15hg8PjdKDn+O5mJqRI8U+Y9MUTS6fq/8ZbQ6qnobm57gvz3nDM OTIeFqsYMV4kWLQK8Io8OaH9vIfmEYA6fet0DwSX783vAwkdJX2k5x8vgDUjCHeUPAEw3E 25U6koheJSOBUK8/xvb6M5g9LrV8zdoxYwk9WDLy2bYm/rp/KgS056a/ZpC1Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677128775; 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=B/XXTqKoLd7w9dqDHnWcbVybEJ/CSFwhLasuvXNvxyI=; b=FL88vbtAnUxPYQkabhQJzBpiau+fpVVnyU2uxUdy2BhCdkFbqGjnxhj2XRsH8q9i00C9Kt DRJOdloVbSiwU0Mto28j2YFd0TFz2PNUzhfOH30QZNL6IWYQLK1Wb3sFZG4wZ3m+YRH5G8 1fi8SItWLHfARRDdDWBPeXSPnyrf/WoF1MZIOHHSGbJlFi8RsYgAqzlymfA3NqSX31wcpv fJ2NM/W8fekKYPPQUjsiSjZMaoKzjCe1Qak+EvFy+/fy0JutcJlOWQ/IwsTu8+CvQtQe9C TRR98YouAGwHJ21jSCBRpYn5yMqJPwI6UQ0InTGqE+LDqEAfSmWIIiAePhlXGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677128775; a=rsa-sha256; cv=none; b=Uz3dpeBCBuDkEQqrBLOx39cMgmpoMu3AuveFS3Pt6evykxsNJFYF6xkQtrLeyrtWZLKnR7 6OFG2CureALXYYdTzZbJ+xzPAFb2xg1EsoSp15ArSsOENIToZP7VK9aCNukwFUoujGhZ+x 2yTPoR6E43DChHZqHct4hZ0TJstfIguzLH0qBcT9Phg0i+A2TtUolXcq5b/Evsx5E4Hq+v WP5ibxZvoNwS4mckzUdUQNSgAqYIeS2/0l+N8VAODuBVHmui0RgcG7yd5Ds8EorbNOz2Dd llzdorP8Olzi6OXwCX7qWClYUEnSZca7WBc17mjHLZ573maU3POLV7bdVE9LpQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMgwR0RSvzVYh; Thu, 23 Feb 2023 05:06:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N56Fa4073350; Thu, 23 Feb 2023 05:06:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N56ELq073349; Thu, 23 Feb 2023 05:06:14 GMT (envelope-from git) Date: Thu, 23 Feb 2023 05:06:14 GMT Message-Id: <202302230506.31N56ELq073349@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: fc9f4715432a - stable/12 - MFV: zlib 1.2.13. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fc9f4715432a820a85428ea7774891674fabf5ea Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=fc9f4715432a820a85428ea7774891674fabf5ea commit fc9f4715432a820a85428ea7774891674fabf5ea Author: Xin LI AuthorDate: 2023-02-17 07:57:24 +0000 Commit: Xin LI CommitDate: 2023-02-23 05:06:09 +0000 MFV: zlib 1.2.13. Relnotes: yes (cherry picked from commit e37bb444aa945ed0725766e986698a09bd61b1b2) --- sys/contrib/zlib/ChangeLog | 24 +++- sys/contrib/zlib/LICENSE | 22 ++++ sys/contrib/zlib/README | 4 +- sys/contrib/zlib/compress.c | 6 +- sys/contrib/zlib/contrib/README.contrib | 2 +- sys/contrib/zlib/crc32.c | 25 ++-- sys/contrib/zlib/deflate.c | 218 ++++++++++++++++---------------- sys/contrib/zlib/deflate.h | 4 +- sys/contrib/zlib/gzlib.c | 2 +- sys/contrib/zlib/gzread.c | 8 +- sys/contrib/zlib/gzwrite.c | 2 +- sys/contrib/zlib/infback.c | 17 ++- sys/contrib/zlib/inflate.c | 2 + sys/contrib/zlib/inftrees.c | 4 +- sys/contrib/zlib/inftrees.h | 2 +- sys/contrib/zlib/test/example.c | 3 +- sys/contrib/zlib/test/minigzip.c | 2 +- sys/contrib/zlib/trees.c | 123 +++++++++--------- sys/contrib/zlib/uncompr.c | 4 +- sys/contrib/zlib/zconf.h | 19 ++- sys/contrib/zlib/zconf.h.in | 19 ++- sys/contrib/zlib/zlib.3 | 4 +- sys/contrib/zlib/zlib.h | 20 +-- sys/contrib/zlib/zutil.c | 16 ++- sys/contrib/zlib/zutil.h | 1 + 25 files changed, 317 insertions(+), 236 deletions(-) diff --git a/sys/contrib/zlib/ChangeLog b/sys/contrib/zlib/ChangeLog index f0b0e6180921..457526bc6a51 100644 --- a/sys/contrib/zlib/ChangeLog +++ b/sys/contrib/zlib/ChangeLog @@ -1,6 +1,18 @@ ChangeLog file for zlib +Changes in 1.2.13 (13 Oct 2022) +- Fix configure issue that discarded provided CC definition +- Correct incorrect inputs provided to the CRC functions +- Repair prototypes and exporting of new CRC functions +- Fix inflateBack to detect invalid input with distances too far +- Have infback() deliver all of the available output up to any error +- Fix a bug when getting a gzip header extra field with inflate() +- Fix bug in block type selection when Z_FIXED used +- Tighten deflateBound bounds +- Remove deleted assembler code references +- Various portability and appearance improvements + Changes in 1.2.12 (27 Mar 2022) - Cygwin does not have _wopen(), so do not create gzopen_w() there - Permit a deflateParams() parameter change as soon as possible @@ -159,7 +171,7 @@ Changes in 1.2.7.1 (24 Mar 2013) - Fix types in contrib/minizip to match result of get_crc_table() - Simplify contrib/vstudio/vc10 with 'd' suffix - Add TOP support to win32/Makefile.msc -- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Support i686 and amd64 assembler builds in CMakeLists.txt - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h - Add vc11 and vc12 build files to contrib/vstudio - Add gzvprintf() as an undocumented function in zlib @@ -359,14 +371,14 @@ Changes in 1.2.5.1 (10 Sep 2011) - Use u4 type for crc_table to avoid conversion warnings - Apply casts in zlib.h to avoid conversion warnings - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] -- Improve inflateSync() documentation to note indeterminancy +- Improve inflateSync() documentation to note indeterminacy - Add deflatePending() function to return the amount of pending output - Correct the spelling of "specification" in FAQ [Randers-Pehrson] - Add a check in configure for stdarg.h, use for gzprintf() - Check that pointers fit in ints when gzprint() compiled old style - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] -- Add debug records in assmebler code [Londer] +- Add debug records in assembler code [Londer] - Update RFC references to use http://tools.ietf.org/html/... [Li] - Add --archs option, use of libtool to configure for Mac OS X [Borstel] @@ -1033,7 +1045,7 @@ Changes in 1.2.0.1 (17 March 2003) - Include additional header file on VMS for off_t typedef - Try to use _vsnprintf where it supplants vsprintf [Vollant] - Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to +- Enhance comments in zlib.h on what happens if gzprintf() tries to write more than 4095 bytes before compression - Remove unused state from inflateBackEnd() - Remove exit(0) from minigzip.c, example.c @@ -1211,7 +1223,7 @@ Changes in 1.0.9 (17 Feb 1998) - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) + the declaration of FAR (Gilles Vollant) - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) - read_buf buf parameter of type Bytef* instead of charf* - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) @@ -1567,7 +1579,7 @@ Changes in 0.4: - renamed deflateOptions as deflateInit2, call one or the other but not both - added the method parameter for deflateInit2 - added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting +- simplified considerably deflateInit and inflateInit by not supporting user-provided history buffer. This is supported only in deflateInit2 and inflateInit2 diff --git a/sys/contrib/zlib/LICENSE b/sys/contrib/zlib/LICENSE new file mode 100644 index 000000000000..ab8ee6f71428 --- /dev/null +++ b/sys/contrib/zlib/LICENSE @@ -0,0 +1,22 @@ +Copyright notice: + + (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu diff --git a/sys/contrib/zlib/README b/sys/contrib/zlib/README index 024b79d3d8c8..ba34d1894a9b 100644 --- a/sys/contrib/zlib/README +++ b/sys/contrib/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.12 is a general purpose data compression library. All the code is +zlib 1.2.13 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.12 are documented in the file ChangeLog. +The changes made in version 1.2.13 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . diff --git a/sys/contrib/zlib/compress.c b/sys/contrib/zlib/compress.c index e2db404abf88..2ad5326c14ec 100644 --- a/sys/contrib/zlib/compress.c +++ b/sys/contrib/zlib/compress.c @@ -19,7 +19,7 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) +int ZEXPORT compress2(dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) /* =========================================================================== */ -int ZEXPORT compress (dest, destLen, source, sourceLen) +int ZEXPORT compress(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ -uLong ZEXPORT compressBound (sourceLen) +uLong ZEXPORT compressBound(sourceLen) uLong sourceLen; { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + diff --git a/sys/contrib/zlib/contrib/README.contrib b/sys/contrib/zlib/contrib/README.contrib index 335e43508be2..5e5f95054090 100644 --- a/sys/contrib/zlib/contrib/README.contrib +++ b/sys/contrib/zlib/contrib/README.contrib @@ -1,4 +1,4 @@ -All files under this contrib directory are UNSUPPORTED. There were +All files under this contrib directory are UNSUPPORTED. They were provided by users of zlib and were not tested by the authors of zlib. Use at your own risk. Please contact the authors of the contributions for help about these, not the zlib authors. Thanks. diff --git a/sys/contrib/zlib/crc32.c b/sys/contrib/zlib/crc32.c index 451887bc7ce4..f8357b083f76 100644 --- a/sys/contrib/zlib/crc32.c +++ b/sys/contrib/zlib/crc32.c @@ -98,13 +98,22 @@ # endif #endif +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 +# define ARMCRC32 +#endif + /* Local functions. */ local z_crc_t multmodp OF((z_crc_t a, z_crc_t b)); local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); -/* If available, use the ARM processor CRC32 instruction. */ -#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 -# define ARMCRC32 +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) + local z_word_t byte_swap OF((z_word_t word)); +#endif + +#if defined(W) && !defined(ARMCRC32) + local z_crc_t crc_word OF((z_word_t data)); + local z_word_t crc_word_big OF((z_word_t data)); #endif #if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) @@ -645,8 +654,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) len &= 7; /* Do three interleaved CRCs to realize the throughput of one crc32x - instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three - CRCs are combined into a single CRC after each set of batches. */ + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ while (num >= 3 * Z_BATCH) { crc1 = 0; crc2 = 0; @@ -1086,7 +1095,7 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong crc2; z_off_t len2; { - return crc32_combine64(crc1, crc2, len2); + return crc32_combine64(crc1, crc2, (z_off64_t)len2); } /* ========================================================================= */ @@ -1103,11 +1112,11 @@ uLong ZEXPORT crc32_combine_gen64(len2) uLong ZEXPORT crc32_combine_gen(len2) z_off_t len2; { - return crc32_combine_gen64(len2); + return crc32_combine_gen64((z_off64_t)len2); } /* ========================================================================= */ -uLong crc32_combine_op(crc1, crc2, op) +uLong ZEXPORT crc32_combine_op(crc1, crc2, op) uLong crc1; uLong crc2; uLong op; diff --git a/sys/contrib/zlib/deflate.c b/sys/contrib/zlib/deflate.c index af9e4bcf2918..cffe335093d6 100644 --- a/sys/contrib/zlib/deflate.c +++ b/sys/contrib/zlib/deflate.c @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -87,13 +87,7 @@ local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV -# pragma message("Assembler code may have bugs -- use at your own risk") - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif #ifdef ZLIB_DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, @@ -160,7 +154,7 @@ local const config configuration_table[10] = { * characters, so that a running hash key can be computed from the previous * key instead of complete recalculation each time. */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) +#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== @@ -191,9 +185,9 @@ local const config configuration_table[10] = { */ #define CLEAR_HASH(s) \ do { \ - s->head[s->hash_size-1] = NIL; \ + s->head[s->hash_size - 1] = NIL; \ zmemzero((Bytef *)s->head, \ - (unsigned)(s->hash_size-1)*sizeof(*s->head)); \ + (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \ } while (0) /* =========================================================================== @@ -285,6 +279,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; + if (windowBits < -15) + return Z_STREAM_ERROR; windowBits = -windowBits; } #ifdef GZIP @@ -314,7 +310,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); @@ -340,11 +336,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, * sym_buf value to read moves forward three bytes. From that symbol, up to * 31 bits are written to pending_buf. The closest the written pending_buf * bits gets to the next sym_buf symbol to read is just before the last - * code is written. At that time, 31*(n-2) bits have been written, just - * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at - * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1 + * code is written. At that time, 31*(n - 2) bits have been written, just + * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at + * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1 * symbols are written.) The closest the writing gets to what is unread is - * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and + * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and * can range from 128 to 32768. * * Therefore, at a minimum, there are 142 bits of space between what is @@ -390,7 +386,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, /* ========================================================================= * Check for a valid deflate stream state. Return 0 if ok, 1 if not. */ -local int deflateStateCheck (strm) +local int deflateStateCheck(strm) z_streamp strm; { deflate_state *s; @@ -413,7 +409,7 @@ local int deflateStateCheck (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; @@ -482,7 +478,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) z_streamp strm; Bytef *dictionary; uInt *dictLength; @@ -504,7 +500,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) +int ZEXPORT deflateResetKeep(strm) z_streamp strm; { deflate_state *s; @@ -542,7 +538,7 @@ int ZEXPORT deflateResetKeep (strm) } /* ========================================================================= */ -int ZEXPORT deflateReset (strm) +int ZEXPORT deflateReset(strm) z_streamp strm; { int ret; @@ -554,7 +550,7 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) +int ZEXPORT deflateSetHeader(strm, head) z_streamp strm; gz_headerp head; { @@ -565,7 +561,7 @@ int ZEXPORT deflateSetHeader (strm, head) } /* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) +int ZEXPORT deflatePending(strm, pending, bits) unsigned *pending; int *bits; z_streamp strm; @@ -579,7 +575,7 @@ int ZEXPORT deflatePending (strm, pending, bits) } /* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) +int ZEXPORT deflatePrime(strm, bits, value) z_streamp strm; int bits; int value; @@ -674,36 +670,50 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) } /* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. + * For the default windowBits of 15 and memLevel of 8, this function returns a + * close to exact, as well as small, upper bound on the compressed size. This + * is an expansion of ~0.03%, plus a small constant. + * + * For any setting other than those defaults for windowBits and memLevel, one + * of two worst case bounds is returned. This is at most an expansion of ~4% or + * ~13%, plus a small constant. * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. + * Both the 0.03% and 4% derive from the overhead of stored blocks. The first + * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second + * is for stored blocks of 127 bytes (the worst case memLevel == 1). The + * expansion results from five bytes of header for each stored block. * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. + * The larger expansion of 13% results from a window size less than or equal to + * the symbols buffer size (windowBits <= memLevel + 7). In that case some of + * the data being compressed may have slid out of the sliding window, impeding + * a stored block from being emitted. Then the only choice is a fixed or + * dynamic block, where a fixed block limits the maximum expansion to 9 bits + * per 8-bit byte, plus 10 bits for every block. The smallest block size for + * which this can occur is 255 (memLevel == 2). + * + * Shifts are used to approximate divisions, for speed. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; - uLong complen, wraplen; + uLong fixedlen, storelen, wraplen; + + /* upper bound for fixed blocks with 9-bit literals and length 255 + (memLevel == 2, which is the lowest that may not use stored blocks) -- + ~13% overhead plus a small constant */ + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) + + (sourceLen >> 9) + 4; - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + /* upper bound for stored blocks with length 127 (memLevel == 1) -- + ~4% overhead plus a small constant */ + storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) + + (sourceLen >> 11) + 7; - /* if can't get parameters, return conservative bound plus zlib wrapper */ + /* if can't get parameters, return larger bound plus a zlib wrapper */ if (deflateStateCheck(strm)) - return complen + 6; + return (fixedlen > storelen ? fixedlen : storelen) + 6; /* compute wrapper length */ s = strm->state; @@ -740,11 +750,12 @@ uLong ZEXPORT deflateBound(strm, sourceLen) wraplen = 6; } - /* if not default parameters, return conservative bound */ + /* if not default parameters, return one of the conservative bounds */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; + return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen; - /* default settings: return tight bound for that case */ + /* default settings: return tight bound for that case -- ~0.03% overhead + plus a small constant */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } @@ -754,7 +765,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ -local void putShortMSB (s, b) +local void putShortMSB(s, b) deflate_state *s; uInt b; { @@ -801,7 +812,7 @@ local void flush_pending(strm) } while (0) /* ========================================================================= */ -int ZEXPORT deflate (strm, flush) +int ZEXPORT deflate(strm, flush) z_streamp strm; int flush; { @@ -856,7 +867,7 @@ int ZEXPORT deflate (strm, flush) s->status = BUSY_STATE; if (s->status == INIT_STATE) { /* zlib header */ - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) @@ -1116,7 +1127,7 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ -int ZEXPORT deflateEnd (strm) +int ZEXPORT deflateEnd(strm) z_streamp strm; { int status; @@ -1142,7 +1153,7 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ -int ZEXPORT deflateCopy (dest, source) +int ZEXPORT deflateCopy(dest, source) z_streamp dest; z_streamp source; { @@ -1231,7 +1242,7 @@ local unsigned read_buf(strm, buf, size) /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ -local void lm_init (s) +local void lm_init(s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; @@ -1252,11 +1263,6 @@ local void lm_init (s) s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif } #ifndef FASTEST @@ -1269,10 +1275,6 @@ local void lm_init (s) * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ @@ -1297,10 +1299,10 @@ local uInt longest_match(s, cur_match) */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); + register ush scan_end = *(ushf*)(scan + best_len - 1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end1 = scan[best_len - 1]; register Byte scan_end = scan[best_len]; #endif @@ -1318,7 +1320,8 @@ local uInt longest_match(s, cur_match) */ if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); @@ -1336,43 +1339,44 @@ local uInt longest_match(s, cur_match) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ - if (*(ushf*)(match+best_len-1) != scan_end || + if (*(ushf*)(match + best_len - 1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient + * strstart + 3, + 5, up to strstart + 257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + /* Here, scan <= window + strstart + 257 */ + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); if (*scan == *match) scan++; - len = (MAX_MATCH - 1) - (int)(strend-scan); + len = (MAX_MATCH - 1) - (int)(strend - scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; + if (match[best_len] != scan_end || + match[best_len - 1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1382,7 +1386,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1391,7 +1395,8 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; @@ -1403,9 +1408,9 @@ local uInt longest_match(s, cur_match) best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); + scan_end = *(ushf*)(scan + best_len - 1); #else - scan_end1 = scan[best_len-1]; + scan_end1 = scan[best_len - 1]; scan_end = scan[best_len]; #endif } @@ -1415,7 +1420,6 @@ local uInt longest_match(s, cur_match) if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } -#endif /* ASMV */ #else /* FASTEST */ @@ -1436,7 +1440,8 @@ local uInt longest_match(s, cur_match) */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); Assert(cur_match < s->strstart, "no future"); @@ -1446,7 +1451,7 @@ local uInt longest_match(s, cur_match) */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1456,7 +1461,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1465,7 +1470,7 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); @@ -1501,7 +1506,7 @@ local void check_match(s, start, match, length) z_error("invalid match"); } if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); + fprintf(stderr,"\\[%d,%d]", start - match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } @@ -1547,9 +1552,9 @@ local void fill_window(s) /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ - if (s->strstart >= wsize+MAX_DIST(s)) { + if (s->strstart >= wsize + MAX_DIST(s)) { - zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); + zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; @@ -1682,7 +1687,7 @@ local void fill_window(s) * * deflate_stored() is written to minimize the number of times an input byte is * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. + * maximizes the opportunities to have a single copy from next_in to next_out. */ local block_state deflate_stored(s, flush) deflate_state *s; @@ -1892,7 +1897,7 @@ local block_state deflate_fast(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1940,7 +1945,7 @@ local block_state deflate_fast(s, flush) s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); + UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif @@ -1951,7 +1956,7 @@ local block_state deflate_fast(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -1995,7 +2000,7 @@ local block_state deflate_slow(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -2037,17 +2042,17 @@ local block_state deflate_slow(s, flush) uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - check_match(s, s->strstart-1, s->prev_match, s->prev_length); + check_match(s, s->strstart - 1, s->prev_match, s->prev_length); - _tr_tally_dist(s, s->strstart -1 - s->prev_match, + _tr_tally_dist(s, s->strstart - 1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not + * strstart - 1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ - s->lookahead -= s->prev_length-1; + s->lookahead -= s->prev_length - 1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { @@ -2065,8 +2070,8 @@ local block_state deflate_slow(s, flush) * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } @@ -2084,8 +2089,8 @@ local block_state deflate_slow(s, flush) } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); s->match_available = 0; } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; @@ -2142,7 +2147,8 @@ local block_state deflate_rle(s, flush) if (s->match_length > s->lookahead) s->match_length = s->lookahead; } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (uInt)(s->window_size - 1), + "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ @@ -2157,7 +2163,7 @@ local block_state deflate_rle(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -2197,7 +2203,7 @@ local block_state deflate_huff(s, flush) /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); diff --git a/sys/contrib/zlib/deflate.h b/sys/contrib/zlib/deflate.h index 17c226113b08..1a06cd5f25d1 100644 --- a/sys/contrib/zlib/deflate.h +++ b/sys/contrib/zlib/deflate.h @@ -329,8 +329,8 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (uch)(length); \ ush dist = (ush)(distance); \ - s->sym_buf[s->sym_next++] = dist; \ - s->sym_buf[s->sym_next++] = dist >> 8; \ + s->sym_buf[s->sym_next++] = (uch)dist; \ + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \ s->sym_buf[s->sym_next++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ diff --git a/sys/contrib/zlib/gzlib.c b/sys/contrib/zlib/gzlib.c index 4637ea4a0524..93f4dbba1801 100644 --- a/sys/contrib/zlib/gzlib.c +++ b/sys/contrib/zlib/gzlib.c @@ -33,7 +33,7 @@ local gzFile gz_open OF((const void *, int, const char *)); The gz_strwinerror function does not change the current setting of GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) +char ZLIB_INTERNAL *gz_strwinerror(error) DWORD error; { static char buf[1024]; diff --git a/sys/contrib/zlib/gzread.c b/sys/contrib/zlib/gzread.c index a0d48949e681..3cc1f84ad690 100644 --- a/sys/contrib/zlib/gzread.c +++ b/sys/contrib/zlib/gzread.c @@ -160,11 +160,9 @@ local int gz_look(state) the output buffer is larger than the input buffer, which also assures space for gzungetc() */ state->x.next = state->out; - if (strm->avail_in) { - memcpy(state->x.next, strm->next_in, strm->avail_in); - state->x.have = strm->avail_in; - strm->avail_in = 0; - } + memcpy(state->x.next, strm->next_in, strm->avail_in); + state->x.have = strm->avail_in; + strm->avail_in = 0; state->how = COPY; state->direct = 1; return 0; diff --git a/sys/contrib/zlib/gzwrite.c b/sys/contrib/zlib/gzwrite.c index a02b87e565ed..5a9aebb6ff8d 100644 --- a/sys/contrib/zlib/gzwrite.c +++ b/sys/contrib/zlib/gzwrite.c @@ -477,7 +477,7 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) #else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, +int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) gzFile file; const char *format; diff --git a/sys/contrib/zlib/infback.c b/sys/contrib/zlib/infback.c index 3a1282bb88ce..ab9810070c09 100644 --- a/sys/contrib/zlib/infback.c +++ b/sys/contrib/zlib/infback.c @@ -66,6 +66,7 @@ int stream_size; state->window = window; state->wnext = 0; state->whave = 0; + state->sane = 1; return Z_OK; } @@ -605,25 +606,27 @@ void FAR *out_desc; break; case DONE: - /* inflate stream terminated properly -- write leftover output */ + /* inflate stream terminated properly */ ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; - default: /* can't happen, but makes compilers happy */ + default: + /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } - /* Return unused input */ + /* Write leftover output and return unused input */ inf_leave: + if (left < state->wsize) { *** 782 LINES SKIPPED *** From nobody Thu Feb 23 06:56:33 2023 X-Original-To: dev-commits-src-branches@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 4PMkMj5Vjdz3t5cf; Thu, 23 Feb 2023 06:56:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMkMj5D5hz3Kcp; Thu, 23 Feb 2023 06:56:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677135393; 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=AeS1UdWcd0VmDifuipSRq7IvdPJt8zwJgMcCUQB2kXc=; b=MUmJHW4ji2sEeVlFuogc6gBEURfdSTeKehcIXo1oXSVw0CScbiBeMpsHHYhLwNtWBilqHY Xho9avU9fyY6GLkaSIg/HOk34kCNeGi1DiT1mGY7HI5gYI//9yaYD4ThA6sQshjqsx3/PB P1wsYJjKHKltD5cf5vK37CR9GC/vsxCoueqWzqLy1N5Zj3tbKaH//DaPU7J+Pu/2Qjo9Ki l66VWQ0TjPFPdINU8lgC054IXe5aDCL5OWPOuIjItH+6zg4yeEgSrNNUzsQ9pFH3xS+r8J 3f+U2N5ForVG8+3yzZWAD3j9ATLqYH9pridlUsONpN1QfLNoMGoDRzpInyXxVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677135393; 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=AeS1UdWcd0VmDifuipSRq7IvdPJt8zwJgMcCUQB2kXc=; b=djVV/G9BzXhIynz/SvuGtLAXZUGNHFaUwjFEdvaQL0cMdxX8/EGYGinlXkenyFRUyWY4aa ez05tI/doWj6bslHH9KQf9spZZ4pOKQGVv0hSRyi/yxh2Xn1hjtHCSDPPzNsXmFQnVOKgR SXSIVBRPWnbwpLDBblCkUSu8biUPiDtiUPaD12RBPL0uLAcckspndclnxJTnF4D6K8KAlL I4z+qkZrGYyHZBDDaxJVts/8yxYX/RM/VQt91UVPwbfFYY7SDJWUqbIgEppWMzbTLqmAv4 FqbUtYPSGPVZEjAQhqnfihryQ+0R3cYMFPKzog4JBzv1NMbFj1ACMx+KAOVkwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677135393; a=rsa-sha256; cv=none; b=ReCwoXJnGnz6G7vk82JVrU55R9bQa7Q8NwtoXDHElj9EnivDeSvqgLibbEKJVfXYdT5LSF mIgIYSq+8VZ5bCcpghSowg8FOL+UkjZRZ+GLipXOfXqxzP/YXw449QaUQ4i3sxzlWSNG/E RSq6ijy875Czj+aRAMDUxzOlehi0UneJpAOGv3R5yaj18I+k4huWo/u75bWru3H1fxFIMv cg8Vcpksow4E4yllRyb56ugMucTFD2BpsprTFkUfsuNSTQ9ykm3c2FnZkyDtI9HyUJ4yZN UUvOlxnnw1cFyx1rGsCWEnh8VLLXGM0QDmAGZnHCgAMbdmH56SLxrjIEt+kRTA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMkMj4JsJzXGj; Thu, 23 Feb 2023 06:56:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31N6uXCG029344; Thu, 23 Feb 2023 06:56:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31N6uXHJ029343; Thu, 23 Feb 2023 06:56:33 GMT (envelope-from git) Date: Thu, 23 Feb 2023 06:56:33 GMT Message-Id: <202302230656.31N6uXHJ029343@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 16a1df8f2dac - releng/13.2 - MFV: zlib 1.2.13. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 16a1df8f2dace0d33fededc8f17afb87c9a8a9f6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=16a1df8f2dace0d33fededc8f17afb87c9a8a9f6 commit 16a1df8f2dace0d33fededc8f17afb87c9a8a9f6 Author: Xin LI AuthorDate: 2023-02-17 07:57:24 +0000 Commit: Xin LI CommitDate: 2023-02-23 06:56:20 +0000 MFV: zlib 1.2.13. Relnotes: yes Approved by: re (cperciva) (cherry picked from commit e37bb444aa945ed0725766e986698a09bd61b1b2) (cherry picked from commit 3a7d654ed82bc2b379549f8b2ac1e8ac6a638fa5) --- sys/contrib/zlib/ChangeLog | 24 +++- sys/contrib/zlib/LICENSE | 22 ++++ sys/contrib/zlib/README | 4 +- sys/contrib/zlib/compress.c | 6 +- sys/contrib/zlib/contrib/README.contrib | 2 +- sys/contrib/zlib/crc32.c | 25 ++-- sys/contrib/zlib/deflate.c | 218 ++++++++++++++++---------------- sys/contrib/zlib/deflate.h | 4 +- sys/contrib/zlib/gzlib.c | 2 +- sys/contrib/zlib/gzread.c | 8 +- sys/contrib/zlib/gzwrite.c | 2 +- sys/contrib/zlib/infback.c | 17 ++- sys/contrib/zlib/inflate.c | 2 + sys/contrib/zlib/inftrees.c | 4 +- sys/contrib/zlib/inftrees.h | 2 +- sys/contrib/zlib/test/example.c | 3 +- sys/contrib/zlib/test/minigzip.c | 2 +- sys/contrib/zlib/trees.c | 123 +++++++++--------- sys/contrib/zlib/uncompr.c | 4 +- sys/contrib/zlib/zconf.h | 19 ++- sys/contrib/zlib/zconf.h.in | 19 ++- sys/contrib/zlib/zlib.3 | 4 +- sys/contrib/zlib/zlib.h | 20 +-- sys/contrib/zlib/zutil.c | 16 ++- sys/contrib/zlib/zutil.h | 1 + 25 files changed, 317 insertions(+), 236 deletions(-) diff --git a/sys/contrib/zlib/ChangeLog b/sys/contrib/zlib/ChangeLog index f0b0e6180921..457526bc6a51 100644 --- a/sys/contrib/zlib/ChangeLog +++ b/sys/contrib/zlib/ChangeLog @@ -1,6 +1,18 @@ ChangeLog file for zlib +Changes in 1.2.13 (13 Oct 2022) +- Fix configure issue that discarded provided CC definition +- Correct incorrect inputs provided to the CRC functions +- Repair prototypes and exporting of new CRC functions +- Fix inflateBack to detect invalid input with distances too far +- Have infback() deliver all of the available output up to any error +- Fix a bug when getting a gzip header extra field with inflate() +- Fix bug in block type selection when Z_FIXED used +- Tighten deflateBound bounds +- Remove deleted assembler code references +- Various portability and appearance improvements + Changes in 1.2.12 (27 Mar 2022) - Cygwin does not have _wopen(), so do not create gzopen_w() there - Permit a deflateParams() parameter change as soon as possible @@ -159,7 +171,7 @@ Changes in 1.2.7.1 (24 Mar 2013) - Fix types in contrib/minizip to match result of get_crc_table() - Simplify contrib/vstudio/vc10 with 'd' suffix - Add TOP support to win32/Makefile.msc -- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Support i686 and amd64 assembler builds in CMakeLists.txt - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h - Add vc11 and vc12 build files to contrib/vstudio - Add gzvprintf() as an undocumented function in zlib @@ -359,14 +371,14 @@ Changes in 1.2.5.1 (10 Sep 2011) - Use u4 type for crc_table to avoid conversion warnings - Apply casts in zlib.h to avoid conversion warnings - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] -- Improve inflateSync() documentation to note indeterminancy +- Improve inflateSync() documentation to note indeterminacy - Add deflatePending() function to return the amount of pending output - Correct the spelling of "specification" in FAQ [Randers-Pehrson] - Add a check in configure for stdarg.h, use for gzprintf() - Check that pointers fit in ints when gzprint() compiled old style - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] -- Add debug records in assmebler code [Londer] +- Add debug records in assembler code [Londer] - Update RFC references to use http://tools.ietf.org/html/... [Li] - Add --archs option, use of libtool to configure for Mac OS X [Borstel] @@ -1033,7 +1045,7 @@ Changes in 1.2.0.1 (17 March 2003) - Include additional header file on VMS for off_t typedef - Try to use _vsnprintf where it supplants vsprintf [Vollant] - Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to +- Enhance comments in zlib.h on what happens if gzprintf() tries to write more than 4095 bytes before compression - Remove unused state from inflateBackEnd() - Remove exit(0) from minigzip.c, example.c @@ -1211,7 +1223,7 @@ Changes in 1.0.9 (17 Feb 1998) - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) + the declaration of FAR (Gilles Vollant) - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) - read_buf buf parameter of type Bytef* instead of charf* - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) @@ -1567,7 +1579,7 @@ Changes in 0.4: - renamed deflateOptions as deflateInit2, call one or the other but not both - added the method parameter for deflateInit2 - added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting +- simplified considerably deflateInit and inflateInit by not supporting user-provided history buffer. This is supported only in deflateInit2 and inflateInit2 diff --git a/sys/contrib/zlib/LICENSE b/sys/contrib/zlib/LICENSE new file mode 100644 index 000000000000..ab8ee6f71428 --- /dev/null +++ b/sys/contrib/zlib/LICENSE @@ -0,0 +1,22 @@ +Copyright notice: + + (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu diff --git a/sys/contrib/zlib/README b/sys/contrib/zlib/README index 024b79d3d8c8..ba34d1894a9b 100644 --- a/sys/contrib/zlib/README +++ b/sys/contrib/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.12 is a general purpose data compression library. All the code is +zlib 1.2.13 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.12 are documented in the file ChangeLog. +The changes made in version 1.2.13 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . diff --git a/sys/contrib/zlib/compress.c b/sys/contrib/zlib/compress.c index e2db404abf88..2ad5326c14ec 100644 --- a/sys/contrib/zlib/compress.c +++ b/sys/contrib/zlib/compress.c @@ -19,7 +19,7 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) +int ZEXPORT compress2(dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) /* =========================================================================== */ -int ZEXPORT compress (dest, destLen, source, sourceLen) +int ZEXPORT compress(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ -uLong ZEXPORT compressBound (sourceLen) +uLong ZEXPORT compressBound(sourceLen) uLong sourceLen; { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + diff --git a/sys/contrib/zlib/contrib/README.contrib b/sys/contrib/zlib/contrib/README.contrib index 335e43508be2..5e5f95054090 100644 --- a/sys/contrib/zlib/contrib/README.contrib +++ b/sys/contrib/zlib/contrib/README.contrib @@ -1,4 +1,4 @@ -All files under this contrib directory are UNSUPPORTED. There were +All files under this contrib directory are UNSUPPORTED. They were provided by users of zlib and were not tested by the authors of zlib. Use at your own risk. Please contact the authors of the contributions for help about these, not the zlib authors. Thanks. diff --git a/sys/contrib/zlib/crc32.c b/sys/contrib/zlib/crc32.c index 382b9a322fda..7b0e60462dda 100644 --- a/sys/contrib/zlib/crc32.c +++ b/sys/contrib/zlib/crc32.c @@ -98,13 +98,22 @@ # endif #endif +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 +# define ARMCRC32 +#endif + /* Local functions. */ local z_crc_t multmodp OF((z_crc_t a, z_crc_t b)); local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); -/* If available, use the ARM processor CRC32 instruction. */ -#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 -# define ARMCRC32 +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) + local z_word_t byte_swap OF((z_word_t word)); +#endif + +#if defined(W) && !defined(ARMCRC32) + local z_crc_t crc_word OF((z_word_t data)); + local z_word_t crc_word_big OF((z_word_t data)); #endif #if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) @@ -647,8 +656,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) len &= 7; /* Do three interleaved CRCs to realize the throughput of one crc32x - instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three - CRCs are combined into a single CRC after each set of batches. */ + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ while (num >= 3 * Z_BATCH) { crc1 = 0; crc2 = 0; @@ -1092,7 +1101,7 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong crc2; z_off_t len2; { - return crc32_combine64(crc1, crc2, len2); + return crc32_combine64(crc1, crc2, (z_off64_t)len2); } /* ========================================================================= */ @@ -1109,11 +1118,11 @@ uLong ZEXPORT crc32_combine_gen64(len2) uLong ZEXPORT crc32_combine_gen(len2) z_off_t len2; { - return crc32_combine_gen64(len2); + return crc32_combine_gen64((z_off64_t)len2); } /* ========================================================================= */ -uLong crc32_combine_op(crc1, crc2, op) +uLong ZEXPORT crc32_combine_op(crc1, crc2, op) uLong crc1; uLong crc2; uLong op; diff --git a/sys/contrib/zlib/deflate.c b/sys/contrib/zlib/deflate.c index af9e4bcf2918..cffe335093d6 100644 --- a/sys/contrib/zlib/deflate.c +++ b/sys/contrib/zlib/deflate.c @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -87,13 +87,7 @@ local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV -# pragma message("Assembler code may have bugs -- use at your own risk") - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif #ifdef ZLIB_DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, @@ -160,7 +154,7 @@ local const config configuration_table[10] = { * characters, so that a running hash key can be computed from the previous * key instead of complete recalculation each time. */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) +#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== @@ -191,9 +185,9 @@ local const config configuration_table[10] = { */ #define CLEAR_HASH(s) \ do { \ - s->head[s->hash_size-1] = NIL; \ + s->head[s->hash_size - 1] = NIL; \ zmemzero((Bytef *)s->head, \ - (unsigned)(s->hash_size-1)*sizeof(*s->head)); \ + (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \ } while (0) /* =========================================================================== @@ -285,6 +279,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; + if (windowBits < -15) + return Z_STREAM_ERROR; windowBits = -windowBits; } #ifdef GZIP @@ -314,7 +310,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); @@ -340,11 +336,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, * sym_buf value to read moves forward three bytes. From that symbol, up to * 31 bits are written to pending_buf. The closest the written pending_buf * bits gets to the next sym_buf symbol to read is just before the last - * code is written. At that time, 31*(n-2) bits have been written, just - * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at - * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1 + * code is written. At that time, 31*(n - 2) bits have been written, just + * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at + * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1 * symbols are written.) The closest the writing gets to what is unread is - * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and + * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and * can range from 128 to 32768. * * Therefore, at a minimum, there are 142 bits of space between what is @@ -390,7 +386,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, /* ========================================================================= * Check for a valid deflate stream state. Return 0 if ok, 1 if not. */ -local int deflateStateCheck (strm) +local int deflateStateCheck(strm) z_streamp strm; { deflate_state *s; @@ -413,7 +409,7 @@ local int deflateStateCheck (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; @@ -482,7 +478,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) z_streamp strm; Bytef *dictionary; uInt *dictLength; @@ -504,7 +500,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) +int ZEXPORT deflateResetKeep(strm) z_streamp strm; { deflate_state *s; @@ -542,7 +538,7 @@ int ZEXPORT deflateResetKeep (strm) } /* ========================================================================= */ -int ZEXPORT deflateReset (strm) +int ZEXPORT deflateReset(strm) z_streamp strm; { int ret; @@ -554,7 +550,7 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) +int ZEXPORT deflateSetHeader(strm, head) z_streamp strm; gz_headerp head; { @@ -565,7 +561,7 @@ int ZEXPORT deflateSetHeader (strm, head) } /* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) +int ZEXPORT deflatePending(strm, pending, bits) unsigned *pending; int *bits; z_streamp strm; @@ -579,7 +575,7 @@ int ZEXPORT deflatePending (strm, pending, bits) } /* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) +int ZEXPORT deflatePrime(strm, bits, value) z_streamp strm; int bits; int value; @@ -674,36 +670,50 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) } /* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. + * For the default windowBits of 15 and memLevel of 8, this function returns a + * close to exact, as well as small, upper bound on the compressed size. This + * is an expansion of ~0.03%, plus a small constant. + * + * For any setting other than those defaults for windowBits and memLevel, one + * of two worst case bounds is returned. This is at most an expansion of ~4% or + * ~13%, plus a small constant. * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. + * Both the 0.03% and 4% derive from the overhead of stored blocks. The first + * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second + * is for stored blocks of 127 bytes (the worst case memLevel == 1). The + * expansion results from five bytes of header for each stored block. * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. + * The larger expansion of 13% results from a window size less than or equal to + * the symbols buffer size (windowBits <= memLevel + 7). In that case some of + * the data being compressed may have slid out of the sliding window, impeding + * a stored block from being emitted. Then the only choice is a fixed or + * dynamic block, where a fixed block limits the maximum expansion to 9 bits + * per 8-bit byte, plus 10 bits for every block. The smallest block size for + * which this can occur is 255 (memLevel == 2). + * + * Shifts are used to approximate divisions, for speed. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; - uLong complen, wraplen; + uLong fixedlen, storelen, wraplen; + + /* upper bound for fixed blocks with 9-bit literals and length 255 + (memLevel == 2, which is the lowest that may not use stored blocks) -- + ~13% overhead plus a small constant */ + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) + + (sourceLen >> 9) + 4; - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + /* upper bound for stored blocks with length 127 (memLevel == 1) -- + ~4% overhead plus a small constant */ + storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) + + (sourceLen >> 11) + 7; - /* if can't get parameters, return conservative bound plus zlib wrapper */ + /* if can't get parameters, return larger bound plus a zlib wrapper */ if (deflateStateCheck(strm)) - return complen + 6; + return (fixedlen > storelen ? fixedlen : storelen) + 6; /* compute wrapper length */ s = strm->state; @@ -740,11 +750,12 @@ uLong ZEXPORT deflateBound(strm, sourceLen) wraplen = 6; } - /* if not default parameters, return conservative bound */ + /* if not default parameters, return one of the conservative bounds */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; + return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen; - /* default settings: return tight bound for that case */ + /* default settings: return tight bound for that case -- ~0.03% overhead + plus a small constant */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } @@ -754,7 +765,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ -local void putShortMSB (s, b) +local void putShortMSB(s, b) deflate_state *s; uInt b; { @@ -801,7 +812,7 @@ local void flush_pending(strm) } while (0) /* ========================================================================= */ -int ZEXPORT deflate (strm, flush) +int ZEXPORT deflate(strm, flush) z_streamp strm; int flush; { @@ -856,7 +867,7 @@ int ZEXPORT deflate (strm, flush) s->status = BUSY_STATE; if (s->status == INIT_STATE) { /* zlib header */ - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) @@ -1116,7 +1127,7 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ -int ZEXPORT deflateEnd (strm) +int ZEXPORT deflateEnd(strm) z_streamp strm; { int status; @@ -1142,7 +1153,7 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ -int ZEXPORT deflateCopy (dest, source) +int ZEXPORT deflateCopy(dest, source) z_streamp dest; z_streamp source; { @@ -1231,7 +1242,7 @@ local unsigned read_buf(strm, buf, size) /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ -local void lm_init (s) +local void lm_init(s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; @@ -1252,11 +1263,6 @@ local void lm_init (s) s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif } #ifndef FASTEST @@ -1269,10 +1275,6 @@ local void lm_init (s) * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ @@ -1297,10 +1299,10 @@ local uInt longest_match(s, cur_match) */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); + register ush scan_end = *(ushf*)(scan + best_len - 1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end1 = scan[best_len - 1]; register Byte scan_end = scan[best_len]; #endif @@ -1318,7 +1320,8 @@ local uInt longest_match(s, cur_match) */ if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); @@ -1336,43 +1339,44 @@ local uInt longest_match(s, cur_match) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ - if (*(ushf*)(match+best_len-1) != scan_end || + if (*(ushf*)(match + best_len - 1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient + * strstart + 3, + 5, up to strstart + 257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + /* Here, scan <= window + strstart + 257 */ + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); if (*scan == *match) scan++; - len = (MAX_MATCH - 1) - (int)(strend-scan); + len = (MAX_MATCH - 1) - (int)(strend - scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; + if (match[best_len] != scan_end || + match[best_len - 1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1382,7 +1386,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1391,7 +1395,8 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; @@ -1403,9 +1408,9 @@ local uInt longest_match(s, cur_match) best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); + scan_end = *(ushf*)(scan + best_len - 1); #else - scan_end1 = scan[best_len-1]; + scan_end1 = scan[best_len - 1]; scan_end = scan[best_len]; #endif } @@ -1415,7 +1420,6 @@ local uInt longest_match(s, cur_match) if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } -#endif /* ASMV */ #else /* FASTEST */ @@ -1436,7 +1440,8 @@ local uInt longest_match(s, cur_match) */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); Assert(cur_match < s->strstart, "no future"); @@ -1446,7 +1451,7 @@ local uInt longest_match(s, cur_match) */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1456,7 +1461,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1465,7 +1470,7 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); @@ -1501,7 +1506,7 @@ local void check_match(s, start, match, length) z_error("invalid match"); } if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); + fprintf(stderr,"\\[%d,%d]", start - match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } @@ -1547,9 +1552,9 @@ local void fill_window(s) /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ - if (s->strstart >= wsize+MAX_DIST(s)) { + if (s->strstart >= wsize + MAX_DIST(s)) { - zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); + zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; @@ -1682,7 +1687,7 @@ local void fill_window(s) * * deflate_stored() is written to minimize the number of times an input byte is * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. + * maximizes the opportunities to have a single copy from next_in to next_out. */ local block_state deflate_stored(s, flush) deflate_state *s; @@ -1892,7 +1897,7 @@ local block_state deflate_fast(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1940,7 +1945,7 @@ local block_state deflate_fast(s, flush) s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); + UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif @@ -1951,7 +1956,7 @@ local block_state deflate_fast(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -1995,7 +2000,7 @@ local block_state deflate_slow(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -2037,17 +2042,17 @@ local block_state deflate_slow(s, flush) uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - check_match(s, s->strstart-1, s->prev_match, s->prev_length); + check_match(s, s->strstart - 1, s->prev_match, s->prev_length); - _tr_tally_dist(s, s->strstart -1 - s->prev_match, + _tr_tally_dist(s, s->strstart - 1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not + * strstart - 1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ - s->lookahead -= s->prev_length-1; + s->lookahead -= s->prev_length - 1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { @@ -2065,8 +2070,8 @@ local block_state deflate_slow(s, flush) * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } @@ -2084,8 +2089,8 @@ local block_state deflate_slow(s, flush) } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); s->match_available = 0; } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; @@ -2142,7 +2147,8 @@ local block_state deflate_rle(s, flush) if (s->match_length > s->lookahead) s->match_length = s->lookahead; } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (uInt)(s->window_size - 1), + "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ @@ -2157,7 +2163,7 @@ local block_state deflate_rle(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -2197,7 +2203,7 @@ local block_state deflate_huff(s, flush) /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); diff --git a/sys/contrib/zlib/deflate.h b/sys/contrib/zlib/deflate.h index 17c226113b08..1a06cd5f25d1 100644 --- a/sys/contrib/zlib/deflate.h +++ b/sys/contrib/zlib/deflate.h @@ -329,8 +329,8 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (uch)(length); \ ush dist = (ush)(distance); \ - s->sym_buf[s->sym_next++] = dist; \ - s->sym_buf[s->sym_next++] = dist >> 8; \ + s->sym_buf[s->sym_next++] = (uch)dist; \ + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \ s->sym_buf[s->sym_next++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ diff --git a/sys/contrib/zlib/gzlib.c b/sys/contrib/zlib/gzlib.c index 9370974647b4..40830201e4e9 100644 --- a/sys/contrib/zlib/gzlib.c +++ b/sys/contrib/zlib/gzlib.c @@ -34,7 +34,7 @@ local gzFile gz_open OF((const void *, int, const char *)); The gz_strwinerror function does not change the current setting of GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) +char ZLIB_INTERNAL *gz_strwinerror(error) DWORD error; { static char buf[1024]; diff --git a/sys/contrib/zlib/gzread.c b/sys/contrib/zlib/gzread.c index a0d48949e681..3cc1f84ad690 100644 --- a/sys/contrib/zlib/gzread.c +++ b/sys/contrib/zlib/gzread.c @@ -160,11 +160,9 @@ local int gz_look(state) the output buffer is larger than the input buffer, which also assures space for gzungetc() */ state->x.next = state->out; - if (strm->avail_in) { - memcpy(state->x.next, strm->next_in, strm->avail_in); - state->x.have = strm->avail_in; - strm->avail_in = 0; - } + memcpy(state->x.next, strm->next_in, strm->avail_in); + state->x.have = strm->avail_in; + strm->avail_in = 0; state->how = COPY; state->direct = 1; return 0; diff --git a/sys/contrib/zlib/gzwrite.c b/sys/contrib/zlib/gzwrite.c index a02b87e565ed..5a9aebb6ff8d 100644 --- a/sys/contrib/zlib/gzwrite.c +++ b/sys/contrib/zlib/gzwrite.c @@ -477,7 +477,7 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) #else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, +int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) gzFile file; const char *format; diff --git a/sys/contrib/zlib/infback.c b/sys/contrib/zlib/infback.c index 3a1282bb88ce..ab9810070c09 100644 --- a/sys/contrib/zlib/infback.c +++ b/sys/contrib/zlib/infback.c @@ -66,6 +66,7 @@ int stream_size; state->window = window; state->wnext = 0; state->whave = 0; + state->sane = 1; return Z_OK; } @@ -605,25 +606,27 @@ void FAR *out_desc; break; case DONE: - /* inflate stream terminated properly -- write leftover output */ + /* inflate stream terminated properly */ ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; - default: /* can't happen, but makes compilers happy */ + default: + /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } - /* Return unused input */ + /* Write leftover output and return unused input */ *** 784 LINES SKIPPED *** From nobody Thu Feb 23 15:36:26 2023 X-Original-To: dev-commits-src-branches@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 4PMxvb0yyWz3s7q5; Thu, 23 Feb 2023 15:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMxvb0Pdjz3Hk9; Thu, 23 Feb 2023 15:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677166587; 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=tiaN5MgJ9ic80Yz2YACe7w1lBcI4yIW0gei95aWw+c4=; b=OaCTIsvoCtbAEP3bn328q1J7VLnsNCjW3X5JUmWh42JyVjdknIU3Yg1AYTLNtScaKnVhJq HBse/PeHj+RODml4PGOJD0NxOTxFKG9uUR/9jZbvggzyywtJS5Jl8KGsiGr6XEGQDDXUAu Vmtl5aPCwD1UAjxXzwDD3xDjqS2U8LeOryv0NesrdOGNNG+yZyE9q1XS/7w4W/UysqoLdE 9x/4XfFaBFPuCs4o2rx8rSwbYQn1mb5qr15c61kvAN70Bwn0KVD00mDV4j0NfOwBefrEek RHFEXCYCKev3r120iVJKv8iP/S6JtEVQy2mKKTueIGRJLlxDnw101wXMozcfsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677166587; 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=tiaN5MgJ9ic80Yz2YACe7w1lBcI4yIW0gei95aWw+c4=; b=ScR+gaJRAB3lO51aucDUwJfzMWvjKCkesTnJxMs19XBk9HRjAw4Gp/S1J3qXLWWPiE9iwb XJ8LhnxZS5TGvO49skgeEdDRfYJfIRaBOqvwcln/CqqHbFvPVo4nTHFNTyPg3rhEJMx3xj VNmMz8mmXq9Kl+CO+AobsJcBl8IrfQ7rDNY7O5bAhDqND59rMnPKYpOaEeq5fsfPP4nfIO E1Nh5OUxm+2r6AllHVMJ0o1bxWmG7AOziMlfb/th9ul9/UOJOpD+5dvl4OpCRpDSnINxvW fBzQjLjQFQ8vQg1FiRn7xQenLdjOnMJe6aiOUXiX6T8UKv2A7b5g7q5LsXWeMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677166587; a=rsa-sha256; cv=none; b=sbF6bPdmZPzrpvj5E6LcXjHHoN/FJ5Vkg077i3GTewvyg/ZDjFcfMXWg+JW5ng6J8+kGo6 F6I9p14Zf6Ni9492SUBSdqC9gq6Pz/kqMoIgkOCuzilkhD+nKrCDYdPPcrT9/4ZSq2EpVi fVfYFtFD4nKwb8qWwwo0Ied4pZUPJd3InblZGrjfn5hHRjvsyGjM5E3m12maT0lzWVMsSO BZIvPFVNVCLm6lpW/zORSKGUZc4OjH4jXFinXs1is94v7frpJgHy7Mglr3pSAtZ3J5uD74 Xd9N/TjRuXvte4adJyMKzVOkhxwwgPUgUeE7j2EOH5jHVuWsG8NCY7J0nTy1DQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMxvZ6CSczn3n; Thu, 23 Feb 2023 15:36:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NFaQ4h075083; Thu, 23 Feb 2023 15:36:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NFaQPx075082; Thu, 23 Feb 2023 15:36:26 GMT (envelope-from git) Date: Thu, 23 Feb 2023 15:36:26 GMT Message-Id: <202302231536.31NFaQPx075082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 577a666c3c33 - stable/13 - vmm: Fix AP startup compatibility for old bhyve executables List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 577a666c3c33def1d4b996575dc43f8567fdac5c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=577a666c3c33def1d4b996575dc43f8567fdac5c commit 577a666c3c33def1d4b996575dc43f8567fdac5c Author: Mark Johnston AuthorDate: 2023-02-09 20:52:35 +0000 Commit: Mark Johnston CommitDate: 2023-02-23 15:15:47 +0000 vmm: Fix AP startup compatibility for old bhyve executables These changes unbreak AP startup when using a 13.1-RELEASE bhyve executable with a newer kernel: - Correct the destination mask for the VM_EXITCODE_IPI message generated by an INIT or STARTUP IPI in vlapic_icrlo_write_handler(). - Only initialize vlapics on active vCPUs. 13.1-RELEASE bhyve activates AP vCPUs only after the BSP starts them with an IPI, and vmm now allocates vcpu structures lazily, so the STARTUP handling in vm_handle_ipi() could trigger a page fault. - Fix an off-by-one setting the vcpuid in a VM_EXITCODE_SPINUP_AP message. Fixes: 7c326ab5bb9a ("vmm: don't lock a mtx in the icr_low write handler") Reviewed by: jhb, corvink MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38446 (cherry picked from commit b265a2e0d76422f4007e96dd7295ed0aeb846e2d) --- sys/amd64/vmm/io/vlapic.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index a68c68073893..884e232b1422 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -1144,7 +1144,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) vmexit->exitcode = VM_EXITCODE_IPI; vmexit->u.ipi.mode = mode; vmexit->u.ipi.vector = vec; - vmexit->u.ipi.dmask = dmask; + vmexit->u.ipi.dmask = ipimask; *retu = true; } @@ -1169,16 +1169,22 @@ vm_handle_ipi(struct vcpu *vcpu, struct vm_exit *vme, bool *retu) *retu = true; switch (vme->u.ipi.mode) { - case APIC_DELMODE_INIT: - vm_smp_rendezvous(vcpu, *dmask, vlapic_handle_init, - NULL); + case APIC_DELMODE_INIT: { + cpuset_t active, reinit; + + active = vm_active_cpus(vcpu_vm(vcpu)); + CPU_AND(&reinit, &active, dmask); + if (!CPU_EMPTY(&reinit)) { + vm_smp_rendezvous(vcpu, reinit, vlapic_handle_init, + NULL); + } vm_await_start(vcpu_vm(vcpu), dmask); - if (!vlapic->ipi_exit) { + if (!vlapic->ipi_exit) *retu = false; - } break; + } case APIC_DELMODE_STARTUP: /* * Ignore SIPIs in any state other than wait-for-SIPI @@ -1196,13 +1202,13 @@ vm_handle_ipi(struct vcpu *vcpu, struct vm_exit *vme, bool *retu) */ if (!vlapic->ipi_exit) { vme->exitcode = VM_EXITCODE_SPINUP_AP; - vme->u.spinup_ap.vcpu = CPU_FFS(dmask); + vme->u.spinup_ap.vcpu = CPU_FFS(dmask) - 1; vme->u.spinup_ap.rip = vec << PAGE_SHIFT; } break; default: - return (1); + __assert_unreachable(); } return (0); From nobody Thu Feb 23 17:06:59 2023 X-Original-To: dev-commits-src-branches@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 4PMzw43DQsz3sFMZ; Thu, 23 Feb 2023 17:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMzw42PfVz3kNq; Thu, 23 Feb 2023 17:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677172020; 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=5nYALF20+noAEeHK0xOu8Izlxq0M/Jp+hPjIEZMDJxU=; b=SgNlrHEvomMoz2h/ubQmZBtOMDcpMfPeGkQHnIa1HBMN4Dozcd8faVEwMWsbEmurFJ91Re KOea2MQiOJURLcWuncva9uI9gANNvZP5FiNxDYw4C2lq9G70aaY5q0OYGuT3ROSCVhQ//S D+6XCok70FDfBB0wVr5M4r2vc6fpA8ZHdkeZo3dQcvkK9lF5GZObHk2/c+kK+XzK5KzUDD B7UweUJfeeKqgKzBLJrjQun5XpKxybIe1qtfJlOSxxEF2T7Hd1EHKPLDowpxv0jXpffwBy ZGPaiCrBXlFx0UAjTBSP7guX08zaKY5iCSCgp8JagH4vq6iDiVjgoJYYMKS/QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677172020; 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=5nYALF20+noAEeHK0xOu8Izlxq0M/Jp+hPjIEZMDJxU=; b=r6YTmHDJ0o2f8Xw2TCnAd5+l4Vf6rOFER+mWR97/yT9MwpmNPszTelk0rAfZzuOd+DnMha ioYp4eiNwdhXdBmDZXb2BAjtyctHxFynwMAmXkHCI5xv63Idc8Zyz3iIRmWcRHkdpcBBm5 ECGPktgTQDLzlFS0hm4DZriHSAKky4iwUDwXquXpCv2YBBhlMqC5zP7d9y1Y1yV2AJomjk KlMU7f4CWvfUaiL0LWfmjj48sta7oO+3qLUSI5KW5HFs1gvLrP2DFzxzX1/lwfjBVqIi1S qUxdf0MS5FTVb3LgBJYHvjZnJbKBLOdaM2uIvMn7JF1Ftf9g2h6QGsocHFoIOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677172020; a=rsa-sha256; cv=none; b=VbGFc88Mux5Uj3yIB1c8vdAIRGNc14uuW8ZLga7CFhghslFGuEwlTAZMZRO0J/Z0kbuM9Q papWRJJoHBJRoAudYapGQFhT8ykcTYFAKLF7zQbXRVsDQKpYpkE8qCj18TZyMcLk3OhU+f 8CcsrKQgkJisnQHA4JLc0dOazSNEIq0e+bhdxjozuwUg7ikWvP5bTcS+twKFiYn9A7zHKH 4cAWT7R3W5eesoMDgUnLfV6HVEZpI8hwJvLEneguejPRIazUb1n+r714u4aPkegovuYAjy 6iEYUEXxToUMDvqmLExCleNUuH9Bh/WxttklXRKX6//pBPrwQE2RzS2nbf54Pg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMzw41PlPzqfZ; Thu, 23 Feb 2023 17:06:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NH6xIo005398; Thu, 23 Feb 2023 17:06:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NH6xqS005397; Thu, 23 Feb 2023 17:06:59 GMT (envelope-from git) Date: Thu, 23 Feb 2023 17:06:59 GMT Message-Id: <202302231706.31NH6xqS005397@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 31f9db72a35b - stable/13 - Add nproc(1) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 31f9db72a35bb20ad01d792eaaa1d6048252ab38 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=31f9db72a35bb20ad01d792eaaa1d6048252ab38 commit 31f9db72a35bb20ad01d792eaaa1d6048252ab38 Author: Mateusz Guzik AuthorDate: 2023-02-04 23:33:48 +0000 Commit: Mateusz Guzik CommitDate: 2023-02-23 17:06:41 +0000 Add nproc(1) This program prints the number of CPU threads it can run on, while respecting cpusets (or not, depending on switches). It aims to be compatible with nproc as found in GNU coreutils. Reviewed by: des Reviewed by: pstef Differential Revision: https://reviews.freebsd.org/D38386 (cherry picked from commit 48bfd3597654490cdc43bf0f591a539d3a28b590) --- bin/Makefile | 1 + bin/nproc/Makefile | 4 ++ bin/nproc/nproc.1 | 54 ++++++++++++++++++++ bin/nproc/nproc.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++ usr.bin/cpuset/cpuset.1 | 1 + 5 files changed, 192 insertions(+) diff --git a/bin/Makefile b/bin/Makefile index cdd96d0b84e8..83bf79dcb9f9 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -24,6 +24,7 @@ SUBDIR= cat \ ls \ mkdir \ mv \ + nproc \ pax \ pkill \ ps \ diff --git a/bin/nproc/Makefile b/bin/nproc/Makefile new file mode 100644 index 000000000000..2a57083b9d40 --- /dev/null +++ b/bin/nproc/Makefile @@ -0,0 +1,4 @@ +PACKAGE=runtime +PROG= nproc + +.include diff --git a/bin/nproc/nproc.1 b/bin/nproc/nproc.1 new file mode 100644 index 000000000000..ae252fe0f50c --- /dev/null +++ b/bin/nproc/nproc.1 @@ -0,0 +1,54 @@ +.\"- +.\" * Copyright (c) 2023 Piotr PaweÅ‚ Stefaniak +.\" +.\" * SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd February 5, 2023 +.Dt NPROC 1 +.Os +.Sh NAME +.Nm nproc +.Nd print the number of processors +.Sh SYNOPSIS +.Nm +.Op Fl -all +.Op Fl -ignore Ns = Ns Ar count +.Nm Fl -help +.Nm Fl -version +.Sh DESCRIPTION +The +.Nm +utility is used to print the number of processors limited to the +.Xr cpuset 2 +of the current process, unless the +.Fl -all +flag is specified. +.Pp +The available flags are: +.Bl -tag -width Ds +.It Fl -all +Count all processors currently online. +.It Fl -ignore Ns = Ns Ar count +The result is decreased by +.Ar count , +but never below 1. +.It Fl -version +Print the current program version and exit. Don't use this option. +.It Fl -help +Print usage information and exit. +.El +.Sh COMPATIBILITY +This program is intended to be compatible with nproc as found in GNU coreutils. +.Sh SEE ALSO +.Xr cpuset 1 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 14.0 . +.Sh AUTHORS +.An -nosplit +.An Mateusz Guzik Aq Mt mjg@FreeBSD.org +wrote the program and +.An Piotr PaweÅ‚ Stefaniak Aq Mt pstef@FreeBSD.org +wrote this page. diff --git a/bin/nproc/nproc.c b/bin/nproc/nproc.c new file mode 100644 index 000000000000..9037c74dbfff --- /dev/null +++ b/bin/nproc/nproc.c @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 2023 Mateusz Guzik + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * This program is intended to be compatible with nproc as found in GNU + * coreutils. + * + * In order to maintain that, do not add any features here if they are not + * present in said program. If you are looking for anything more advanced you + * probably should patch cpuset(1) instead. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OPT_ALL (CHAR_MAX + 1) +#define OPT_IGNORE (CHAR_MAX + 2) +#define OPT_VERSION (CHAR_MAX + 3) +#define OPT_HELP (CHAR_MAX + 4) + +static struct option long_opts[] = { + { "all", no_argument, NULL, OPT_ALL }, + { "ignore", required_argument, NULL, OPT_IGNORE }, + { "version", no_argument, NULL, OPT_VERSION }, + { "help", no_argument, NULL, OPT_HELP }, + { NULL, 0, NULL, 0 } +}; + +static void +help(void) +{ + fprintf(stderr, + "usage: nproc [--all] [--ignore=count]\n"); + fprintf(stderr, + " nproc --help\n"); + fprintf(stderr, + " nproc --version\n"); +} + +static void +usage(void) +{ + help(); + exit(EX_USAGE); +} + +/* + * GNU variant ships with the --version switch. + * + * While we don't have anything to put there, print something which is + * whitespace-compatible with the original. Version number was taken + * from coreutils this code is in sync with. + */ +static void +version(void) +{ + printf("nproc (neither_GNU nor_coreutils) 8.32\n"); + exit(EXIT_SUCCESS); +} + +int +main(int argc, char *argv[]) +{ + const char *errstr; + cpuset_t mask; + int ch, cpus, ignore; + bool all_flag; + + ignore = 0; + all_flag = false; + + while ((ch = getopt_long(argc, argv, "", long_opts, NULL)) != -1) { + switch (ch) { + case OPT_ALL: + all_flag = true; + break; + case OPT_IGNORE: + ignore = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(1, "bad ignore count: %s", errstr); + break; + case OPT_VERSION: + version(); + __builtin_unreachable(); + case OPT_HELP: + help(); + exit(EXIT_SUCCESS); + default: + usage(); + } + } + + argc -= optind; + argv += optind; + + if (argc != 0) + usage(); + + if (all_flag) { + cpus = sysconf(_SC_NPROCESSORS_ONLN); + if (cpus == -1) + err(1, "sysconf"); + } else { + CPU_ZERO(&mask); + if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, + sizeof(mask), &mask) != 0) + err(1, "cpuset_getaffinity"); + cpus = CPU_COUNT(&mask); + } + + if (ignore >= cpus) + cpus = 1; + else + cpus -= ignore; + + printf("%u\n", cpus); + + exit(EXIT_SUCCESS); +} diff --git a/usr.bin/cpuset/cpuset.1 b/usr.bin/cpuset/cpuset.1 index 935164394b31..1d0180c98991 100644 --- a/usr.bin/cpuset/cpuset.1 +++ b/usr.bin/cpuset/cpuset.1 @@ -217,6 +217,7 @@ Create a new cpuset that is restricted to CPUs 0 and 2 and move into the new set: .Dl cpuset -C -c -l 0,2 -p .Sh SEE ALSO +.Xr nproc 1 , .Xr cpuset 2 , .Xr rctl 8 .Sh HISTORY From nobody Thu Feb 23 17:07:00 2023 X-Original-To: dev-commits-src-branches@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 4PMzw51hqtz3sDqq; Thu, 23 Feb 2023 17:07:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMzw50zZLz3kLt; Thu, 23 Feb 2023 17:07:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677172021; 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=0kQNCTBe4H7Z1Sk2YiHhN+oxBZhuzhxc0cICGzgcgxw=; b=HvUe7m7Nouu3ZqR+6HSX4IN3uA6AFr+HuhRT6x0M964ywI1jt/8IS3QSxR3wWGDsvrFWV5 36Zrbf6zOq8i4mAJwRRFCg5ge5bBVF6tz8tMDFZcBdBc18jC9L/OLFt5bphijTufi7/aoP 21fNdcbcyD1EzUfunoGo/r1xCpfezRsicLeFzgKc24n/i3k4ATdgZ6W8HLZzarBB4y54GO mNFOZ0vwgCVd3qL4/z1F41UuwJwvqHHePRBhtS73SqHiuPWvRkJbUzYhyJwKAjMniP6q7x 2wZ2iXk/qaON2bc+xNOn3CApHPths20pzaNXev5uRF8EBucjALWafu7qkNgikA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677172021; 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=0kQNCTBe4H7Z1Sk2YiHhN+oxBZhuzhxc0cICGzgcgxw=; b=FjDSWD8xgm7NRVKwe6ju8XO/XPorLpfmTELbV/GUvo3e48rDJOdhEUBO+B5Rn+5CyctQyp qDzyExO7oXlmpuPAcx3xHDyGIWWmXH8kWEly/t45kSfEqfc47zk3yTXWNA2WAiReHB8/ZB vSenYP0FpiI3c/KUs9ltfirb/ex/zZDffnaeXWSIDy7WkCNox0qlnEnR3pBYTnAhFkQBg9 6g6iKW7nZiizna5lTyv1giB5x20s8JrMRxUYYFK6UnqRMmykWlep0dvepgz4/q8BikuX7F O+Hx/krgAqfjiDAzSrVg/GYUaxQ1+UgXPHC1fQx/3hszqJfYMdXCIG/CSksGhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677172021; a=rsa-sha256; cv=none; b=n5c+lU7S7lTu3gV62LL+QdbShTMUJ+AUhJyza0lBl/qN0549gxi+eBfH+jJAAYSv4s9FYa OslIAFRWeydxN+1vn45zBwu6Xqtdvty3JrwzrDaADqvOdlhW57OZaft1q8vAlpGNpgj7ue wEzYTeMkAvdXOWCRq/O13jfD2aI82HyoR48q/u59DSn6Yf2tqTNtn8+y7+EQjHPlYVtdTV XhEQWf3Qrrc8kRicP2gApoaann1aCaKh25gUe6Ip0sn4t1JJJ1TgDJbzcv5VfoNva1RY4H wNfwvxttdvlZubiidUXhvItykNcvIpMXSkC+RZk1vn4iu3dDNSo0Y236QJF0Rg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMzw474JrzqMc; Thu, 23 Feb 2023 17:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NH70d0005417; Thu, 23 Feb 2023 17:07:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NH70RH005416; Thu, 23 Feb 2023 17:07:00 GMT (envelope-from git) Date: Thu, 23 Feb 2023 17:07:00 GMT Message-Id: <202302231707.31NH70RH005416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 117d4cafdcb8 - stable/13 - nproc: denote an incompatiblity with Linux List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 117d4cafdcb806407e38266de44aebe0b4e62b6f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=117d4cafdcb806407e38266de44aebe0b4e62b6f commit 117d4cafdcb806407e38266de44aebe0b4e62b6f Author: Mateusz Guzik AuthorDate: 2023-02-15 20:17:27 +0000 Commit: Mateusz Guzik CommitDate: 2023-02-23 17:06:41 +0000 nproc: denote an incompatiblity with Linux On Linux _NPROCESSORS_CONF reports CPU threads disabled by the kernel, while it does not on FreeBSD. Flip _NPROCESSORS_ONLN to _NPROCESSORS_CONF. While it keeps reporting the same value, it will automagically unbreak should someone change the above. (cherry picked from commit 059320b8c8de73a90514879cd1e2da397584cfde) --- bin/nproc/nproc.1 | 7 ++++++- bin/nproc/nproc.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/nproc/nproc.1 b/bin/nproc/nproc.1 index ae252fe0f50c..d4d97ccbb5be 100644 --- a/bin/nproc/nproc.1 +++ b/bin/nproc/nproc.1 @@ -3,7 +3,7 @@ .\" .\" * SPDX-License-Identifier: BSD-2-Clause .\" -.Dd February 5, 2023 +.Dd February 15, 2023 .Dt NPROC 1 .Os .Sh NAME @@ -39,6 +39,11 @@ Print usage information and exit. .El .Sh COMPATIBILITY This program is intended to be compatible with nproc as found in GNU coreutils. +.Sh BUGS +If HyperThreading is enabled in BIOS and disabled in the kernel, the +.Fl -all +option on Linux will still report all possible CPU threads. +On FreeBSD only active threads will be reported. .Sh SEE ALSO .Xr cpuset 1 .Sh HISTORY diff --git a/bin/nproc/nproc.c b/bin/nproc/nproc.c index 9037c74dbfff..c2ab75826ce1 100644 --- a/bin/nproc/nproc.c +++ b/bin/nproc/nproc.c @@ -110,7 +110,7 @@ main(int argc, char *argv[]) usage(); if (all_flag) { - cpus = sysconf(_SC_NPROCESSORS_ONLN); + cpus = sysconf(_SC_NPROCESSORS_CONF); if (cpus == -1) err(1, "sysconf"); } else { From nobody Thu Feb 23 17:08:28 2023 X-Original-To: dev-commits-src-branches@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 4PMzxm6g6Qz3sDr1; Thu, 23 Feb 2023 17:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PMzxm60kvz3ktF; Thu, 23 Feb 2023 17:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677172108; 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=/aZCTiIMVDWC3r1ziFm7b4WAFGMIs0gHGXxKBn6am0k=; b=VRuozLgkgu5qkGLlS7PEIy8xGhY9roQExogJKh2fGcyOnGXUbhJ33AhRphtCQ7loD8EhGv vdSZtJtVvcI8sPpO6ndsoywDfSLt7hmlnaJxawnwdUpynKC5TnhwNq2cs/ySqaWHPJBOAL QMS8XLjXrAw45s94pAIKjLgFut+cBEiN5CjxI9hluKyrYOPwgosXOSl8rIote/SXjWGHHd QZHNlyUlWiOw/DjF0Mtj6+dLiJBEAS1BzPStu2Gp2vcpF9m69ZgoZDUy+9XrapjAcCXpyT 9gvoYUVcetFGfWQjXsn3ACioPL/8fufTU5zQOQFRC8dR0QSzVUx2gdAW1dqdRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677172108; 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=/aZCTiIMVDWC3r1ziFm7b4WAFGMIs0gHGXxKBn6am0k=; b=wt0D7bDyrEh3qVIcxIy9WTEyH9OXdD+dBQULcaOmJGdva47+4K73ir85EpqPjJww18wuS9 gDoHvpEBR9CTLcyi/Bhzw6kltclwDkGcnVvMS7TN6xoVU/N27GPBIIUrql77jW1RdYCEN0 dlK7P6mkUoETVx+vZBcZ4ASfta0tt4ozIvXnp9bBzefxYCVuJ5TgxMy9dg3UUeTQNsJJB8 +WZdiK4L8N3rLWVuU5ho88ik6x6PxGlDvVobgggEtlcn6ZMlBqiRIB4aGtiJFzJ8EayxCV ItQfSN4coj4uHOcU5kln3qAPo8LWzL8mcsBzAMG6U4496ja369e5DMqoBqfD6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677172108; a=rsa-sha256; cv=none; b=d66kESzMkdGvgGOlHJoGZJRmViocC1GMm3gpwu7ukuCG3WqJX9FLPeSmEPpFPSvg1r+z+W kFAeb/sPFhmlBCDdyBV8VJbWvirJSsIYdJJWkQKz9aTJQZJ/9uCBHgLTnePQsfLfcabOlW 7cduTUYguJfTcCehdF3vP/sH4yXK3axhWuIWsEm1CXi1BaMjoymMWv3bZx9nlbfm4vq348 5bHKj8icelRvOXqnKyQ0P0e8R3+MoLTHPO3jfOBstRe4O4izaLjbN+7C+aWdULMaF+i+R+ ZrtkaQZ5SaSd2cYIUEySJ2wCgFeeWyI3pzYmszdmu4Oo5Ne4Ph+cNoU6z+dt/A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PMzxm54r9zqqq; Thu, 23 Feb 2023 17:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NH8SSO005686; Thu, 23 Feb 2023 17:08:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NH8SYK005685; Thu, 23 Feb 2023 17:08:28 GMT (envelope-from git) Date: Thu, 23 Feb 2023 17:08:28 GMT Message-Id: <202302231708.31NH8SYK005685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5e8827063b9f - releng/13.2 - vmm: Fix AP startup compatibility for old bhyve executables List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 5e8827063b9f565697135b33399a64ca9f000a02 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5e8827063b9f565697135b33399a64ca9f000a02 commit 5e8827063b9f565697135b33399a64ca9f000a02 Author: Mark Johnston AuthorDate: 2023-02-09 20:52:35 +0000 Commit: Mark Johnston CommitDate: 2023-02-23 17:07:47 +0000 vmm: Fix AP startup compatibility for old bhyve executables These changes unbreak AP startup when using a 13.1-RELEASE bhyve executable with a newer kernel: - Correct the destination mask for the VM_EXITCODE_IPI message generated by an INIT or STARTUP IPI in vlapic_icrlo_write_handler(). - Only initialize vlapics on active vCPUs. 13.1-RELEASE bhyve activates AP vCPUs only after the BSP starts them with an IPI, and vmm now allocates vcpu structures lazily, so the STARTUP handling in vm_handle_ipi() could trigger a page fault. - Fix an off-by-one setting the vcpuid in a VM_EXITCODE_SPINUP_AP message. Approved by: re (cperciva) Fixes: 7c326ab5bb9a ("vmm: don't lock a mtx in the icr_low write handler") Reviewed by: jhb, corvink MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38446 (cherry picked from commit b265a2e0d76422f4007e96dd7295ed0aeb846e2d) (cherry picked from commit 577a666c3c33def1d4b996575dc43f8567fdac5c) --- sys/amd64/vmm/io/vlapic.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 44641cc29035..f7370e440d66 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -1160,7 +1160,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) vmexit->exitcode = VM_EXITCODE_IPI; vmexit->u.ipi.mode = mode; vmexit->u.ipi.vector = vec; - vmexit->u.ipi.dmask = dmask; + vmexit->u.ipi.dmask = ipimask; *retu = true; } @@ -1185,16 +1185,22 @@ vm_handle_ipi(struct vcpu *vcpu, struct vm_exit *vme, bool *retu) *retu = true; switch (vme->u.ipi.mode) { - case APIC_DELMODE_INIT: - vm_smp_rendezvous(vcpu, *dmask, vlapic_handle_init, - NULL); + case APIC_DELMODE_INIT: { + cpuset_t active, reinit; + + active = vm_active_cpus(vcpu_vm(vcpu)); + CPU_AND(&reinit, &active, dmask); + if (!CPU_EMPTY(&reinit)) { + vm_smp_rendezvous(vcpu, reinit, vlapic_handle_init, + NULL); + } vm_await_start(vcpu_vm(vcpu), dmask); - if (!vlapic->ipi_exit) { + if (!vlapic->ipi_exit) *retu = false; - } break; + } case APIC_DELMODE_STARTUP: /* * Ignore SIPIs in any state other than wait-for-SIPI @@ -1212,13 +1218,13 @@ vm_handle_ipi(struct vcpu *vcpu, struct vm_exit *vme, bool *retu) */ if (!vlapic->ipi_exit) { vme->exitcode = VM_EXITCODE_SPINUP_AP; - vme->u.spinup_ap.vcpu = CPU_FFS(dmask); + vme->u.spinup_ap.vcpu = CPU_FFS(dmask) - 1; vme->u.spinup_ap.rip = vec << PAGE_SHIFT; } break; default: - return (1); + __assert_unreachable(); } return (0); From nobody Thu Feb 23 17:52:49 2023 X-Original-To: dev-commits-src-branches@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 4PN0wx5jwtz3sHpR; Thu, 23 Feb 2023 17:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN0wx55v0z3ppZ; Thu, 23 Feb 2023 17:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677174769; 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=btnWCqVeKi2fS3ioZLSrh8ApJERk9D3Y1Tcu7OV3hBU=; b=CUAsj3SSti4F0oMcQ/J/rP35Y7hnVfFnQvgimssqcQpJx4heGrtI44Y95ix66FElfyF7sg p1OMBll8UIDoBkXn9IVIrr6UacpRSyH9yexi5uTTmMDANzjlECzNfmq9uQeuXT/Vae213Q LgISaYgOPKs0QpaFdi5KvLSrZC95JHLShnzIZJovsbBJZ0RyQwmZl+8+ko3+HDhGsq+Ez9 OeQX3laSsSlJAJmva5N63ySOf/CkOeMKU7RfSXlxKfkDkFsTJR9q2Z0ETD0bQB9Jr9z11K 584eG4SNbgoY0nZcYFxxg4N08mf/ao15dZhcm89U4IcJG0GpFiUO3yIInsK9Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677174769; 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=btnWCqVeKi2fS3ioZLSrh8ApJERk9D3Y1Tcu7OV3hBU=; b=khQ6sI/Gah0uZ6IFMhMisFSEnnPdFHMcwLSjvMcJ3mAOG+80sn+zIgmSnKrJMLT5LR197y eO8de1/t9pu+vwX1ZTf/tATaZtPypgYxxfZt/oCuYGOFHKtl2FSuaPF3h59VQuoxVOsuAi j/UJuVVrDVhS3E4qTq70ZbAzDX7duLhqDRhWqRixt9D+5glNB4SpCbst56NApamf9khgrp pFmi53WBSxhXggeAKWUv0ec7/BppELscxwHhD7xbBs7fGu02fGmW/c6qXXhpJr7HYer2ey ycLQMzYc4S7/Ax2V0oX/pbv+YcIU4VOFoY3j41eHJdK4zXv8+tzpCVzOL+GFfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677174769; a=rsa-sha256; cv=none; b=TcVA2fNcaZYayWIOdlAHdgvaJ3G9x/NkSt+zMOULpv7x97aODmMMw7B8hzajz9g/Z1q7wa dBesRKzzsP9AkJAcndB+Lr/yThIqPRhkF/lKoKqjxwIJLQ240Rlormrt0Fn/29qqb1lBMT Y3Jrz/lDBfRHtfy1iMgvaqDSEbGqk8wgdkjZDkmM9UdSZv1FPO+vKofbOcdfasnaproUPZ vyKdwnwZnZfb74IdeJy92H0EWEXcdnQcW8h6yyDKzF+S54aldLsSbHBukKHKSxf05w2ZXU n1Y/pbP9sw4askNk74v6mgxmiV5Z6smE2saIEWDdaXQSgvMFwl9eiwvYmT5OAQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN0wx487zzrSp; Thu, 23 Feb 2023 17:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NHqnBA075811; Thu, 23 Feb 2023 17:52:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NHqnPd075810; Thu, 23 Feb 2023 17:52:49 GMT (envelope-from git) Date: Thu, 23 Feb 2023 17:52:49 GMT Message-Id: <202302231752.31NHqnPd075810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: eb9e9f1c2533 - releng/13.2 - Add nproc(1) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: eb9e9f1c2533a8b01446e14a46f45eb7b0cd71e2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=eb9e9f1c2533a8b01446e14a46f45eb7b0cd71e2 commit eb9e9f1c2533a8b01446e14a46f45eb7b0cd71e2 Author: Mateusz Guzik AuthorDate: 2023-02-04 23:33:48 +0000 Commit: Mateusz Guzik CommitDate: 2023-02-23 17:51:07 +0000 Add nproc(1) This program prints the number of CPU threads it can run on, while respecting cpusets (or not, depending on switches). It aims to be compatible with nproc as found in GNU coreutils. Approved by: re (cperciva) Reviewed by: des Reviewed by: pstef Differential Revision: https://reviews.freebsd.org/D38386 (cherry picked from commit 48bfd3597654490cdc43bf0f591a539d3a28b590) (cherry picked from commit 31f9db72a35bb20ad01d792eaaa1d6048252ab38) --- bin/Makefile | 1 + bin/nproc/Makefile | 4 ++ bin/nproc/nproc.1 | 54 ++++++++++++++++++++ bin/nproc/nproc.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++ usr.bin/cpuset/cpuset.1 | 1 + 5 files changed, 192 insertions(+) diff --git a/bin/Makefile b/bin/Makefile index cdd96d0b84e8..83bf79dcb9f9 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -24,6 +24,7 @@ SUBDIR= cat \ ls \ mkdir \ mv \ + nproc \ pax \ pkill \ ps \ diff --git a/bin/nproc/Makefile b/bin/nproc/Makefile new file mode 100644 index 000000000000..2a57083b9d40 --- /dev/null +++ b/bin/nproc/Makefile @@ -0,0 +1,4 @@ +PACKAGE=runtime +PROG= nproc + +.include diff --git a/bin/nproc/nproc.1 b/bin/nproc/nproc.1 new file mode 100644 index 000000000000..ae252fe0f50c --- /dev/null +++ b/bin/nproc/nproc.1 @@ -0,0 +1,54 @@ +.\"- +.\" * Copyright (c) 2023 Piotr PaweÅ‚ Stefaniak +.\" +.\" * SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd February 5, 2023 +.Dt NPROC 1 +.Os +.Sh NAME +.Nm nproc +.Nd print the number of processors +.Sh SYNOPSIS +.Nm +.Op Fl -all +.Op Fl -ignore Ns = Ns Ar count +.Nm Fl -help +.Nm Fl -version +.Sh DESCRIPTION +The +.Nm +utility is used to print the number of processors limited to the +.Xr cpuset 2 +of the current process, unless the +.Fl -all +flag is specified. +.Pp +The available flags are: +.Bl -tag -width Ds +.It Fl -all +Count all processors currently online. +.It Fl -ignore Ns = Ns Ar count +The result is decreased by +.Ar count , +but never below 1. +.It Fl -version +Print the current program version and exit. Don't use this option. +.It Fl -help +Print usage information and exit. +.El +.Sh COMPATIBILITY +This program is intended to be compatible with nproc as found in GNU coreutils. +.Sh SEE ALSO +.Xr cpuset 1 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 14.0 . +.Sh AUTHORS +.An -nosplit +.An Mateusz Guzik Aq Mt mjg@FreeBSD.org +wrote the program and +.An Piotr PaweÅ‚ Stefaniak Aq Mt pstef@FreeBSD.org +wrote this page. diff --git a/bin/nproc/nproc.c b/bin/nproc/nproc.c new file mode 100644 index 000000000000..9037c74dbfff --- /dev/null +++ b/bin/nproc/nproc.c @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 2023 Mateusz Guzik + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * This program is intended to be compatible with nproc as found in GNU + * coreutils. + * + * In order to maintain that, do not add any features here if they are not + * present in said program. If you are looking for anything more advanced you + * probably should patch cpuset(1) instead. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OPT_ALL (CHAR_MAX + 1) +#define OPT_IGNORE (CHAR_MAX + 2) +#define OPT_VERSION (CHAR_MAX + 3) +#define OPT_HELP (CHAR_MAX + 4) + +static struct option long_opts[] = { + { "all", no_argument, NULL, OPT_ALL }, + { "ignore", required_argument, NULL, OPT_IGNORE }, + { "version", no_argument, NULL, OPT_VERSION }, + { "help", no_argument, NULL, OPT_HELP }, + { NULL, 0, NULL, 0 } +}; + +static void +help(void) +{ + fprintf(stderr, + "usage: nproc [--all] [--ignore=count]\n"); + fprintf(stderr, + " nproc --help\n"); + fprintf(stderr, + " nproc --version\n"); +} + +static void +usage(void) +{ + help(); + exit(EX_USAGE); +} + +/* + * GNU variant ships with the --version switch. + * + * While we don't have anything to put there, print something which is + * whitespace-compatible with the original. Version number was taken + * from coreutils this code is in sync with. + */ +static void +version(void) +{ + printf("nproc (neither_GNU nor_coreutils) 8.32\n"); + exit(EXIT_SUCCESS); +} + +int +main(int argc, char *argv[]) +{ + const char *errstr; + cpuset_t mask; + int ch, cpus, ignore; + bool all_flag; + + ignore = 0; + all_flag = false; + + while ((ch = getopt_long(argc, argv, "", long_opts, NULL)) != -1) { + switch (ch) { + case OPT_ALL: + all_flag = true; + break; + case OPT_IGNORE: + ignore = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(1, "bad ignore count: %s", errstr); + break; + case OPT_VERSION: + version(); + __builtin_unreachable(); + case OPT_HELP: + help(); + exit(EXIT_SUCCESS); + default: + usage(); + } + } + + argc -= optind; + argv += optind; + + if (argc != 0) + usage(); + + if (all_flag) { + cpus = sysconf(_SC_NPROCESSORS_ONLN); + if (cpus == -1) + err(1, "sysconf"); + } else { + CPU_ZERO(&mask); + if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, + sizeof(mask), &mask) != 0) + err(1, "cpuset_getaffinity"); + cpus = CPU_COUNT(&mask); + } + + if (ignore >= cpus) + cpus = 1; + else + cpus -= ignore; + + printf("%u\n", cpus); + + exit(EXIT_SUCCESS); +} diff --git a/usr.bin/cpuset/cpuset.1 b/usr.bin/cpuset/cpuset.1 index 935164394b31..1d0180c98991 100644 --- a/usr.bin/cpuset/cpuset.1 +++ b/usr.bin/cpuset/cpuset.1 @@ -217,6 +217,7 @@ Create a new cpuset that is restricted to CPUs 0 and 2 and move into the new set: .Dl cpuset -C -c -l 0,2 -p .Sh SEE ALSO +.Xr nproc 1 , .Xr cpuset 2 , .Xr rctl 8 .Sh HISTORY From nobody Thu Feb 23 17:52:50 2023 X-Original-To: dev-commits-src-branches@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 4PN0wy6jN2z3sHpT; Thu, 23 Feb 2023 17:52:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN0wy5r48z3phQ; Thu, 23 Feb 2023 17:52:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677174770; 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=EOxEBpYk5AQqfOmSgzHA++68njyy3gFNWC4M4XJ9hzQ=; b=yzwEZ1Gzs35iARTAGMgdkiJbfjgMvKVQOuYXkt9MnFv35po+TUDAH87ziM584854QkDDrQ NbJJxScFlFHIDJAeR9hMjpvJYfbcfduYA081xM/zC3vmWSdgNNGvgXTyffWl4YKsKJAli+ dku/Ik4742vJUjSSaQnrSafdHf1grIUPTa3JXTaOKz8hiQsQbuZgxq/DuyvMi6cFlIXYlI qwxcGnLnyEATXVkOY20bYJRuXf6ALXRF6dpiN40E8pc8VAX0dM14JVvBM/azhYJjTER42B Xe4kuUGL4bLAoLHD+VATpP692Ec8BxNnrnCYFy7nioVVURnfPOhQ/ZRRpJUgrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677174770; 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=EOxEBpYk5AQqfOmSgzHA++68njyy3gFNWC4M4XJ9hzQ=; b=moy4uq+IZFKVFVGdqReC69jTciW0UqFgThcR3eTeOAccB9XcOBE3fyMls4JYvW4WhxghXU VgH5B/JDfhezOJPnAb+TVKkQ8ZT10CyCTvQHxeXUwgp6tzfVB9H/bRu0AQ+muaijAZKdlg YN57nFdE15ZO2GCJQnAeyCYK4UiDBX8o5jVRcqOcjEOQFv2RvRuwCV8Y+4vIrXu8jFd08O dqLmD8h1lfx/Rek+qQubRLSCMlPE/Cx30P7BRXX5BAiKqretOThFe89uMQFN+1OvLh3xMk YJNlnbSxpa/QpFvWW9HcgLAVpeuu+jSinF6ICbsupLQLYhU5lJxJsLbw/j6FIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677174770; a=rsa-sha256; cv=none; b=xcxwgF1jHakSZsAKJh2Vh6okMBY2juXh3pN+WxY3nrUNOvP9ItfG87yg24ivo9Nz93Kaip EpL9OJvom1t8K0OBy8V9+R/n/Y3sHX1UmvYoDuClZC16B2bacHAIggdPhNrzEFScek8c3S rP7qL6KA9KndkJlptHqS4UD34NcISUkJjQsu17Y3zp33C2bVW1wjwMCNXPp0czpO1eYrMG RkBdLHgKUL2L/SgqNByw18bmE3ueSZy5YmK/46l1T2kCxM70nO/5kiVJpCy6aWKChD6SCW tWISylkdqSvM8Cq9jaJTC0UB8kuAr2MXDhinnyjYSm60viM4iWqGWFlngyoxEA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN0wy4xLnzrSq; Thu, 23 Feb 2023 17:52:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NHqoFG075830; Thu, 23 Feb 2023 17:52:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NHqoJt075829; Thu, 23 Feb 2023 17:52:50 GMT (envelope-from git) Date: Thu, 23 Feb 2023 17:52:50 GMT Message-Id: <202302231752.31NHqoJt075829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 0ea305c63685 - releng/13.2 - nproc: denote an incompatiblity with Linux List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 0ea305c636857d806c351b50a7368ab67c9bfb9f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0ea305c636857d806c351b50a7368ab67c9bfb9f commit 0ea305c636857d806c351b50a7368ab67c9bfb9f Author: Mateusz Guzik AuthorDate: 2023-02-15 20:17:27 +0000 Commit: Mateusz Guzik CommitDate: 2023-02-23 17:51:28 +0000 nproc: denote an incompatiblity with Linux On Linux _NPROCESSORS_CONF reports CPU threads disabled by the kernel, while it does not on FreeBSD. Flip _NPROCESSORS_ONLN to _NPROCESSORS_CONF. While it keeps reporting the same value, it will automagically unbreak should someone change the above. Approved by: re (cperciva) (cherry picked from commit 059320b8c8de73a90514879cd1e2da397584cfde) (cherry picked from commit 117d4cafdcb806407e38266de44aebe0b4e62b6f) --- bin/nproc/nproc.1 | 7 ++++++- bin/nproc/nproc.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/nproc/nproc.1 b/bin/nproc/nproc.1 index ae252fe0f50c..d4d97ccbb5be 100644 --- a/bin/nproc/nproc.1 +++ b/bin/nproc/nproc.1 @@ -3,7 +3,7 @@ .\" .\" * SPDX-License-Identifier: BSD-2-Clause .\" -.Dd February 5, 2023 +.Dd February 15, 2023 .Dt NPROC 1 .Os .Sh NAME @@ -39,6 +39,11 @@ Print usage information and exit. .El .Sh COMPATIBILITY This program is intended to be compatible with nproc as found in GNU coreutils. +.Sh BUGS +If HyperThreading is enabled in BIOS and disabled in the kernel, the +.Fl -all +option on Linux will still report all possible CPU threads. +On FreeBSD only active threads will be reported. .Sh SEE ALSO .Xr cpuset 1 .Sh HISTORY diff --git a/bin/nproc/nproc.c b/bin/nproc/nproc.c index 9037c74dbfff..c2ab75826ce1 100644 --- a/bin/nproc/nproc.c +++ b/bin/nproc/nproc.c @@ -110,7 +110,7 @@ main(int argc, char *argv[]) usage(); if (all_flag) { - cpus = sysconf(_SC_NPROCESSORS_ONLN); + cpus = sysconf(_SC_NPROCESSORS_CONF); if (cpus == -1) err(1, "sysconf"); } else { From nobody Thu Feb 23 18:10:58 2023 X-Original-To: dev-commits-src-branches@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 4PN1Kt6LwLz3sKdN; Thu, 23 Feb 2023 18:10:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN1Kt5wFpz3sFv; Thu, 23 Feb 2023 18:10:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677175858; 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=Rm27lNQO/g5OOGio4wnux33U8JWLioRe0lSLGQ7FUd4=; b=jOZHCrJu2TjsPWLJtknHkzDvy+uxY3/vX0fYXJyPNlHhG03xSOR2b7UcCdckGHlBBc3SON 8omSWjrg7x2KjA6B7SsNvEG09TQqHNIlZsJB0OkMZdzqdEKm4/KYvHqxAkf9VumQLiIdRD 3bPmWh2O9mBYldMT+RuxYsqhpXlMWp9P5/NwuQTkAly396OAG3XRQVWKBROLZq4Omq01eP /SORl1Vrq1cb3cCI7J29BK39MzIXvoZJBRce/UrpRg8jsYyz2qfU4S/Eq9jnk99r2UFOmP ILi6bqrjQUfIPEnyDmgcUDz8NB5xJ3IbnU2aaHSIEoOs+ZjyZaLmSRW0io40Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677175858; 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=Rm27lNQO/g5OOGio4wnux33U8JWLioRe0lSLGQ7FUd4=; b=MgzDRh1OUhr+KehtPRimbI3bS9j5ZQIwGHFBTwXyDFEpygpYZRdhmRjZmiV7THE1a0u5T4 NTiou652mOkxp3oEdyV0gWaizE3tMo7t4YmJzBTtIRfmLDVBloBiLZGCCo7bGyCDPDmng0 IPUL98ZdndKqW6kfWwZctlDW67eD3vqMeWU3B1ntua4/E6z9tx/vTYLnhdybUx8NMj5hcb RSvOl01DPRAvCK2or/Ot775GtVjeLRx8FXRCYXBVsy1WzSkMbJM67OG/ech8BsG2TNV59K nWFcqS1CQuSgmJ+TORnWItZH3CqcGYv1PbhN7DHtfbvKC81BySUL92kvupFJ3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677175858; a=rsa-sha256; cv=none; b=MXYBP1WcgmXkwPMnKMJDfTG+xIFJLzGy3cFgFl0H/TkzwxMEuwzch++LOXM3cy06CWXSzC CaFtcxWMGbvyMM30CHMaslzaCs5NsuIz0LzqmZFXyQj6YU7cmosbPYFpBNU20UGs1N8+eS jZK/245gvpUmHYENldqwxzU6PdJznMAwDQKOUPgg9ItzGSJVGC0dRi62yocjJ8lx3lwi4Z XPo6l8lUJscrE9f1WdKfFJZQeKeH5EeiX6QTRXZKcceZ2cruC4KtlqJltfyQQinGKGvY2Y f3S5eyJemi/4LUomDn5HXriWZMk7rmgUqAAIHeyllHKEUvfqcOQYBEM4suzFWw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN1Kt4zkXzsRs; Thu, 23 Feb 2023 18:10:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NIAwsM005181; Thu, 23 Feb 2023 18:10:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NIAw5H005180; Thu, 23 Feb 2023 18:10:58 GMT (envelope-from git) Date: Thu, 23 Feb 2023 18:10:58 GMT Message-Id: <202302231810.31NIAw5H005180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: ac25a113775a - releng/13.2 - loader: always install help files List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: ac25a113775ad527a0fc4040738bfc9e43c7db4e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=ac25a113775ad527a0fc4040738bfc9e43c7db4e commit ac25a113775ad527a0fc4040738bfc9e43c7db4e Author: Mitchell Horne AuthorDate: 2021-02-11 14:29:00 +0000 Commit: Mitchell Horne CommitDate: 2023-02-23 18:10:19 +0000 loader: always install help files Address two issues with current help file logic: The existing condition prevents the common help file from being installed when there are no additional help files defined. This results in no loader.help on EFI platforms, for example. Second, due to the fact that we build and install multiple loader types, each successive install will clobber the previous loader.help. The result is that we could lose type-specific commands, or possibly list them in loaders that do not have such commands. Instead, give each loader type a uniquely named help file. The EFI loader will look for /boot/loader.help.efi, userboot will look for /boot/loader.help.userboot, etc. The interpreter variant has no effect on which help file is loaded. This leaves the old /boot/loader.help unused. Some credit for the final approach goes to Mathieu for their version of the fix in https://reviews.freebsd.org/D22951. Approved by: re (cperciva) PR: 267134 Reported by: Daniel O'Connor Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28591 (cherry picked from commit 8859960436f5727f163a7b3468e08710c5e6d874) (cherry picked from commit a2b4abce0e30e014b2c08c0bdc34b368aa9c7a6f) --- ObsoleteFiles.inc | 3 +++ stand/common/commands.c | 4 ++-- stand/efi/loader/Makefile | 1 + stand/i386/loader/Makefile | 1 + stand/kboot/Makefile | 2 ++ stand/loader.mk | 15 ++++++++++----- stand/powerpc/ofw/Makefile | 1 + stand/uboot/Makefile | 3 ++- stand/userboot/userboot/Makefile | 2 ++ 9 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index fd0c71b4814a..64214e29e93f 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,6 +52,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20230203: loader help files renamed +OLD_FILES+=boot/loader.help + # 20230201: timeout moved from /usr/bin to /bin OLD_FILES+=usr/tests/usr.bin/timeout/Kyuafile OLD_FILES+=usr/tests/usr.bin/timeout/timeout_test diff --git a/stand/common/commands.c b/stand/common/commands.c index d109a2a8dbcf..d195bf723b37 100644 --- a/stand/common/commands.c +++ b/stand/common/commands.c @@ -123,7 +123,6 @@ help_emitsummary(char *topic, char *subtopic, char *desc) return (pager_output("\n")); } - static int command_help(int argc, char *argv[]) { @@ -132,7 +131,8 @@ command_help(int argc, char *argv[]) char *topic, *subtopic, *t, *s, *d; /* page the help text from our load path */ - snprintf(buf, sizeof(buf), "%s/boot/loader.help", getenv("loaddev")); + snprintf(buf, sizeof(buf), "%s/boot/%s", getenv("loaddev"), + HELP_FILENAME); if ((hfd = open(buf, O_RDONLY)) < 0) { printf("Verbose help not available, " "use '?' to list commands\n"); diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index 2aaba4fbb377..4c94f67cf4e0 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -83,6 +83,7 @@ CFLAGS+= -DEFI_SECUREBOOT NEWVERSWHAT= "EFI loader" ${MACHINE} VERSION_FILE= ${.CURDIR}/../loader/version +HELP_FILENAME= loader.help.efi # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index 3195cb00c6be..2d3fcba4383c 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -67,6 +67,7 @@ CFLAGS.main.c+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs .if exists(${.CURDIR}/help.i386) HELP_FILES= ${.CURDIR}/help.i386 .endif +HELP_FILENAME= loader.help.bios # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/kboot/Makefile b/stand/kboot/Makefile index 35d71cb064fc..6a238aad93b0 100644 --- a/stand/kboot/Makefile +++ b/stand/kboot/Makefile @@ -42,6 +42,8 @@ CFLAGS+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs HAVE_ZFS=yes .endif +HELP_FILENAME= loader.help.kboot + .include "${BOOTSRC}/fdt.mk" # Note: Since we're producing a userland binary, we key off of MACHINE_ARCH diff --git a/stand/loader.mk b/stand/loader.mk index 262de84c3107..b3569c1080c9 100644 --- a/stand/loader.mk +++ b/stand/loader.mk @@ -168,12 +168,17 @@ vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} CFLAGS+= -DELF_VERBOSE .endif -.if !empty(HELP_FILES) +# Each loader variant defines their own help filename. Optional or +# build-specific commands are included by augmenting HELP_FILES. +.if !defined(HELP_FILENAME) +.error Define HELP_FILENAME before including loader.mk +.endif + HELP_FILES+= ${LDRSRC}/help.common -CLEANFILES+= loader.help -FILES+= loader.help +CFLAGS+= -DHELP_FILENAME=\"${HELP_FILENAME}\" +CLEANFILES+= ${HELP_FILENAME} +FILES+= ${HELP_FILENAME} -loader.help: ${HELP_FILES} +${HELP_FILENAME}: ${HELP_FILES} cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} -.endif diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile index 28eb8ee91fad..5912ceae93d5 100644 --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -37,6 +37,7 @@ SRCS+= trampolineLE.S .endif HELP_FILES= ${FDTSRC}/help.fdt +HELP_FILENAME= loader.help.ofw # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/uboot/Makefile b/stand/uboot/Makefile index ed2253cdae6f..5b8275a0131b 100644 --- a/stand/uboot/Makefile +++ b/stand/uboot/Makefile @@ -35,7 +35,8 @@ WARNS?= 1 CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif -HELP_FILES= ${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt +HELP_FILES= ${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt +HELP_FILENAME= loader.help.uboot # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile index c5e2e6fe7c7c..43011b9577c9 100644 --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -54,6 +54,8 @@ CFLAGS+= -DUSERBOOT_ZFS_SUPPORT HAVE_ZFS=yes .endif +HELP_FILENAME= loader.help.userboot + # Always add MI sources .include "${BOOTSRC}/loader.mk" CFLAGS+= -I. From nobody Thu Feb 23 19:34:21 2023 X-Original-To: dev-commits-src-branches@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 4PN3B60rY9z3sfNJ; Thu, 23 Feb 2023 19:34:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3B60KWFz44Qj; Thu, 23 Feb 2023 19:34:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180862; 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=7+FbXyrvUC4TdvTecr0VHGsHiJqcHqHMuHdIY69J9/w=; b=vsB+J95rm+4ouQxb3FeuefGRlq6yXlaZxap13fOwpw7lJh6h3JR2ORvBrXFp+oyll1xr4p SFng8z6R5Csql0AS1c0DESrSE9JxYfCjikwh9WX7eQTaf6/RvOf6QOiSJE81RLf0ZtY9NU 1Dj1BLnP64a1Sa5ENPAre+XZgsJqDToQxq8z3OIMHUU8yf2JGxepMJG/aDIj9W4ljOISUl 0vXTpNli77gUOOljbsMqwx4zhDANW6+Z8UTEY/ntAuQTEG7XJ31wl+PVNWJJLbcPD7qT05 nbqaHPLd494dERgfCy+ONbNsNTp9vUN4a+/gQSp0lnjB+YSsgd3ousXjQv6B1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180862; 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=7+FbXyrvUC4TdvTecr0VHGsHiJqcHqHMuHdIY69J9/w=; b=XZW7hf7q64e7hXkp1fNl4embugajgsgAk5nvd/4bRUw3wA69LOJI3xDlls5L+haOGngXKC Hk/eN5Ch3ZC8vrHdcecyfvymWL+WaCqq4HOr4v9jqMzEy1nhKt3G9Cf5IbTBn0UnIZKCky LP6xqzUnSnX17RLE3RqGgwv4fg8eLq64r87rUVottRd4j1cPkhQIMHtiaWtExwtoEiBcYL ySWWqoGUE27JQGlL4x4GzkrwMpH/qMw0P478xuqGQzSV9chZOthGgjnkGrxOgz9FEGJbp7 j167eDELYLY7n6Byt8y8O0M52yv20Sa0EU501iJ+/aHr9IMI+eNdEur2fXLMrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180862; a=rsa-sha256; cv=none; b=PnhobFquax39V4irnmZ6BIvfMuiktvmx9ueEFZ3GiI/9cZsaTw6VU5npxV+nzYavZ0yDcn 7OvRtzzsaO0Q08YMLVd/qkt9GGdn6x1ZdLmqX6OnTrgurA0rP4Z3Ae3W9YU5EoN40/YqRe j0uv8s7NB45GAmcor8yMpVNQwKmtxxYk84nbL0R2imvmv0C4Iwsw3xki5UVeh4YjxK+8k+ RUx8l3khrD/bmMsxTF78rJXaWz6PoEG5LrZwYSfnmRrdcL2QCQlInCmEveyz2ywsW8DQWq 0k5+wtPH7MxFYJHy4RhhDPeKe1WumzHCcy0zw2xZbw1AaFngCrt7M2My6Bbkng== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3B56Vw8zts5; Thu, 23 Feb 2023 19:34:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYLsC020090; Thu, 23 Feb 2023 19:34:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYLfU020089; Thu, 23 Feb 2023 19:34:21 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:21 GMT Message-Id: <202302231934.31NJYLfU020089@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0da06968d3e8 - releng/13.2 - LinuxKPI: linux_pci.c: fix whitespace List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 0da06968d3e84c45b6b39b1baedec9a940ed85a6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0da06968d3e84c45b6b39b1baedec9a940ed85a6 commit 0da06968d3e84c45b6b39b1baedec9a940ed85a6 Author: Bjoern A. Zeeb AuthorDate: 2023-01-27 15:18:44 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:30:35 +0000 LinuxKPI: linux_pci.c: fix whitespace Properly indent a line. No functional change. Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) (cherry picked from commit 68b1d162505149b8629f7e22cecf298cea2ff1f9) (cherry picked from commit 069f504a8c4f9873ca32637cf0df1b0390b69b6a) --- sys/compat/linuxkpi/common/src/linux_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 54780adfda14..15c5030a33b9 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -1184,7 +1184,7 @@ linuxkpi_dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_ha struct lkpi_devres_dmam_coherent *dr; dr = lkpi_devres_alloc(lkpi_dmam_free_coherent, - sizeof(*dr), GFP_KERNEL | __GFP_ZERO); + sizeof(*dr), GFP_KERNEL | __GFP_ZERO); if (dr == NULL) return (NULL); From nobody Thu Feb 23 19:34:22 2023 X-Original-To: dev-commits-src-branches@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 4PN3B71nNnz3sfFc; Thu, 23 Feb 2023 19:34:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3B71CYrz44m0; Thu, 23 Feb 2023 19:34:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180863; 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=h+F0v/cWLUX/itfAu3OJMqOVjr+8o46NTzOCuVG8418=; b=piow+Y3HAz7avPt7n11954VFdRqrFl0O9zQW+rpWugjfp++ZHikQ2h1sYqTTBOjXJgERwS N3Ma/yC28C1im2jUUY/r4NyP/5akYx96pUeGR7FHUsNLX6pamYp6oWfC5pdFVQTTJH/JKw 6gn/GcsMJaz0gFeFK9lzaXd2VY/mozNA2BPUYOAh/4i0bbF0SEI3onrLFDx7bYhKId5EPs P0zjpomZlloPfBf7mxy7xisGIEQx6k5eD2F8w4ZjjML6irtQZLhdmyA+Pjbe/esv45YTKW LIUxsXVchvMhf/Wqt3lofBjCbCLBv5baSxH22uRbCW2EgGYYu5324Coi08Ttwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180863; 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=h+F0v/cWLUX/itfAu3OJMqOVjr+8o46NTzOCuVG8418=; b=SkRhwIEhfp1+f9Ff/kJ7zKJtX9ZlwnXzYAQlAjVPNdTAJLtdp/rQHPvQ1ZNZulsb3RfIz0 NFCCeKScdMvjyiwq13gIBKtBg/VNL6zEFNQr1BLI0MjNJOpBtYPsrl89jyOBMqqoGKc4zk GrXk1cxDBEcT/EAMcU07LYMMVx/+Q4dZp5NKnv07NeASLoUcntcXvHs9nMzHdyfl+geXte 8VINY22dx9PoeMcw+6BcHnIueA81nc7ZCYB3kQyh7XV8sq0pr5yjMlWW4+e6PX+7ZB26Nm pd9IjW/zunRysGZlaKU8+6w2ejVcoqAi6Q82oK+wnMV8L7jjvhcUGov3SQm6lg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180863; a=rsa-sha256; cv=none; b=Fw4CHxohaaE76Pm7+TBbugtmuwELf664DwUhSMkncSFLXT9+I/yDMCxu7cShBNWEm9JIu9 Ek1xB2B/1TQ7Fi+MzDP63ISQvv5sQTCDOvaA6kJVwIM3drAuVo2O/YBI2UxR9eFLMmL7a5 jtCyVwTuRs5G4IVbkMkLOkCkQYMiMdLu0Vn6gyxH3FOCU0JuA9eK5qRxHw8JPQaVi5wBrm TGYjAYKql0AYe0acHq+b/XF/iEPxAQgrR3b4BkCuyU7Pw1X+0H0sDkjq+UFhdrk/kcsv0w dxEoVoghT+TgBeh6rKwFBmNOsjr8JWNbgTDM2RDMJhv5csdi+/EmRB4dTMfn5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3B70J0RzvLY; Thu, 23 Feb 2023 19:34:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYMRq020117; Thu, 23 Feb 2023 19:34:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYMXv020116; Thu, 23 Feb 2023 19:34:22 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:22 GMT Message-Id: <202302231934.31NJYMXv020116@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: da2538a136f4 - releng/13.2 - LinuxKPI: interrupt.h: add disable_irq_nosync(), irq_set_status_flags() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: da2538a136f4ca1f103ef7f9f7485a339e0ae833 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=da2538a136f4ca1f103ef7f9f7485a339e0ae833 commit da2538a136f4ca1f103ef7f9f7485a339e0ae833 Author: Bjoern A. Zeeb AuthorDate: 2023-01-28 16:11:59 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:31:29 +0000 LinuxKPI: interrupt.h: add disable_irq_nosync(), irq_set_status_flags() Add a dummy irq_set_status_flags() along with #defines passed by the driver. Add disable_irq_nosync() as another wrapper to lkpi_disable_irq(). Those are used by wireless drivers. Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38241 (cherry picked from commit bc81a2b788f5644ece58defa30880b69c9894981) (cherry picked from commit 75727a02155af29167a6d460de5ce6a9d52e26d8) --- .../linuxkpi/common/include/linux/interrupt.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index 57d7ac58ec5e..cb2b1bef4667 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -43,6 +43,9 @@ typedef irqreturn_t (*irq_handler_t)(int, void *); #define IRQF_SHARED RF_SHAREABLE +#define IRQF_NOBALANCING 0 + +#define IRQ_DISABLE_UNLAZY 0 struct irq_ent; @@ -105,6 +108,12 @@ disable_irq(unsigned int irq) lkpi_disable_irq(irq); } +static inline void +disable_irq_nosync(unsigned int irq) +{ + lkpi_disable_irq(irq); +} + static inline int bind_irq_to_cpu(unsigned int irq, int cpu_id) { @@ -136,6 +145,18 @@ irq_set_affinity_hint(int vector, cpumask_t *mask) return (-error); } +static inline struct msi_desc * +irq_get_msi_desc(unsigned int irq) +{ + + return (lkpi_pci_msi_desc_alloc(irq)); +} + +static inline void +irq_set_status_flags(unsigned int irq __unused, unsigned long flags __unused) +{ +} + /* * LinuxKPI tasklet support */ From nobody Thu Feb 23 19:34:24 2023 X-Original-To: dev-commits-src-branches@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 4PN3B82yH5z3sfFg; Thu, 23 Feb 2023 19:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3B82Dmjz44gv; Thu, 23 Feb 2023 19:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180864; 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=WvXkQ3pGBQyi0iz+mqsbHCMnCxhSXr0E8UenEW+Y6mc=; b=GPppRrG1AuWJJN9Em9+GJz6poNeT0KvVwcHymdoN7HqD7QSo8PU42iz7D8FQDa26sbogxP qDfc2OPEM6ob6zm1OTAQrPCkd/fbKWVVcRVSMFmz/xFpCpzD84vtPhy+cUAaEtUTG7R9Xr nfXhzNr2Jw8lZX8UUVAFQ9us6QO6h089rJs481gPW6ioV2OXjm7Gfjr9IzYZrPT/1TRmW9 YCRV1ZXyIQ0AxVidUJJKruG3owsZBZ/V5gTelhlzCclS7yX0LqW8L6xnImvAnaNiyBCkwu wSwf1rkQT4pqFuoTUDsjfZkNFmGIHM91bAq2rhq2caTnf5ChwWSHYmwJHom0KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180864; 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=WvXkQ3pGBQyi0iz+mqsbHCMnCxhSXr0E8UenEW+Y6mc=; b=TDc/Yz0Vmrk7KkO+812JXp8j7D3YWjwKk+mCPlLVzDjdBp6Hklq/k7/ShTBIwHNM+mDqnG S05RTQbh6zQHp7MvWwIrNlY1u2bX6Nq0OU0EdmNbhi73ySpmloGZr6znKYYRAcYrWFS6Ei 6CxCfXapDU4FUnyK1YK7mzeHiq2BnwNTysAZPIUdgDd9QMkAGhFK1won1j+58SB5yRA8WN DpqB6V06BdvoJ/7jTfY3mkeYrM5TG+RHA2Ar/53A7WeyY1zIZNArMLNX0A2oRglvyJm8V4 7fI/dtvOmWG+qRapamGrAZn15a88xAauJtbmrRhzBqndOV5+zYEyHFJ2lqgi2Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180864; a=rsa-sha256; cv=none; b=uIxAXVk663CK3Ji6Md/iGzEHrgS0pTuekgCuZH6uIC8UGN29r58ipxThiNjo74dY//mtvC sLEcfqVCZduDJ/CjLTtESlXCcrAXLCivCPOOOVWp2afImANxL7KxZG2uSzm78dwFbwvhif aJVAUVbPIWey2IOor52XUH1ekNPxCmVaiDPIK7imud1TUXRaRf6YxQ6+dTCRlcY6GF1SA6 EZ7TnDzMsp6Itumqpd446xhw2Uge1eDV+v+VPaXo5uja7NQSkdQHYOhllL313v5en4EetD 7A5F3F7LAdBWNtBWgx+wn2oqeH3QRxLbh40gMxj8XOSllrrww6PqFON0IkLW1A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3B81BhLzvTK; Thu, 23 Feb 2023 19:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYOHK020137; Thu, 23 Feb 2023 19:34:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYOUX020136; Thu, 23 Feb 2023 19:34:24 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:24 GMT Message-Id: <202302231934.31NJYOUX020136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 82f8db9d3fdd - releng/13.2 - LinuxKPI: mm.h: implement virt_to_head_page() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 82f8db9d3fddea4eb71e87febe51d808bd9bd219 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=82f8db9d3fddea4eb71e87febe51d808bd9bd219 commit 82f8db9d3fddea4eb71e87febe51d808bd9bd219 Author: Bjoern A. Zeeb AuthorDate: 2023-01-28 16:00:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:31:37 +0000 LinuxKPI: mm.h: implement virt_to_head_page() Implement virt_to_head_page(). Sponsored by: The FreeBSD Foundation Reviewed by: markj Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38240 (cherry picked from commit 70b97048a051958be37b650b8a67c89203fd6b70) (cherry picked from commit 1984e6e4f1583ad1a44b6913e8722121fabe8967) --- sys/compat/linuxkpi/common/include/linux/mm.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h index 4afc1a953f8e..572bdd8e9ddc 100644 --- a/sys/compat/linuxkpi/common/include/linux/mm.h +++ b/sys/compat/linuxkpi/common/include/linux/mm.h @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -149,6 +150,13 @@ struct sysinfo { uint32_t mem_unit; }; +static inline struct page * +virt_to_head_page(const void *p) +{ + + return (virt_to_page(p)); +} + /* * Compute log2 of the power of two rounded up count of pages * needed for size bytes. From nobody Thu Feb 23 19:34:25 2023 X-Original-To: dev-commits-src-branches@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 4PN3B92yb5z3sfQ4; Thu, 23 Feb 2023 19:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3B92XKxz450N; Thu, 23 Feb 2023 19:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180865; 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=Y/hwraFlyBtNSPnRRfTa9FsY2RkyRi9b0QKTyPtCNOE=; b=lwaPFFSatWCqlD5iygItQHqv3WxgGW24XriGVltjPZUzBfFf3sjrWpTUFaquA0y6z0eq12 Ul2BBmW5oRpJHW37U4q2dIZEKcvP9ukbCWps5s6l+LLelvgrr8HMU7lR96sg+Yqigl56w3 VG/xU7NF2UMA8vvfW4tA5a8bcLe+IjWC926GcjbFJ2FNqqqHUSvrsLVTdrMoT8s7JkIsD+ BdfBA92V0UX4xkdHrezGlvdS706lGTHG7zCExrf0ZVgEoL1O7De4dFuOlaRIhbCUPokuqa 44SQZtPOdBsdLxXeuIYCSFFrw6VVHBbFVoE2Zr57ClOqSC+RiA7EL+In7rkpWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180865; 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=Y/hwraFlyBtNSPnRRfTa9FsY2RkyRi9b0QKTyPtCNOE=; b=xpb1pFgzONGLHqVJegf6QqK4SOH+inVM8AY46Qqog0nLF3xgTwDwTKpaBLy5EbKdXYs5dR yXLk3W3STyVmXLmKiI+A3X2WHHkhftCe4YTggUIbA768aWu8rq82fsINpDsf1wKXvuUFtf Xsjm9KNqFDfzw3S3jOudcf/RPaKgy6Un/G4z1PNaqSQs6gqkXqAlYRHYjpNLrpf0e7Jj4J J//fFEAiO9xBRwO/h7thigDv+ji3HC9xUVCPQDNMVub2M8wXmWYVAPspZa5GzepG39tb8S XxlH90raIXvL35fZ8x1+YBKkzkdjLxI3KycZ3oy4V+pFyd18PZ/GgbMiUuiURg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180865; a=rsa-sha256; cv=none; b=WocvcoJjGYMgX0lqC8090k7ydCnQEEwqrNYJVduYQKqg1OrsOBMJ4edi1+E/dTlXdCV1gl SB0Z7up1YXFVMW4JFJpqRJR8IrIr+g7V7toRVq3c32bI7wL/t07aFnxHhj5Af/RbknN8Tq SaWdLovTrkRUI/B73jBW0yfC1qn/5PYjHthVMXO8CYIH/wlOVPeVOCvfRjaOItfQ4K4zPZ RqeEfyF8r+iM1eGqEePbToiqj4RpHaIZxEV7ye6jsjfJ6VJ9Zndng1m+PXGWiRfEr04ycm /OptouRxr0gQampwHcYbvLJHLMTlPfW0HjK0pLlNUYcIoGpu0B6aPCMUtZ4OjA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3B91fQLzvBY; Thu, 23 Feb 2023 19:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYP04020156; Thu, 23 Feb 2023 19:34:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYPnb020155; Thu, 23 Feb 2023 19:34:25 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:25 GMT Message-Id: <202302231934.31NJYPnb020155@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a6f89b2b5f7e - releng/13.2 - LinuxKPI: const argument to irq_set_affinity_hint() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: a6f89b2b5f7e94be6dd14139ff0633526eed9968 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a6f89b2b5f7e94be6dd14139ff0633526eed9968 commit a6f89b2b5f7e94be6dd14139ff0633526eed9968 Author: Bjoern A. Zeeb AuthorDate: 2023-01-28 16:15:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:31:45 +0000 LinuxKPI: const argument to irq_set_affinity_hint() irq_set_affinity_hint() takes a const mask argument and some drivers pass it in as such where earlier implementations were more lenient. Deal with it and __DECONST() the argument when passed to intr_setaffinity(). Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38242 (cherry picked from commit 4c72d075a57e9a3215639aede16df4df29e1c1da) (cherry picked from commit 4724e1867e81ab5de2c6b5a6819998b660f3e96d) --- sys/compat/linuxkpi/common/include/linux/interrupt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index cb2b1bef4667..1e7a1042d237 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -133,12 +133,12 @@ devm_free_irq(struct device *xdev, unsigned int irq, void *p) } static inline int -irq_set_affinity_hint(int vector, cpumask_t *mask) +irq_set_affinity_hint(int vector, const cpumask_t *mask) { int error; if (mask != NULL) - error = intr_setaffinity(vector, CPU_WHICH_IRQ, mask); + error = intr_setaffinity(vector, CPU_WHICH_IRQ, __DECONST(cpumask_t *, mask)); else error = intr_setaffinity(vector, CPU_WHICH_IRQ, cpuset_root); From nobody Thu Feb 23 19:34:26 2023 X-Original-To: dev-commits-src-branches@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 4PN3BB3ffGz3sf7h; Thu, 23 Feb 2023 19:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BB3DCvz44sR; Thu, 23 Feb 2023 19:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180866; 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=w+KtWQkLlOXmCbpbnqZv1w6iPblSW9bhl+FNzTasNJE=; b=T6Q9wC1qRvC/TPsz7NQw+zVqhg0fcUIDSVjci/+ZKP4jK4vHLLU1bRCtZVf9xe+smB9XpT Y/PKLGuvgtBJMuJIDHyS55Ph1w269C3Rwv3bTxG7dK2KmwmdUs59JJW25aqHqTZSq74AgY IHnHTQg5QGH0k5KYzo+5c25liphNs4gvJF/n4q5Xl/GLcs11uJErLuJemilYDC7iR6KJzn /nJjJE9LTxgoYkS0ixxQ7fUR6fRwjEbPfrra2xGhCQlq5MSwO8H9WgpNFhsJVDk3qYc6FU +r/9WY1XFSpAisAX1RkITN0fwIYkeGGqspQOICBnVCWQxHrnUjhzVzCWqfy0CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180866; 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=w+KtWQkLlOXmCbpbnqZv1w6iPblSW9bhl+FNzTasNJE=; b=hUUiz+q+fR2JAp345eLy2WfqpBqwULzU+mKGXkQYzEM6Zv98QFMntvXEi7iJgvMtVA/W78 YXBjIeqBDKxr8ZnT7QHkl+RL+UXiGPpcku/v8ven+gLDC81LjQW31sMCjzjQcNg9t+R28l 82Sik/536V2e4rEXImGE2Vac4SaVWSTUOpo2vnxckAuxRFPc6Y053ohxjGKz/eY8SxdDYs 9SstL6eZPAWMFjsrItrXGY1narpa2y++VUwvbs1DXkugURRuZPWBTqouVsNw1B3OKH7xNU +R4/OsTRtyJZnhK8UbmN9jWwtHifpXHGGLTr+dOJZMRnHlzXg4tM4N+ExNocHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180866; a=rsa-sha256; cv=none; b=DH2yfMeU7MtZ/Kt1MIpOOv2ogiOX4M7MVZjWO3KuNjhIczL578P5Wip+loovMAHhXMRnFO RLmowdZzFeJ9HmoLQFXSPp2e8XOovMDnDkQkJAUmC7NCljjYTDF7ZSY3K8khDY9wFhRV5r b9P9sJACv9pCo43QQS6C92clUxOu7ZVsME5EaoJC7t3c+G4kXgQEgAiyMAPj/FY7axdalr 5hmAkf4qtKlDHlnC+PZAhbIYE/qvaEILvbTKv4Dtc4o3ayohq/4CN+6sleo6Y5J7rbQ4Og CvM20+YFOCoWLWKE8Drcfzal6zqwKUOkIsmZjS948ezEFbHr7DgO1RVuvT2UDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BB2Klyzts6; Thu, 23 Feb 2023 19:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYQXL020175; Thu, 23 Feb 2023 19:34:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYQ88020174; Thu, 23 Feb 2023 19:34:26 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:26 GMT Message-Id: <202302231934.31NJYQ88020174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: c30972f3d0e4 - releng/13.2 - LinuxKPI: device: add device_set_wakeup_enable() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: c30972f3d0e4abd83f1eb8e3087dc7acd588a7d7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c30972f3d0e4abd83f1eb8e3087dc7acd588a7d7 commit c30972f3d0e4abd83f1eb8e3087dc7acd588a7d7 Author: Bjoern A. Zeeb AuthorDate: 2023-01-28 15:18:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:31:52 +0000 LinuxKPI: device: add device_set_wakeup_enable() Add a dummy device_set_wakeup_enable() which is used for WoWLAN which we do not (yet) support and device_wakeup_enable() which is a wrapper to the former with the enable argument being true. Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38238 (cherry picked from commit ffdf10fb9cf13464801f2d78d3e1470201394812) (cherry picked from commit b45e9a172d3830bed00018325eaa73c04a0b3a13) --- sys/compat/linuxkpi/common/include/linux/device.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 70015fb7d81f..ced13faffcf0 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -536,6 +536,24 @@ device_reprobe(struct device *dev) return (-error); } +static inline void +device_set_wakeup_enable(struct device *dev __unused, bool enable __unused) +{ + + /* + * XXX-BZ TODO This is used by wireless drivers supporting WoWLAN which + * we currently do not support. + */ +} + +static inline int +device_wakeup_enable(struct device *dev) +{ + + device_set_wakeup_enable(dev, true); + return (0); +} + #define dev_pm_set_driver_flags(dev, flags) do { \ } while (0) From nobody Thu Feb 23 19:34:27 2023 X-Original-To: dev-commits-src-branches@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 4PN3BD0FJQz3sfNX; Thu, 23 Feb 2023 19:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BC494Fz453c; Thu, 23 Feb 2023 19:34:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180867; 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=5kJZjyD0N2bhr+bIe1Rma/OirDmoZM/uxovddLvMQNI=; b=ccY9ZgZ55YlPa/lA+2J5AltJSmt/XX1alSN2vmT49P+r9YUzvDqzAyqT5Jplj32SeXYHuw MZHEG+0Smo1IqJjf00I2noCtReieRrWP+kTuyY7R0EAewnIncKyF298nj17XJmlKhLsGBJ 0GqjmtiFlt45vNI8wcE0LMa3FIi1l+TxhjL2Jd2AIwpUBAzog+Y5i5PkEmD1nmSOWfx22J 8JjE5cB7ctW83ya6LljQkMPU19vzyTjiID5ShaRKPCJSwQx3Vf0HAYIyUOMCEvmYlNOyL3 KVLXPx0RT7OFm1O6lbdZ54JH13DlpyquBkS+XY9mGJP4OOmgBX99US8iVqF0Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180867; 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=5kJZjyD0N2bhr+bIe1Rma/OirDmoZM/uxovddLvMQNI=; b=u9N0HnGCPRkOrsjtfgrrOXl/WiwWVTrJeLKWYHqH0BHQHlA6iLTxLmyFDg1Ircva+tqbRg SUvuQPKim9XJ1GnvpYwM+kwifM7BbwEL07y679ebJQiE8yojcUZH9RRGZtWY7VsQRrJ0yp 2nj5HZFhROza2utU11h0AeaXBqW0a7K9vTBgX4T+OT+ygwPFLFxZQR/A00wYjCn0SrG7Dm JAEEbLZSDHpRt6DNvZyIEcP8I6kSVmhHttpPQqr89+wJlpe4UbC+q6jVtaXPsonDvUNGgq IaB8VIBujE1ids5aZNjl8TF7TwiEWVyMXYhbvv03gxKXMupxio2iNFG/HaFsaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180867; a=rsa-sha256; cv=none; b=NQ+sKw3kxEXaG2+cdCxdkFvPhuZq/hVg8vZi44gnQc8JDgm4qH5/g4YT2/hmF3UuLjQI6/ 8O3gTWWi0fQoPMHYaouxjYlLaTwrWYfdnQQPXbeLTPHi9j5BMrKWCU2kfFtPVYXbMVk3ym g+8u4dv9nBB2sG9ru/zmrrD/BSRgHwFS7CWoZsL0KcoPje8LwqCyC6DP39qGF/xCykgTsL ykvv/5rB1kmSt4UDu9PEPqoFYdwa+IjFd0q54KSMxidelemYQ5eaDJsjrAEPBZnPOvqusF 9KT+8EScfa9I5p82IwPIshBkzo9dEsDhw7dvNPj7dcaz7Ib6d4X7jheOhIFOuA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BC3GS0zv9J; Thu, 23 Feb 2023 19:34:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYRnE020208; Thu, 23 Feb 2023 19:34:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYRVd020207; Thu, 23 Feb 2023 19:34:27 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:27 GMT Message-Id: <202302231934.31NJYRVd020207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: e89029eacaee - releng/13.2 - LinuxKPI: pm.h: add dummy pm_wakeup_event() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: e89029eacaee78b55706ca0a80ba80b1733d7bc5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=e89029eacaee78b55706ca0a80ba80b1733d7bc5 commit e89029eacaee78b55706ca0a80ba80b1733d7bc5 Author: Bjoern A. Zeeb AuthorDate: 2023-01-28 15:53:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:31:59 +0000 LinuxKPI: pm.h: add dummy pm_wakeup_event() Add a dummy implementation of pm_wakeup_event() which is used to notify the power management system about a wakeup (which we currently do not implement yet). Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38239 (cherry picked from commit 934cb7a3316609380fdea8da73233759f6dfff43) (cherry picked from commit fbc5dea2a3af8edf1f22603605f78fe9f9b71494) --- sys/compat/linuxkpi/common/include/linux/pm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h index eb3316088787..74f0d330f505 100644 --- a/sys/compat/linuxkpi/common/include/linux/pm.h +++ b/sys/compat/linuxkpi/common/include/linux/pm.h @@ -33,10 +33,15 @@ #ifndef _LINUXKPI_LINUX_PM_H #define _LINUXKPI_LINUX_PM_H +#include /* pr_debug */ +#include + /* Needed but breaks linux_usb.c */ /* #include */ /* #include */ +struct device; + typedef struct pm_message { int event; } pm_message_t; @@ -79,4 +84,11 @@ const struct dev_pm_ops _name = { \ } #endif +static inline void +pm_wakeup_event(struct device *dev __unused, unsigned int x __unused) +{ + + pr_debug("%s: TODO\n", __func__); +} + #endif /* _LINUXKPI_LINUX_PM_H */ From nobody Thu Feb 23 19:34:28 2023 X-Original-To: dev-commits-src-branches@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 4PN3BD6VNrz3sfBL; Thu, 23 Feb 2023 19:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BD5Xjyz45Dh; Thu, 23 Feb 2023 19:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180868; 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=5ol2L9YtThjQajO7wNQaU/1rfH8bjSUficp01U7nQzs=; b=WtcH6MLcu1WgKGSsb5kl8UKi/mOwBygRq8jPKunVCzfr6qX2uOymM80ofZNPsW0ImeGNi+ pwHQgDxcUOnziJHsXOI4Mw+BnlGgO1cuXTMYZfJz226HqfvVNrvNH9/QPBfh/QODRGavMz +VansJwCnlURvFHuXtv4g8o4w4MH7nZtfhMTBOuk9ARvKsti9s40gdF0My0dP3coPtZ0mN Xt+gAF6JfHQnkrDVbnLggtWa233Fxj85M0CDzrPQQKcmEcg/1Kj4PYEOMivBugfS3nNlEE lj6E1WQz36XEH2zJkFGWClmt9ziYuFFOWJvk9I+R+aLDS9bZIiwM0fP6VG5U2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180868; 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=5ol2L9YtThjQajO7wNQaU/1rfH8bjSUficp01U7nQzs=; b=NiOveGLtk45tgWP4R2b43m6bU3MKIc/NCnsIiUfZGtZfkzcUU2sEPWqvJciYBKJPuUhdbJ h29mQj1mwkGId3ez2WGD03zO+yqLlWb7uXO4575QWYdcSwT6+vMDTp59CfQI1jTS90GWJH /k045NPhAsO1s9pp5AcZD/UG0t++CtedoPwssADtmJAE21Mr054LvD0i9MUm++yaB8lDXv 83mwmZPGNzEyKn4+y3Rj6NGPc6GQ0BVZdEVLCx4Uwc7kYS3JfvVcors55KX4jL30WNip5u m+lMFS8D1oWLWpRCkRIrU5Q8FytFu+3XiQi0gKHY1H1gJVpna3ylaIfqQNrgBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180868; a=rsa-sha256; cv=none; b=VZ7P1Kf4YIOtEZ1w78AilphedWZfLBAmcuMQelUE692I67Tty6D0Sm6CWe8fi4lumDp2lH PVqYyE9x2SI/E2PsZWMWui84/Yq0YTMe4nblNF0qfyM5Q3aJxXX5lXWcfGUv5yIhjbKe7H PN0nJjsOJfe3LcKrX/q/ejSOCCWOKFOO+Gpso2C19b4nVcfNRTDK87DenangMU5jVIaxgt RFCco3EclfiKxz0jA5Z6j2s5w61pqEWtxWeIyPA+9zlCMBGjARlHRM2Zj8AFv4RRdLc0A/ VSx38hYORNa/jrZTtnOtoI/D9duS9YmMT3gOGwe1Djp6uCbj3ztBcMuKbTpoJg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BD4QMHzvTL; Thu, 23 Feb 2023 19:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYSXk020233; Thu, 23 Feb 2023 19:34:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYS6o020232; Thu, 23 Feb 2023 19:34:28 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:28 GMT Message-Id: <202302231934.31NJYS6o020232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b03bf921b5b6 - releng/13.2 - LinuxKPI: add more dummy header files List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: b03bf921b5b67f2179c58cba49f42a67690ea401 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b03bf921b5b67f2179c58cba49f42a67690ea401 commit b03bf921b5b67f2179c58cba49f42a67690ea401 Author: Bjoern A. Zeeb AuthorDate: 2023-01-29 18:16:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:32:06 +0000 LinuxKPI: add more dummy header files Add more empty header files wireless drivers try to include but we do not (yet) need for any implementation. Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38271 (cherry picked from commit 52c28b99034bd32c86e6c058f68cfbf11c8f76c3) (cherry picked from commit 8a091335fc63c86b80704abf58055f53c0621740) --- sys/compat/linuxkpi/dummy/include/linux/const.h | 0 sys/compat/linuxkpi/dummy/include/linux/elf.h | 0 sys/compat/linuxkpi/dummy/include/linux/if.h | 0 sys/compat/linuxkpi/dummy/include/linux/mmc/card.h | 0 sys/compat/linuxkpi/dummy/include/linux/mmc/core.h | 0 sys/compat/linuxkpi/dummy/include/linux/mmc/host.h | 0 sys/compat/linuxkpi/dummy/include/linux/mmc/mmc.h | 0 sys/compat/linuxkpi/dummy/include/linux/mmc/sd.h | 0 sys/compat/linuxkpi/dummy/include/linux/mmc/sdio.h | 0 sys/compat/linuxkpi/dummy/include/linux/mmc/sdio_func.h | 0 sys/compat/linuxkpi/dummy/include/linux/mmc/sdio_ids.h | 0 sys/compat/linuxkpi/dummy/include/linux/msi.h | 0 sys/compat/linuxkpi/dummy/include/linux/nvmem-consumer.h | 0 sys/compat/linuxkpi/dummy/include/linux/of_address.h | 0 sys/compat/linuxkpi/dummy/include/linux/property.h | 0 sys/compat/linuxkpi/dummy/include/linux/remoteproc.h | 0 sys/compat/linuxkpi/dummy/include/linux/rtnetlink.h | 0 sys/compat/linuxkpi/dummy/include/net/rtnetlink.h | 0 sys/compat/linuxkpi/dummy/include/uapi/linux/if_arp.h | 0 19 files changed, 0 insertions(+), 0 deletions(-) diff --git a/sys/compat/linuxkpi/dummy/include/linux/const.h b/sys/compat/linuxkpi/dummy/include/linux/const.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/elf.h b/sys/compat/linuxkpi/dummy/include/linux/elf.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/if.h b/sys/compat/linuxkpi/dummy/include/linux/if.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/mmc/card.h b/sys/compat/linuxkpi/dummy/include/linux/mmc/card.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/mmc/core.h b/sys/compat/linuxkpi/dummy/include/linux/mmc/core.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/mmc/host.h b/sys/compat/linuxkpi/dummy/include/linux/mmc/host.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/mmc/mmc.h b/sys/compat/linuxkpi/dummy/include/linux/mmc/mmc.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/mmc/sd.h b/sys/compat/linuxkpi/dummy/include/linux/mmc/sd.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/mmc/sdio.h b/sys/compat/linuxkpi/dummy/include/linux/mmc/sdio.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/mmc/sdio_func.h b/sys/compat/linuxkpi/dummy/include/linux/mmc/sdio_func.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/mmc/sdio_ids.h b/sys/compat/linuxkpi/dummy/include/linux/mmc/sdio_ids.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/msi.h b/sys/compat/linuxkpi/dummy/include/linux/msi.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/nvmem-consumer.h b/sys/compat/linuxkpi/dummy/include/linux/nvmem-consumer.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/of_address.h b/sys/compat/linuxkpi/dummy/include/linux/of_address.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/property.h b/sys/compat/linuxkpi/dummy/include/linux/property.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/remoteproc.h b/sys/compat/linuxkpi/dummy/include/linux/remoteproc.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/linux/rtnetlink.h b/sys/compat/linuxkpi/dummy/include/linux/rtnetlink.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/net/rtnetlink.h b/sys/compat/linuxkpi/dummy/include/net/rtnetlink.h new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sys/compat/linuxkpi/dummy/include/uapi/linux/if_arp.h b/sys/compat/linuxkpi/dummy/include/uapi/linux/if_arp.h new file mode 100644 index 000000000000..e69de29bb2d1 From nobody Thu Feb 23 19:34:29 2023 X-Original-To: dev-commits-src-branches@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 4PN3BG28qrz3sfFx; Thu, 23 Feb 2023 19:34:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BF6CDkz45FK; Thu, 23 Feb 2023 19:34:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180869; 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=e2/lknigu4c7T9pJFURHKh2MfjbTMTPRt2a9Z1EqIMc=; b=rL2ewRWMW6VaCLqMvGTguLFyCIj9YN3dV9WELS7sCxXDwWbcljwAgD19TGT8tXgsAXfdeQ wpu81yW7bjuKsvkje+l2CG1ADbCXUZC+UuvkGSnmgxdxsUd2ZQAuEybm5GCfp2gGEYTrWD zwP6t5H35csNAc865Ioc/Hw4lnkIF8LGuYI2V3L6b/byfXYTsbigNX8Fma+X24uJXaD0L8 w+SELV1eIZgndn1fB//HZfy5kNf/C2ckKlXN+REtIKwxjpFsinnl9npZu1ebCGq4SgJyhr wuXumqBUrBXAorCUe721uMrp0u+WExFXZPhh/K5CLVRRo5+2pjDQNemaEAygog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180869; 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=e2/lknigu4c7T9pJFURHKh2MfjbTMTPRt2a9Z1EqIMc=; b=RESe8hMk89V5+yXamJn8Wh1phhY6urVpyKx6DofE/R3KRy/U7cbLkMO4SJ+Slri39aIYrA 1t5BzCK3DKPj972/azJBX8Y/ePy9zwUl2BMOY0Im1aMYHh7mtFvaf4f5j0ToDuLqB1SVuX FyNKQagH58OrQ7zv5tDBe83NgX29wjQJZalnox25YmZVWDkYyygbXVqqCdBTFuXqqwvo8N 0FKWu8LI/0nzvJ2NyabffBezFekOrlaanwcf1TMEZxVVTHc/XRn74OQYhpW7YH+4mWBCH3 +C32Z4H7KtwtfDAQ4sQe6ZR1ZXZdMV2DqZLNSE4TnSo8F5H+MYyRwPBmuor11w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180869; a=rsa-sha256; cv=none; b=yc352QhXYqH0AZaST9+v2yvS2WUA9UyXC8n1BRxrVll2D7nngFOEmxczEmA/bkDPDAv+Wb 9/4E7+9wmfDadJQni4vzXZcklW2yB8vGrjkqP4o+ZJmn+yYi/eDfLLPqgkZh73PHkQ0+SQ yUIT3RHD4UXWn5Vwsv08vwcaJqiedCPeCP/0y1mxaakbE5BXBQZ6qMNdWzl28xoQDmjAYs osYFyDZVxAPDzbXGqp5zEMox7e2CFRkqTagD9LwPJtg6Siqq5FS7CT7ZYhv+OUdFRnGKkz Vgxt7kyrVJdHpOIXvh8BU3njbp0tZO3Tun3QmXuzn9BlkxYAjgJgjLeDfbKLog== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BF5Jt1zvWV; Thu, 23 Feb 2023 19:34:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYTUN020252; Thu, 23 Feb 2023 19:34:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYT4A020251; Thu, 23 Feb 2023 19:34:29 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:29 GMT Message-Id: <202302231934.31NJYT4A020251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 792038fdb234 - releng/13.2 - LinuxKPI: skbuff: implement skb_free_frag() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 792038fdb234f608ba6301aaae364d02bd3ad9be Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=792038fdb234f608ba6301aaae364d02bd3ad9be commit 792038fdb234f608ba6301aaae364d02bd3ad9be Author: Bjoern A. Zeeb AuthorDate: 2023-01-28 15:33:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:32:13 +0000 LinuxKPI: skbuff: implement skb_free_frag() Using the work from 55038a6306a570c9f2df89f5ad076de0f7d98152 implement skb_free_frag() calling page_frag_free(). Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) (cherry picked from commit dbbf46ebba78770c2c3a1d7983e92e79ca67abc0) (cherry picked from commit 8a6a4122e6dd91489e48de50a3080f82d00e8715) --- sys/compat/linuxkpi/common/include/linux/skbuff.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h index 35d5a1fd9b80..12a6be42e743 100644 --- a/sys/compat/linuxkpi/common/include/linux/skbuff.h +++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h @@ -791,7 +791,7 @@ static inline void skb_free_frag(void *frag) { - SKB_TODO(); + page_frag_free(frag); } static inline struct sk_buff * From nobody Thu Feb 23 19:34:30 2023 X-Original-To: dev-commits-src-branches@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 4PN3BH2Hlvz3sfKV; Thu, 23 Feb 2023 19:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BG6swtz459f; Thu, 23 Feb 2023 19:34:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180871; 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=q7zVS4hHCaDBn+QLhmNOIrlGn14goDR9V3sRmISIGiE=; b=LtFr/g9PZ6g4vCt58qzrg+ZHjmkrVUemeNO9xqR8BgfMXIoaXCri3C+vbY8im/btQJnXVN X9uJj7yzG0xxacu30FdX5JIEmFYyHX2wwVa+GWn78MEl2ZzE3cEyNY9Rqi/0uooBw5d5AO B1a0HsrRzUEcrPlBqsX+0Lz93qG6iSreJ8S7E5lPb+M7uQdMHNHlFTWxtddSsNcn30WJvZ Ljdz24MCmgWByQIC/hbrBUmEwY1jSsZmiyuxmTbvtoE5heozhNAFgULdZBM+WlMLKKSefU JJlGfkfLsxh6bBQzVbjV9mee4S8QqjDKAFUBJJqLEKmQsDn3oyDWCu2q3qjS3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180871; 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=q7zVS4hHCaDBn+QLhmNOIrlGn14goDR9V3sRmISIGiE=; b=MHn4dYuYJ0J/fhZ3g7rhCvJzkt/ihnaZ8jP6r2SWmcuahJp4WAlfbBD/mzp0C28uaR8Qc9 LTILJoxIuLUVagebUnI4CnLBZuwBBqwWCbKAv0zBlOP/upg1kMzlt66t0rh/B1kKtYvpFu 10fWlslhqx1WxWU+cdVTZNlQ2EcueJYC6Z96YPJ9DT5UEoQjnwL9+tmoVIw0vzZEhK0y3/ pRlHyRZ5QbG4ZyL9H/f6LtI90FNuGd81ElRUfq5S9It9g2dmyfaR8WfkUoa2pFrttUUc+P VweT5otmI9JFmGy0OoKftuUCvQmYCeOeFuyRwlM2KXAdyvF0BKHp+9JqaVyJfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180871; a=rsa-sha256; cv=none; b=aByx8E5L0H/1/LehGhHg2YdtJB4PFtJgb2EqNaJzqJlsQYWhr2WEhkrOxA/3hVicpWGf5s IX0Kkwm8R04wThv6uCpfkuFmmAs4PCKnmTKA+eSh0d8bzhgw9gFZZokILAvISBAtk3NP2L HKHhyLbC9x4kstHvwxyc+r4b9ocpEgwadGsHmtdQg38rmIREIr/nYBPoQqZYot5107V6ks I3GqTupNurr7zDpOykoQtYSLZF2rIU4zZTlie39TaJdLvZ60o+IoG/zDhDBBHUB7vmJYSn UBIB3nrAUKzQDodVYN37FOPXzQb1UJPGs+X+B2Bhivcj/oMrhgsuRpVefmV49w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BG5zdhzvNG; Thu, 23 Feb 2023 19:34:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYU4U020273; Thu, 23 Feb 2023 19:34:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYUtf020272; Thu, 23 Feb 2023 19:34:30 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:30 GMT Message-Id: <202302231934.31NJYUtf020272@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3473f9920c89 - releng/13.2 - LinuxKPI: 802.11: fix types and whitespace List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 3473f9920c8988cf24490b34c5c4d8448cef7df4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3473f9920c8988cf24490b34c5c4d8448cef7df4 commit 3473f9920c8988cf24490b34c5c4d8448cef7df4 Author: Bjoern A. Zeeb AuthorDate: 2023-01-31 13:39:04 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:32:21 +0000 LinuxKPI: 802.11: fix types and whitespace Correct struct member types, fix whitespace, and remove superfluous return statements in void functions. No functional changes. Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) (cherry picked from commit a3baca22d0b7789a040a60f389e3c132b6e1755b) (cherry picked from commit d282e777d7c9721614f110a1de66c7d88d0a6ea8) --- sys/compat/linuxkpi/common/include/net/cfg80211.h | 11 ++++++----- sys/compat/linuxkpi/common/include/net/mac80211.h | 6 ------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index 55a74227a338..8b73dc1abe3f 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2020-2021 The FreeBSD Foundation + * Copyright (c) 2020-2023 The FreeBSD Foundation * Copyright (c) 2021-2022 Bjoern A. Zeeb * * This software was developed by Björn Zeeb under sponsorship from @@ -265,9 +265,8 @@ struct cfg80211_roam_info { }; struct cfg80211_bss_ies { - /* XXX TODO, type is best guess. Fix if more info. */ uint8_t *data; - int len; + size_t len; }; struct cfg80211_bss { @@ -937,6 +936,7 @@ struct iface_combination_params { struct regulatory_request { /* XXX TODO */ uint8_t alpha2[2]; + enum environment_cap country_ie_env; int initiator, dfs_region; int user_reg_hint_type; }; @@ -1029,8 +1029,9 @@ struct wiphy { uint32_t rts_threshold; uint32_t frag_threshold; struct tid_config_support tid_config_support; + uint8_t available_antennas_rx; + uint8_t available_antennas_tx; - int available_antennas_rx, available_antennas_tx; int features, hw_version; int interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ssids, max_sched_scan_ie_len, max_sched_scan_plan_interval, max_sched_scan_plan_iterations, max_sched_scan_plans, max_sched_scan_reqs, max_sched_scan_ssids; int num_iftype_ext_capab; @@ -1200,7 +1201,7 @@ cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan, { return (linuxkpi_cfg80211_get_bss(wiphy, chan, bssid, ssid, ssid_len, - bss_type, privacy)); + bss_type, privacy)); } static inline void diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index d548b9bb956f..caf9be89281e 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -2394,7 +2394,6 @@ static __inline void ieee80211_resume_disconnect(struct ieee80211_vif *vif) { TODO(); - return; } static __inline int @@ -2410,7 +2409,6 @@ ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key, uint32_t iv32, uint16_t *p1k) { TODO(); - return; } static __inline struct ieee80211_key_conf * @@ -2426,14 +2424,12 @@ ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid, const uint8_t *replay_ctr, gfp_t gfp) { TODO(); - return; } static __inline void ieee80211_remove_key(struct ieee80211_key_conf *key) { TODO(); - return; } static __inline void @@ -2441,7 +2437,6 @@ ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid, struct ieee80211_key_seq *seq) { TODO(); - return; } static __inline void @@ -2449,7 +2444,6 @@ ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif, struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp) { TODO(); - return; } static __inline void From nobody Thu Feb 23 19:34:31 2023 X-Original-To: dev-commits-src-branches@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 4PN3BJ20Ybz3sff6; Thu, 23 Feb 2023 19:34:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BJ1F84z454q; Thu, 23 Feb 2023 19:34:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180872; 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=bz3jyovAiEUuxFLchuwiMoUJBToIR4ZMIaGqpdtoba4=; b=gYBdY/okhg3T/k1dQh6w+vxvPWBtXXVnRA88LHR5nXm+RQZ+Tys3X3TiMwhcLA1NiEdOo4 3zrMEJe/DD9g7mZAG2ims+Aj6nnYhgwX1U/bJPrLgSQOakCgEuI44Quar9sTZYQRq9HF6q Cq1oYBYFjmgZyQ+z5eNW/X1pmv2oT2I9ev/vIQwqmWhC5llqJmlu96yZHXqOkmBbMD1UPh yIs5YFOq7Q5adTQEdRKNmO+oluN3eAnsRda+Bi+83AxUITLQazE7oSbsH9VyjVEV5pOPeS JFIAXR1pua1Nl2YublNIulhYkCveNu87cC+1zpUTAaJE8QgE93pTm7rtrD8SbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180872; 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=bz3jyovAiEUuxFLchuwiMoUJBToIR4ZMIaGqpdtoba4=; b=g7NU4zAstsHiLRVhn8GQpQBItsuxUOPqpU5Rw020eXQ0SU+Fvts9Q38Q+QejV+qYCasG96 a1z9LDaZPhj2/HKjf8/OGOJ8nKGYJQYDdRg/4h6zAi9Esmbm5q+FzWR1UvE+yDsBtEwpMr mwHF+kbw1XJDPncQ9g5Ppq4oqxa6e4PdguFqK6TKdJQusfhplF45ay2HIH8ls06STaZRDB pmdeFYBaKKYiNWe7IswHOV5G+H+U+YEwdMyNURlocUv0djN3wpXkLmyzWRTkADRNCgoJV1 BwhtsrxZMvr6IcNDM0qXPoXMpHCLxNG5OsURGjVsmyqc9E7tkg5QnYnDzELaug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180872; a=rsa-sha256; cv=none; b=rhXnLeEmXmsstMJwaTy8Re3JM6BijYq/BnZpJsaoUDeKWvwIXzpHUUwbUfHETPnmdsMu7A nd0pws9m2GLDy/d37viJD/qX8v+VuQn0hTQbYTSpMMV+k9FV9zW0M2UekJ9sMaTKCJmoZP foJ0oLYudw88XQSq4sm46bwyFJYsi6bgS0XFAGX9vdrQkrcXLBSASegxU2fWrzpO6wUCRU 5BMFBkhf3BaugvOg6DvrR4ue4R+PspwCMEYI8JxgUq5rKRuK6SEDFZ1KIURWn/jM3Lw33X W9Hmjnm6CMvqQ+Cx+PwlVF6vf/Jm4OAFA5gF7UF+cSLbZfN7RPzFR0ShVVJNZw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BH6w86zvNH; Thu, 23 Feb 2023 19:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYVhH020292; Thu, 23 Feb 2023 19:34:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYVGD020291; Thu, 23 Feb 2023 19:34:31 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:31 GMT Message-Id: <202302231934.31NJYVGD020291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 422d97dd1be3 - releng/13.2 - LinuxKPI: 802.11: extend linuxkpi_ieee80211_rx() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 422d97dd1be339e9c7cdd48cff0b625e5b8f4013 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=422d97dd1be339e9c7cdd48cff0b625e5b8f4013 commit 422d97dd1be339e9c7cdd48cff0b625e5b8f4013 Author: Bjoern A. Zeeb AuthorDate: 2023-01-31 15:05:30 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:32:28 +0000 LinuxKPI: 802.11: extend linuxkpi_ieee80211_rx() Extend linuxkpi_ieee80211_rx() by another argument for the ieee80211_rx_list() implementation (even though the argument is currently ignored). Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) (cherry picked from commit e30e05d3ab3979a148068235298e1a6f73b675f0) (cherry picked from commit e420c65378a04c5b9cde34013cab78188bc5a4c2) --- sys/compat/linuxkpi/common/include/net/mac80211.h | 25 ++++++++++++----------- sys/compat/linuxkpi/common/src/linux_80211.c | 15 +++++++++++++- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index caf9be89281e..fee8b88d8feb 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1001,7 +1001,7 @@ void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *, void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *, struct cfg80211_scan_info *); void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *, - struct ieee80211_sta *, struct napi_struct *); + struct ieee80211_sta *, struct napi_struct *, struct list_head *); uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool); struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *, const u8 *); @@ -1468,28 +1468,36 @@ ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct sk_buff *skb, struct napi_struct *napi) { - linuxkpi_ieee80211_rx(hw, skb, sta, napi); + linuxkpi_ieee80211_rx(hw, skb, sta, napi, NULL); +} + +static __inline void +ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta, + struct sk_buff *skb, struct list_head *list) +{ + + linuxkpi_ieee80211_rx(hw, skb, sta, NULL, list); } static __inline void ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb) { - linuxkpi_ieee80211_rx(hw, skb, NULL, NULL); + linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL); } static __inline void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) { - linuxkpi_ieee80211_rx(hw, skb, NULL, NULL); + linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL); } static __inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb) { - linuxkpi_ieee80211_rx(hw, skb, NULL, NULL); + linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL); } /* -------------------------------------------------------------------------- */ @@ -2347,13 +2355,6 @@ ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, TODO(); } -static __inline void -ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - struct sk_buff *skb, struct list_head *list) -{ - TODO(); -} - static __inline void ieee80211_tx_status_ext(struct ieee80211_hw *hw, struct ieee80211_tx_status *txstat) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index ee4b58e60f4d..e0457e0e5fa0 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3840,9 +3840,11 @@ linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *hw, return; } +/* For %list see comment towards the end of the function. */ void linuxkpi_ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, - struct ieee80211_sta *sta, struct napi_struct *napi __unused) + struct ieee80211_sta *sta, struct napi_struct *napi __unused, + struct list_head *list __unused) { struct epoch_tracker et; struct lkpi_hw *lhw; @@ -4050,6 +4052,17 @@ skip_device_ts: if (ieee80211_hw_check(hw, RX_INCLUDES_FCS)) m_adj(m, -IEEE80211_CRC_LEN); +#if 0 + if (list != NULL) { + /* + * Normally this would be queued up and delivered by + * netif_receive_skb_list(), napi_gro_receive(), or the like. + * See mt76::mac80211.c as only current possible consumer. + */ + IMPROVE("we simply pass the packet to net80211 to deal with."); + } +#endif + NET_EPOCH_ENTER(et); if (ni != NULL) { ok = ieee80211_input_mimo(ni, m); From nobody Thu Feb 23 19:34:32 2023 X-Original-To: dev-commits-src-branches@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 4PN3BK1qGwz3sfBT; Thu, 23 Feb 2023 19:34:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BK17qJz45Lc; Thu, 23 Feb 2023 19:34:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180873; 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=5b+hLgDWdPoT2GzhojTVGVLZX6rI7n053yfjUtfK0LA=; b=i1gtEUAddSP35MUKv2mGd6uStjhJOQONlSDztDw74byLtXPRH2RXc7NqMLg6fWt1cbspsb 7FIvfpZCisc1qqdjhYJP8Uk0QMtWpENDbZhiRSbERi4QDulLiPLddolSLLT6PYHthyu5QS emu9zmsw2/spud0HUz5uTCIpyhsV2zC0xkXxDtfLXOt5uBL5u06CKNkpaS/diD53VKu2w2 LdbH+z5iFiTi+UZDWIc6s4GztWfdz3C4nOa5/QJSpHbq3fp+eFNIL/ZImzyvu1IZPPKdOg LgpBG37iZ3eRkeq9oJPF5YIIq+x6LGvAhLAmUk2trA2TL35tcwejsC9bOzdOgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180873; 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=5b+hLgDWdPoT2GzhojTVGVLZX6rI7n053yfjUtfK0LA=; b=NjJYzqsBuUpRF9ic0lsDouAYwJbCG7BCY2QiA1td7z1BQBky8JTtQVs7J6CBfBCE7JzLSH 1zDkR+5xX3C0kSaMrzdxOd1OZObW3J6c9yLUkbkbPBPROW8dYi9ooGG5hmAL0aEz4iT3b+ eWFN5QK+s/oLgQVEvWmVjzo5iiUAmdGdeFLNv0zN3EonkkC17Six3+SA2XRUP74GAPR+wY TC1kuoNMZKsUJQjh3pJ7T+1yC1kJRKLiseNWA2zVo5UQPRCnyV4q3FMVf+oBJRZTHVyRO+ YpOkOVvN24avXKmOxH5jRAWj+B29Wll/Bho25tKyA+3WgcyZn4hlurqUz8IQ8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180873; a=rsa-sha256; cv=none; b=ljlvma8zLjtVm1/bNuvaulUY1+l8YX2kqEegfZxZFSGbcE+c18ehotbRV0CdXIhNfua35q +MnQU/lj3d90vtwMi3h12zrW4n/YoCXBpwSQJVeHTyXqw+x3bYqXn+ImvQ864oJjL1H7sX OajHSbRGIQ2Lw1DndRIfMOcBO9EocP2bob3atxDGwRuFtAbWe3RpzeHiXqedQeDgW89i0T 640Mvva/8NfHOS47q6FpReF4wdvxG6NY+14wj871L+Z88ojySIQAXPrLshcLfLy4aZ/OEP 43JeivMXBYfC7oloGW/IobD1bHA1FR5xjzlWrQOfptYkqXjLxYAyPAfshYCtwQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BK06GLzts7; Thu, 23 Feb 2023 19:34:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYWKe020311; Thu, 23 Feb 2023 19:34:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYW3r020310; Thu, 23 Feb 2023 19:34:32 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:32 GMT Message-Id: <202302231934.31NJYW3r020310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 47ff90e57ef3 - releng/13.2 - LinuxKPI: 802.11: implement ieee80211_tx_status_ext() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 47ff90e57ef3a2e9ad39133d558064ef490e42c0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=47ff90e57ef3a2e9ad39133d558064ef490e42c0 commit 47ff90e57ef3a2e9ad39133d558064ef490e42c0 Author: Bjoern A. Zeeb AuthorDate: 2023-01-31 15:35:59 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:32:34 +0000 LinuxKPI: 802.11: implement ieee80211_tx_status_ext() Add an implementation of ieee80211_tx_status_ext() extending the internal linuxkpi_ieee80211_tx_status() implementation. Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) (cherry picked from commit a839757109891573123d8777b539fafa2d2198bb) (cherry picked from commit df109ed24233e367ef7060a25ab1b55e2afcddc8) --- sys/compat/linuxkpi/common/include/net/mac80211.h | 31 +++++++++-------- sys/compat/linuxkpi/common/src/linux_80211.c | 41 +++++++++++++++++++---- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index fee8b88d8feb..2b3f6b8e3ab1 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1028,6 +1028,8 @@ void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *); struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *, uint8_t *, uint8_t *, size_t, size_t); void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *); +void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *, + struct ieee80211_tx_status *); /* -------------------------------------------------------------------------- */ @@ -1988,13 +1990,6 @@ ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t) TODO(); } -static __inline void -ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - - linuxkpi_ieee80211_tx_status(hw, skb); -} - static __inline void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid, struct ieee80211_key_seq *seq) @@ -2130,6 +2125,13 @@ ieee80211_wake_queue(struct ieee80211_hw *hw, uint16_t q) TODO(); } +static __inline void +ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) +{ + + linuxkpi_ieee80211_tx_status(hw, skb); +} + static __inline void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) { @@ -2144,6 +2146,14 @@ ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb) ieee80211_tx_status(hw, skb); } +static __inline void +ieee80211_tx_status_ext(struct ieee80211_hw *hw, + struct ieee80211_tx_status *txstat) +{ + + linuxkpi_ieee80211_tx_status_ext(hw, txstat); +} + static __inline void ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) { @@ -2355,13 +2365,6 @@ ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, TODO(); } -static __inline void -ieee80211_tx_status_ext(struct ieee80211_hw *hw, - struct ieee80211_tx_status *txstat) -{ - TODO(); -} - static __inline void ieee80211_color_change_finish(struct ieee80211_vif *vif) { diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index e0457e0e5fa0..57dd174b62a1 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4280,8 +4280,8 @@ linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *txq, * passed back from the driver. rawx_mit() saves the ni on the m and the * m on the skb for us to be able to give feedback to net80211. */ -void -linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb, +static void +_lkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb, int status) { struct ieee80211_node *ni; @@ -4296,20 +4296,28 @@ linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb, ieee80211_tx_complete(ni, m, status); /* ni & mbuf were consumed. */ } +} +void +linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb, + int status) +{ + + _lkpi_ieee80211_free_txskb(hw, skb, status); kfree_skb(skb); } void -linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) +linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw, + struct ieee80211_tx_status *txstat) { + struct sk_buff *skb; struct ieee80211_tx_info *info; struct ieee80211_ratectl_tx_status txs; struct ieee80211_node *ni; int status; - info = IEEE80211_SKB_CB(skb); - + skb = txstat->skb; if (skb->m != NULL) { struct mbuf *m; @@ -4320,6 +4328,7 @@ linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) ni = NULL; } + info = txstat->info; if (info->flags & IEEE80211_TX_STAT_ACK) { status = 0; /* No error. */ txs.status = IEEE80211_RATECTL_TX_SUCCESS; @@ -4342,7 +4351,7 @@ linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) txs.flags |= IEEE80211_RATECTL_STATUS_LONG_RETRY; } #if 0 /* Unused in net80211 currently. */ - /* XXX-BZ conver;t check .flags for MCS/VHT/.. */ + /* XXX-BZ convert check .flags for MCS/VHT/.. */ txs.final_rate = info->status.rates[0].idx; txs.flags |= IEEE80211_RATECTL_STATUS_FINAL_RATE; #endif @@ -4390,7 +4399,25 @@ linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) info->status.status_driver_data[1]); #endif - linuxkpi_ieee80211_free_txskb(hw, skb, status); + if (txstat->free_list) { + _lkpi_ieee80211_free_txskb(hw, skb, status); + list_add_tail(&skb->list, txstat->free_list); + } else { + linuxkpi_ieee80211_free_txskb(hw, skb, status); + } +} + +void +linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) +{ + struct ieee80211_tx_status status; + + memset(&status, 0, sizeof(status)); + status.info = IEEE80211_SKB_CB(skb); + status.skb = skb; + /* sta, n_rates, rates, free_list? */ + + ieee80211_tx_status_ext(hw, &status); } /* From nobody Thu Feb 23 19:34:34 2023 X-Original-To: dev-commits-src-branches@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 4PN3BL5BvDz3sfQS; Thu, 23 Feb 2023 19:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BL2d5dz45Zv; Thu, 23 Feb 2023 19:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180874; 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=mtrRnnLcEH/W08BuW/KZ2micN1gIDbPwQL7SRfArUis=; b=wIhEFmoqPyBpkpmzuCI+cSFaI49VzH3V/W1bHZy3zuBABaCZg3Vk2ovuKN4PL7PY922fds HuD8PwfIAg6SqH+stSPSFIMo2BUb0u3akj0jXyQ8f1Ai0cF866mfr73jIEi2kFM+xkIs/b a3qPUWH+scDUzY79f0NCSfHimJ7U9uhuwiFsZ/hXRdVENNgHIgFip0jg+bHE8n5MCVwihj ugwxLLcG7Sh3oErsJXanPocFogr5Zm59kA2tpN98iGfpGya49fFMwIiP0xTuA4xAwRQcje Bzsxi2e3Z9PqRWBu4xdjBY5sbE0lMNMQA8lFostNRHVhsMUPizpEPXZMZ5Wcow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180874; 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=mtrRnnLcEH/W08BuW/KZ2micN1gIDbPwQL7SRfArUis=; b=VTpfKTDpw9VMEaYKJY46Nw/d4I3Gr+8gd3IYsqoz/dWc1PSMhEVcrq/5WK8rxUDWODyUwP VDq5fnFMrnypGP2LBR28LNDbr+Wo+e/xq8o68H1mscgmkHUUtLxNiXaCdmUIEPhGvXDw19 66uLeed3QFtOhauXz1kVZjwf3A+1TFTk+4cqiI9Q3rwuYjmUdNu6DzUhGHExr5YaueW8NX rWmgd3yxkwIWpfD437Ey5yJKKUGqB+pmIGxSqvwCfAiCAjCQYSjd/8uscpOU++361RqR7y Pg9hbriHkRv2hUvPF03qxPucQ5gaDm4/bVAHnaro7g4YMe/nvwE6lglY2xrwiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180874; a=rsa-sha256; cv=none; b=mVTKzt/2wk1bAEdCE9E5KjtRpeQIo9OxVDmu6yHLj7cPBOHllVeAgLVi3SrajUhempK/xV +ag3BdNCsRrZrtTlRPf1sCypmMbObFL32usvjHKogpC+cio5RlfZl0Tu4joFZL2pjeLS/K DoyzYeK2Xke98hSqbrjXpR257uevuI1FUR0JdEQlrOvGx3VrXh1K63gwgqdnNNZCv7P5U4 QuvZAtJzV+yc6zlDBwhsbrbiaUG3tC/rSSUcSSV0HKL1tz87+OIyaDQqRNj2aHaZnvSEoj WerXBuH9Kh7zZDEp3qJn2Kr7rpR9qyZzJ0PSFmX8NPJ+3xckVO39ECghNfPT4w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BL1MGXzvLZ; Thu, 23 Feb 2023 19:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYYqL020336; Thu, 23 Feb 2023 19:34:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYYV7020335; Thu, 23 Feb 2023 19:34:34 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:34 GMT Message-Id: <202302231934.31NJYYV7020335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 811e79336e96 - releng/13.2 - LinuxKPI: 802.11: implement ieee80211_is_pspoll() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 811e79336e963ada4db550e40def2d77b6753f8a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=811e79336e963ada4db550e40def2d77b6753f8a commit 811e79336e963ada4db550e40def2d77b6753f8a Author: Bjoern A. Zeeb AuthorDate: 2023-01-31 16:36:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:32:41 +0000 LinuxKPI: 802.11: implement ieee80211_is_pspoll() Implement ieee80211_is_pspoll() and move it up to the set of implemented ieee80211_is_*() functions. There are no further changes (git diff just looks weird). Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) (cherry picked from commit ff76cbc81d57ffc4bbc9bc20fd22325b2a8c2028) (cherry picked from commit 2336248a8ba9763ad38074db40f32e117edd86f5) (cherry picked from commit 16dc23caf17f8ffa21e365a1f2fe1a72d7fecbe8) --- sys/compat/linuxkpi/common/include/net/mac80211.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 2b3f6b8e3ab1..b7c6c2d37b90 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1342,29 +1342,33 @@ ieee80211_is_any_nullfunc(__le16 fc) return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)); } -static __inline bool -ieee80211_vif_is_mesh(struct ieee80211_vif *vif) +static inline bool +ieee80211_is_pspoll(__le16 fc) { - TODO(); - return (false); + __le16 v; + + fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); + v = htole16(IEEE80211_FC0_SUBTYPE_PS_POLL | IEEE80211_FC0_TYPE_CTL); + + return (fc == v); } static __inline bool -ieee80211_is_frag(struct ieee80211_hdr *hdr) +ieee80211_vif_is_mesh(struct ieee80211_vif *vif) { TODO(); return (false); } static __inline bool -ieee80211_is_first_frag(__le16 fc) +ieee80211_is_frag(struct ieee80211_hdr *hdr) { TODO(); return (false); } static __inline bool -ieee80211_is_pspoll(__le16 fc) +ieee80211_is_first_frag(__le16 fc) { TODO(); return (false); From nobody Thu Feb 23 19:34:35 2023 X-Original-To: dev-commits-src-branches@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 4PN3BM4PVMz3sf80; Thu, 23 Feb 2023 19:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BM2xRpz45H9; Thu, 23 Feb 2023 19:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180875; 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=ZjqncX0nr62SdF59DSIoz8P6oaiP6NReMcQrJV8h4tY=; b=ldTNAaWwBQiA8FITnY8sa4JSwxy8h8gqziZVB2zVyP+lvIRaU7Kvz7i0eAOlliVQbp3nzP jBKazLoND2Xn2U+EN5JmT5hKt9CHIscwZuqQKRvDcYvbt0gXvs0sNHywCQymRIe0ypu3To ZfG8ABmKcZHoJL1ruvYyOgfLXiPxUnUDvFYgWGUoW9Gf38xHsEWyXj6Nqasonud/Kha5Ty sU19PtvbW52mO1mUqcuSfBDuVOV5QOVP7h+/J/0MUIslT7wsKgCCr/xk4zv7BmhipIIHrm dV5aS1WYKByVz3Ps0FYjjur97x2AI7zpVtvv0zPjpEA+Z69Fly6ujh7ZFBLMHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180875; 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=ZjqncX0nr62SdF59DSIoz8P6oaiP6NReMcQrJV8h4tY=; b=jugW8WJnzdmKHuS4OCBETT6XpzReBInHq0QgYquYBQ3yx8WaE75+MQMJa8jrBet4HJqOjy OokxmE2ZIDYvgvIfku0wrSFfZaYHl5/YPcCCSb5GvsCOOEr4ngDLAZngjU3KpDjaiGQNtz N1mtyUdUeBmiuIDZcpUopUtq8FL2FVgj1HQGj47QKaAC5jAkNiAk7LAywENL3GdM7mPTxt sRmHJAiLVkVrUX5jzAi2a84FE5b+lIDYeTQIU+LgJA+FAgwAA1o0FxJVywcZOiUIiOs81Z wmCwg5r2ikQJ/dnEF8cHR6F0ZBT4OQ2NlX+ERnMPDOpaOqPIcMgjbTpSCFkN9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180875; a=rsa-sha256; cv=none; b=epeoyp2iSSosUJ2GT7BHy7uBsUzG3tzvz2B640u+oPkcKvSnQdehD6ee39GEexaCWTD8Jv o2uUhMq/XX+WYD+rT+lfj4qmIx4hqbzb5RTcez3ZZBtKQ0nO4lqFLn/2Rb7iiBLrVCmmK/ 8S4fWzsPCyUx6gl6b3dgB7e6jJ0frT8hYezd5fdMYdNv/joGfYJPqk4wDdXlD+/lhyNmIq J5MkNcnyogeoD4IKQVh7HRFltxmlwsj4LsExUWuUc8WFH15RcXDPoycWNkVi5Xa5GT7HRe wKrXGIIj+wpZ5FJAIGrZarMGgGi0/0Wq+mU0J6a13JK1ILP1jG7UH0XeSsGzxg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BM22gCzts8; Thu, 23 Feb 2023 19:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYZn3020360; Thu, 23 Feb 2023 19:34:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYZj9020359; Thu, 23 Feb 2023 19:34:35 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:35 GMT Message-Id: <202302231934.31NJYZj9020359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 377fdea48222 - releng/13.2 - LinuxKPI: 802.11: enhance lkpi_scan_ies_add() for HT and VHT List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 377fdea48222d2422d18c93d4d2dada1f553e2bb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=377fdea48222d2422d18c93d4d2dada1f553e2bb commit 377fdea48222d2422d18c93d4d2dada1f553e2bb Author: Bjoern A. Zeeb AuthorDate: 2023-01-31 23:00:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:32:48 +0000 LinuxKPI: 802.11: enhance lkpi_scan_ies_add() for HT and VHT Add code (currently disabled by #ifdef) for HT and VHT to lkpi_scan_ies_add(). Switch to a local variable for ic given the new code also needs the value. Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) (cherry picked from commit 3dd980267f4e53df259eb6d322e7332a8bc5bb0a) (cherry picked from commit 28fbc0caa49b0fb119cc34a704d5437d63f479a3) --- sys/compat/linuxkpi/common/src/linux_80211.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 57dd174b62a1..b2969aeb5db2 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2478,11 +2478,13 @@ lkpi_scan_ies_add(uint8_t *p, struct ieee80211_scan_ies *scan_ies, { struct ieee80211_supported_band *supband; struct linuxkpi_ieee80211_channel *channels; + struct ieee80211com *ic; const struct ieee80211_channel *chan; const struct ieee80211_rateset *rs; uint8_t *pb; int band, i; + ic = vap->iv_ic; for (band = 0; band < NUM_NL80211_BANDS; band++) { if ((band_mask & (1 << band)) == 0) continue; @@ -2503,7 +2505,7 @@ lkpi_scan_ies_add(uint8_t *p, struct ieee80211_scan_ies *scan_ies, if (channels[i].flags & IEEE80211_CHAN_DISABLED) continue; - chan = ieee80211_find_channel(vap->iv_ic, + chan = ieee80211_find_channel(ic, channels[i].center_freq, 0); if (chan != NULL) break; @@ -2514,10 +2516,31 @@ lkpi_scan_ies_add(uint8_t *p, struct ieee80211_scan_ies *scan_ies, continue; pb = p; - rs = ieee80211_get_suprates(vap->iv_ic, chan); /* calls chan2mode */ + rs = ieee80211_get_suprates(ic, chan); /* calls chan2mode */ p = ieee80211_add_rates(p, rs); p = ieee80211_add_xrates(p, rs); +#if defined(LKPI_80211_HT) + if ((vap->iv_flags_ht & IEEE80211_FHT_HT) != 0) { + struct ieee80211_channel *c; + + c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, + vap->iv_flags_ht); + p = ieee80211_add_htcap_ch(p, vap, c); + } +#endif +#if defined(LKPI_80211_VHT) + if ((vap->iv_vht_flags & IEEE80211_FVHT_VHT) != 0) { + struct ieee80211_channel *c; + + c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, + vap->iv_flags_ht); + c = ieee80211_vht_adjust_channel(ic, c, + vap->iv_vht_flags); + p = ieee80211_add_vhtcap_ch(p, vap, c); + } +#endif + scan_ies->ies[band] = pb; scan_ies->len[band] = p - pb; } From nobody Thu Feb 23 19:34:36 2023 X-Original-To: dev-commits-src-branches@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 4PN3BN4nRdz3sfJC; Thu, 23 Feb 2023 19:34:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BN43s1z45mN; Thu, 23 Feb 2023 19:34:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180876; 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=znotsN6JnaUuq5vxwbH9QGMwURRfQnl457Kdl0jUcrY=; b=dMnf78MpVxHpOKcRMLCtx0PVpEOz/LTmEegTP4Tws6RgSsr2AoDOZ42ONrS9W6sD1GIR2m NhzTKgwx0flZVYcxaPKVc3xqCy97rMc6/zYOTgSlSOCDojDqXsRansMieDEkXtZlSKKmlx ytU1GJE5GX9lWLNo7bvSPscfb6eyn3y3EnY2mib/RqGVNIy1X6tKU8Kl3PU6prW35m5Tvl CTaE41V6Ns7bOuEKaWcOcYjUNnWDrqkyrtI34ApQ0dDFZIG5cm2mjYcxfRN975Ctr/vB1G 3RTNlfYPRK6yXNoI8FalUs3KDMcqiFm6YmSrr02smqwhitHsQBlXMZq1+I3yJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180876; 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=znotsN6JnaUuq5vxwbH9QGMwURRfQnl457Kdl0jUcrY=; b=Fey3kRPTkSp8L203VIIsMaM8RKB5ouBDrO9RCq/Ns3PHFwGoF6fTMtM1uP3g1Jfcrrl04M FsQzPLiPml0Diw0G4ZQzeRMLN1dSOj9KUzcrqSNYMpBF3uM2xYue3eofBGXedLsSGpGlpO lblx5IbIdHQaoxOkteplmVwm/MSInuW3NLKnnDJzIyQivaUCVz9gOgwjNq0NX7IKaa4yG/ eA/ee98OyVODv6yxD/oNazr3rtPIHvcrRWC8suTSRbN17plttWqy2+cq4rE7di9W+40AVt jaw7Tb0YPtxgAPHvdIYFuZ/577ai3p4ka5VVWURIrZqHWtyJsTZ8gsiANIZxlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180876; a=rsa-sha256; cv=none; b=Dllw0wgYFgD++zL/K3pzxYqfqxbU7Ofs/AfrQDpqjIqhFgItdDl42Gj10HkXQR7uZE0N60 BFrd+8eY0zIJxDuK+gPLMF4Vixxkr09i6/JCWz9xdOkEy8PiLm2EcgzjJH9Ro6DKxBF640 XIOGH91nUTzCSfjWEMLRn327KGy1VDykhqi5FgDyk0CDv4vYyHooIPYWy6ruuolPQU6ePr h/dt21t3/bd3hDjQ+cG7woJxSj8XvX/vs1b+vnb/qCec9HdYwIztET9QTf1t5VYvJasiMc dhgiQBCwjpSUcKChGFX/z9rJGzMMIWiOOLfY+i/i+R3PEAqqKoOpSG0g5wUsMg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BN32nYzvNJ; Thu, 23 Feb 2023 19:34:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYa0s020379; Thu, 23 Feb 2023 19:34:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYaL0020378; Thu, 23 Feb 2023 19:34:36 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:36 GMT Message-Id: <202302231934.31NJYaL0020378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 8e45120aceeb - releng/13.2 - LinuxKPI: 802.11: fix indent in lkpi_wake_tx_queues() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 8e45120aceeb5a1457b9406c9b1543e5a1d1d314 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8e45120aceeb5a1457b9406c9b1543e5a1d1d314 commit 8e45120aceeb5a1457b9406c9b1543e5a1d1d314 Author: Bjoern A. Zeeb AuthorDate: 2023-01-31 23:12:30 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:32:55 +0000 LinuxKPI: 802.11: fix indent in lkpi_wake_tx_queues() Fix indentation in lkpi_wake_tx_queues(). No functional changes. Sponsored by: The FreeBSD Foundation Approved by: re (cperciva) (cherry picked from commit b0ddb44fd427d44b8153781ce9c461e393771aff) (cherry picked from commit 9e782bfab9042aed12c36746534b1e4e4ec6d597) --- sys/compat/linuxkpi/common/src/linux_80211.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index b2969aeb5db2..bcd8ea9d4c6e 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -861,24 +861,24 @@ lkpi_wake_tx_queues(struct ieee80211_hw *hw, struct ieee80211_sta *sta, /* Wake up all queues to know they are allocated in the driver. */ for (tid = 0; tid < nitems(sta->txq); tid++) { - if (tid == IEEE80211_NUM_TIDS) { - IMPROVE("station specific?"); - if (!ieee80211_hw_check(hw, STA_MMPDU_TXQ)) - continue; - } else if (tid >= hw->queues) + if (tid == IEEE80211_NUM_TIDS) { + IMPROVE("station specific?"); + if (!ieee80211_hw_check(hw, STA_MMPDU_TXQ)) continue; + } else if (tid >= hw->queues) + continue; - if (sta->txq[tid] == NULL) - continue; + if (sta->txq[tid] == NULL) + continue; - ltxq = TXQ_TO_LTXQ(sta->txq[tid]); - if (dequeue_seen && !ltxq->seen_dequeue) - continue; + ltxq = TXQ_TO_LTXQ(sta->txq[tid]); + if (dequeue_seen && !ltxq->seen_dequeue) + continue; - if (no_emptyq && skb_queue_empty(<xq->skbq)) - continue; + if (no_emptyq && skb_queue_empty(<xq->skbq)) + continue; - lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid]); + lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid]); } } From nobody Thu Feb 23 19:34:37 2023 X-Original-To: dev-commits-src-branches@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 4PN3BP6wrJz3sfP5; Thu, 23 Feb 2023 19:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BP4hkSz45c6; Thu, 23 Feb 2023 19:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180877; 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=lnhmBJUWfxoaNY1yvqzeEgRBp6mGqpWvbEkDJoccdZY=; b=MMLblRfLhVzlyhsJGUR2HnnttIzqj8dNeW4CUxHQFdwkz8ZHoL5W1awa1H9a0KifVlQiiV GtUPxXyMrD2ckx5EI66QpmzDot139r8JvWP0vmR0fplh7EeTM1qRyevws/Byuet98qxqYk zs0NEucDbYWmzVpRMq4uDaWBcL4lkeHGdVXwEd0GufdibxhaQ4S8KajGOBR1zn2h1bxM+e 1vABYbcao2j+iFKhJ+yAenSlxF8dfdMfJQnGSeo5mZ5UI5CL5AMZtjVtk0sL8IpR0wpvBT V1DTB33UFEs/VL5NmriNE+9hUgBzWrLqrXE+Y/i3gQbInrBkvxCj/YpfNyeUng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180877; 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=lnhmBJUWfxoaNY1yvqzeEgRBp6mGqpWvbEkDJoccdZY=; b=nazQ0udRGCD0zViezjH4X2CQhWXOaUO3e/ij49KoU2a+myOmgrAoLoFnkW1Ymc15OhiCfF GItZ/LeIeJVpqDNvBrMbn+VYkEh97YNxCP4K2rZuXOebz/9CcXMkO5gyQlBXjNevBYjl4L r2wOC52zFZtie9I2QhHyWSRf1HLLyFzvLYgJTm7wg9I2udN+1IZK3xqJkXqnvlyklX6oSX K68MZ4Q7T240SAGC6wbT/n6T8XqHAS+pC9GVVAGS61a2A5hs2UdEcuXFpAR7EUKi4M9ayC 0L5CeKk5cxvKjbYyF56JkzxqpI2oavPWpzvSku3pJ21SaikdHECFH3cGIoqwgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180877; a=rsa-sha256; cv=none; b=n3kpCZmcZnmx0L5IoY/HppfQPcvysmRKDe7Fvbo59Sq+bC8xkzLHKvgkjYX5Y7TZK3sRQc nJP/Ek/ltBxtvG5NEbpU7jYfltViDVJ6fu5D2gQNL07YKFiX6yZX6jSSdlhK9KuyHTcGed 2KXNoqOlYtJpA3GUgcg92l4g8PLWd1gQV4r2V3dxtB5QJIKf9tMVM7DpgpovSeoIGEl8na YpwsHgddEXY/ksMSzFBOW6QReZFayClfU1ncrIGL28msOtM6dvkuWu4VraXcONiRyQkb3c Bw68I777XYdrCoJKdCxlWyWwTtCtb6CZ8DA8HQ/L41Uqy0Uq4X4nQzbKOOu+sw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BP3mCvzvBZ; Thu, 23 Feb 2023 19:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYbOS020398; Thu, 23 Feb 2023 19:34:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYbYG020397; Thu, 23 Feb 2023 19:34:37 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:37 GMT Message-Id: <202302231934.31NJYbYG020397@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0b165b1fce84 - releng/13.2 - LinuxKPI: 802.11: basic implementation of *queue(s)/*txq* LinuxKPI: 802.11: deal with stopped queues List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 0b165b1fce848c6c636548d54064eec5a9d82c55 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0b165b1fce848c6c636548d54064eec5a9d82c55 commit 0b165b1fce848c6c636548d54064eec5a9d82c55 Author: Bjoern A. Zeeb AuthorDate: 2023-01-31 16:17:14 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:33:01 +0000 LinuxKPI: 802.11: basic implementation of *queue(s)/*txq* LinuxKPI: 802.11: deal with stopped queues Very basic implementations of ieee80211_{wake,stop}_queue[s], as well as ieee80211_txq_schedule_start(), ieee80211_next_txq(), and ieee80211_schedule_txq(). Various combinations of these are used by different wireless drivers, incl. iwlwifi. Following 5a9a0d7803382321b5f9fff1deae5fb08463cf1a initialize the queue values explicitly and deal with a stopped queue in ieee80211_tx_dequeue(). Sponsored by: The FreeBSD Foundation (parts of this work) Approved by: re (cperciva) (cherry picked from commit 5a9a0d7803382321b5f9fff1deae5fb08463cf1a) (cherry picked from commit 0cbcfa1964de89cd346ee6f79437c6ab83a3b716) (cherry picked from commit 9f9d047405778b2d2aca829a2037532b8ae8ed5d) --- sys/compat/linuxkpi/common/include/net/mac80211.h | 124 +++++------ sys/compat/linuxkpi/common/src/linux_80211.c | 237 ++++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_80211.h | 14 ++ 3 files changed, 316 insertions(+), 59 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index b7c6c2d37b90..36e6600f237b 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1030,6 +1030,14 @@ struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *, void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *); void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *, struct ieee80211_tx_status *); +void linuxkpi_ieee80211_stop_queues(struct ieee80211_hw *); +void linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *); +void linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *, int); +void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *, int); +void linuxkpi_ieee80211_txq_schedule_start(struct ieee80211_hw *, uint8_t); +struct ieee80211_txq *linuxkpi_ieee80211_next_txq(struct ieee80211_hw *, uint8_t); +void linuxkpi_ieee80211_schedule_txq(struct ieee80211_hw *, + struct ieee80211_txq *, bool); /* -------------------------------------------------------------------------- */ @@ -1508,6 +1516,63 @@ ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb) /* -------------------------------------------------------------------------- */ +static inline void +ieee80211_stop_queues(struct ieee80211_hw *hw) +{ + linuxkpi_ieee80211_stop_queues(hw); +} + +static inline void +ieee80211_wake_queues(struct ieee80211_hw *hw) +{ + linuxkpi_ieee80211_wake_queues(hw); +} + +static inline void +ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum) +{ + linuxkpi_ieee80211_stop_queue(hw, qnum); +} + +static inline void +ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum) +{ + linuxkpi_ieee80211_wake_queue(hw, qnum); +} + +static inline void +ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) +{ + linuxkpi_ieee80211_schedule_txq(hw, txq, true); +} + +static inline void +ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, + bool withoutpkts) +{ + linuxkpi_ieee80211_schedule_txq(hw, txq, true); +} + +static inline void +ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac) +{ + linuxkpi_ieee80211_txq_schedule_start(hw, ac); +} + +static inline void +ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac) +{ + /* DO_NADA; */ +} + +static inline struct ieee80211_txq * +ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac) +{ + return (linuxkpi_ieee80211_next_txq(hw, ac)); +} + +/* -------------------------------------------------------------------------- */ + static __inline uint8_t ieee80211_get_tid(struct ieee80211_hdr *hdr) { @@ -1819,18 +1884,6 @@ ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr, TODO(); } -static __inline void -ieee80211_stop_queues(struct ieee80211_hw *hw) -{ - TODO(); -} - -static __inline void -ieee80211_wake_queues(struct ieee80211_hw *hw) -{ - TODO(); -} - static __inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state) { @@ -2117,18 +2170,6 @@ ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w) linuxkpi_ieee80211_queue_work(hw, w); } -static __inline void -ieee80211_stop_queue(struct ieee80211_hw *hw, uint16_t q) -{ - TODO(); -} - -static __inline void -ieee80211_wake_queue(struct ieee80211_hw *hw, uint16_t q) -{ - TODO(); -} - static __inline void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) { @@ -2259,41 +2300,6 @@ ieee80211_sta_register_airtime(struct ieee80211_sta *sta, TODO(); } - -static __inline void -ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac) -{ - TODO(); -} - -static __inline void -ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac) -{ - /* DO_NADA; */ -} - -static __inline struct ieee80211_txq * -ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac) -{ - - TODO(); - return (NULL); -} - -static __inline void -ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) -{ - TODO(); -} - -static __inline void -ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, - bool withoutpkts) -{ - TODO(); -} - - static __inline void ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter) { diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index bcd8ea9d4c6e..d0a3b4b8586a 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -76,6 +76,12 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_LKPI80211, "lkpi80211", "LinuxKPI 80211 compat"); +/* XXX-BZ really want this and others in queue.h */ +#define TAILQ_ELEM_INIT(elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = NULL; \ +} while (0) + /* -------------------------------------------------------------------------- */ /* Keep public for as long as header files are using it too. */ @@ -238,9 +244,11 @@ lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], ltxq->txq.ac = tid_to_mac80211_ac[tid & 7]; } ltxq->seen_dequeue = false; + ltxq->stopped = false; ltxq->txq.vif = vif; ltxq->txq.tid = tid; ltxq->txq.sta = sta; + TAILQ_ELEM_INIT(ltxq, txq_entry); skb_queue_head_init(<xq->skbq); sta->txq[tid] = <xq->txq; } @@ -2270,6 +2278,9 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], vif->hw_queue[i] = i; else vif->hw_queue[i] = 0; + + /* Initialize the queue to running. Stopped? */ + lvif->hw_queue_stopped[i] = false; } vif->cab_queue = IEEE80211_INVAL_HW_QUEUE; @@ -4262,13 +4273,25 @@ linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { struct lkpi_txq *ltxq; + struct lkpi_vif *lvif; struct sk_buff *skb; + skb = NULL; ltxq = TXQ_TO_LTXQ(txq); ltxq->seen_dequeue = true; + if (ltxq->stopped) + goto stopped; + + lvif = VIF_TO_LVIF(ltxq->txq.vif); + if (lvif->hw_queue_stopped[ltxq->txq.ac]) { + ltxq->stopped = true; + goto stopped; + } + skb = skb_dequeue(<xq->skbq); +stopped: return (skb); } @@ -4643,6 +4666,220 @@ linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *vif) /* -------------------------------------------------------------------------- */ +void +linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum) +{ + struct lkpi_hw *lhw; + struct lkpi_vif *lvif; + struct ieee80211_vif *vif; + int ac_count, ac; + + KASSERT(qnum < hw->queues, ("%s: qnum %d >= hw->queues %d, hw %p\n", + __func__, qnum, hw->queues, hw)); + + lhw = wiphy_priv(hw->wiphy); + + /* See lkpi_ic_vap_create(). */ + if (hw->queues >= IEEE80211_NUM_ACS) + ac_count = IEEE80211_NUM_ACS; + else + ac_count = 1; + + LKPI_80211_LHW_LVIF_LOCK(lhw); + TAILQ_FOREACH(lvif, &lhw->lvif_head, lvif_entry) { + + vif = LVIF_TO_VIF(lvif); + for (ac = 0; ac < ac_count; ac++) { + IMPROVE_TXQ("LOCKING"); + if (qnum == vif->hw_queue[ac]) { + /* + * For now log this to better understand + * how this is supposed to work. + */ + if (lvif->hw_queue_stopped[ac]) + ic_printf(lhw->ic, "%s:%d: lhw %p hw %p " + "lvif %p vif %p ac %d qnum %d already " + "stopped\n", __func__, __LINE__, + lhw, hw, lvif, vif, ac, qnum); + lvif->hw_queue_stopped[ac] = true; + } + } + } + LKPI_80211_LHW_LVIF_UNLOCK(lhw); +} + +void +linuxkpi_ieee80211_stop_queues(struct ieee80211_hw *hw) +{ + int i; + + IMPROVE_TXQ("Locking; do we need further info?"); + for (i = 0; i < hw->queues; i++) + linuxkpi_ieee80211_stop_queue(hw, i); +} + + +static void +lkpi_ieee80211_wake_queues(struct ieee80211_hw *hw, int hwq) +{ + struct lkpi_hw *lhw; + struct lkpi_vif *lvif; + struct lkpi_sta *lsta; + int ac_count, ac, tid; + + /* See lkpi_ic_vap_create(). */ + if (hw->queues >= IEEE80211_NUM_ACS) + ac_count = IEEE80211_NUM_ACS; + else + ac_count = 1; + + lhw = wiphy_priv(hw->wiphy); + + IMPROVE_TXQ("Locking"); + LKPI_80211_LHW_LVIF_LOCK(lhw); + TAILQ_FOREACH(lvif, &lhw->lvif_head, lvif_entry) { + struct ieee80211_vif *vif; + + vif = LVIF_TO_VIF(lvif); + for (ac = 0; ac < ac_count; ac++) { + + if (hwq == vif->hw_queue[ac]) { + + /* XXX-BZ what about software scan? */ + + /* + * For now log this to better understand + * how this is supposed to work. + */ + if (!lvif->hw_queue_stopped[ac]) + ic_printf(lhw->ic, "%s:%d: lhw %p hw %p " + "lvif %p vif %p ac %d hw_q not stopped\n", + __func__, __LINE__, + lhw, hw, lvif, vif, ac); + lvif->hw_queue_stopped[ac] = false; + + LKPI_80211_LVIF_LOCK(lvif); + TAILQ_FOREACH(lsta, &lvif->lsta_head, lsta_entry) { + struct ieee80211_sta *sta; + + sta = LSTA_TO_STA(lsta); + for (tid = 0; tid < nitems(sta->txq); tid++) { + struct lkpi_txq *ltxq; + + if (sta->txq[tid] == NULL) + continue; + + if (sta->txq[tid]->ac != ac) + continue; + + ltxq = TXQ_TO_LTXQ(sta->txq[tid]); + if (!ltxq->stopped) + continue; + + ltxq->stopped = false; + + /* XXX-BZ see when this explodes with all the locking. taskq? */ + lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid]); + } + } + LKPI_80211_LVIF_UNLOCK(lvif); + } + } + } + LKPI_80211_LHW_LVIF_UNLOCK(lhw); +} + +void +linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *hw) +{ + int i; + + IMPROVE_TXQ("Is this all/enough here?"); + for (i = 0; i < hw->queues; i++) + lkpi_ieee80211_wake_queues(hw, i); +} + +void +linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum) +{ + + KASSERT(qnum < hw->queues, ("%s: qnum %d >= hw->queues %d, hw %p\n", + __func__, qnum, hw->queues, hw)); + + lkpi_ieee80211_wake_queues(hw, qnum); +} + +/* This is just hardware queues. */ +void +linuxkpi_ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac) +{ + struct lkpi_hw *lhw; + + lhw = HW_TO_LHW(hw); + + IMPROVE_TXQ("Are there reasons why we wouldn't schedule?"); + IMPROVE_TXQ("LOCKING"); + if (++lhw->txq_generation[ac] == 0) + lhw->txq_generation[ac]++; +} + +struct ieee80211_txq * +linuxkpi_ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac) +{ + struct lkpi_hw *lhw; + struct ieee80211_txq *txq; + struct lkpi_txq *ltxq; + + lhw = HW_TO_LHW(hw); + txq = NULL; + + IMPROVE_TXQ("LOCKING"); + + /* Check that we are scheduled. */ + if (lhw->txq_generation[ac] == 0) + goto out; + + ltxq = TAILQ_FIRST(&lhw->scheduled_txqs[ac]); + if (ltxq == NULL) + goto out; + if (ltxq->txq_generation == lhw->txq_generation[ac]) + goto out; + + ltxq->txq_generation = lhw->txq_generation[ac]; + TAILQ_REMOVE(&lhw->scheduled_txqs[ac], ltxq, txq_entry); + txq = <xq->txq; + TAILQ_ELEM_INIT(ltxq, txq_entry); + +out: + return (txq); +} + +void linuxkpi_ieee80211_schedule_txq(struct ieee80211_hw *hw, + struct ieee80211_txq *txq, bool withoutpkts) +{ + struct lkpi_hw *lhw; + struct lkpi_txq *ltxq; + + ltxq = TXQ_TO_LTXQ(txq); + + IMPROVE_TXQ("LOCKING"); + + /* Only schedule if work to do or asked to anyway. */ + if (!withoutpkts && skb_queue_empty(<xq->skbq)) + goto out; + + /* Make sure we do not double-schedule. */ + if (ltxq->txq_entry.tqe_next != NULL) + goto out; + + lhw = HW_TO_LHW(hw); + TAILQ_INSERT_TAIL(&lhw->scheduled_txqs[txq->ac], ltxq, txq_entry); +out: + return; +} + +/* -------------------------------------------------------------------------- */ + struct lkpi_cfg80211_bss { u_int refcnt; struct cfg80211_bss bss; diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h index d9f2ce68f4f1..4d44ca07948e 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.h +++ b/sys/compat/linuxkpi/common/src/linux_80211.h @@ -50,6 +50,7 @@ #ifndef D80211_IMPROVE #define D80211_IMPROVE 0x2 #endif +#define D80211_IMPROVE_TXQ 0x4 #define D80211_TRACE 0x10 #define D80211_TRACEOK 0x20 #define D80211_TRACE_TX 0x100 @@ -62,6 +63,10 @@ #define D80211_TRACE_STA 0x10000 #define D80211_TRACE_MO 0x100000 +#define IMPROVE_TXQ(...) \ + if (linuxkpi_debug_80211 & D80211_IMPROVE_TXQ) \ + printf("%s:%d: XXX LKPI80211 IMPROVE_TXQ\n", __func__, __LINE__) + struct lkpi_radiotap_tx_hdr { struct ieee80211_radiotap_header wt_ihdr; uint8_t wt_flags; @@ -93,7 +98,11 @@ struct lkpi_radiotap_rx_hdr { (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)) struct lkpi_txq { + TAILQ_ENTRY(lkpi_txq) txq_entry; + bool seen_dequeue; + bool stopped; + uint32_t txq_generation; struct sk_buff_head skbq; /* Must be last! */ @@ -139,6 +148,8 @@ struct lkpi_vif { TAILQ_HEAD(, lkpi_sta) lsta_head; bool added_to_drv; /* Driver knows; i.e. we called add_interface(). */ + bool hw_queue_stopped[IEEE80211_NUM_ACS]; + /* Must be last! */ struct ieee80211_vif vif __aligned(CACHE_LINE_SIZE); }; @@ -164,6 +175,9 @@ struct lkpi_hw { /* name it mac80211_sc? */ struct mtx mtx; + uint32_t txq_generation[IEEE80211_NUM_ACS]; + TAILQ_HEAD(, lkpi_txq) scheduled_txqs[IEEE80211_NUM_ACS]; + /* Scan functions we overload to handle depending on scan mode. */ void (*ic_scan_curchan)(struct ieee80211_scan_state *, unsigned long); From nobody Thu Feb 23 19:34:38 2023 X-Original-To: dev-commits-src-branches@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 4PN3BR1p37z3sfQh; Thu, 23 Feb 2023 19:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BQ5s6kz45T5; Thu, 23 Feb 2023 19:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180878; 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=YzzF/jyAlz25ZqeN29AHYQS818Pr4Va0UGyXP4Hz3oo=; b=CSpFylkUdi6IEOX1XqBmnNglFwG5p6rchwQ8ZIaQS4xd9CTy0y85rX5+GGMzgL9CmULI4v V+7cC9RbACnk3/+oEVFxKlxderyLX53kJpITdHGf8XykbEDOVVPnl1Rc1ECMlMvrWiBVrU qgFb4FLfIb/9uqFh3WQhDkqPyu8iMqPIoDBoxNgftViB/BlsxyPCHk9sclLjcaHF7o/aWy YHSsGyBhlNPZ39XaykrF5oruC5G67AMexwGSUJQuTO0XU1ewqSDxzxOrOdd4RKkeZvxPJq VOtQrBtufVA+JSSiEubpIMlFBn9DaG2hgtDlbyzmfyhR0bxBzG6Z+1NNE2CSbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180878; 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=YzzF/jyAlz25ZqeN29AHYQS818Pr4Va0UGyXP4Hz3oo=; b=j2Rit4SvnHIvwVyWXX8Poi5RH73VjIodMHc+G4M/xLrDO0eRJkby+mf7eJjRdo9N1aZONN BSpy1BFlH7o8ol0f5o2qe3R9LS7lQJ8Ol73ZHpn/gwKgiIPOswoEhzcG6XkWJXOSGe/wP7 xLb3YOLW6QGs+gwy7ewG6zfv4RyZGzXZNcLAN17avRT9QVTB2UWq/jahCBYUiUgEgZNrd1 y5E93ArIGxmBhTlycleNU9e/e40qOSQizMmDzPcrivkAmO1zApZUTEQ97Az8g1ohYz+NqV 9u258LGRQFzXcaJDXzxa0nCHdEbIFvJQHiYPTU9g1bWVOwZnHnGLiHDY37LY7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180878; a=rsa-sha256; cv=none; b=KZwzSzoy/7NvaKg2EjjDYfaepno5aDcRppwqfLR95+kAjdO9gF6rH0xk0afuN5uZfZcyVC sSnImYt1SwK4miRtnoQIylAa/3fTdIvpMaO7EcFKiMhmpfGaW37SWA10PfQY0TngZK1nlI d5sPN/8FMxSNtUcRxVysF7yk10bFnTs6A3t5LSxSeOthDZ1fzDSflrIAAAq7ZZr2eRNCgP BlkFZUiJkrpDMj//xuydkc3VFY10LtoX5daV1YmDpaksyLpS+qF3Gu1kVEN6eoksH3TD63 THvxaInAZ2zGWe2oy7Lfib/yALubEeco3qNeQ3oT6DUttHfh6PmuqTzwyGsXyw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BQ4xykzvTM; Thu, 23 Feb 2023 19:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYckk020417; Thu, 23 Feb 2023 19:34:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYcJ3020416; Thu, 23 Feb 2023 19:34:38 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:38 GMT Message-Id: <202302231934.31NJYcJ3020416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4876c939ce63 - releng/13.2 - LinuxKPI: implement irq_get_msi_desc() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 4876c939ce63c86fe918e469881cc92ec40cfbee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4876c939ce63c86fe918e469881cc92ec40cfbee commit 4876c939ce63c86fe918e469881cc92ec40cfbee Author: Bjoern A. Zeeb AuthorDate: 2022-11-28 18:27:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:33:09 +0000 LinuxKPI: implement irq_get_msi_desc() Add irq_get_msi_desc() as a wrapper around a PCI function which will allocate a single cached value (see comment on struct) for the msi_desc requested if it doesn't exist yet and handle freeing it when the PCI device goes away. We take the values from the ivars of the native (FreeBSD) device. While changing struct pci_dev also add the msi_cap field requested by a wireless driver. Reviewed by: hselasky (earlier version) Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D37523 (cherry picked from commit 4b56afaf7bf4fa37bae5b26fd93ee1ff5969c1bb) (cherry picked from commit 7d23664b35a2611dc4fea56f7cfd2b99f91626a0) --- sys/compat/linuxkpi/common/include/linux/pci.h | 14 ++++++++++++ sys/compat/linuxkpi/common/src/linux_pci.c | 31 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 8d41e33b0da8..1475a159e0b5 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -303,6 +303,17 @@ _pci_exit(void) \ module_init(_pci_init); \ module_exit(_pci_exit) +struct msi_msg { + uint32_t data; +}; + +struct msi_desc { + struct msi_msg msg; + struct { + bool is_64; + } msi_attrib; +}; + /* * If we find drivers accessing this from multiple KPIs we may have to * refcount objects of this structure. @@ -338,6 +349,8 @@ struct pci_dev { bool managed; /* devres "pcim_*(). */ bool want_iomap_res; bool msix_enabled; + uint8_t msi_cap; + struct msi_desc *msi_desc; }; /* XXX add kassert here on the mmio offset */ @@ -366,6 +379,7 @@ struct resource *_lkpi_pci_iomap(struct pci_dev *pdev, int bar, int mmio_size); struct pcim_iomap_devres *lkpi_pcim_iomap_devres_find(struct pci_dev *pdev); void lkpi_pcim_iomap_table_release(struct device *, void *); struct pci_dev *lkpi_pci_get_device(uint16_t, uint16_t, struct pci_dev *); +struct msi_desc *lkpi_pci_msi_desc_alloc(int); static inline bool dev_is_pci(struct device *dev) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 15c5030a33b9..e31ff18b675d 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -341,6 +341,8 @@ lkpinew_pci_dev_release(struct device *dev) if (pdev->bus->self != pdev) pci_dev_put(pdev->bus->self); free(pdev->bus, M_DEVBUF); + if (pdev->msi_desc != NULL) + free(pdev->msi_desc, M_DEVBUF); free(pdev, M_DEVBUF); } @@ -962,6 +964,35 @@ out: return (-EINVAL); } +struct msi_desc * +lkpi_pci_msi_desc_alloc(int irq) +{ + struct device *dev; + struct pci_dev *pdev; + struct msi_desc *desc; + struct pci_devinfo *dinfo; + struct pcicfg_msi *msi; + + dev = linux_pci_find_irq_dev(irq); + if (dev == NULL) + return (NULL); + + pdev = to_pci_dev(dev); + if (pdev->msi_desc != NULL) + return (pdev->msi_desc); + + dinfo = device_get_ivars(dev->bsddev); + msi = &dinfo->cfg.msi; + + desc = malloc(sizeof(*desc), M_DEVBUF, M_WAITOK | M_ZERO); + + desc->msi_attrib.is_64 = + (msi->msi_ctrl & PCIM_MSICTRL_64BIT) ? true : false; + desc->msg.data = msi->msi_data; + + return (desc); +} + CTASSERT(sizeof(dma_addr_t) <= sizeof(uint64_t)); struct linux_dma_obj { From nobody Thu Feb 23 19:34:39 2023 X-Original-To: dev-commits-src-branches@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 4PN3BS0bskz3sfcf; Thu, 23 Feb 2023 19:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BR6vPQz45w7; Thu, 23 Feb 2023 19:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180880; 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=s+EJAgKtQrvVcK78Sk2Q/GwH9xdGl/muwUq5h4hHPII=; b=rHsY1fpW1umPLoVg0LhosjnwZkG8EJIdiXqSrUlo5mVv8MvZHZY7S5B4PARcT/9Bdjj7Y/ Mz5w74BWT6T+i5+Geo/8ADgfHL/fIiBonScpNxeT7eyjHI1pIQPD9Oxp6u4qnJSwosw2bQ F1gLvOonG5kSWKL8iiIEWR1bA2/b7pFTjOfdsQlxTzVr4FK1lxWXhh3xT/iBSqV3OcBJdH F/gQ4XdYlkzpxqy14bTbX9slK1TA+U4aXmJmJXveJ/Y6DjjrA/pScqtu0pFAWK8AkmEap0 fpCliwwxBtwWtVKfPhR/MRy5Rx/Oy6Z8sEP6fIBYbW1Ng7I9eVWCGUlS814ljg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180880; 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=s+EJAgKtQrvVcK78Sk2Q/GwH9xdGl/muwUq5h4hHPII=; b=pt4BemVCGnf+PtWWxCzJKfEtbnm010wO+HWHPn6t/jgFR4Z8lg+JyfqB1XMqJaWJEhOnDp uxO2FqXfMAUsyK2MYIikx6SHtPW/zbZBOCX4IZdtTsJCnmPUaIawpOWPwKa4RMfRxIzXwc C0kijAMrwx99DdMqv0OJrCfmRZXyqC3/pDlAmErDAzPePI5FN133FWbEF88BevQu1HKzvI aBR2cRm0jO7KXMziyl+iJ9M2u2MWSL9TFteOJ1Z1BLjiy3bvK7q2nuxaymId58DNrXGNHr UeKw4PB4qWOT2eMJQekiAcPC6fPAN/pwndPb6fUxx0HIWygmXMF0ANFOPejBfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180880; a=rsa-sha256; cv=none; b=mFTN2Wk6Z7up5tAc1xXVO82Be+qx13v37pVKbaxBCRgODtNZDINf3kt3NAjazSVkjtMAQ3 1HCWGPj3HuE1+nL8bN6YtNsAYyaJDWHZm3x6O/dmOKJd4lKb3cd3TX2RgmZtxLnjoF4vw/ Hsrqb7K16zjwVAyhoBEYqS1GOzSRoXQ4ZbdKV/G5ZB1pSK02jiiEjbvv/prznjs/ywRujc +Zes67tQu3AJQDsY4jjw6oLNBie++d/hil+pVNm+r3uV9vx1ucA0s/RX7AwIwqBDYOsRfD ahlSGi6Nlif15XFALx0Up9ScUWOpPK5PkugrRXfrDS6oyG2Od7dWMs4qrwkcmA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BR605nzvTN; Thu, 23 Feb 2023 19:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYdJi020441; Thu, 23 Feb 2023 19:34:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYd7S020440; Thu, 23 Feb 2023 19:34:39 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:39 GMT Message-Id: <202302231934.31NJYd7S020440@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0de7dba20435 - releng/13.2 - LinuxKPI: PCI: implement support for more than 1 MSI vector List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 0de7dba20435c0361067b451886b8185d53b0951 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0de7dba20435c0361067b451886b8185d53b0951 commit 0de7dba20435c0361067b451886b8185d53b0951 Author: Bjoern A. Zeeb AuthorDate: 2023-01-27 15:34:42 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:33:16 +0000 LinuxKPI: PCI: implement support for more than 1 MSI vector Following e9715b1c4474333ff119aba3a9a74bff91f72372 and 4b56afaf7bf4fa37bae5b26fd93ee1ff5969c1bb, implement support for up-to 32 MSI vectors. This is used by wireless drivers. This also switches msi_desc to an array in order to store per-vector information. Sponsored by: The FreeBSD Foundation Discussed with: grehan (in Dec) Reviewed by: jhb Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38222 (cherry picked from commit b15491b4773af99ce2470144ef6bcd9146cc9a98) (cherry picked from commit 03a85378b81fcaffae5f8efdd75e2b8e10094e6a) --- sys/compat/linuxkpi/common/include/linux/pci.h | 36 +++++++++++++++++++------- sys/compat/linuxkpi/common/src/linux_pci.c | 32 ++++++++++++++++++----- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 1475a159e0b5..5e028774f079 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -350,7 +350,7 @@ struct pci_dev { bool want_iomap_res; bool msix_enabled; uint8_t msi_cap; - struct msi_desc *msi_desc; + struct msi_desc **msi_desc; }; /* XXX add kassert here on the mmio offset */ @@ -901,28 +901,44 @@ pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, linux_pci_enable_msi(pdev) static inline int -pci_enable_msi(struct pci_dev *pdev) +_lkpi_pci_enable_msi_range(struct pci_dev *pdev, int minvec, int maxvec) { struct resource_list_entry *rle; int error; - int avail; + int nvec; - avail = pci_msi_count(pdev->dev.bsddev); - if (avail < 1) - return -EINVAL; + if (maxvec < minvec) + return (-EINVAL); + + nvec = pci_msi_count(pdev->dev.bsddev); + if (nvec < 1 || nvec < minvec) + return (-ENOSPC); - avail = 1; /* this function only enable one MSI IRQ */ - if ((error = -pci_alloc_msi(pdev->dev.bsddev, &avail)) != 0) + nvec = min(nvec, maxvec); + if ((error = -pci_alloc_msi(pdev->dev.bsddev, &nvec)) != 0) return error; + /* Native PCI might only ever ask for 32 vectors. */ + if (nvec < minvec) { + pci_release_msi(pdev->dev.bsddev); + return (-ENOSPC); + } + rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1, false); pdev->dev.irq_start = rle->start; - pdev->dev.irq_end = rle->start + avail; + pdev->dev.irq_end = rle->start + nvec; pdev->irq = rle->start; pdev->msi_enabled = true; return (0); } +static inline int +pci_enable_msi(struct pci_dev *pdev) +{ + + return (_lkpi_pci_enable_msi_range(pdev, 1, 1)); +} + static inline int pci_channel_offline(struct pci_dev *pdev) { @@ -1623,7 +1639,7 @@ err: /* * We cannot simply re-define pci_get_device() as we would normally do * and then hide it in linux_pci.c as too many semi-native drivers still - * inlucde linux/pci.h and run into the conflict with native PCI. Linux drivers + * include linux/pci.h and run into the conflict with native PCI. Linux drivers * using pci_get_device() need to be changed to call linuxkpi_pci_get_device(). */ static inline struct pci_dev * diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index e31ff18b675d..a66627612778 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -322,6 +322,11 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) pdev->dev.parent = &linux_root_device; pdev->dev.release = lkpi_pci_dev_release; INIT_LIST_HEAD(&pdev->dev.irqents); + + if (pci_msi_count(dev) > 0) + pdev->msi_desc = malloc(pci_msi_count(dev) * + sizeof(*pdev->msi_desc), M_DEVBUF, M_WAITOK | M_ZERO); + kobject_init(&pdev->dev.kobj, &linux_dev_ktype); kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev)); kobject_add(&pdev->dev.kobj, &linux_root_device.kobj, @@ -334,6 +339,7 @@ static void lkpinew_pci_dev_release(struct device *dev) { struct pci_dev *pdev; + int i; pdev = to_pci_dev(dev); if (pdev->root != NULL) @@ -341,8 +347,11 @@ lkpinew_pci_dev_release(struct device *dev) if (pdev->bus->self != pdev) pci_dev_put(pdev->bus->self); free(pdev->bus, M_DEVBUF); - if (pdev->msi_desc != NULL) + if (pdev->msi_desc != NULL) { + for (i = pci_msi_count(pdev->dev.bsddev) - 1; i >= 0; i--) + free(pdev->msi_desc[i], M_DEVBUF); free(pdev->msi_desc, M_DEVBUF); + } free(pdev, M_DEVBUF); } @@ -949,10 +958,7 @@ out: if (flags & PCI_IRQ_MSI) { if (pci_msi_count(pdev->dev.bsddev) < minv) return (-ENOSPC); - /* We only support 1 vector in pci_enable_msi() */ - if (minv != 1) - return (-ENOSPC); - error = pci_enable_msi(pdev); + error = _lkpi_pci_enable_msi_range(pdev, minv, maxv); if (error == 0 && pdev->msi_enabled) return (pdev->dev.irq_end - pdev->dev.irq_start); } @@ -972,14 +978,24 @@ lkpi_pci_msi_desc_alloc(int irq) struct msi_desc *desc; struct pci_devinfo *dinfo; struct pcicfg_msi *msi; + int vec; dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return (NULL); pdev = to_pci_dev(dev); - if (pdev->msi_desc != NULL) - return (pdev->msi_desc); + + if (pdev->msi_desc == NULL) + return (NULL); + + if (irq < pdev->dev.irq_start || irq >= pdev->dev.irq_end) + return (NULL); + + vec = pdev->dev.irq_start - irq; + + if (pdev->msi_desc[vec] != NULL) + return (pdev->msi_desc[vec]); dinfo = device_get_ivars(dev->bsddev); msi = &dinfo->cfg.msi; @@ -990,6 +1006,8 @@ lkpi_pci_msi_desc_alloc(int irq) (msi->msi_ctrl & PCIM_MSICTRL_64BIT) ? true : false; desc->msg.data = msi->msi_data; + pdev->msi_desc[vec] = desc; + return (desc); } From nobody Thu Feb 23 19:34:40 2023 X-Original-To: dev-commits-src-branches@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 4PN3BT1Ffjz3sfch; Thu, 23 Feb 2023 19:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BT0Ybqz45tB; Thu, 23 Feb 2023 19:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180881; 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=GDlIK+Exq989JXxh7ZcQzIhIV416cRq46I6t+9Gwoc4=; b=jLZ5MtAfZfp1Goq9JJyRJ1EFPf1PHN5xI6Hm3E42d3rqBCskkRGhrU5Pjbfa7E2UYe5zbJ OdRBxemhs8R0bW4RROeAgDHlE6V6XhRufZfDa2D1F6E8Ki8R2HCN67DkaQK+/FyQn2zKS4 4OrovIY89nik/2QrbmoujjqruurANuZ6g8RZCHoA3sboG22rct1327idIzwn/1f+tiX7jV kDvSwoPiHIXe798Fl+exzkaWPTIrGJ/6Woy4vnHHphso6YmqcjviEzNxMS/R8Ug5lj5Ggp PLVWpFjLM6FRvNMlFPSOPhGYepSvscjVXB6xLAUX3AEfSz8mfbP4Nc5speyZFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180881; 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=GDlIK+Exq989JXxh7ZcQzIhIV416cRq46I6t+9Gwoc4=; b=mLDPPd4XqHrF8EdT3EpDoZ6JO1qDmcInaz0k95eSendG/59wn5EMqShYutQRXUvoGH4XP/ Ydwgr10yqT6EbH4iFBbeRHt6o4XE9if4ECWRZ2/hLAsAKyAKOIwOFTAJ2Ln9ApbmgbFtE6 oW6wWIoKtMVHPHLzbpvqmFun3IrvbU0n09LYil4vIUyGn4CAvyCtPwNRZAxZJA1iwavN6i 0OaqGtq8E18PJs3Xob8t9cIpV3u/VzwGtTgzWfxh7lzIbLsS9diQWovMMPI805HGvJYUqr maV8nCfU6w6CWo6puy36t+F5x83oDym1OJ0edp7ggk53f3ql1epFQJargSsXYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180881; a=rsa-sha256; cv=none; b=OOziYuo2zeo5UbpM4AOKnhZAKIJ+DcuI6M/fWaqhkkClCIcAffr3EmMxcKjC1/S37JpJCD oSipTz+wh5XyngEXmFnkA5xGNeFD25YoHQlzUdzewAhoHva37WNA26V7HBVzWuC0LsLqwk hWB6/ndBnx7pEqjUcDVaeEn82M31d+gxJh0r+sIsMNa1ET+4C9CZdn6KR2mRWnkL5xkA/j H38Bldvon27L2f8Rayr8T7Qmxj+42SV+Mx0uVZIXZflYA/muVyDXHh5eHTgiQ9IHFDb76p jkwwraLXPCXgzBberYmjWj9ZGOP4lYQWTxKrSbYMfo+1xc9fW138Vmrt6DnqRA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BS6dHxzv9K; Thu, 23 Feb 2023 19:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYe2c020463; Thu, 23 Feb 2023 19:34:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYe1T020462; Thu, 23 Feb 2023 19:34:40 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:40 GMT Message-Id: <202302231934.31NJYe1T020462@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4fa10614c773 - releng/13.2 - LinuxKPI: pci: add more functions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 4fa10614c77369ae4edd09a065a70fd20e526d43 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4fa10614c77369ae4edd09a065a70fd20e526d43 commit 4fa10614c77369ae4edd09a065a70fd20e526d43 Author: Bjoern A. Zeeb AuthorDate: 2023-01-28 15:02:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:33:24 +0000 LinuxKPI: pci: add more functions Add a dummy pci_assign_resource() and an implementation of pci_irq_vector() returning the irq for MSI-X, MSI, and legacy interrupt. Both are needed by wirless drivers. Sponsored by: The FreeBSD Foundation Reviewed by: jhb Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D38237 (cherry picked from commit fd1a2f3dfc0e8fb20d0d397d586000bb918aab47) (cherry picked from commit 7b65e6f377ca0005a986c59f1e31a0421d92660f) --- sys/compat/linuxkpi/common/include/linux/pci.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 5e028774f079..3d43595df047 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1694,4 +1694,30 @@ pci_is_enabled(struct pci_dev *pdev) PCIM_CMD_BUSMASTEREN) != 0); } +static inline int +pci_assign_resource(struct pci_dev *pdev, int bar) +{ + + return (0); +} + +static inline int +pci_irq_vector(struct pci_dev *pdev, unsigned int vector) +{ + + if (!pdev->msix_enabled && !pdev->msi_enabled) { + if (vector != 0) + return (-EINVAL); + return (pdev->irq); + } + + if (pdev->msix_enabled || pdev->msi_enabled) { + if ((pdev->dev.irq_start + vector) >= pdev->dev.irq_end) + return (-EINVAL); + return (pdev->dev.irq_start + vector); + } + + return (-ENXIO); +} + #endif /* _LINUXKPI_LINUX_PCI_H_ */ From nobody Thu Feb 23 19:34:41 2023 X-Original-To: dev-commits-src-branches@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 4PN3BV44YHz3sfBl; Thu, 23 Feb 2023 19:34:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PN3BV1g86z45rM; Thu, 23 Feb 2023 19:34:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180882; 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=Brml1X7LjoZ3rjEni+HcHwJvKlruZcLzmhEvBeJDBfQ=; b=VJzd+0ZLLu66KVY0H9eGb5peinZdG7Z3XzbqoNSdmVvIaDB3TrhfPfJb3Yw8Fq1VyoczjO fQExE5BXPU5dh3UzkFEUppEi1sVHx52DtcIvTyJzEyr1oNH/YN2nW8Zf79MmxHzFgJovFX WMB/XcewwG4n9fH8Ta2HuZVKOIQ058MQtX5gKbMIVPMvSZOSPPB8nJTKi3n06X1FEvtBge UWGbo0AMUTVqVFJ73K4wnfJA7Rw3BWmy1l1k/sMpZgSO7ByYvTWPx4WnQMUFtyRMxOkDyB GL3TiNsW0ktvuP/rBJbadjL3oDWH6Kc9Q1XZihzAQD2+otpik+yg/wpLk/Dliw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677180882; 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=Brml1X7LjoZ3rjEni+HcHwJvKlruZcLzmhEvBeJDBfQ=; b=XpPqKR3rkmQHQpHHI8zI4DUdNp6xl/aVqLGvwKvCu7Ca/gUcOiYnZQqZWKnJ0AYI3JaJQ/ LYlq3N/N33kc4olSFyJU29KNvRwlFJ+9tnAuP9J7s6Vgq2M3Y63PGLAde6UW82cYVjamW7 BrX2yC4TtKCqzEOAKTB9EigF3scoHw5pq+Ix4A9qCvLT88HNYjCr7fKYdVIznumFwJd2P0 jVC8QRYvyd41VKSCSKlC5UL1Kf22QA3VsAZU6PeWsW72QJ5BLdQvSdxHRWIPWqvV2f9IQ3 mGt6kkTseiBbAokNVHKIn7s8/aQZvaN6qEIZP0/tDEg/HfCk+gU124ENDUc0VA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677180882; a=rsa-sha256; cv=none; b=wo8WaMgfsfoOKVJM55DS0UYWjWp7uJrvD5AfKAiMxNdAjZyIkjO2Yvow4HHG11SmZaMa2S LjyNtHnDExPTN8ll0xEIn8UZiYn0ybuY15/4O7SovU7eGgxg4jMpEpYnd8JpykMJbqI+xC GLZsC54CdIbMm3hByaaAlIIrrtXE5gKeslS6AxVI/iOFacwUlA+Y5t/8C4CopmVTnLd56j i1OfwDXRHn+3bq5itxul9sMa4SNdWiU+h6szUDK2doIuNCsAkgpkY2RT8XhYASMmOnP6PY QIl2P/twNk6nWkx0ACFiJ/FCyHS5TOqO4yk/JU+GMtnR01jjEAnKvmY3E43y6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PN3BV0V6ZzvTP; Thu, 23 Feb 2023 19:34:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31NJYfOb020484; Thu, 23 Feb 2023 19:34:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31NJYf4W020483; Thu, 23 Feb 2023 19:34:41 GMT (envelope-from git) Date: Thu, 23 Feb 2023 19:34:41 GMT Message-Id: <202302231934.31NJYf4W020483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 368a398b9c3e - releng/13.2 - LinuxKPI: return an address string in pci_name() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 368a398b9c3e01359d9997aaa3ccff6415129f74 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=368a398b9c3e01359d9997aaa3ccff6415129f74 commit 368a398b9c3e01359d9997aaa3ccff6415129f74 Author: Val Packett AuthorDate: 2023-02-06 21:50:13 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-23 19:33:31 +0000 LinuxKPI: return an address string in pci_name() amdgpu's virtual display feature uses pci_name() to match a module parameter string, and the documentation shows an example of `0000:26:00.0` for the name. In our case the name was just `drmn`, which is not actually unique across devices. The other consumers are wireless drivers, which will benefit from this change. Generate the expected string for pci_name() to return. Related to: https://github.com/freebsd/drm-kmod/issues/134 Sponsored by: https://www.patreon.com/valpackett Reviewed by: bz, hselasky, manu (earlier) Approved by: re (cperciva) Differential Revision: https://reviews.freebsd.org/D34248 (cherry picked from commit 393b0ba25f1a54dcc3f94244933c665f1c471d1a) (cherry picked from commit 30960c51e646c51134fcb72e0adc881f36a41c38) --- sys/compat/linuxkpi/common/include/linux/pci.h | 4 ++-- sys/compat/linuxkpi/common/src/linux_pci.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 3d43595df047..e050cb5021cf 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -351,6 +351,7 @@ struct pci_dev { bool msix_enabled; uint8_t msi_cap; struct msi_desc **msi_desc; + char *path_name; }; /* XXX add kassert here on the mmio offset */ @@ -470,8 +471,7 @@ pci_resource_flags(struct pci_dev *pdev, int bar) static inline const char * pci_name(struct pci_dev *d) { - - return device_get_desc(d->dev.bsddev); + return d->path_name; } static inline void * diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index a66627612778..3dbcf5cfbce0 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -309,6 +309,9 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) pdev->subsystem_device = pci_get_subdevice(dev); pdev->class = pci_get_class(dev); pdev->revision = pci_get_revid(dev); + pdev->path_name = kasprintf(GFP_KERNEL, "%04d:%02d:%02d.%d", + pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev), + pci_get_function(dev)); pdev->bus = malloc(sizeof(*pdev->bus), M_DEVBUF, M_WAITOK | M_ZERO); /* * This should be the upstream bridge; pci_upstream_bridge() @@ -352,6 +355,7 @@ lkpinew_pci_dev_release(struct device *dev) free(pdev->msi_desc[i], M_DEVBUF); free(pdev->msi_desc, M_DEVBUF); } + kfree(pdev->path_name); free(pdev, M_DEVBUF); } From nobody Fri Feb 24 07:51:41 2023 X-Original-To: dev-commits-src-branches@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 4PNMXs2KHDz3tg0Z; Fri, 24 Feb 2023 07:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNMXs1tRQz3H8r; Fri, 24 Feb 2023 07:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677225101; 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=dyr6mK0YXTZmlebs2lpWw+fEq3Smw3Xx5T6leNT2tR0=; b=ERlbgECkgH3WZn/yOYEcOHPYS6d969AFfCvaG/JNP0s6T2/x6Ue8kF8LCW/3i5K7Ic/KI4 FOSGgtbL5pWqN39QnkmyWUB6l73gGWyYEXoOiHAHTG2+XeQ9zyrsfWKskxwwECP4OtwYba gXv0HnePRmk/eJBLFJFvE1VLsFSfhUFf2+BCYKrNbIipPp2ANsY9+WkSAtet26U+Ivm5SC SDldudtDEvGved9RdvY1okf+pFwH0RzZ0QGPmskHTP0liEWdpIKQdh852FfTUkRNPgEeEz 0EzgCPWIf9QS/Tqd/DZDeqlMnJYZAl4/Kex2ApILf5G3VDNvBYlCGnWyw3F9NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677225101; 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=dyr6mK0YXTZmlebs2lpWw+fEq3Smw3Xx5T6leNT2tR0=; b=N2ZwgNg2l0twZsAZKOIpDv8atLGth/0Ec/wpAX/eAd9h6pTA/IFvbUaNI9Bg4o8zdoGeMo A9Xfhxrk0EH05Tr7RpWfrD/EUyhIm0C6H95GyvpScDmZOP/bQw/Te/azERTH6ksFyHgK2A 4tMOpAQdk53JIS7CuX0FutmomTZJz6UOmZLK43oqzb1vDhnUF5gtCk52TALg1i9W5Ckd4D lVgZV0+uIMQ003H3wNd/r42OASgwwMEFLhEq5+ivet9MLkkSBcDSlyjWKjcjUgC3GLQiz0 upsN3ed1HFewsVi04vANtHjvlJwo4HMbXm+Z6UGvZsStcDGdFMbl3DuTtRDBIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677225101; a=rsa-sha256; cv=none; b=WQYmJvyBkkzc4sBdqvegnaLjSpvJpRR5i0B2YYSXMPxhfglXntWuo3qk+MIGiTrEHpMLxK KkUGCkjCandNeUq+Od1w6DIBwvLVkq4/Vp77+EMCegnmDHSPAy16rgyLDdu3OM3ewSlc3l MSw5j+/DzHbQxmIZoPnlLaG4ahFEeiNj+ZV01XAwQQwcBe8ankSjdVYUWAU+sa7d941Wwt QeP1zMj1PDMpv24Fv1mTvpLgb5WUaJBMJZuUWeVCG5sBnP+PgraGK3ule46PiBQeIvAeLY mBTaBPphYglr3EOs+54Iia6aV7d9UurO2Gj4SW3uXBg3oTcALxOvdwqdR+/HFw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PNMXs0yBxzFnd; Fri, 24 Feb 2023 07:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31O7pfLY073984; Fri, 24 Feb 2023 07:51:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31O7pfcm073983; Fri, 24 Feb 2023 07:51:41 GMT (envelope-from git) Date: Fri, 24 Feb 2023 07:51:41 GMT Message-Id: <202302240751.31O7pfcm073983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: d0e8ce556627 - releng/13.2 - 13.2: update to BETA3 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: d0e8ce556627662153fd5d207fc86d7917a95065 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=d0e8ce556627662153fd5d207fc86d7917a95065 commit d0e8ce556627662153fd5d207fc86d7917a95065 Author: Colin Percival AuthorDate: 2023-02-24 07:50:45 +0000 Commit: Colin Percival CommitDate: 2023-02-24 07:50:45 +0000 13.2: update to BETA3 Approved by: re (implicit) Sponsored by: https://www.patreon.com/cperciva --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 92aab7aafc2e..f49a96657cdd 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.2" -BRANCH="BETA2" +BRANCH="BETA3" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Fri Feb 24 10:34:58 2023 X-Original-To: dev-commits-src-branches@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 4PNR9G5BNhz3tpPn; Fri, 24 Feb 2023 10:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNR9G4hdMz3mcv; Fri, 24 Feb 2023 10:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677234898; 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=84ovkklmzy+QSrq67pft9MzHJwOnbKnVuqvMWN8GrNY=; b=LcdknxV5Z2oxNcrJr46fieDC4rdHz5yRmj+9VWQiQq+fHSJrSDbigsChz2BjjHGht6RmjK 8f/cxF5AfrbHV2rUt+1tjIsAllsdvf1IDtT7BNlbFJajRABM1YkdAGX9MeIHV3ajb1j3qN J9FeqL15GpNVbsEEgI9E+9vQ6vq/iyK/dz43Awg4uDTGVlz2xEwxFUcRbBi5qfgGbDf4OJ NjafmNe1AJS9SmBJS1vfk/B8IHrKQfozdVG0sUdb7yWEClZnIU09yPnf8h1xVzBUqYoost TISk7XwMEGRrQSOMsaQKfVqAoD6f3vsPl43CmOoy8UASgRraqQBBcwyO+AZc0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677234898; 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=84ovkklmzy+QSrq67pft9MzHJwOnbKnVuqvMWN8GrNY=; b=Yh2aS1MmpzvYkmj/uDygoGP8lNlP/Zti2hOo9R+0uJHtk+FpAkZlQOHR4YheVIvXQ3lgIE adLi8EUQBli8cP7QK8aJ6pvTE7slL4Tohym4kND5e4tu3LpXc6y6I5vxuZxI6579qsZfpG GkkXQCAaabWogI5Zq2zgR4ptMV8VRpEFS8kbsm4cHeX1MOmFtCF7xd3skH0xeFa0KTlo6n E5stjO9LCJS8zLYcDjhG8J93jQ5dWTJfRemC3NyWapZbmtm1nGdU3EejVGmsrg+CV5vmHc K7TYlTqQMehfhGtx6Y58g+BxpAmYw3q0Itj+bVmn5G6zKWuiIBFnP6lhQ+J0cA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677234898; a=rsa-sha256; cv=none; b=XdsclmXHz7SL17l+LyCiw7ukTSxaOlOXo56Y150m2aTmTs/g2AbRMy138XWHKtmvJJvb0C QvIFO5xznQc0ky2q2RuYiEzsioSK9s43qfzuXifC6tRw4miepNSKUX6BLAadYKI9xXcG+K vcQGclHi9/3+HW2GhioPU9yvxyXCSmDqN/Ue3sGKgFrPix66W/FXXpDZ/zDGn0UZmm006G lrw7a5Mh6kxQlCtzbHxMS80HEYosTd8ZKS4/DbN7TqUMTXchEnK+sG07QBhDiklUj5S5Do sKNO+EwbtKM7e1s9xtuk+ObzUnlHsmDoM/BMiWbw2HR4ak1SKT62HgqFT/sNAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PNR9G3lC5zL1F; Fri, 24 Feb 2023 10:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31OAYwuH005760; Fri, 24 Feb 2023 10:34:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31OAYw6M005759; Fri, 24 Feb 2023 10:34:58 GMT (envelope-from git) Date: Fri, 24 Feb 2023 10:34:58 GMT Message-Id: <202302241034.31OAYw6M005759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: c90cd0a9cf15 - stable/13 - netlink: Fix "version introduced" documentation. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c90cd0a9cf157a30824145cc114716f880df8480 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=c90cd0a9cf157a30824145cc114716f880df8480 commit c90cd0a9cf157a30824145cc114716f880df8480 Author: Tom Hukins AuthorDate: 2023-02-24 10:25:35 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-24 10:32:11 +0000 netlink: Fix "version introduced" documentation. netlink(4) and associated features will exist in FreeBSD 14.0 but they will also exist in 13.2, an older version, from commits such as 02b958b and b309249. Pull Request: #651 MFC after: 1 day --- share/man/man3/snl.3 | 2 +- share/man/man4/genetlink.4 | 2 +- share/man/man4/netlink.4 | 2 +- share/man/man4/rtnetlink.4 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man3/snl.3 b/share/man/man3/snl.3 index 9fdeeaf56178..78a6b67e88a9 100644 --- a/share/man/man3/snl.3 +++ b/share/man/man3/snl.3 @@ -297,7 +297,7 @@ and The .Dv SNL library appeared in -.Fx 14.0 . +.Fx 13.2 . .Sh AUTHORS This library was implemented by .An Alexander Chernikov Aq Mt melifaro@FreeBSD.org . diff --git a/share/man/man4/genetlink.4 b/share/man/man4/genetlink.4 index 2c5b9b99f994..a21963b5e3bd 100644 --- a/share/man/man4/genetlink.4 +++ b/share/man/man4/genetlink.4 @@ -138,7 +138,7 @@ The following groups are defined: The .Dv NETLINK_GENERIC protocol family appeared in -.Fx 14.0 . +.Fx 13.2 . .Sh AUTHORS The netlink was implementated by .An -nosplit diff --git a/share/man/man4/netlink.4 b/share/man/man4/netlink.4 index fdcc823b01a6..a5cde2852158 100644 --- a/share/man/man4/netlink.4 +++ b/share/man/man4/netlink.4 @@ -344,7 +344,7 @@ or .Re .Sh HISTORY The netlink protocol appeared in -.Fx 14.0 . +.Fx 13.2 . .Sh AUTHORS The netlink was implemented by .An -nosplit diff --git a/share/man/man4/rtnetlink.4 b/share/man/man4/rtnetlink.4 index 2c601251f7b0..56c124e4f854 100644 --- a/share/man/man4/rtnetlink.4 +++ b/share/man/man4/rtnetlink.4 @@ -532,7 +532,7 @@ RTNLGRP_NEIGH Notifies on ARP/NDP neighbor arrival/removal/change The .Dv NETLINK_ROUTE protocol family appeared in -.Fx 14.0 . +.Fx 13.2 . .Sh AUTHORS The netlink was implementated by .An -nosplit From nobody Fri Feb 24 10:39:06 2023 X-Original-To: dev-commits-src-branches@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 4PNRG22z57z3t5DW; Fri, 24 Feb 2023 10: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNRG22V2hz3nPD; Fri, 24 Feb 2023 10:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235146; 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=SgZOY+Wna5oWXyqKYKUrjFIJjCyXrAP/mExP5ZcouMM=; b=HTkj3+SvP/6ac0CSTZikREvc0Bd57C8S8Q/gmYrksw2I1bm088GJkQh0QUjhj5kwbmbnEa f6popbd8nneiJqsahMsQtzYE+GQI5cuUL7vb3JAKw61FI0CNOa1jZhoXUuOuY1uIqA+FPk 2OXjjqqAP3Ka29Jt62n5p7XCTq42SnV+Vl5Cg1roQ7Fuu+Nj5Rl7EQgPoBD/qJFUgiULEJ K6RXTSNncoKrLzTKmilRDiGdJ542NyeUD/CE5lfJYjH8fRarS7uOKFaeERTUYA5anSDz8x 1H4WrgR08//Ti9p0c59BvDAK4cog5fLnDrc3GPXCMOFakpVkHsYgHolA9wxqKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235146; 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=SgZOY+Wna5oWXyqKYKUrjFIJjCyXrAP/mExP5ZcouMM=; b=r0Y+5pbR4SGwWqzyCQ8Ajf+TdJIH+z8DwXW/3G3pEIFvZdtXRm3tbPokirV23D7dpSwx4t d/6CHUk5GxJ2RPDdOosAmUDkhOLceprzXn5rioOPxsWzb81s7gCtp+B8+9pSBuT4L4icgd A4nPHxAXpad9wpH1q1CcLKxEl64wDdKZrFs5t/pdbcz9YV5F532VDsF9y8So1lsT1ZPaaK Xaq31x74qk7heffjEX4esn68OTnNNNxG+s3fX/3bhgftLp4pPVOYH4znb9cUU0yoLyD4wP RbIZaERv9hKuHdQ02T3hF/rU8EVlWJUFkIgODv/lF8EFV/Q5x+z+ynBZh8epeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677235146; a=rsa-sha256; cv=none; b=GkccCTWvT52oyZT+uAWSXRo38+AX0UJnryB5xak5mp4PrWJysrevxJuPley8wywVne1Du4 9gj4l+Mw+lWgOGPJAYO7lrT9KZBkQaOeczSm47QsvQNz5PjlzQPfdQRg5zeBl2W4mMaA6I 8xO4zlbbpzd2uaA9YFMaCCVTd1SeaOIdDKCjL2VulHX+6Ld1BbWgXbPaWlistqWP/IbrqB ld2Ks42/EcZGYQEXnDRoW79ZIImUQwUWOeCg/ftBsKdruMagaXut2brBPz5Zxjz32Tz7kZ dMqgicEfh2tmXf5rFj2wkwg97M4Ys4gnkYAIZThedEGKGcdcusq4LMpacopDEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PNRG21Y42zKd8; Fri, 24 Feb 2023 10:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31OAd6A8006339; Fri, 24 Feb 2023 10:39:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31OAd6LJ006338; Fri, 24 Feb 2023 10:39:06 GMT (envelope-from git) Date: Fri, 24 Feb 2023 10:39:06 GMT Message-Id: <202302241039.31OAd6LJ006338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: f9f0d2f475e0 - stable/13 - netlink: fix style(9) after c3d3f3594fdf. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9f0d2f475e05ad88120ef1c0a645d2aa6dc3e94 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f9f0d2f475e05ad88120ef1c0a645d2aa6dc3e94 commit f9f0d2f475e05ad88120ef1c0a645d2aa6dc3e94 Author: Alexander V. Chernikov AuthorDate: 2023-02-24 10:37:51 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-24 10:38:41 +0000 netlink: fix style(9) after c3d3f3594fdf. No functional changes. Reported by: karels --- sys/kern/uipc_sockbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 277965412779..aa8c2345c21f 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -693,7 +693,7 @@ sbsetopt(struct socket *so, int cmd, u_long cc) if (*lowat > *hiwat) *lowat = *hiwat; } else { - u_long limit = sogetmaxbuf(so); + u_long limit = sogetmaxbuf(so); if (!sbreserve_locked_limit(sb, cc, so, limit, curthread)) error = ENOBUFS; } From nobody Fri Feb 24 10:40:40 2023 X-Original-To: dev-commits-src-branches@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 4PNRJ55qstz3tphb; Fri, 24 Feb 2023 10:40:53 +0000 (UTC) (envelope-from melifaro@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNRJ55NRVz3p06; Fri, 24 Feb 2023 10:40:53 +0000 (UTC) (envelope-from melifaro@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235253; 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=ls1+5o/x4zXkjkq1L5u9a792AqbAhC9V57TAM1XHLwA=; b=V9+QK7InVcGjeYPn4aje0Tai6W4qQyk8Z6MMwEXbvB7nQLnw2Lgp7Olk8hlKXKVENUxuQB 4WP6w2WI1s5+jrnq+dezAwAnUn8zRq3CpFMCMNpSLTb/tGW798XRfK87gbgVVhSE/K0j9i h1kls+d7mski1XOj2X4wOiR7Kk+jElpHBt8tXbhilFclbxMm+T1txVjr5oVwN8EnydB7ST bSyAblbE+VqYifN1Y1DG4yeg+lnNr2ku6l70kPmxMi98+XQtswTh0QfPmsY/dJQD+gZjoE cMbKA5EtkPwM6dg606IUzJcEXeXaIOCqXIpCK6QGdXc2ZaGbNpVo79hkYf74/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235253; 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=ls1+5o/x4zXkjkq1L5u9a792AqbAhC9V57TAM1XHLwA=; b=Zp8sZqde0j3atEZXQi+/hrBRidfczwISIYIa6BDLB5E7Tf1Oa1Pw7UiOHUK47k+/LxYMQq LOf3q6UiT03rmdGTki6IaFGdoHS1PT6VlW0dYFXnyg5XezfTtIOno/9vyhvcaVjnGWvDV/ CTvxdNHrEi8czkSonRzw+3BivOBmVFbX+j2mOp9dZenQqg3UPl2tsBvrhUAdBZayvkNCoH 8zTjoYZTOpsRTjy+YRLvon9O/LtAj2wqm6YFRKE88jKLd22oNhaMdnP3txs//iLClsC+aR gngwyhtw8m+fycH03Lqj6556GHD9hAa37Oj7Ug4aouJ1h/383yGz8KqKIOFLOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677235253; a=rsa-sha256; cv=none; b=cloFxotdSKWhJnWO/PWib3GcoH/eaQCUygzZttwEWhRBit/cTZVP430ukk2/DwC/kWXrrp B1jf35NMumFUA/EgXbDTeC153c+2R+zKFCF+34ce1U8MuvsbnHviE0tS6ZfBLpEkc/AcRy dYIUUVwsz/MnzJlkY85zBRcicLNo6ndnJZmCV9UIa08FWsuKeeavU+78VMfcpfrY7D0e1+ +dT37M8FygwlT8hpkdk86/yibQqLvUI698Bw5pqTtKSQl6HmKYS3iPGmbAyspvq5o8oWtV zRaSc0Q5gQCsh1fmDNcHQhn/CprZp7LTVgMie8suxebV3mpMMX7mT54/hZOWvA== Received: from smtpclient.apple (unknown [IPv6:2a02:8084:d6bb:510:8470:49be:b746:8dbc]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: melifaro/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PNRJ50tFSzt2q; Fri, 24 Feb 2023 10:40:53 +0000 (UTC) (envelope-from melifaro@freebsd.org) Content-Type: text/plain; charset=utf-8 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: git: c3d3f3594fdf - stable/13 - netlink: allow to override sb_max for netlink sockets. From: Alexander Chernikov In-Reply-To: <721D2CDA-6740-482D-BDC9-C5EFE56F7AE0@karels.net> Date: Fri, 24 Feb 2023 10:40:40 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-branches@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <2F9CFF0F-F14C-401F-97D6-E83B3842A599@FreeBSD.org> References: <202302101619.31AGJESZ073291@gitrepo.freebsd.org> <721D2CDA-6740-482D-BDC9-C5EFE56F7AE0@karels.net> To: Mike Karels X-Mailer: Apple Mail (2.3731.400.51.1.1) X-ThisMailContainsUnwantedMimeParts: N > On 10 Feb 2023, at 17:00, Mike Karels wrote: >=20 > On 10 Feb 2023, at 10:19, Alexander V. Chernikov wrote: >=20 >> The branch stable/13 has been updated by melifaro: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dc3d3f3594fdf653392936594b75ec330= af12d7fa >>=20 >> commit c3d3f3594fdf653392936594b75ec330af12d7fa >> Author: Alexander V. Chernikov >> AuthorDate: 2023-02-10 16:07:17 +0000 >> Commit: Alexander V. Chernikov >> CommitDate: 2023-02-10 16:07:22 +0000 >>=20 >> netlink: allow to override sb_max for netlink sockets. >>=20 >> Netlink sockets sometimes require larger buffers than other = sockets. >> For example, full-view IPv4 dump sent via netlink may consume 50+ = megabytes. >> The desired buffer may be bigger than the system maximum `sb_max`. >> FreeBSD HEAD has a mechanism for overriding protocol `setsockopt()` = handler, >> which netlink uses to permit buffer reservations beyond `sb_max`. >> This behaviour is handy as it doesn't require system administrator = to lift >> the limits for other sockets. >> Stable/13 lack such muchanism, so a different approach has to be = used. >> This diff is a direct commit to stable/13 and it simply copies the = logic from >> Netlink in -HEAD for checking if the larger buffer size should be = permitted. >>=20 >> Differential Revision: https://reviews.freebsd.org/D38472 >> --- >> sys/kern/uipc_sockbuf.c | 3 ++- >> sys/kern/uipc_socket.c | 10 ++++++++++ >> sys/sys/sockopt.h | 1 + >> 3 files changed, 13 insertions(+), 1 deletion(-) >>=20 >> diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c >> index cbfcc0e5fe95..277965412779 100644 >> --- a/sys/kern/uipc_sockbuf.c >> +++ b/sys/kern/uipc_sockbuf.c >> @@ -693,7 +693,8 @@ sbsetopt(struct socket *so, int cmd, u_long cc) >> if (*lowat > *hiwat) >> *lowat =3D *hiwat; >> } else { >> - if (!sbreserve_locked(sb, cc, so, curthread)) >> + u_long limit =3D sogetmaxbuf(so); >=20 > Spaces instead of tabs. >=20 > Mike Ups. Haven=E2=80=99t noticed that one. Fixed in f9f0d2f475e05ad88120ef1c0a645d2aa6dc3e94. Thank you! >=20 >> + if (!sbreserve_locked_limit(sb, cc, so, limit, curthread)) >> error =3D ENOBUFS; >> } >> if (error =3D=3D 0) >> diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c >> index f8931b653a4d..fdf718de2483 100644 >> --- a/sys/kern/uipc_socket.c >> +++ b/sys/kern/uipc_socket.c >> @@ -128,6 +128,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -2975,6 +2976,15 @@ sooptcopyin(struct sockopt *sopt, void *buf, = size_t len, size_t minlen) >> return (0); >> } >>=20 >> +u_long >> +sogetmaxbuf(struct socket *so) >> +{ >> + if (so->so_proto->pr_domain->dom_family !=3D PF_NETLINK) >> + return (sb_max); >> + u_long nl_maxsockbuf =3D 512 * 1024 * 1024; /* 512M, XXX: init = based on physmem */ >> + return ((priv_check(curthread, PRIV_NET_ROUTE) =3D=3D 0) ? = nl_maxsockbuf : sb_max); >> +} >> + >> /* >> * Kernel version of setsockopt(2). >> * >> diff --git a/sys/sys/sockopt.h b/sys/sys/sockopt.h >> index cb7fc3ffca27..d01d62f21680 100644 >> --- a/sys/sys/sockopt.h >> +++ b/sys/sys/sockopt.h >> @@ -68,5 +68,6 @@ int accept_filt_getopt(struct socket *, struct = sockopt *); >> int accept_filt_setopt(struct socket *, struct sockopt *); >> int so_setsockopt(struct socket *so, int level, int optname, >> void *optval, size_t optlen); >> +u_long sogetmaxbuf(struct socket *so); >>=20 >> #endif /* _SYS_SOCKOPT_H_ */ From nobody Fri Feb 24 10:44:40 2023 X-Original-To: dev-commits-src-branches@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 4PNRNT0bt1z3t5Fb; Fri, 24 Feb 2023 10:44:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNRNS678kz3pmD; Fri, 24 Feb 2023 10:44:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235480; 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=A19YPah/hQ2t22d46iXGYB2pTATdf2T76pn3EaecZCU=; b=vfaq1garIVdrdsA8phpnxIME+9Wz719OkWRbVvCFu944YkO7/Qrgcil/vQ1eJ2/ln+CnZX H9oEFk9xGKJj4GMcRzE+LRsBZkUUBjUTXeX7hfznlXYrO0cR3060L0G0BV9xIQ5xmBGk7Q 9E2E3gMhCHypwxt6KM3CupfgCEvrSZgXB8EPn8T5XUlV7yjzQ3TLh5j/FzyaLfjbVQ4iS2 JFxuiZu9kkdQLDa/ya+fxi7gp+5HBzE75C4O+aoVkB0WmgfQwztfumx3GY+OqBaVDVnRpr 5P5kFdiaDOqLKucZNzrMWYik9FQabGoanYDsHnE+dcUfX190hESDo5Sh4uuyaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235480; 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=A19YPah/hQ2t22d46iXGYB2pTATdf2T76pn3EaecZCU=; b=GlDG33FmRvOrltlAZvTcYQy+xKChyFZ//v6OSzsDTtFo0YJN+XGAOPWsVSGZrhxHWw/Pip GGHPiug6mwEo7zXeIRi2dSwxHJd86K+JMtTfufIK4ZYoKf71O2MfeNDvaSeUg/7D4RgOpz 9feJ7EUFrALtbEjdgjPqYj5gYgMOpM9IRQvK2w2ZyPOYf0l7S3uKKXjoG1eedvoI9n5XMp Euum3k1WLC2fRhNXU+NA8HzkagMTr+cP27VfW7koe5zeJYMfmUs1XPofXXcLCkSM8eYRks SzxWLtgOv8azCc5uBrCs648qngw8sBmN6d+8Ov6blFwlAl/jQprEgCwwSEfdiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677235480; a=rsa-sha256; cv=none; b=Ap8LXm1KSn8M1fYLz3XPOHnHh2F1I/Z4XtRKLu4hP/bvwkwXSOeTcREbW5puJ91KqmIRoD 5XkqJPf1ryAhm1SnrtNExO9++h1b7vNysPZm5juG14Cm8o9YEslMw4wG053DXVcxph26sx Af1fJJgj8h9+sw9SXzqIXV6e8uTD+4OXsV3xSg69j4MwYo3afpXryA98vbU1hrP+IHza7v 4iidXt2iRahdX4C89uw27hsnqFtI6ugWM45XZc+Hzmenc//kZLYdliEdO5qirQWVXl3e9b 3+KwW/Wv69Els3RJ+x1RlHoH0By5lB3yNQ8Z62jLkgtKawItHfIGfTPkw03uJg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PNRNS5DL1zLG9; Fri, 24 Feb 2023 10:44:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31OAieiq019890; Fri, 24 Feb 2023 10:44:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31OAieAa019889; Fri, 24 Feb 2023 10:44:40 GMT (envelope-from git) Date: Fri, 24 Feb 2023 10:44:40 GMT Message-Id: <202302241044.31OAieAa019889@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 07595bd3c55a - stable/13 - testing: handling non-root users with VNETs in pytest-based tests. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 07595bd3c55a1c63ca49d7e250346a90910c206d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=07595bd3c55a1c63ca49d7e250346a90910c206d commit 07595bd3c55a1c63ca49d7e250346a90910c206d Author: Alexander V. Chernikov AuthorDate: 2023-02-09 14:31:34 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-24 10:43:30 +0000 testing: handling non-root users with VNETs in pytest-based tests. Currently isolation and resource requirements are handled directly by the kyua runner, based on the requirements specified by the test. It works well for simple tests, but may cause discrepancy with tests doing complex pre-setups. For example, all tests that perform VNET setups require root access to properly function. This change adds additional handling of the "require_user" property within the python testing framework. Specifically, it requests root access if the test class signals its root requirements and drops privileges to the desired user after performing the pre-setup. Differential Revision: https://reviews.freebsd.org/D37923 MFC after: 2 weeks (cherry picked from commit 6332ef8941999b0c074d1ece0e1e108447c70b98) --- tests/atf_python/atf_pytest.py | 54 ++++++++++++++++++++++++++++++++++++---- tests/atf_python/sys/net/vnet.py | 3 +++ tests/atf_python/utils.py | 23 ++++++++++++++++- tests/conftest.py | 26 +++++++++++++------ 4 files changed, 92 insertions(+), 14 deletions(-) diff --git a/tests/atf_python/atf_pytest.py b/tests/atf_python/atf_pytest.py index d530c7b4515c..db7244d3234b 100644 --- a/tests/atf_python/atf_pytest.py +++ b/tests/atf_python/atf_pytest.py @@ -3,6 +3,7 @@ from typing import Any from typing import Dict from typing import List from typing import NamedTuple +from typing import Optional from typing import Tuple import pytest @@ -51,10 +52,32 @@ class ATFTestObj(object): return line return obj.name + @staticmethod + def _convert_user_mark(mark, obj, ret: Dict): + username = mark.args[0] + if username == "unprivileged": + # Special unprivileged user requested. + # First, require the unprivileged-user config option presence + key = "require.config" + if key not in ret: + ret[key] = "unprivileged_user" + else: + ret[key] = "{} {}".format(ret[key], "unprivileged_user") + # Check if the framework requires root + test_cls = ATFHandler.get_test_class(obj) + if test_cls and getattr(test_cls, "NEED_ROOT", False): + # Yes, so we ask kyua to run us under root instead + # It is up to the implementation to switch back to the desired + # user + ret["require.user"] = "root" + else: + ret["require.user"] = username + + def _convert_marks(self, obj) -> Dict[str, Any]: wj_func = lambda x: " ".join(x) # noqa: E731 _map: Dict[str, Dict] = { - "require_user": {"name": "require.user"}, + "require_user": {"handler": self._convert_user_mark}, "require_arch": {"name": "require.arch", "fmt": wj_func}, "require_diskspace": {"name": "require.diskspace"}, "require_files": {"name": "require.files", "fmt": wj_func}, @@ -66,6 +89,9 @@ class ATFTestObj(object): ret = {} for mark in obj.iter_markers(): if mark.name in _map: + if "handler" in _map[mark.name]: + _map[mark.name]["handler"](mark, obj, ret) + continue name = _map[mark.name].get("name", mark.name) if "fmt" in _map[mark.name]: val = _map[mark.name]["fmt"](mark.args[0]) @@ -91,8 +117,24 @@ class ATFHandler(object): state: str reason: str - def __init__(self): + def __init__(self, report_file_name: Optional[str]): self._tests_state_map: Dict[str, ReportStatus] = {} + self._report_file_name = report_file_name + self._report_file_handle = None + + def setup_configure(self): + fname = self._report_file_name + if fname: + self._report_file_handle = open(fname, mode="w") + + def setup_method_pre(self, item): + """Called before actually running the test setup_method""" + # Check if we need to manually drop the privileges + for mark in item.iter_markers(): + if mark.name == "require_user": + cls = self.get_test_class(item) + cls.TARGET_USER = mark.args[0] + break def override_runtest(self, obj): # Override basic runtest command @@ -220,7 +262,9 @@ class ATFHandler(object): # global failure self.set_report_state(test_name, state, reason) - def write_report(self, path): + def write_report(self): + if self._report_file_handle is None: + return if self._tests_state_map: # If we're executing in ATF mode, there has to be just one test # Anyway, deterministically pick the first one @@ -230,8 +274,8 @@ class ATFHandler(object): line = test.state else: line = "{}: {}".format(test.state, test.reason) - with open(path, mode="w") as f: - print(line, file=f) + print(line, file=self._report_file_handle) + self._report_file_handle.close() @staticmethod def get_atf_vars() -> Dict[str, str]: diff --git a/tests/atf_python/sys/net/vnet.py b/tests/atf_python/sys/net/vnet.py index 1f61269ffe6c..c0e0a24f6687 100644 --- a/tests/atf_python/sys/net/vnet.py +++ b/tests/atf_python/sys/net/vnet.py @@ -329,6 +329,7 @@ class ObjectsMap(NamedTuple): class VnetTestTemplate(BaseTest): + NEED_ROOT: bool = True TOPOLOGY = {} def _get_vnet_handler(self, vnet_alias: str): @@ -374,6 +375,7 @@ class VnetTestTemplate(BaseTest): # Do unbuffered stdout for children # so the logs are present if the child hangs sys.stdout.reconfigure(line_buffering=True) + self.drop_privileges() handler(vnet) def setup_topology(self, topo: Dict, topology_id: str): @@ -465,6 +467,7 @@ class VnetTestTemplate(BaseTest): # Save state for the main handler self.iface_map = obj_map.iface_map self.vnet_map = obj_map.vnet_map + self.drop_privileges() def cleanup(self, test_id: str): # pytest test id: file::class::test_name diff --git a/tests/atf_python/utils.py b/tests/atf_python/utils.py index fddfadac9a56..c8146b943ce9 100644 --- a/tests/atf_python/utils.py +++ b/tests/atf_python/utils.py @@ -1,8 +1,10 @@ #!/usr/bin/env python3 import os +import pwd from ctypes import CDLL from ctypes import get_errno from ctypes.util import find_library +from typing import Dict from typing import List from typing import Optional @@ -31,6 +33,8 @@ libc = LibCWrapper() class BaseTest(object): + NEED_ROOT: bool = False # True if the class needs root privileges for the setup + TARGET_USER = None # Set to the target user by the framework REQUIRED_MODULES: List[str] = [] def _check_modules(self): @@ -41,9 +45,26 @@ class BaseTest(object): pytest.skip( "kernel module '{}' not available: {}".format(mod_name, err_str) ) + @property + def atf_vars(self) -> Dict[str, str]: + px = "_ATF_VAR_" + return {k[len(px):]: v for k, v in os.environ.items() if k.startswith(px)} + + def drop_privileges_user(self, user: str): + uid = pwd.getpwnam(user)[2] + print("Dropping privs to {}/{}".format(user, uid)) + os.setuid(uid) + + def drop_privileges(self): + if self.TARGET_USER: + if self.TARGET_USER == "unprivileged": + user = self.atf_vars["unprivileged-user"] + else: + user = self.TARGET_USER + self.drop_privileges_user(user) @property - def test_id(self): + def test_id(self) -> str: # 'test_ip6_output.py::TestIP6Output::test_output6_pktinfo[ipandif] (setup)' return os.environ.get("PYTEST_CURRENT_TEST").split(" ")[0] diff --git a/tests/conftest.py b/tests/conftest.py index b5ce5ae2286b..687f6bde375e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,10 +7,14 @@ PLUGIN_ENABLED = False DEFAULT_HANDLER = None +def set_handler(config): + global DEFAULT_HANDLER, PLUGIN_ENABLED + DEFAULT_HANDLER = ATFHandler(report_file_name=config.option.atf_file) + PLUGIN_ENABLED = True + return DEFAULT_HANDLER + + def get_handler(): - global DEFAULT_HANDLER - if DEFAULT_HANDLER is None: - DEFAULT_HANDLER = ATFHandler() return DEFAULT_HANDLER @@ -81,11 +85,9 @@ def pytest_configure(config): "markers", "timeout(dur): int/float with max duration in sec" ) - global PLUGIN_ENABLED - PLUGIN_ENABLED = config.option.atf - if not PLUGIN_ENABLED: + if not config.option.atf: return - get_handler() + handler = set_handler(config) if config.option.collectonly: # Need to output list of tests to stdout, hence override @@ -93,6 +95,8 @@ def pytest_configure(config): reporter = config.pluginmanager.getplugin("terminalreporter") if reporter: config.pluginmanager.unregister(reporter) + else: + handler.setup_configure() def pytest_collection_modifyitems(session, config, items): @@ -114,6 +118,12 @@ def pytest_collection_finish(session): handler.list_tests(session.items) +def pytest_runtest_setup(item): + if PLUGIN_ENABLED: + handler = get_handler() + handler.setup_method_pre(item) + + def pytest_runtest_logreport(report): if PLUGIN_ENABLED: handler = get_handler() @@ -123,4 +133,4 @@ def pytest_runtest_logreport(report): def pytest_unconfigure(config): if PLUGIN_ENABLED and config.option.atf_file: handler = get_handler() - handler.write_report(config.option.atf_file) + handler.write_report() From nobody Fri Feb 24 10:44:41 2023 X-Original-To: dev-commits-src-branches@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 4PNRNV1kfcz3t5Hj; Fri, 24 Feb 2023 10:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNRNV0G2kz3pgg; Fri, 24 Feb 2023 10:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235482; 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=UPrIl6a5yDvu0+xiSSxtIDz8nqSev7ViBz2VLCxpJKo=; b=U/c3WMCbApvZPsbI4KPbCz8iFucZAFdz8I9Te5F+yUKb3E4gq+UC8lWW1N9GOnBDyg7jZw 4w7STPMwbgnaWd7V8jyr0nfzJNdoh5EMdLEBgwX4G3D6IY6S4/p+0yL5i47n9/tbsygWzY N2SI19MJmDeX1H+ntgGbHyAFA0Cth2XY3UuunmWbEbx9ry9CVGzDuqIhseHn1hJ68cMFqI AG0wzi0I8UMuygm803JwRzyLdBcqXLerSYqVuIyHjzjabIbf+ld+ONTU9i93U+uBAistVZ BxVeXo0NP2y4dIddguXnVTMdQYemXslEyCYsFmZ9NnkB34NnKcbqxUQnw2Xu2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235482; 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=UPrIl6a5yDvu0+xiSSxtIDz8nqSev7ViBz2VLCxpJKo=; b=LGHy+YS1C+bXoZZwt0Mgk6DfIRAjEp4Us94i46tGbj8/MUHxMcJSYQxmo4ma7y5Te/Ic5n CrLkwy4Ig/wGC/Cg5d1vCYnX0OHGRWQITNmSP7FZA51r+6ek7CXKAj8uiow/g+SnOgMfL5 YfCChXS/2Hhv1B2u2xogPc//HCNdcTWXFRleF4Lyfnkskr4AuwCme4J0ybxINgBmSxiYQp DLr8Ayd87ybO6kB5NOu0XKAgg5YbEv14G3uLsmAQ/qucXEBO6xYLc5l9+aS0G+0DtrtFxb IVumnamG5tf+hmspFuQ0pyuyy6colYbh+b5kob7HlE92fQnm5SByW997JPZ1fQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677235482; a=rsa-sha256; cv=none; b=dS5wg6ewdps37+OMb9c2K6zkHRG7wrd6xjrQh5ZDHwSzuJpn00vhtztcIcpBGuE1jRXTce uRKEbAuog3O/dFotY+NJDhgTlwvCJVmm4lmyDXQL3uMb1wpHxkMTbZ2MqJ5/uQNstzO+eS uzFKmVliVDdIYD96suROKwo6IpvxI+vBn9ZKcOADhADc7MAl4m79QBN9uXqImNlha722PC edX+SIUJ1I60uuk/SxDEpqgd8vq1HYFT9ODgv71nOJqoCo4e8HqpQu0Am56HahpP1pMC+K 29fjZGhLYJXfUT8SjuCssvF379EHFAbGCFXKS/jQGIuL3eIQ0LtZR6mgqLANqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PNRNT5sN3zKdZ; Fri, 24 Feb 2023 10:44:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31OAifEN019912; Fri, 24 Feb 2023 10:44:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31OAifiO019911; Fri, 24 Feb 2023 10:44:41 GMT (envelope-from git) Date: Fri, 24 Feb 2023 10:44:41 GMT Message-Id: <202302241044.31OAifiO019911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 240ee0183fa1 - stable/13 - netlink: fix IPv6 route addition with link-local gateway List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 240ee0183fa190502a5e1f163c49f336f8f10cd4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=240ee0183fa190502a5e1f163c49f336f8f10cd4 commit 240ee0183fa190502a5e1f163c49f336f8f10cd4 Author: Alexander V. Chernikov AuthorDate: 2023-02-20 14:24:01 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-24 10:43:50 +0000 netlink: fix IPv6 route addition with link-local gateway Currently kernel assumes that IPv6 gateway address is in "embedded" form - that is, for the link-local IPv6 addresses, interface index is embedded in bytes 2 and 3 of the address. Fix address embedding in netlink by wrapping nhop_set_gw() in the netlink-specific nl_set_nexthop_gw(), which does such embedding automatically. Reported by: Marek Zarychta MFC after: 3 days (cherry picked from commit c7c348162101a70b1f99299578dabe1d3b100e48) --- sys/netlink/route/nexthop.c | 42 ++++++++++++++++++++++++++++++++++++------ sys/netlink/route/route_var.h | 2 ++ sys/netlink/route/rt.c | 15 ++++++++++++--- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/sys/netlink/route/nexthop.c b/sys/netlink/route/nexthop.c index e9f008842644..63e491687249 100644 --- a/sys/netlink/route/nexthop.c +++ b/sys/netlink/route/nexthop.c @@ -741,8 +741,34 @@ newnhg(struct unhop_ctl *ctl, struct nl_parsed_nhop *attrs, struct user_nhop *un return (0); } +/* + * Sets nexthop @nh gateway specified by @gw. + * If gateway is IPv6 link-local, alters @gw to include scopeid equal to + * @ifp ifindex. + * Returns 0 on success or errno. + */ +int +nl_set_nexthop_gw(struct nhop_object *nh, struct sockaddr *gw, struct ifnet *ifp, + struct nl_pstate *npt) +{ +#ifdef INET6 + if (gw->sa_family == AF_INET6) { + struct sockaddr_in6 *gw6 = (struct sockaddr_in6 *)gw; + if (IN6_IS_ADDR_LINKLOCAL(&gw6->sin6_addr)) { + if (ifp == NULL) { + NLMSG_REPORT_ERR_MSG(npt, "interface not set"); + return (EINVAL); + } + in6_set_unicast_scopeid(&gw6->sin6_addr, ifp->if_index); + } + } +#endif + nhop_set_gw(nh, gw, true); + return (0); +} + static int -newnhop(struct nl_parsed_nhop *attrs, struct user_nhop *unhop) +newnhop(struct nl_parsed_nhop *attrs, struct user_nhop *unhop, struct nl_pstate *npt) { struct ifaddr *ifa = NULL; struct nhop_object *nh; @@ -750,17 +776,17 @@ newnhop(struct nl_parsed_nhop *attrs, struct user_nhop *unhop) if (!attrs->nha_blackhole) { if (attrs->nha_gw == NULL) { - NL_LOG(LOG_DEBUG, "missing NHA_GATEWAY"); + NLMSG_REPORT_ERR_MSG(npt, "missing NHA_GATEWAY"); return (EINVAL); } if (attrs->nha_oif == NULL) { - NL_LOG(LOG_DEBUG, "missing NHA_OIF"); + NLMSG_REPORT_ERR_MSG(npt, "missing NHA_OIF"); return (EINVAL); } if (ifa == NULL) ifa = ifaof_ifpforaddr(attrs->nha_gw, attrs->nha_oif); if (ifa == NULL) { - NL_LOG(LOG_DEBUG, "Unable to determine default source IP"); + NLMSG_REPORT_ERR_MSG(npt, "Unable to determine default source IP"); return (EINVAL); } } @@ -777,7 +803,11 @@ newnhop(struct nl_parsed_nhop *attrs, struct user_nhop *unhop) if (attrs->nha_blackhole) nhop_set_blackhole(nh, NHF_BLACKHOLE); else { - nhop_set_gw(nh, attrs->nha_gw, true); + error = nl_set_nexthop_gw(nh, attrs->nha_gw, attrs->nha_oif, npt); + if (error != 0) { + nhop_free(nh); + return (error); + } nhop_set_transmit_ifp(nh, attrs->nha_oif); nhop_set_src(nh, ifa); } @@ -839,7 +869,7 @@ rtnl_handle_newnhop(struct nlmsghdr *hdr, struct nlpcb *nlp, if (attrs.nha_group) error = newnhg(ctl, &attrs, unhop); else - error = newnhop(&attrs, unhop); + error = newnhop(&attrs, unhop, npt); if (error != 0) { free(unhop, M_NETLINK); diff --git a/sys/netlink/route/route_var.h b/sys/netlink/route/route_var.h index f1e522c7ae05..f3b1d7d929a5 100644 --- a/sys/netlink/route/route_var.h +++ b/sys/netlink/route/route_var.h @@ -104,6 +104,8 @@ void rtnl_iface_drivers_register(void); void rtnl_nexthops_init(void); struct nhop_object *nl_find_nhop(uint32_t fibnum, int family, uint32_t uidx, int nh_flags, int *perror); +int nl_set_nexthop_gw(struct nhop_object *nh, struct sockaddr *gw, + struct ifnet *ifp, struct nl_pstate *npt); #endif diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index aca69e75fea8..534186447b4d 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -736,7 +736,11 @@ create_nexthop_one(struct nl_parsed_route *attrs, struct rta_mpath_nh *mpnh, if (nh == NULL) return (ENOMEM); - nhop_set_gw(nh, mpnh->gw, true); + error = nl_set_nexthop_gw(nh, mpnh->gw, mpnh->ifp, npt); + if (error != 0) { + nhop_free(nh); + return (error); + } if (mpnh->ifp != NULL) nhop_set_transmit_ifp(nh, mpnh->ifp); nhop_set_rtflags(nh, attrs->rta_rtflags); @@ -800,8 +804,13 @@ create_nexthop_from_attrs(struct nl_parsed_route *attrs, *perror = ENOMEM; return (NULL); } - if (attrs->rta_gw != NULL) - nhop_set_gw(nh, attrs->rta_gw, true); + if (attrs->rta_gw != NULL) { + *perror = nl_set_nexthop_gw(nh, attrs->rta_gw, attrs->rta_oif, npt); + if (*perror != 0) { + nhop_free(nh); + return (NULL); + } + } if (attrs->rta_oif != NULL) nhop_set_transmit_ifp(nh, attrs->rta_oif); if (attrs->rtax_mtu != 0) From nobody Fri Feb 24 10:44:42 2023 X-Original-To: dev-commits-src-branches@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 4PNRNW1ssQz3t5QG; Fri, 24 Feb 2023 10:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNRNW0wHYz3pkF; Fri, 24 Feb 2023 10:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235483; 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=1GNK0Yf0jkm0TyRmi2ekk/7tCQqc5wDxxZzQy+idO8w=; b=psi3HgRRjcJ9Q1rXHzmjZGZPvH4vDRckxzFHn+rc8aBoshwCwbqieolLUrXBGLrHcBvru3 rqyPZc0wFBjCwQfICrSOtL7O3ULo//QFEijiE9iMii1wAqzbTQPpd/vnB59NuYHib47hza MtmR3myl9hFC6qj2asgvdbhyO8NsPOtPgw3vUZvmUwcW8fkkQqiiTd/4e3+4nxKZTrYZuM 7eY2Qo6eqX2P66nVg73vqrdtZlk945KYzB0R60sfA3JOlU642rDgwcZLULPJN5NHF5UXin vIBkf7dXWCEe9sESSEwabKFK7Fr8FWgYGUEbyLxiFdaMkGvfOG6z0Y69KoAl+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235483; 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=1GNK0Yf0jkm0TyRmi2ekk/7tCQqc5wDxxZzQy+idO8w=; b=v15N2BjDvV2DZoRxs5YlCHvY3jcmt0rSGZiztezuiQzANpSgT7JJoTrnPhsBHKPn84JTf9 wvWy5sXO03xU3N8XbRAkZ2C/qADZ6/1o0H0vMveUXIx8KUyiWRUeasFJtK00yY5G0w8r4s uUW4oZXLfczO12abzsiyNYzSsLgMi+vFdaoa/rti3jUVmYHQamv987I0RyWZcGUuomLTgh fsRS5aUkdZmRzj4Q7xiUOaYS7Z777oHfGyUG15p/wa1ebaLPf8hqsolOAX47+M+F8pNanR 4iLcYoJVniMtt/kz4yqeHOWLJhxz2h7/LmIg0E09btaFjjeuiWLDzCMB587MCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677235483; a=rsa-sha256; cv=none; b=JqUOROSUN2BrcEVsEI4GuIfc2pCioOkAp/hUYhhmFapiHRl70gb2F85hI1Cz+pk8cURTcr bGV9YSCa3SMslMu5X+gL+1PwkrIRhEl14k6tdka3rbcJv/HMqdONtf+lCXioKEkBeyNZPh tmsa7zHp66e5VoYxWj/Pn7FGZHrgFqQ/LIPP5P+m5JbBAJk59cKGWDWEwUFCGFrz7VVGoV xvnJE/0R4YIg1UbehunHjyfKyl2IJ5LtHhQE/ovnv69lDJjTQy1WKAV29Od/FBClUViVsk A7FRt7HVZ3cAp9/BWlJrfp+Dz4randkbJHUS9gghY2c689L4DbzgC/DpqZuxXg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PNRNV70STzLRL; Fri, 24 Feb 2023 10:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31OAigJw019938; Fri, 24 Feb 2023 10:44:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31OAigeV019937; Fri, 24 Feb 2023 10:44:42 GMT (envelope-from git) Date: Fri, 24 Feb 2023 10:44:42 GMT Message-Id: <202302241044.31OAigeV019937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d101991d8dcc - stable/13 - netlink: clear IPv6 embedded scope when dumping route gateways. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d101991d8dcc1e056d1c06ca83b88826f4d65ae5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d101991d8dcc1e056d1c06ca83b88826f4d65ae5 commit d101991d8dcc1e056d1c06ca83b88826f4d65ae5 Author: Alexander V. Chernikov AuthorDate: 2023-02-21 12:25:58 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-24 10:44:02 +0000 netlink: clear IPv6 embedded scope when dumping route gateways. Reported by: zarychtam@plan-b.pwste.edu.pl MFC after: 3 days (cherry picked from commit b9b2184322da85e1f4d52e3b0a6322dd214210ec) --- sys/netlink/route/rt.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 534186447b4d..dabdaea3e03b 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -123,7 +124,9 @@ rc_get_nhop(const struct rib_cmd_info *rc) static void dump_rc_nhop_gw(struct nl_writer *nw, const struct nhop_object *nh) { +#ifdef INET6 int upper_family; +#endif switch (nhop_get_neigh_family(nh)) { case AF_LINK: @@ -132,19 +135,27 @@ dump_rc_nhop_gw(struct nl_writer *nw, const struct nhop_object *nh) case AF_INET: nlattr_add(nw, NL_RTA_GATEWAY, 4, &nh->gw4_sa.sin_addr); break; +#ifdef INET6 case AF_INET6: upper_family = nhop_get_upper_family(nh); if (upper_family == AF_INET6) { - nlattr_add(nw, NL_RTA_GATEWAY, 16, &nh->gw6_sa.sin6_addr); + struct in6_addr gw6 = nh->gw6_sa.sin6_addr; + in6_clearscope(&gw6); + + nlattr_add(nw, NL_RTA_GATEWAY, 16, &gw6); } else if (upper_family == AF_INET) { /* IPv4 over IPv6 */ + struct in6_addr gw6 = nh->gw6_sa.sin6_addr; + in6_clearscope(&gw6); + char buf[20]; struct rtvia *via = (struct rtvia *)&buf[0]; via->rtvia_family = AF_INET6; - memcpy(via->rtvia_addr, &nh->gw6_sa.sin6_addr, 16); + memcpy(via->rtvia_addr, &gw6, 16); nlattr_add(nw, NL_RTA_VIA, 17, via); } break; +#endif } }