From owner-dev-commits-src-all@freebsd.org Mon Sep 27 00:24:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 360F96AB40D; Mon, 27 Sep 2021 00:24: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 4HHk0l0Tv4z3MQy; Mon, 27 Sep 2021 00:24:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E533427229; Mon, 27 Sep 2021 00:24: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 18R0Oc1J088016; Mon, 27 Sep 2021 00:24:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R0Oc3H088015; Mon, 27 Sep 2021 00:24:38 GMT (envelope-from git) Date: Mon, 27 Sep 2021 00:24:38 GMT Message-Id: <202109270024.18R0Oc3H088015@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: 31ddfec5099b - stable/13 - aio_fsync_vnode: use for(; ; ) loop instead of label 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: 31ddfec5099b311ec53bf9986e972a5985f93196 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 00:24:39 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=31ddfec5099b311ec53bf9986e972a5985f93196 commit 31ddfec5099b311ec53bf9986e972a5985f93196 Author: Konstantin Belousov AuthorDate: 2021-09-20 09:30:54 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-27 00:24:08 +0000 aio_fsync_vnode: use for(;;) loop instead of label (cherry picked from commit 922bee44e400321ac98b3b371cde3f0ff6137dd0) --- sys/kern/vfs_aio.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 7d4d9ac3e94b..d4683c91e80a 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -724,24 +724,29 @@ static int aio_fsync_vnode(struct thread *td, struct vnode *vp, int op) { struct mount *mp; + vm_object_t obj; int error; - if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - goto drop; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (vp->v_object != NULL) { - VM_OBJECT_WLOCK(vp->v_object); - vm_object_page_clean(vp->v_object, 0, 0, 0); - VM_OBJECT_WUNLOCK(vp->v_object); - } - if (op == LIO_DSYNC) - error = VOP_FDATASYNC(vp, td); - else - error = VOP_FSYNC(vp, MNT_WAIT, td); + for (;;) { + error = vn_start_write(vp, &mp, V_WAIT | PCATCH); + if (error != 0) + break; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + obj = vp->v_object; + if (obj != NULL) { + VM_OBJECT_WLOCK(obj); + vm_object_page_clean(obj, 0, 0, 0); + VM_OBJECT_WUNLOCK(obj); + } + if (op == LIO_DSYNC) + error = VOP_FDATASYNC(vp, td); + else + error = VOP_FSYNC(vp, MNT_WAIT, td); - VOP_UNLOCK(vp); - vn_finished_write(mp); -drop: + VOP_UNLOCK(vp); + vn_finished_write(mp); + break; + } return (error); } From owner-dev-commits-src-all@freebsd.org Mon Sep 27 00:24:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 435596AB58C; Mon, 27 Sep 2021 00:24: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 4HHk0m1Qghz3MR0; Mon, 27 Sep 2021 00:24:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 128C1270DE; Mon, 27 Sep 2021 00:24: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 18R0OddO088040; Mon, 27 Sep 2021 00:24:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R0OdoW088039; Mon, 27 Sep 2021 00:24:39 GMT (envelope-from git) Date: Mon, 27 Sep 2021 00:24:39 GMT Message-Id: <202109270024.18R0OdoW088039@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: 1be8bd8d44b1 - stable/13 - aio_fsync_vnode: handle ERELOOKUP after VOP_FSYNC() 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: 1be8bd8d44b1c9baa257eb49133542615960dbb2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 00:24:40 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1be8bd8d44b1c9baa257eb49133542615960dbb2 commit 1be8bd8d44b1c9baa257eb49133542615960dbb2 Author: Konstantin Belousov AuthorDate: 2021-09-20 09:32:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-27 00:24:08 +0000 aio_fsync_vnode: handle ERELOOKUP after VOP_FSYNC() (cherry picked from commit 2933a7ca03f16ba7b048a9bd2b3df1fc3cf9c344) --- sys/kern/vfs_aio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index d4683c91e80a..865eaeee2d13 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -745,7 +745,8 @@ aio_fsync_vnode(struct thread *td, struct vnode *vp, int op) VOP_UNLOCK(vp); vn_finished_write(mp); - break; + if (error != ERELOOKUP) + break; } return (error); } From owner-dev-commits-src-all@freebsd.org Mon Sep 27 00:25:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6DB36AB425; Mon, 27 Sep 2021 00:25: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 4HHk1H4gs7z3M79; Mon, 27 Sep 2021 00:25:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 812F526BE5; Mon, 27 Sep 2021 00:25: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 18R0P7Sj088198; Mon, 27 Sep 2021 00:25:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R0P7lX088197; Mon, 27 Sep 2021 00:25:07 GMT (envelope-from git) Date: Mon, 27 Sep 2021 00:25:07 GMT Message-Id: <202109270025.18R0P7lX088197@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: 720177158ccd - stable/13 - opencrypto: Allow kern.crypto.allow_soft to be specified as a tunable 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: 720177158ccdfe2b706ed232126621f5cb73aef3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 00:25:07 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=720177158ccdfe2b706ed232126621f5cb73aef3 commit 720177158ccdfe2b706ed232126621f5cb73aef3 Author: Mark Johnston AuthorDate: 2021-09-20 16:07:29 +0000 Commit: Mark Johnston CommitDate: 2021-09-27 00:25:00 +0000 opencrypto: Allow kern.crypto.allow_soft to be specified as a tunable Sponsored by: The FreeBSD Foundation (cherry picked from commit 9e0c051249e3832e0f6a0067058ff9735677f3d5) --- sys/opencrypto/crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 0316eb35361a..59c74c86de00 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -214,11 +214,11 @@ SYSCTL_INT(_kern, OID_AUTO, userasymcrypto, CTLFLAG_RW, #endif int crypto_devallowsoft = 0; -SYSCTL_INT(_kern_crypto, OID_AUTO, allow_soft, CTLFLAG_RW, +SYSCTL_INT(_kern_crypto, OID_AUTO, allow_soft, CTLFLAG_RWTUN, &crypto_devallowsoft, 0, "Enable use of software crypto by /dev/crypto"); #ifdef COMPAT_FREEBSD12 -SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RW, +SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RWTUN, &crypto_devallowsoft, 0, "Enable/disable use of software crypto by /dev/crypto"); #endif From owner-dev-commits-src-all@freebsd.org Mon Sep 27 00:54:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8091B6AB9BE; Mon, 27 Sep 2021 00:54: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 4HHkfj30qPz3NyG; Mon, 27 Sep 2021 00:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47742276DB; Mon, 27 Sep 2021 00:54: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 18R0s5o4028006; Mon, 27 Sep 2021 00:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R0s5cn028005; Mon, 27 Sep 2021 00:54:05 GMT (envelope-from git) Date: Mon, 27 Sep 2021 00:54:05 GMT Message-Id: <202109270054.18R0s5cn028005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 964d2210e122 - stable/13 - Fix data race in scsi cd driver. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 964d2210e122edd74b9da601bcf4e36721926055 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 00:54:05 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=964d2210e122edd74b9da601bcf4e36721926055 commit 964d2210e122edd74b9da601bcf4e36721926055 Author: Alexander Motin AuthorDate: 2021-09-13 12:59:51 +0000 Commit: Alexander Motin CommitDate: 2021-09-27 00:54:02 +0000 Fix data race in scsi cd driver. There is a data race between cdsysctlinit and cdcheckmedia. Both functions change softc->flags without synchronization. Submitted by: Arseny Smalyuk MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31726 (cherry picked from commit e76786909ce0195855196305a04d86b40f138894) --- sys/cam/scsi/scsi_cd.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index da367ad65c5d..ee59da3e53c9 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -372,6 +372,7 @@ cdoninvalidate(struct cam_periph *periph) { struct cd_softc *softc; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; /* @@ -452,7 +453,7 @@ cdasync(void *callback_arg, u_int32_t code, printf("cdasync: Unable to attach new device " "due to status 0x%x\n", status); - break; + return; } case AC_UNIT_ATTENTION: { @@ -472,10 +473,10 @@ cdasync(void *callback_arg, u_int32_t code, if (asc == 0x28 && ascq == 0x00) disk_media_changed(softc->disk, M_NOWAIT); } - cam_periph_async(periph, code, path, arg); break; } case AC_SCSI_AEN: + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; if (softc->state == CD_STATE_NORMAL && !softc->tur) { if (cam_periph_acquire(periph) == 0) { @@ -489,6 +490,7 @@ cdasync(void *callback_arg, u_int32_t code, { struct ccb_hdr *ccbh; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; /* * Don't fail on the expected unit attention @@ -497,12 +499,13 @@ cdasync(void *callback_arg, u_int32_t code, softc->flags |= CD_FLAG_RETRY_UA; LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le) ccbh->ccb_state |= CD_CCB_RETRY_UA; - /* FALLTHROUGH */ + break; } default: - cam_periph_async(periph, code, path, arg); break; } + + cam_periph_async(periph, code, path, arg); } static void @@ -521,7 +524,9 @@ cdsysctlinit(void *context, int pending) snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); sysctl_ctx_init(&softc->sysctl_ctx); + cam_periph_lock(periph); softc->flags |= CD_FLAG_SCTX_INIT; + cam_periph_unlock(periph); softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_kern_cam_cd), OID_AUTO, tmpstr2, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, tmpstr, @@ -900,6 +905,7 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb) struct bio *bp; struct ccb_scsiio *csio; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdstart\n")); @@ -1144,6 +1150,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cddone\n")); + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; csio = &done_ccb->csio; @@ -2624,6 +2631,7 @@ cdprevent(struct cam_periph *periph, int action) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdprevent\n")); + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; if (((action == PR_ALLOW) @@ -2661,6 +2669,7 @@ cdmediaprobedone(struct cam_periph *periph) { struct cd_softc *softc; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; softc->flags &= ~CD_FLAG_MEDIA_SCAN_ACT; @@ -2682,6 +2691,7 @@ cdcheckmedia(struct cam_periph *periph, int do_wait) struct cd_softc *softc; int error; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; error = 0; @@ -3071,13 +3081,14 @@ cderror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct cd_softc *)periph->softc; - error = 0; + cam_periph_assert(periph, MA_OWNED); /* * We use a status of CAM_REQ_INVALID as shorthand -- if a 6 byte * CDB comes back with this particular error, try transforming it * into the 10 byte version. */ + error = 0; if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { error = cd6byteworkaround(ccb); } else if (scsi_extract_sense_ccb(ccb, From owner-dev-commits-src-all@freebsd.org Mon Sep 27 01:40:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F3836AC669; Mon, 27 Sep 2021 01:40: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 4HHlhQ1rPCz3hG2; Mon, 27 Sep 2021 01:40:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FBC4299; Mon, 27 Sep 2021 01:40: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 18R1ecox092133; Mon, 27 Sep 2021 01:40:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R1ecnx092132; Mon, 27 Sep 2021 01:40:38 GMT (envelope-from git) Date: Mon, 27 Sep 2021 01:40:38 GMT Message-Id: <202109270140.18R1ecnx092132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 62c5be4ab4c8 - main - nfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg() 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/main X-Git-Reftype: branch X-Git-Commit: 62c5be4ab4c8b8127185286e148638cb8cdf45f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 01:40:38 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=62c5be4ab4c8b8127185286e148638cb8cdf45f4 commit 62c5be4ab4c8b8127185286e148638cb8cdf45f4 Author: Rick Macklem AuthorDate: 2021-09-27 01:37:25 +0000 Commit: Rick Macklem CommitDate: 2021-09-27 01:37:25 +0000 nfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg() Commit 5e5ca4c8fc53 added a flag to a NFSv4 mount point that is set when the first delegation is acquired from the NFSv4 server. For a common case where delegations are not being issued by the NFSv4 server, the nfscl_removedeleg() code acquires the mutex lock for open/lock state, finds the delegation list empty, then just unlocks the mutex and returns. This patch adds a check of the flag to avoid the need to acquire the mutex for this common case. This change appears to be performance neutral for a small number of opens, but should reduce lock contention for a large number of opens for the common case where server is not issuing delegations. This commit should not affect the high level semantics of delegation handling. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 8ec5b80489f9..ddbfa40300d8 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4604,6 +4604,12 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) int igotlock = 0, triedrecall = 0, needsrecall, retcnt = 0, islept; nmp = VFSTONFS(vp->v_mount); + NFSLOCKMNT(nmp); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { + NFSUNLOCKMNT(nmp); + return (retcnt); + } + NFSUNLOCKMNT(nmp); np = VTONFS(vp); NFSLOCKCLSTATE(); /* From owner-dev-commits-src-all@freebsd.org Mon Sep 27 03:59:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3553F6ADF90; Mon, 27 Sep 2021 03:59: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 4HHpmh73hmz3qTd; Mon, 27 Sep 2021 03:59:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D469820C2; Mon, 27 Sep 2021 03:59:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18R3xWex068759; Mon, 27 Sep 2021 03:59:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R3xWrG068758; Mon, 27 Sep 2021 03:59:32 GMT (envelope-from git) Date: Mon, 27 Sep 2021 03:59:32 GMT Message-Id: <202109270359.18R3xWrG068758@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: a3a1ce3794e8 - main - fusefs: diff reduction in fuse_kernel.h 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/main X-Git-Reftype: branch X-Git-Commit: a3a1ce3794e85fe27cb5af5e9f48a490a9ef70c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 03:59:33 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=a3a1ce3794e85fe27cb5af5e9f48a490a9ef70c2 commit a3a1ce3794e85fe27cb5af5e9f48a490a9ef70c2 Author: Alan Somers AuthorDate: 2021-09-25 14:23:54 +0000 Commit: Alan Somers CommitDate: 2021-09-27 03:57:07 +0000 fusefs: diff reduction in fuse_kernel.h Synchronize formatting and documentation in fuse_kernel.h with upstream sources. MFC after: 2 weeks Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D32141 --- sys/fs/fuse/fuse_internal.c | 2 +- sys/fs/fuse/fuse_kernel.h | 85 ++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 77 insertions(+), 10 deletions(-) diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c index 82e37ed5a466..731ac9c2ba24 100644 --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -363,7 +363,7 @@ fuse_internal_fsync(struct vnode *vp, ffsi->fsync_flags = 0; if (datasync) - ffsi->fsync_flags = 1; + ffsi->fsync_flags = FUSE_FSYNC_FDATASYNC; if (waitfor == MNT_WAIT) { err = fdisp_wait_answ(&fdi); diff --git a/sys/fs/fuse/fuse_kernel.h b/sys/fs/fuse/fuse_kernel.h index 14cf4fabac14..bd7323e9def2 100644 --- a/sys/fs/fuse/fuse_kernel.h +++ b/sys/fs/fuse/fuse_kernel.h @@ -41,22 +41,61 @@ * * Protocol changelog: * + * 7.1: + * - add the following messages: + * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK, + * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE, + * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR, + * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR, + * FUSE_RELEASEDIR + * - add padding to messages to accommodate 32-bit servers on 64-bit kernels + * + * 7.2: + * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags + * - add FUSE_FSYNCDIR message + * + * 7.3: + * - add FUSE_ACCESS message + * - add FUSE_CREATE message + * - add filehandle to fuse_setattr_in + * + * 7.4: + * - add frsize to fuse_kstatfs + * - clean up request size limit checking + * + * 7.5: + * - add flags and max_write to fuse_init_out + * + * 7.6: + * - add max_readahead to fuse_init_in and fuse_init_out + * + * 7.7: + * - add FUSE_INTERRUPT message + * - add POSIX file lock support + * + * 7.8: + * - add lock_owner and flags fields to fuse_release_in + * - add FUSE_BMAP message + * - add FUSE_DESTROY message + * * 7.9: * - new fuse_getattr_in input argument of GETATTR * - add lk_flags in fuse_lk_in * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in * - add blksize field to fuse_attr * - add file flags field to fuse_read_in and fuse_write_in + * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in * * 7.10 * - add nonseekable open flag * - * 7.11 + * 7.11 * - add IOCTL message * - add unsolicited notification support + * - add POLL message and NOTIFY_POLL notification * - * 7.12 - * - add umask flag to input argument of open, mknod and mkdir + * 7.12 + * - add umask flag to input argument of create, mknod and mkdir * - add notification messages for invalidation of inodes and * directory entries * @@ -89,6 +128,7 @@ * * 7.20 * - add FUSE_AUTO_INVAL_DATA + * * 7.21 * - add FUSE_READDIRPLUS * - send the requested events in POLL request @@ -105,7 +145,7 @@ * - add FUSE_RENAME2 request * - add FUSE_NO_OPEN_SUPPORT flag * - * 7.24 + * 7.24 * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support * * 7.25 @@ -134,6 +174,26 @@ #include #endif +/* + * Version negotiation: + * + * Both the kernel and userspace send the version they support in the + * INIT request and reply respectively. + * + * If the major versions match then both shall use the smallest + * of the two minor versions for communication. + * + * If the kernel supports a larger major version, then userspace shall + * reply with the major version it supports, ignore the rest of the + * INIT message and expect a new INIT message from the kernel with a + * matching major version. + * + * If the library supports a larger major version, then it shall fall + * back to the major protocol version sent by the kernel for + * communication and reply with that major version (and an arbitrary + * supported minor version). + */ + /** Version number of this interface */ #define FUSE_KERNEL_VERSION 7 @@ -331,6 +391,13 @@ struct fuse_file_lock { */ #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) +/** + * Fsync flags + * + * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata + */ +#define FUSE_FSYNC_FDATASYNC (1 << 0) + enum fuse_opcode { FUSE_LOOKUP = 1, FUSE_FORGET = 2, /* no reply */ @@ -791,14 +858,14 @@ struct fuse_notify_retrieve_in { }; struct fuse_lseek_in { - uint64_t fh; - uint64_t offset; - uint32_t whence; - uint32_t padding; + uint64_t fh; + uint64_t offset; + uint32_t whence; + uint32_t padding; }; struct fuse_lseek_out { - uint64_t offset; + uint64_t offset; }; struct fuse_copy_file_range_in { From owner-dev-commits-src-all@freebsd.org Mon Sep 27 03:59:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CFB86ADBCE; Mon, 27 Sep 2021 03:59: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 4HHpmk28jDz3q7P; Mon, 27 Sep 2021 03:59:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1B5B1F39; Mon, 27 Sep 2021 03:59: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 18R3xXY2068783; Mon, 27 Sep 2021 03:59:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R3xXSV068782; Mon, 27 Sep 2021 03:59:33 GMT (envelope-from git) Date: Mon, 27 Sep 2021 03:59:33 GMT Message-Id: <202109270359.18R3xXSV068782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 7124d2bc3a3b - main - fusefs: implement FUSE_NO_OPEN_SUPPORT and FUSE_NO_OPENDIR_SUPPORT 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/main X-Git-Reftype: branch X-Git-Commit: 7124d2bc3a3bd58f6d3803a0579f2e0fa853b56d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 03:59:34 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=7124d2bc3a3bd58f6d3803a0579f2e0fa853b56d commit 7124d2bc3a3bd58f6d3803a0579f2e0fa853b56d Author: Alan Somers AuthorDate: 2021-09-25 03:53:28 +0000 Commit: Alan Somers CommitDate: 2021-09-27 03:57:29 +0000 fusefs: implement FUSE_NO_OPEN_SUPPORT and FUSE_NO_OPENDIR_SUPPORT For file systems that allow it, fusefs will skip FUSE_OPEN, FUSE_RELEASE, FUSE_OPENDIR, and FUSE_RELEASEDIR operations, a minor optimization. MFC after: 2 weeks Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D32141 --- sys/fs/fuse/fuse_file.c | 65 +++++++++++++++++++++++++++++------------ sys/fs/fuse/fuse_file.h | 3 +- sys/fs/fuse/fuse_internal.c | 8 +++-- sys/fs/fuse/fuse_ipc.h | 2 ++ sys/fs/fuse/fuse_kernel.h | 4 ++- tests/sys/fs/fusefs/open.cc | 66 ++++++++++++++++++++++++++++++++++++++++++ tests/sys/fs/fusefs/opendir.cc | 48 ++++++++++++++++++++++++++++++ 7 files changed, 174 insertions(+), 22 deletions(-) diff --git a/sys/fs/fuse/fuse_file.c b/sys/fs/fuse/fuse_file.c index f9b0c781f49a..a7357d85a8b3 100644 --- a/sys/fs/fuse/fuse_file.c +++ b/sys/fs/fuse/fuse_file.c @@ -124,44 +124,68 @@ int fuse_filehandle_open(struct vnode *vp, int a_mode, struct fuse_filehandle **fufhp, struct thread *td, struct ucred *cred) { + struct mount *mp = vnode_mount(vp); + struct fuse_data *data = fuse_get_mpdata(mp); struct fuse_dispatcher fdi; - struct fuse_open_in *foi; - struct fuse_open_out *foo; + const struct fuse_open_out default_foo = { + .fh = 0, + .open_flags = FOPEN_KEEP_CACHE, + .padding = 0 + }; + struct fuse_open_in *foi = NULL; + const struct fuse_open_out *foo; fufh_type_t fufh_type; - + int dataflags = data->dataflags; int err = 0; int oflags = 0; int op = FUSE_OPEN; + int relop = FUSE_RELEASE; + int fsess_no_op_support = FSESS_NO_OPEN_SUPPORT; fufh_type = fflags_2_fufh_type(a_mode); oflags = fufh_type_2_fflags(fufh_type); if (vnode_isdir(vp)) { op = FUSE_OPENDIR; + relop = FUSE_RELEASEDIR; + fsess_no_op_support = FSESS_NO_OPENDIR_SUPPORT; /* vn_open_vnode already rejects FWRITE on directories */ MPASS(fufh_type == FUFH_RDONLY || fufh_type == FUFH_EXEC); } fdisp_init(&fdi, sizeof(*foi)); - fdisp_make_vp(&fdi, op, vp, td, cred); - - foi = fdi.indata; - foi->flags = oflags; - - if ((err = fdisp_wait_answ(&fdi))) { - SDT_PROBE2(fusefs, , file, trace, 1, - "OUCH ... daemon didn't give fh"); - if (err == ENOENT) { - fuse_internal_vnode_disappear(vp); + if (fsess_not_impl(mp, op) && dataflags & fsess_no_op_support) { + /* The operation implicitly succeeds */ + foo = &default_foo; + } else { + fdisp_make_vp(&fdi, op, vp, td, cred); + + foi = fdi.indata; + foi->flags = oflags; + + err = fdisp_wait_answ(&fdi); + if (err == ENOSYS && dataflags & fsess_no_op_support) { + /* The operation implicitly succeeds */ + foo = &default_foo; + fsess_set_notimpl(mp, op); + fsess_set_notimpl(mp, relop); + err = 0; + } else if (err) { + SDT_PROBE2(fusefs, , file, trace, 1, + "OUCH ... daemon didn't give fh"); + if (err == ENOENT) + fuse_internal_vnode_disappear(vp); + goto out; + } else { + foo = fdi.answ; } - goto out; } - foo = fdi.answ; fuse_filehandle_init(vp, fufh_type, fufhp, td, cred, foo); fuse_vnode_open(vp, foo->open_flags, td); out: - fdisp_destroy(&fdi); + if (foi) + fdisp_destroy(&fdi); return err; } @@ -169,6 +193,7 @@ int fuse_filehandle_close(struct vnode *vp, struct fuse_filehandle *fufh, struct thread *td, struct ucred *cred) { + struct mount *mp = vnode_mount(vp); struct fuse_dispatcher fdi; struct fuse_release_in *fri; @@ -180,6 +205,10 @@ fuse_filehandle_close(struct vnode *vp, struct fuse_filehandle *fufh, } if (vnode_isdir(vp)) op = FUSE_RELEASEDIR; + + if (fsess_not_impl(mp, op)) + goto out; + fdisp_init(&fdi, sizeof(*fri)); fdisp_make_vp(&fdi, op, vp, td, cred); fri = fdi.indata; @@ -327,8 +356,8 @@ fuse_filehandle_getrw(struct vnode *vp, int fflag, void fuse_filehandle_init(struct vnode *vp, fufh_type_t fufh_type, - struct fuse_filehandle **fufhp, struct thread *td, struct ucred *cred, - struct fuse_open_out *foo) + struct fuse_filehandle **fufhp, struct thread *td, const struct ucred *cred, + const struct fuse_open_out *foo) { struct fuse_vnode_data *fvdat = VTOFUD(vp); struct fuse_filehandle *fufh; diff --git a/sys/fs/fuse/fuse_file.h b/sys/fs/fuse/fuse_file.h index 10c799d5d40d..25004beead51 100644 --- a/sys/fs/fuse/fuse_file.h +++ b/sys/fs/fuse/fuse_file.h @@ -211,7 +211,8 @@ int fuse_filehandle_getrw(struct vnode *vp, int fflag, void fuse_filehandle_init(struct vnode *vp, fufh_type_t fufh_type, struct fuse_filehandle **fufhp, struct thread *td, - struct ucred *cred, struct fuse_open_out *foo); + const struct ucred *cred, + const struct fuse_open_out *foo); int fuse_filehandle_open(struct vnode *vp, int mode, struct fuse_filehandle **fufhp, struct thread *td, struct ucred *cred); diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c index 731ac9c2ba24..c52f12d3a71a 100644 --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -1009,6 +1009,10 @@ fuse_internal_init_callback(struct fuse_ticket *tick, struct uio *uio) data->dataflags |= FSESS_POSIX_LOCKS; if (fiio->flags & FUSE_EXPORT_SUPPORT) data->dataflags |= FSESS_EXPORT_SUPPORT; + if (fiio->flags & FUSE_NO_OPEN_SUPPORT) + data->dataflags |= FSESS_NO_OPEN_SUPPORT; + if (fiio->flags & FUSE_NO_OPENDIR_SUPPORT) + data->dataflags |= FSESS_NO_OPENDIR_SUPPORT; /* * Don't bother to check FUSE_BIG_WRITES, because it's * redundant with max_write @@ -1098,7 +1102,6 @@ fuse_internal_send_init(struct fuse_data *data, struct thread *td) * FUSE_DO_READDIRPLUS: not yet implemented * FUSE_READDIRPLUS_AUTO: not yet implemented * FUSE_ASYNC_DIO: not yet implemented - * FUSE_NO_OPEN_SUPPORT: not yet implemented * FUSE_PARALLEL_DIROPS: not yet implemented * FUSE_HANDLE_KILLPRIV: not yet implemented * FUSE_POSIX_ACL: not yet implemented @@ -1107,7 +1110,8 @@ fuse_internal_send_init(struct fuse_data *data, struct thread *td) * FUSE_MAX_PAGES: not yet implemented */ fiii->flags = FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_EXPORT_SUPPORT - | FUSE_BIG_WRITES | FUSE_WRITEBACK_CACHE; + | FUSE_BIG_WRITES | FUSE_WRITEBACK_CACHE + | FUSE_NO_OPEN_SUPPORT | FUSE_NO_OPENDIR_SUPPORT; fuse_insert_callback(fdi.tick, fuse_internal_init_callback); fuse_insert_message(fdi.tick, false); diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h index 7b27fd97e212..fe616b3639a7 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -229,6 +229,8 @@ struct fuse_data { /* (and being observed by the daemon) */ #define FSESS_PUSH_SYMLINKS_IN 0x0020 /* prefix absolute symlinks with mp */ #define FSESS_DEFAULT_PERMISSIONS 0x0040 /* kernel does permission checking */ +#define FSESS_NO_OPEN_SUPPORT 0x0080 /* can elide FUSE_OPEN ops */ +#define FSESS_NO_OPENDIR_SUPPORT 0x0100 /* can elide FUSE_OPENDIR ops */ #define FSESS_ASYNC_READ 0x1000 /* allow multiple reads of some file */ #define FSESS_POSIX_LOCKS 0x2000 /* daemon supports POSIX locks */ #define FSESS_EXPORT_SUPPORT 0x10000 /* daemon supports NFS-style lookups */ diff --git a/sys/fs/fuse/fuse_kernel.h b/sys/fs/fuse/fuse_kernel.h index bd7323e9def2..51445637b9a8 100644 --- a/sys/fs/fuse/fuse_kernel.h +++ b/sys/fs/fuse/fuse_kernel.h @@ -198,7 +198,7 @@ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 28 +#define FUSE_KERNEL_MINOR_VERSION 29 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 @@ -300,6 +300,7 @@ struct fuse_file_lock { * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages * FUSE_CACHE_SYMLINKS: cache READLINK responses + * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) @@ -325,6 +326,7 @@ struct fuse_file_lock { #define FUSE_ABORT_ERROR (1 << 21) #define FUSE_MAX_PAGES (1 << 22) #define FUSE_CACHE_SYMLINKS (1 << 23) +#define FUSE_NO_OPENDIR_SUPPORT (1 << 24) #ifdef linux /** diff --git a/tests/sys/fs/fusefs/open.cc b/tests/sys/fs/fusefs/open.cc index ede7ea9f04f7..7ac177a65d14 100644 --- a/tests/sys/fs/fusefs/open.cc +++ b/tests/sys/fs/fusefs/open.cc @@ -73,6 +73,13 @@ void test_ok(int os_flags, int fuse_flags) { }; +class OpenNoOpenSupport: public FuseTest { + virtual void SetUp() { + m_init_flags = FUSE_NO_OPEN_SUPPORT; + FuseTest::SetUp(); + } +}; + /* * fusefs(5) does not support I/O on device nodes (neither does UFS). But it * shouldn't crash @@ -274,3 +281,62 @@ TEST_F(Open, o_rdwr) test_ok(O_RDWR, O_RDWR); } +/* + * Without FUSE_NO_OPEN_SUPPORT, returning ENOSYS is an error + */ +TEST_F(Open, enosys) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + int fd; + + FuseTest::expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_OPEN && + in.body.open.flags == (uint32_t)O_RDONLY && + in.header.nodeid == ino); + }, Eq(true)), + _) + ).Times(1) + .WillOnce(Invoke(ReturnErrno(ENOSYS))); + + fd = open(FULLPATH, O_RDONLY); + ASSERT_EQ(-1, fd) << strerror(errno); + EXPECT_EQ(ENOSYS, errno); +} + +/* + * If a fuse server sets FUSE_NO_OPEN_SUPPORT and returns ENOSYS to a + * FUSE_OPEN, then it and subsequent FUSE_OPEN and FUSE_RELEASE operations will + * also succeed automatically without being sent to the server. + */ +TEST_F(OpenNoOpenSupport, enosys) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + int fd; + + FuseTest::expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 2); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_OPEN && + in.body.open.flags == (uint32_t)O_RDONLY && + in.header.nodeid == ino); + }, Eq(true)), + _) + ).Times(1) + .WillOnce(Invoke(ReturnErrno(ENOSYS))); + expect_flush(ino, 1, ReturnErrno(ENOSYS)); + + fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd) << strerror(errno); + close(fd); + + fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd) << strerror(errno); + + leak(fd); +} diff --git a/tests/sys/fs/fusefs/opendir.cc b/tests/sys/fs/fusefs/opendir.cc index 7943be3124ca..365aa8dff9e2 100644 --- a/tests/sys/fs/fusefs/opendir.cc +++ b/tests/sys/fs/fusefs/opendir.cc @@ -73,6 +73,13 @@ void expect_opendir(uint64_t ino, uint32_t flags, ProcessMockerT r) }; +class OpendirNoOpendirSupport: public Opendir { + virtual void SetUp() { + m_init_flags = FUSE_NO_OPENDIR_SUPPORT; + FuseTest::SetUp(); + } +}; + /* * The fuse daemon fails the request with enoent. This usually indicates a @@ -172,3 +179,44 @@ TEST_F(Opendir, opendir) errno = 0; EXPECT_NE(nullptr, opendir(FULLPATH)) << strerror(errno); } + +/* + * Without FUSE_NO_OPENDIR_SUPPORT, returning ENOSYS is an error + */ +TEST_F(Opendir, enosys) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + + expect_lookup(RELPATH, ino); + expect_opendir(ino, O_RDONLY, ReturnErrno(ENOSYS)); + + EXPECT_EQ(-1, open(FULLPATH, O_DIRECTORY)); + EXPECT_EQ(ENOSYS, errno); +} + +/* + * If a fuse server sets FUSE_NO_OPENDIR_SUPPORT and returns ENOSYS to a + * FUSE_OPENDIR, then it and subsequent FUSE_OPENDIR and FUSE_RELEASEDIR + * operations will also succeed automatically without being sent to the server. + */ +TEST_F(OpendirNoOpendirSupport, enosys) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + int fd; + + FuseTest::expect_lookup(RELPATH, ino, S_IFDIR | 0755, 0, 2); + expect_opendir(ino, O_RDONLY, ReturnErrno(ENOSYS)); + + fd = open(FULLPATH, O_DIRECTORY); + ASSERT_LE(0, fd) << strerror(errno); + close(fd); + + fd = open(FULLPATH, O_DIRECTORY); + ASSERT_LE(0, fd) << strerror(errno); + + leak(fd); +} From owner-dev-commits-src-all@freebsd.org Mon Sep 27 05:13:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA16E6AEB30; Mon, 27 Sep 2021 05:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HHrPq35tWz3tRt; Mon, 27 Sep 2021 05:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A5512DFC; Mon, 27 Sep 2021 05:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18R5DJWP074844; Mon, 27 Sep 2021 05:13:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R5DJKV074843; Mon, 27 Sep 2021 05:13:19 GMT (envelope-from git) Date: Mon, 27 Sep 2021 05:13:19 GMT Message-Id: <202109270513.18R5DJKV074843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 260f26f035af - main - mount: make libxo support more locale-aware MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 260f26f035af2095a1b55c04439f479c49e4056c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 05:13:19 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=260f26f035af2095a1b55c04439f479c49e4056c commit 260f26f035af2095a1b55c04439f479c49e4056c Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-26 20:50:28 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-27 05:12:26 +0000 mount: make libxo support more locale-aware "special", "node", and "mounter" are not guaranteed to be encoded with UTF-8. Use the appropriate modifier. Reported by: eugen@ --- sbin/mount/mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 80eda100c66f..9550ecd1c54e 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -671,7 +671,7 @@ prmount(struct statfs *sfp) struct passwd *pw; char *fsidbuf; - xo_emit("{:special}{L: on }{:node}{L: (}{:fstype}", sfp->f_mntfromname, + xo_emit("{:special/%hs}{L: on }{:node/%hs}{L: (}{:fstype}", sfp->f_mntfromname, sfp->f_mntonname, sfp->f_fstypename); flags = sfp->f_flags & MNT_VISFLAGMASK; @@ -687,9 +687,9 @@ prmount(struct statfs *sfp) if ((flags & MNT_USER) != 0 || sfp->f_owner != 0) { xo_emit("{D:, }{L:mounted by }"); if ((pw = getpwuid(sfp->f_owner)) != NULL) - xo_emit("{:mounter}", pw->pw_name); + xo_emit("{:mounter/%hs}", pw->pw_name); else - xo_emit("{:mounter}", sfp->f_owner); + xo_emit("{:mounter/%hs}", sfp->f_owner); } if (verbose) { if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0) { From owner-dev-commits-src-all@freebsd.org Mon Sep 27 05:46:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B69FE6AF306; Mon, 27 Sep 2021 05:46: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 4HHs7g20hYz3w2n; Mon, 27 Sep 2021 05:46:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22169391F; Mon, 27 Sep 2021 05:46: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 18R5k7hP014790; Mon, 27 Sep 2021 05:46:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R5k7vE014789; Mon, 27 Sep 2021 05:46:07 GMT (envelope-from git) Date: Mon, 27 Sep 2021 05:46:07 GMT Message-Id: <202109270546.18R5k7vE014789@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: c27214f0afa5 - main - ipsec: fix typo in comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c27214f0afa526b9545dc7509e409e81978bf873 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 05:46:07 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=c27214f0afa526b9545dc7509e409e81978bf873 commit c27214f0afa526b9545dc7509e409e81978bf873 Author: Wojciech Macek AuthorDate: 2021-09-27 05:45:33 +0000 Commit: Wojciech Macek CommitDate: 2021-09-27 05:45:33 +0000 ipsec: fix typo in comment --- sys/netipsec/ipsec_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 9beb5c47444f..230e316ea77d 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -344,7 +344,7 @@ setdf: if (m_length(m, NULL) + hlen > pmtu) { /* * If we're forwarding generate ICMP message here, - * so that it contains pmtu substraced by header size. + * so that it contains pmtu subtraced by header size. * Set error to EINPROGRESS, in order for the frame * to be dropped silently. */ @@ -738,7 +738,7 @@ ipsec6_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) if (m_length(m, NULL) + hlen > pmtu) { /* * If we're forwarding generate ICMPv6 message here, - * so that it contains pmtu substracted by header size. + * so that it contains pmtu subtracted by header size. * Set error to EINPROGRESS, in order for the frame * to be dropped silently. */ From owner-dev-commits-src-all@freebsd.org Mon Sep 27 05:47:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 198096AF140; Mon, 27 Sep 2021 05:47: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 4HHs995yn8z3wPs; Mon, 27 Sep 2021 05:47:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACD313A01; Mon, 27 Sep 2021 05:47: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 18R5lPwf014984; Mon, 27 Sep 2021 05:47:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R5lPmn014983; Mon, 27 Sep 2021 05:47:25 GMT (envelope-from git) Date: Mon, 27 Sep 2021 05:47:25 GMT Message-Id: <202109270547.18R5lPmn014983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 8deba29c0a63 - main - ipsec: fix typo part2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8deba29c0a63e812c8a30249ea4a004dc85cdd3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 05:47:26 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=8deba29c0a63e812c8a30249ea4a004dc85cdd3f commit 8deba29c0a63e812c8a30249ea4a004dc85cdd3f Author: Wojciech Macek AuthorDate: 2021-09-27 05:46:56 +0000 Commit: Wojciech Macek CommitDate: 2021-09-27 05:46:56 +0000 ipsec: fix typo part2 --- sys/netipsec/ipsec_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 230e316ea77d..0a722140f93e 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -344,7 +344,7 @@ setdf: if (m_length(m, NULL) + hlen > pmtu) { /* * If we're forwarding generate ICMP message here, - * so that it contains pmtu subtraced by header size. + * so that it contains pmtu subtracted by header size. * Set error to EINPROGRESS, in order for the frame * to be dropped silently. */ From owner-dev-commits-src-all@freebsd.org Mon Sep 27 06:11:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE9656AF74B; Mon, 27 Sep 2021 06:11: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 4HHshj5KFLz4TN8; Mon, 27 Sep 2021 06:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 968BA3AC0; Mon, 27 Sep 2021 06:11: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 18R6BHNE054018; Mon, 27 Sep 2021 06:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R6BH7m054017; Mon, 27 Sep 2021 06:11:17 GMT (envelope-from git) Date: Mon, 27 Sep 2021 06:11:17 GMT Message-Id: <202109270611.18R6BH7m054017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yasuhiro Kimura Subject: git: 77087b11e222 - main - Add myself as ports committer and update mentor/mentee information MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yasu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77087b11e222a4b21e0c72bd3d82ace0bfdf511b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 06:11:17 -0000 The branch main has been updated by yasu (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=77087b11e222a4b21e0c72bd3d82ace0bfdf511b commit 77087b11e222a4b21e0c72bd3d82ace0bfdf511b Author: Yasuhiro Kimura AuthorDate: 2021-09-27 05:37:16 +0000 Commit: Yasuhiro Kimura CommitDate: 2021-09-27 06:10:47 +0000 Add myself as ports committer and update mentor/mentee information It corresponds to the 5th step of the procedure described in section 7.1 of Committer's Guide. Approved by: meta (mentor) Differential Revision: https://reviews.freebsd.org/D32151 --- share/misc/committers-ports.dot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index da65d0641dba..b8b74f5c25a0 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -292,6 +292,7 @@ woodsb02 [label="Ben Woods\nwoodsb02@FreeBSD.org\n2016/05/09"] wxs [label="Wesley Shields\nwxs@FreeBSD.org\n2008/01/03"] xmj [label="Johannes Jost Meixner\nxmj@FreeBSD.org\n2014/04/07"] xride [label="Soeren Straarup\nxride@FreeBSD.org\n2006/09/27"] +yasu [label="Yasuhiro Kimura\nyasu@FreeBSD.org\n2021/08/27"] ygy [label="Guangyuan Yang\nygy@FreeBSD.org\n2021/05/17"] yuri [label="Yuri Victorovich\nyuri@FreeBSD.org\n2017/10/30"] yzlin [label="Yi-Jheng Lin\nyzlin@FreeBSD.org\n2009/07/19"] @@ -607,6 +608,8 @@ matthew -> leres matthew -> lifanov matthew -> ultima +meta -> yasu + mezz -> tmclaugh miwi -> amdmi3 @@ -816,4 +819,6 @@ wxs -> skreuzer wxs -> swills wxs -> zi +ygy -> yasu + } From owner-dev-commits-src-all@freebsd.org Mon Sep 27 07:32:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76C176B0616; Mon, 27 Sep 2021 07:32: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 4HHvV32s8zz4YPT; Mon, 27 Sep 2021 07:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42BA95191; Mon, 27 Sep 2021 07:32: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 18R7WBGG061285; Mon, 27 Sep 2021 07:32:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R7WB1h061284; Mon, 27 Sep 2021 07:32:11 GMT (envelope-from git) Date: Mon, 27 Sep 2021 07:32:11 GMT Message-Id: <202109270732.18R7WB1h061284@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 3b4cc56e524a - main - syslogd: undo regression after r326573 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b4cc56e524ac947ba0e6571e2c455139c2839ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 07:32:11 -0000 The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=3b4cc56e524ac947ba0e6571e2c455139c2839ec commit 3b4cc56e524ac947ba0e6571e2c455139c2839ec Author: Eugene Grosbein AuthorDate: 2021-09-27 07:25:21 +0000 Commit: Eugene Grosbein CommitDate: 2021-09-27 07:25:21 +0000 syslogd: undo regression after r326573 Restore ability for our syslogd to collect pre-RFC3164 formatted messages from remote hosts that was broken with r326573. For example, the line from Cisco SCE8000 splitted for readability: 1130: 03:37:57: %USER-6-PORT_OPERSTATUS_CHANGE_TRAP: CPU#000 trap:link down EntityAdminState: 4 EntityAlarmStatus: 32 Such line was collected and stored before mentioned change but silently dropped after that. Now syslogd saves it again. Note that parsing of RFC5424 format not changed. MFC after: 1 month --- usr.sbin/syslogd/syslogd.c | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 1837c41c4e8b..dc07d4781553 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1357,31 +1357,25 @@ parsemsg(const char *from, char *msg) size_t i; int pri; + i = -1; + pri = DEFUPRI; + /* Parse PRI. */ - if (msg[0] != '<' || !isdigit(msg[1])) { - dprintf("Invalid PRI from %s\n", from); - return; - } - for (i = 2; i <= 4; i++) { - if (msg[i] == '>') - break; - if (!isdigit(msg[i])) { - dprintf("Invalid PRI header from %s\n", from); - return; + if (msg[0] == '<' && isdigit(msg[1])) { + for (i = 2; i <= 4; i++) { + if (msg[i] == '>') { + errno = 0; + n = strtol(msg + 1, &q, 10); + if (errno == 0 && *q == msg[i] && n >= 0 && n <= INT_MAX) { + pri = n; + msg += i + 1; + i = 0; + } + break; } + } } - if (msg[i] != '>') { - dprintf("Invalid PRI header from %s\n", from); - return; - } - errno = 0; - n = strtol(msg + 1, &q, 10); - if (errno != 0 || *q != msg[i] || n < 0 || n >= INT_MAX) { - dprintf("Invalid PRI %ld from %s: %s\n", - n, from, strerror(errno)); - return; - } - pri = n; + if (pri &~ (LOG_FACMASK|LOG_PRIMASK)) pri = DEFUPRI; @@ -1394,8 +1388,7 @@ parsemsg(const char *from, char *msg) pri = LOG_MAKEPRI(LOG_USER, LOG_PRI(pri)); /* Parse VERSION. */ - msg += i + 1; - if (msg[0] == '1' && msg[1] == ' ') + if (i == 0 && msg[0] == '1' && msg[1] == ' ') parsemsg_rfc5424(from, pri, msg + 2); else parsemsg_rfc3164(from, pri, msg); From owner-dev-commits-src-all@freebsd.org Mon Sep 27 08:16:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DBE26B1096; Mon, 27 Sep 2021 08:16:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HHwTS0KNzz4cxl; Mon, 27 Sep 2021 08:16:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id B23832FC12; Mon, 27 Sep 2021 08:16:43 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 74DE14662C; Mon, 27 Sep 2021 10:16:41 +0200 (CEST) From: Kristof Provost To: Alexander Motin Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 695323ae88c7 - main - acpi_cpu: Fix panic if some CPU devices are disabled. Date: Mon, 27 Sep 2021 10:16:39 +0200 X-Mailer: MailMate (1.14r5818) Message-ID: <1D490397-E56E-4D39-A4CC-BDF0CC25E91D@FreeBSD.org> In-Reply-To: <202109252101.18PL1W4I003365@gitrepo.freebsd.org> References: <202109252101.18PL1W4I003365@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 08:16:44 -0000 On 25 Sep 2021, at 23:01, Alexander Motin wrote: > The branch main has been updated by mav: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D695323ae88c71776e131940ed7ded= d25365e932f > > commit 695323ae88c71776e131940ed7dedd25365e932f > Author: Alexander Motin > AuthorDate: 2021-09-25 20:54:28 +0000 > Commit: Alexander Motin > CommitDate: 2021-09-25 21:01:28 +0000 > > acpi_cpu: Fix panic if some CPU devices are disabled. > > While there, remove couple unneeded global variables. > --- > sys/dev/acpica/acpi_cpu.c | 66 = > +++++++++++++++++++++-------------------------- > 1 file changed, 29 insertions(+), 37 deletions(-) > > diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c > index ab4ffda7a02e..0577b6eac8b7 100644 > --- a/sys/dev/acpica/acpi_cpu.c > +++ b/sys/dev/acpica/acpi_cpu.c > @@ -154,8 +154,6 @@ static struct sysctl_oid *cpu_sysctl_tree; > static int cpu_cx_generic; > static int cpu_cx_lowest_lim; > > -static device_t *cpu_devices; > -static int cpu_ndevices; > static struct acpi_cpu_softc **cpu_softc; > ACPI_SERIAL_DECL(cpu, "ACPI CPU"); > > @@ -443,26 +441,21 @@ acpi_cpu_attach(device_t dev) > static void > acpi_cpu_postattach(void *unused __unused) > { I=E2=80=99m seeing this panic on a bhyve VM running an up-to-date main ke= rnel: Fatal trap 12: page fault while in kernel mode cpuid =3D 2; apic id =3D 02 fault virtual address =3D 0x0 fault code =3D supervisor read data, page not present instruction pointer =3D 0x20:0xffffffff804f643c stack pointer =3D 0x28:0xffffffff8358bf20 frame pointer =3D 0x28:0xffffffff8358bfa0 code segment =3D base 0x0, limit 0xfffff, type 0x1b =3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags =3D interrupt enabled, resume, IOPL =3D 0 current process =3D 0 (swapper) trap number =3D 12 panic: page fault cpuid =3D 2 time =3D 1 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame = 0xffffffff8358bbc0 vpanic() at vpanic+0x187/frame 0xffffffff8358bc20 panic() at panic+0x43/frame 0xffffffff8358bc80 trap_fatal() at trap_fatal+0x387/frame 0xffffffff8358bce0 trap_pfault() at trap_pfault+0x99/frame 0xffffffff8358bd40 trap() at trap+0x2a7/frame 0xffffffff8358be50 calltrap() at calltrap+0x8/frame 0xffffffff8358be50 --- trap 0xc, rip =3D 0xffffffff804f643c, rsp =3D 0xffffffff8358bf20, rb= p =3D = 0xffffffff8358bfa0 --- acpi_cpu_postattach() at acpi_cpu_postattach+0x5c/frame = 0xffffffff8358bfa0 mi_startup() at mi_startup+0x1f0/frame 0xffffffff8358bff0 btext() at btext+0x22 KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at kdb_enter+0x37: movq $0,0x1274f0e(%rip) db> I=E2=80=99ve not done any digging, but given that it seems to die in = acpi_cpu_postattach() and you touched that last =E2=80=A6, well you know = how = that goes. Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Mon Sep 27 08:48:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D9296B18A3; Mon, 27 Sep 2021 08:48: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 4HHx9X27nFz4gmm; Mon, 27 Sep 2021 08:48:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25D8A5D5B; Mon, 27 Sep 2021 08:48: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 18R8m0Qd054860; Mon, 27 Sep 2021 08:48:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18R8m0DD054859; Mon, 27 Sep 2021 08:48:00 GMT (envelope-from git) Date: Mon, 27 Sep 2021 08:48:00 GMT Message-Id: <202109270848.18R8m0DD054859@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yasuhiro Kimura Subject: git: 74237127e340 - main - Add myself to calendar.freebsd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yasu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74237127e34084a7c178fbbe9c47c7f3e3e1ec24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 08:48:00 -0000 The branch main has been updated by yasu (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=74237127e34084a7c178fbbe9c47c7f3e3e1ec24 commit 74237127e34084a7c178fbbe9c47c7f3e3e1ec24 Author: Yasuhiro Kimura AuthorDate: 2021-09-27 07:46:54 +0000 Commit: Yasuhiro Kimura CommitDate: 2021-09-27 08:47:01 +0000 Add myself to calendar.freebsd It corresponds to the 9th step of the procedure described in section 7.1 of Committer's Guide. Approved by: meta (mentor) Differential Revision: https://reviews.freebsd.org/D32153 --- usr.bin/calendar/calendars/calendar.freebsd | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd index 10c361fac8da..82a167621105 100644 --- a/usr.bin/calendar/calendars/calendar.freebsd +++ b/usr.bin/calendar/calendars/calendar.freebsd @@ -285,6 +285,7 @@ 07/10 David Schultz born in Oakland, California, United States, 1982 07/10 Ben Woods born in Perth, Western Australia, Australia, 1984 07/11 Jesus R. Camou born in Hermosillo, Sonora, Mexico, 1983 +07/12 Yasuhiro Kimura born in Okazaki, Aichi, Japan, 1967 07/14 Fernando Apesteguia born in Madrid, Spain, 1981 07/15 Gary Jennejohn born in Rochester, New York, United States, 1950 07/16 Suleiman Souhlal born in Roma, Italy, 1983 From owner-dev-commits-src-all@freebsd.org Mon Sep 27 11:03:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1AD16B303A; Mon, 27 Sep 2021 11:03:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ09x5ysRz4qCR; Mon, 27 Sep 2021 11:03:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 972D11412; Mon, 27 Sep 2021 11:03:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id C611E46912; Mon, 27 Sep 2021 13:03:31 +0200 (CEST) From: Kristof Provost To: Emmanuel Vadot Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: a30235a4c360 - main - pkgbase: Create a FreeBSD-kerberos package Date: Mon, 27 Sep 2021 13:03:31 +0200 X-Mailer: MailMate (1.14r5818) Message-ID: In-Reply-To: <202109070952.1879q63H010763@gitrepo.freebsd.org> References: <202109070952.1879q63H010763@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 11:03:34 -0000 On 7 Sep 2021, at 11:52, Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Da30235a4c360c06bb57be1f1= 0ae6866a71fb5622 > > commit a30235a4c360c06bb57be1f10ae6866a71fb5622 > Author: Emmanuel Vadot > AuthorDate: 2021-09-02 04:09:15 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-09-07 08:23:14 +0000 > > pkgbase: Create a FreeBSD-kerberos package > > This allows users to install or not kerberos related utilities > and libs. > > Differential Revision: https://reviews.freebsd.org/D31801 > --- Is it possible that this commit caused /etc/rc.d/gssd to no longer get in= stalled? (I=E2=80=99m not sure this is the responsible commit. I=E2=80=99ve very c= arefully avoided learning anything about our build system.) Kristof From owner-dev-commits-src-all@freebsd.org Mon Sep 27 11:47:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96E626B3D3F; Mon, 27 Sep 2021 11:47: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 4HJ18L2hJ1z4swY; Mon, 27 Sep 2021 11:47:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38D40105AB; Mon, 27 Sep 2021 11:47: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 18RBlEwX093784; Mon, 27 Sep 2021 11: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 18RBlEPI093783; Mon, 27 Sep 2021 11:47:14 GMT (envelope-from git) Date: Mon, 27 Sep 2021 11:47:14 GMT Message-Id: <202109271147.18RBlEPI093783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 4e50efb1944b - main - Check cpu_softc is not NULL before dereferencing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e50efb1944bffe6ae648c8c81bd0814c18474b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 11:47:14 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=4e50efb1944bffe6ae648c8c81bd0814c18474b9 commit 4e50efb1944bffe6ae648c8c81bd0814c18474b9 Author: Andrew Turner AuthorDate: 2021-09-27 11:22:15 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 11:32:12 +0000 Check cpu_softc is not NULL before dereferencing In the acpi_cpu_postattach SYSINIT function cpu_softc may be NULL, e.g. on arm64 when booting from FDT. Check it is not NULL at the start of the function so we don't try to dereference a NULL pointer. Sponsored by: The FreeBSD Foundation --- sys/dev/acpica/acpi_cpu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 0577b6eac8b7..aac25af830ea 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -444,6 +444,9 @@ acpi_cpu_postattach(void *unused __unused) struct acpi_cpu_softc *sc; int attached = 0, i; + if (cpu_softc == NULL) + return; + mtx_lock(&Giant); CPU_FOREACH(i) { if ((sc = cpu_softc[i]) != NULL) From owner-dev-commits-src-all@freebsd.org Mon Sep 27 11:48:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A5186B3FD1; Mon, 27 Sep 2021 11:48:27 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4HJ19l00vmz4tMB; Mon, 27 Sep 2021 11:48:26 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtpclient.apple (cpc91232-cmbg18-2-0-cust554.5-4.cable.virginm.net [82.2.126.43]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id AE6BE4E63E; Mon, 27 Sep 2021 11:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz; s=mail; t=1632743299; bh=Qhs50fdYsawDSqtj2RAhAth+9JRAlH7aodNqj5PYnSU=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=RqCkHVO1uVplI8rmcRIQlf01a9BVFsX6v5WHfaH/o322jySn/ZfVc+0oPw++t7jD/ 6YsBieiBhbS+BM2Da9FhL1AAsb/xCHsdL1xNrcSzmrgjCVyjMsr+ePE3sBYX6zY0Uj y/0gpyKUomZ+yCGp3wNgeumCj+Agd2PwD7zfH4+ns9BksjjNSWEdNd8pWijdmPoIRH OaAv5sE4HQtr24J3i8T1ETgdAGjfbxFadpZz4rY3nVhBL5yDog8cwdX0A4TTr++L+Y 45Fy3Fqg/R5uzvsG6r8JJmShpfNug6f2B1fBm2S2tqybSbRsnIHX+5R9hIRQH7SmOl Mgz2FnDuVt3pywdo40Q7gNOwX+EjiUyIKq1hw9HJsn/spF2Ffj9guRUdbWrDM/nrTu 1FZJJIze748QVLwvEEIhfSDawfc/RiAdRE/qcV+pwi/oNUX2iLWsNJnm7sqH8QIHkL 9tn8ZFkBLYoQFIJYs5wv3ADAtono6Nfrxa0kqd0wFPCG4IQexctCZ0ZurARAMMLh4q bz+JcawO8I2IqOO182y97ncCt+/5iBWjlMRk/lcyeH3PCfJiawo7Gq8RqCCC4vcCYH ic1rAAyS0FnEGMBLeaX+iK18kubBATqFmhMf9GJxg0Ar1wYlNS5uq9r+4DymhNYs5I C1rSWPELmQnfjbCzmeL1U4m4= From: Andrew Turner Message-Id: Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 695323ae88c7 - main - acpi_cpu: Fix panic if some CPU devices are disabled. Date: Mon, 27 Sep 2021 12:48:19 +0100 In-Reply-To: <1D490397-E56E-4D39-A4CC-BDF0CC25E91D@FreeBSD.org> Cc: Alexander Motin , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Kristof Provost References: <202109252101.18PL1W4I003365@gitrepo.freebsd.org> <1D490397-E56E-4D39-A4CC-BDF0CC25E91D@FreeBSD.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HJ19l00vmz4tMB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 11:48:27 -0000 > On 27 Sep 2021, at 09:16, Kristof Provost wrote: >=20 > On 25 Sep 2021, at 23:01, Alexander Motin wrote: >=20 > The branch main has been updated by mav: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D695323ae88c71776e131940ed7dedd25= 365e932f = > commit 695323ae88c71776e131940ed7dedd25365e932f=20 > Author: Alexander Motin =20 > AuthorDate: 2021-09-25 20:54:28 +0000=20 > Commit: Alexander Motin =20 > CommitDate: 2021-09-25 21:01:28 +0000 >=20 > acpi_cpu: Fix panic if some CPU devices are disabled. >=20 > While there, remove couple unneeded global variables.=20 > ---=20 > sys/dev/acpica/acpi_cpu.c | 66 = +++++++++++++++++++++--------------------------=20 > 1 file changed, 29 insertions(+), 37 deletions(-) >=20 > diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c=20 > index ab4ffda7a02e..0577b6eac8b7 100644=20 > --- a/sys/dev/acpica/acpi_cpu.c=20 > +++ b/sys/dev/acpica/acpi_cpu.c=20 > @@ -154,8 +154,6 @@ static struct sysctl_oid *cpu_sysctl_tree;=20 > static int cpu_cx_generic;=20 > static int cpu_cx_lowest_lim; >=20 > -static device_t *cpu_devices;=20 > -static int cpu_ndevices;=20 > static struct acpi_cpu_softc **cpu_softc;=20 > ACPI_SERIAL_DECL(cpu, "ACPI CPU"); >=20 > @@ -443,26 +441,21 @@ acpi_cpu_attach(device_t dev)=20 > static void=20 > acpi_cpu_postattach(void *unused __unused)=20 > { >=20 > I=E2=80=99m seeing this panic on a bhyve VM running an up-to-date main = kernel: >=20 > Fatal trap 12: page fault while in kernel mode > cpuid =3D 2; apic id =3D 02 > fault virtual address =3D 0x0 > fault code =3D supervisor read data, page not present > instruction pointer =3D 0x20:0xffffffff804f643c > stack pointer =3D 0x28:0xffffffff8358bf20 > frame pointer =3D 0x28:0xffffffff8358bfa0 > code segment =3D base 0x0, limit 0xfffff, type 0x1b > =3D DPL 0, pres 1, long 1, def32 0, gran 1 > processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > current process =3D 0 (swapper) > trap number =3D 12 > panic: page fault > cpuid =3D 2 > time =3D 1 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame = 0xffffffff8358bbc0 > vpanic() at vpanic+0x187/frame 0xffffffff8358bc20 > panic() at panic+0x43/frame 0xffffffff8358bc80 > trap_fatal() at trap_fatal+0x387/frame 0xffffffff8358bce0 > trap_pfault() at trap_pfault+0x99/frame 0xffffffff8358bd40 > trap() at trap+0x2a7/frame 0xffffffff8358be50 > calltrap() at calltrap+0x8/frame 0xffffffff8358be50 > --- trap 0xc, rip =3D 0xffffffff804f643c, rsp =3D 0xffffffff8358bf20, = rbp =3D 0xffffffff8358bfa0 --- > acpi_cpu_postattach() at acpi_cpu_postattach+0x5c/frame = 0xffffffff8358bfa0 > mi_startup() at mi_startup+0x1f0/frame 0xffffffff8358bff0 > btext() at btext+0x22 > KDB: enter: panic > [ thread pid 0 tid 100000 ] > Stopped at kdb_enter+0x37: movq $0,0x1274f0e(%rip) > db> > I=E2=80=99ve not done any digging, but given that it seems to die in = acpi_cpu_postattach() and you touched that last =E2=80=A6, well you know = how that goes. >=20 I hit what looks to be the same issue on arm64. In my case it was a NULL = pointer dereference on cpu_softc because acpi_cpu_probe never called = malloc as I=E2=80=99m booting using FDT. I=E2=80=99ve pushed a fix for this in 4e50efb1. Andrew From owner-dev-commits-src-all@freebsd.org Mon Sep 27 11:51:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1046E6B42A4; Mon, 27 Sep 2021 11:51:49 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ1Fc2nKkz4tQ3; Mon, 27 Sep 2021 11:51:48 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1632743501; 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=VPoVwHte/8w+m8PNK+FZZaiqd5fFdsv0nW/KyUlyk9o=; b=IZTNMue+JCiqQiTxiX27VbbXgtAMuSWy3MJrAikYB4VtIBKvOak9pQsqtIto3tOgzHzpHz TtMKjutzGp2a14tjjU3UMbf35o9jofn8dLYtkZqIdoGQ4uXU1FYHpqyNQVuVLbottGpTl8 LJFsGdwfLxDoV7VYMYiEZgiDA6/6hNw= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 0ca16052 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 27 Sep 2021 11:51:41 +0000 (UTC) Date: Mon, 27 Sep 2021 13:51:40 +0200 From: Emmanuel Vadot To: Kristof Provost Cc: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: a30235a4c360 - main - pkgbase: Create a FreeBSD-kerberos package Message-Id: <20210927135140.2dcc977740609d80065aa5a7@bidouilliste.com> In-Reply-To: References: <202109070952.1879q63H010763@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4HJ1Fc2nKkz4tQ3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 11:51:49 -0000 On Mon, 27 Sep 2021 13:03:31 +0200 Kristof Provost wrote: > On 7 Sep 2021, at 11:52, Emmanuel Vadot wrote: > > The branch main has been updated by manu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Da30235a4c360c06bb57be1f1= 0ae6866a71fb5622 > > > > commit a30235a4c360c06bb57be1f10ae6866a71fb5622 > > Author: Emmanuel Vadot > > AuthorDate: 2021-09-02 04:09:15 +0000 > > Commit: Emmanuel Vadot > > CommitDate: 2021-09-07 08:23:14 +0000 > > > > pkgbase: Create a FreeBSD-kerberos package > > > > This allows users to install or not kerberos related utilities > > and libs. > > > > Differential Revision: https://reviews.freebsd.org/D31801 > > --- >=20 > Is it possible that this commit caused /etc/rc.d/gssd to no longer get in= stalled? > (I?m not sure this is the responsible commit. I?ve very carefully avoided= learning anything about our build system.) >=20 > Kristof Really possible yes, Can you test : diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 2271c27b7f8..5981b3b03d1 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -191,7 +191,7 @@ CONFS+=3D ftpd .endif =20 .if ${MK_GSSAPI} !=3D "no" -CONFGROUPS+=3D gssd +CONFGROUPS+=3D GSSD GSSD=3D gssd GSSDPACKAGE=3D kerberos .endif --=20 Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Mon Sep 27 12:28:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C33896B4E21; Mon, 27 Sep 2021 12:28:56 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ24S5C76z3DRj; Mon, 27 Sep 2021 12:28:56 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 786C91E8A; Mon, 27 Sep 2021 12:28:56 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 32FC346969; Mon, 27 Sep 2021 14:28:54 +0200 (CEST) From: Kristof Provost To: Emmanuel Vadot Cc: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: a30235a4c360 - main - pkgbase: Create a FreeBSD-kerberos package Date: Mon, 27 Sep 2021 14:28:53 +0200 X-Mailer: MailMate (1.14r5818) Message-ID: In-Reply-To: <20210927135140.2dcc977740609d80065aa5a7@bidouilliste.com> References: <202109070952.1879q63H010763@gitrepo.freebsd.org> <20210927135140.2dcc977740609d80065aa5a7@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 12:28:56 -0000 On 27 Sep 2021, at 13:51, Emmanuel Vadot wrote: > On Mon, 27 Sep 2021 13:03:31 +0200 > Kristof Provost wrote: > >> On 7 Sep 2021, at 11:52, Emmanuel Vadot wrote: >>> The branch main has been updated by manu: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3Da30235a4c360c06bb57be1= f10ae6866a71fb5622 >>> >>> commit a30235a4c360c06bb57be1f10ae6866a71fb5622 >>> Author: Emmanuel Vadot >>> AuthorDate: 2021-09-02 04:09:15 +0000 >>> Commit: Emmanuel Vadot >>> CommitDate: 2021-09-07 08:23:14 +0000 >>> >>> pkgbase: Create a FreeBSD-kerberos package >>> >>> This allows users to install or not kerberos related utilities >>> and libs. >>> >>> Differential Revision: https://reviews.freebsd.org/D31801 >>> --- >> >> Is it possible that this commit caused /etc/rc.d/gssd to no longer get= installed? >> (I?m not sure this is the responsible commit. I?ve very carefully avoi= ded learning anything about our build system.) >> >> Kristof > > Really possible yes, > Can you test : > diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile > index 2271c27b7f8..5981b3b03d1 100644 > --- a/libexec/rc/rc.d/Makefile > +++ b/libexec/rc/rc.d/Makefile > @@ -191,7 +191,7 @@ CONFS+=3D ftpd > .endif > > .if ${MK_GSSAPI} !=3D "no" > -CONFGROUPS+=3D gssd > +CONFGROUPS+=3D GSSD > GSSD=3D gssd > GSSDPACKAGE=3D kerberos > .endif > It looks like that does the trick. Thanks! Kristof From owner-dev-commits-src-all@freebsd.org Mon Sep 27 12:45:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83B736B53D3; Mon, 27 Sep 2021 12:45:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ2Rw3Mfwz3FP4; Mon, 27 Sep 2021 12:45:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 3A7921E95; Mon, 27 Sep 2021 12:45:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 9D50246A96; Mon, 27 Sep 2021 14:45:46 +0200 (CEST) From: Kristof Provost To: Andrew Turner Cc: Alexander Motin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 695323ae88c7 - main - acpi_cpu: Fix panic if some CPU devices are disabled. Date: Mon, 27 Sep 2021 14:45:45 +0200 X-Mailer: MailMate (1.14r5818) Message-ID: <8AEE4F18-6D9E-4FE5-A5B4-C245FE693C07@FreeBSD.org> In-Reply-To: References: <202109252101.18PL1W4I003365@gitrepo.freebsd.org> <1D490397-E56E-4D39-A4CC-BDF0CC25E91D@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 12:45:48 -0000 On 27 Sep 2021, at 13:48, Andrew Turner wrote: >> On 27 Sep 2021, at 09:16, Kristof Provost wrote: >> >> On 25 Sep 2021, at 23:01, Alexander Motin wrote: >> >> The branch main has been updated by mav: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D695323ae88c71776e131940= ed7dedd25365e932f >> commit 695323ae88c71776e131940ed7dedd25365e932f >> Author: Alexander Motin >> AuthorDate: 2021-09-25 20:54:28 +0000 >> Commit: Alexander Motin >> CommitDate: 2021-09-25 21:01:28 +0000 >> >> acpi_cpu: Fix panic if some CPU devices are disabled. >> >> While there, remove couple unneeded global variables. >> --- >> sys/dev/acpica/acpi_cpu.c | 66 +++++++++++++++++++++------------------= -------- >> 1 file changed, 29 insertions(+), 37 deletions(-) >> >> diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c >> index ab4ffda7a02e..0577b6eac8b7 100644 >> --- a/sys/dev/acpica/acpi_cpu.c >> +++ b/sys/dev/acpica/acpi_cpu.c >> @@ -154,8 +154,6 @@ static struct sysctl_oid *cpu_sysctl_tree; >> static int cpu_cx_generic; >> static int cpu_cx_lowest_lim; >> >> -static device_t *cpu_devices; >> -static int cpu_ndevices; >> static struct acpi_cpu_softc **cpu_softc; >> ACPI_SERIAL_DECL(cpu, "ACPI CPU"); >> >> @@ -443,26 +441,21 @@ acpi_cpu_attach(device_t dev) >> static void >> acpi_cpu_postattach(void *unused __unused) >> { >> >> I=E2=80=99m seeing this panic on a bhyve VM running an up-to-date main= kernel: >> >> Fatal trap 12: page fault while in kernel mode >> cpuid =3D 2; apic id =3D 02 >> fault virtual address =3D 0x0 >> fault code =3D supervisor read data, page not present >> instruction pointer =3D 0x20:0xffffffff804f643c >> stack pointer =3D 0x28:0xffffffff8358bf20 >> frame pointer =3D 0x28:0xffffffff8358bfa0 >> code segment =3D base 0x0, limit 0xfffff, type 0x1b >> =3D DPL 0, pres 1, long 1, def32 0, gran 1 >> processor eflags =3D interrupt enabled, resume, IOPL =3D 0 >> current process =3D 0 (swapper) >> trap number =3D 12 >> panic: page fault >> cpuid =3D 2 >> time =3D 1 >> KDB: stack backtrace: >> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff= 8358bbc0 >> vpanic() at vpanic+0x187/frame 0xffffffff8358bc20 >> panic() at panic+0x43/frame 0xffffffff8358bc80 >> trap_fatal() at trap_fatal+0x387/frame 0xffffffff8358bce0 >> trap_pfault() at trap_pfault+0x99/frame 0xffffffff8358bd40 >> trap() at trap+0x2a7/frame 0xffffffff8358be50 >> calltrap() at calltrap+0x8/frame 0xffffffff8358be50 >> --- trap 0xc, rip =3D 0xffffffff804f643c, rsp =3D 0xffffffff8358bf20, = rbp =3D 0xffffffff8358bfa0 --- >> acpi_cpu_postattach() at acpi_cpu_postattach+0x5c/frame 0xffffffff8358= bfa0 >> mi_startup() at mi_startup+0x1f0/frame 0xffffffff8358bff0 >> btext() at btext+0x22 >> KDB: enter: panic >> [ thread pid 0 tid 100000 ] >> Stopped at kdb_enter+0x37: movq $0,0x1274f0e(%rip) >> db> >> I=E2=80=99ve not done any digging, but given that it seems to die in a= cpi_cpu_postattach() and you touched that last =E2=80=A6, well you know h= ow that goes. >> > I hit what looks to be the same issue on arm64. In my case it was a NUL= L pointer dereference on cpu_softc because acpi_cpu_probe never called ma= lloc as I=E2=80=99m booting using FDT. > > I=E2=80=99ve pushed a fix for this in 4e50efb1. > And that fixed my panic too. Thanks! Kristof From owner-dev-commits-src-all@freebsd.org Mon Sep 27 13:43:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 635686B5FC4; Mon, 27 Sep 2021 13:43:33 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ3kY1mPfz3JyT; Mon, 27 Sep 2021 13:43:33 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qk1-x729.google.com with SMTP id m7so19908274qke.8; Mon, 27 Sep 2021 06:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VVvGAuMM4/FbmoMcHHjmerR2sZPD6F55MrxGqHtaGyI=; b=Yds6j2YwRP8osfmXLbXnkaIvmKjRVbLuNf8c0JTqNk48hCo3cFiAQNgXKpREL+nB0G 0K+VR2ISPpss1mZijKs74xYaMEvlj5mOVgn4e6OOunQ9ocbchOF2BKH9fAQYjkp10Yz8 KvEft7u+6DbpFtg3aoVnSIO/0LY0nQjWLwQ4eIwqb0LZGKDfwt9XqStc5BsIU+mELirv b9uiwsBC0YB7PkFHBnRJoxZYZ97J1EbEgAzHgEnstze8duW7QNmWJWNzXzFV7Ju7GhGh Eqlo/Hn98rLDqahlQdGGjVfYM7ru2PCTZUmF3X6lUxWzG9d0ga1xzuVTJp9gg3k3pXU4 ibhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VVvGAuMM4/FbmoMcHHjmerR2sZPD6F55MrxGqHtaGyI=; b=UdHsBZRtoTTyLER1DCPfeaIO9kfQyUt4JX79H768TM9QJ1Sm2fMXV9I+sHiYsQiR9l itb8FrLyg2UDZoo/cvtO3Yqg3tpTdA8630I4Qdwc7tY01tNMd19FjYO8KeQVasUlrVd8 aSr7VhHnPmUHujMpTIc+g6mUsCQTGUDQJGCfKLbw0lu2yp4RHmrYSoMpxPAEvU65Qftq 7DBdAGvMfSIkgQKrQmQ0bSVT0MIs3Uqc/G/kkpD5V8kBIuQ7lb2+LHsAmtNIdbp64NMI VOAijTi50mgNWD1QDIoPZcA0DWVNew2r0lAOKT0xgc7n1opWfFu9jni0JpqVI1s/pB6y bpQA== X-Gm-Message-State: AOAM532cpehFeR+mjVkVTwtopfiWsofH9/kRvHYiWqo7KfVCAsrpDoOg I9Ge1vQ9ITiJytOTq6wg1Z6LoayOXOg= X-Google-Smtp-Source: ABdhPJx3FGydBiJCkfLLyUALKZue69bCmfxzyN0E9t9rPfsRnWy8lD4m8qzaDMaGmygSI5zYJ3uueQ== X-Received: by 2002:a37:44ca:: with SMTP id r193mr20921qka.190.1632750212271; Mon, 27 Sep 2021 06:43:32 -0700 (PDT) Received: from spectre.mavhome.dp.ua (104-55-12-234.lightspeed.knvltn.sbcglobal.net. [104.55.12.234]) by smtp.gmail.com with ESMTPSA id i67sm12413133qkd.90.2021.09.27.06.43.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 06:43:31 -0700 (PDT) Sender: Alexander Motin Subject: Re: git: 695323ae88c7 - main - acpi_cpu: Fix panic if some CPU devices are disabled. To: Andrew Turner , Kristof Provost Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202109252101.18PL1W4I003365@gitrepo.freebsd.org> <1D490397-E56E-4D39-A4CC-BDF0CC25E91D@FreeBSD.org> From: Alexander Motin Message-ID: Date: Mon, 27 Sep 2021 09:43:30 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HJ3kY1mPfz3JyT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 13:43:33 -0000 On 27.09.2021 07:48, Andrew Turner wrote: >> On 27 Sep 2021, at 09:16, Kristof Provost > I’ve not done any digging, but given that it seems to die in >> acpi_cpu_postattach() and you touched that last …, well you know how >> that goes. >> > I hit what looks to be the same issue on arm64. In my case it was a NULL > pointer dereference on cpu_softc because acpi_cpu_probe never called > malloc as I’m booting using FDT. > > I’ve pushed a fix for this in 4e50efb1. Thank you, Andrew! -- Alexander Motin From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79F0E6B66E3; Mon, 27 Sep 2021 14:08: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 4HJ4HS2LgJz3LMh; Mon, 27 Sep 2021 14:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3055D124CE; Mon, 27 Sep 2021 14:08: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 18RE8alx082339; Mon, 27 Sep 2021 14:08:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8aCQ082338; Mon, 27 Sep 2021 14:08:36 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:36 GMT Message-Id: <202109271408.18RE8aCQ082338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 02a5ee49cb70 - stable/13 - Clean up the arm64 fork_trampoline MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 02a5ee49cb70eb0819751fdaa8a40e76ed93b6aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:36 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=02a5ee49cb70eb0819751fdaa8a40e76ed93b6aa commit 02a5ee49cb70eb0819751fdaa8a40e76ed93b6aa Author: Andrew Turner AuthorDate: 2021-08-09 10:03:57 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 08:36:37 +0000 Clean up the arm64 fork_trampoline When exiting to userspace the code is similar to the restore_registers macro in exception.S. Rework it to remove most of the non-style differences. Sponsored by: The FreeBSD Foundation (cherry picked from commit 1791a628a13e0d6f69bc0b52934b05f09c986507) --- sys/arm64/arm64/swtch.S | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index ee64f89502cc..28b6acb430fd 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -213,7 +213,21 @@ ENTRY(fork_trampoline) mov fp, #0 /* Stack traceback stops here. */ bl _C_LABEL(fork_exit) - /* Restore the registers other than x0 and x1 */ + /* + * Disable interrupts to avoid + * overwriting spsr_el1 and sp_el0 by an IRQ exception. + */ + msr daifset, #10 + + /* Restore sp, lr, elr, and spsr */ + ldp x18, lr, [sp, #TF_SP] + ldp x10, x11, [sp, #TF_ELR] + msr sp_el0, x18 + msr spsr_el1, x11 + msr elr_el1, x10 + + /* Restore the CPU registers */ + ldp x0, x1, [sp, #TF_X + 0 * 8] ldp x2, x3, [sp, #TF_X + 2 * 8] ldp x4, x5, [sp, #TF_X + 4 * 8] ldp x6, x7, [sp, #TF_X + 6 * 8] @@ -222,33 +236,13 @@ ENTRY(fork_trampoline) ldp x12, x13, [sp, #TF_X + 12 * 8] ldp x14, x15, [sp, #TF_X + 14 * 8] ldp x16, x17, [sp, #TF_X + 16 * 8] - ldr x19, [sp, #TF_X + 19 * 8] + ldp x18, x19, [sp, #TF_X + 18 * 8] ldp x20, x21, [sp, #TF_X + 20 * 8] ldp x22, x23, [sp, #TF_X + 22 * 8] ldp x24, x25, [sp, #TF_X + 24 * 8] ldp x26, x27, [sp, #TF_X + 26 * 8] ldp x28, x29, [sp, #TF_X + 28 * 8] - /* - * Disable interrupts to avoid - * overwriting spsr_el1 and sp_el0 by an IRQ exception. - */ - msr daifset, #2 - - /* Restore sp and lr */ - ldp x0, x1, [sp, #TF_SP] - msr sp_el0, x0 - mov lr, x1 - - /* Restore elr and spsr */ - ldp x0, x1, [sp, #TF_ELR] - msr elr_el1, x0 - msr spsr_el1, x1 - - /* Finally x0 and x1 */ - ldp x0, x1, [sp, #TF_X + 0 * 8] - ldr x18, [sp, #TF_X + 18 * 8] - /* * No need for interrupts reenabling since PSR * will be set to the desired value anyway. From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECE796B67CB; Mon, 27 Sep 2021 14:08: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 4HJ4HT3Jtpz3LDN; Mon, 27 Sep 2021 14:08:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5280E124CF; Mon, 27 Sep 2021 14:08: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 18RE8bTv082363; Mon, 27 Sep 2021 14:08:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8bGB082362; Mon, 27 Sep 2021 14:08:37 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:37 GMT Message-Id: <202109271408.18RE8bGB082362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 7cddaf8e68b6 - stable/13 - Add macros for the arm64 daifset/daifclr flags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7cddaf8e68b6d1037e8a40ce1667346ce20e0e71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:38 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7cddaf8e68b6d1037e8a40ce1667346ce20e0e71 commit 7cddaf8e68b6d1037e8a40ce1667346ce20e0e71 Author: Andrew Turner AuthorDate: 2021-08-03 13:18:07 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 08:36:38 +0000 Add macros for the arm64 daifset/daifclr flags Sponsored by: The FreeBSD Foundation (cherry picked from commit 337eb2ab9549b230926ab52857d1ef86ba121366) --- sys/arm64/arm64/exception.S | 6 +++--- sys/arm64/arm64/locore.S | 2 +- sys/arm64/arm64/swtch.S | 3 ++- sys/arm64/include/armreg.h | 9 +++++++++ sys/arm64/include/cpufunc.h | 8 ++++---- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index 2af32a185748..52586d9c225e 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); ldr x0, [x18, #(PC_CURTHREAD)] bl dbg_monitor_enter - msr daifclr, #8 /* Enable the debug exception */ + msr daifclr, #DAIF_D /* Enable the debug exception */ .endif /* * For EL1, debug exceptions are conditionally unmasked in @@ -91,7 +91,7 @@ __FBSDID("$FreeBSD$"); * interrupt exception handler. For EL0 exceptions, do_ast already * did this. */ - msr daifset, #10 + msr daifset, #(DAIF_D | DAIF_INTR) .endif .if \el == 0 ldr x0, [x18, #PC_CURTHREAD] @@ -149,7 +149,7 @@ __FBSDID("$FreeBSD$"); bic x19, x19, #PSR_I 1: /* Disable interrupts */ - msr daifset, #10 + msr daifset, #(DAIF_D | DAIF_INTR) /* Read the current thread flags */ ldr x1, [x18, #PC_CURTHREAD] /* Load curthread */ diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index 50b064ab391a..ae844c8ff473 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -168,7 +168,7 @@ END(_start) */ ENTRY(mpentry) /* Disable interrupts */ - msr daifset, #2 + msr daifset, #DAIF_INTR /* Drop to EL1 */ bl drop_to_el1 diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index 28b6acb430fd..266a5343d7cb 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -34,6 +34,7 @@ #include "opt_sched.h" #include +#include __FBSDID("$FreeBSD$"); @@ -217,7 +218,7 @@ ENTRY(fork_trampoline) * Disable interrupts to avoid * overwriting spsr_el1 and sp_el0 by an IRQ exception. */ - msr daifset, #10 + msr daifset, #(DAIF_D | DAIF_INTR) /* Restore sp, lr, elr, and spsr */ ldp x18, lr, [sp, #TF_SP] diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 8507e02592b8..b6acec3144fe 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -130,6 +130,15 @@ #define DAIF_I_MASKED (1 << 7) #define DAIF_F_MASKED (1 << 6) +/* DAIFSet/DAIFClear */ +#define DAIF_D (1 << 3) +#define DAIF_A (1 << 2) +#define DAIF_I (1 << 1) +#define DAIF_F (1 << 0) +#define DAIF_ALL (DAIF_D | DAIF_A | DAIF_I | DAIF_F) +#define DAIF_INTR (DAIF_I) /* All exceptions that pass */ + /* through the intr framework */ + /* DCZID_EL0 - Data Cache Zero ID register */ #define DCZID_DZP (1 << 4) /* DC ZVA prohibited if non-0 */ #define DCZID_BS_SHIFT 0 diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h index 5400f253f9a2..7f13972e838b 100644 --- a/sys/arm64/include/cpufunc.h +++ b/sys/arm64/include/cpufunc.h @@ -106,7 +106,7 @@ dbg_disable(void) __asm __volatile( "mrs %x0, daif \n" - "msr daifset, #8 \n" + "msr daifset, #(" __XSTRING(DAIF_D) ") \n" : "=&r" (ret)); return (ret); @@ -116,7 +116,7 @@ static __inline void dbg_enable(void) { - __asm __volatile("msr daifclr, #8"); + __asm __volatile("msr daifclr, #(" __XSTRING(DAIF_D) ")"); } static __inline register_t @@ -127,7 +127,7 @@ intr_disable(void) __asm __volatile( "mrs %x0, daif \n" - "msr daifset, #2 \n" + "msr daifset, #(" __XSTRING(DAIF_INTR) ") \n" : "=&r" (ret)); return (ret); @@ -144,7 +144,7 @@ static __inline void intr_enable(void) { - __asm __volatile("msr daifclr, #2"); + __asm __volatile("msr daifclr, #(" __XSTRING(DAIF_INTR) ")"); } static __inline register_t From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C27F26B6561; Mon, 27 Sep 2021 14:08: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 4HJ4HV4YcNz3L0L; Mon, 27 Sep 2021 14:08:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 793BA124D0; Mon, 27 Sep 2021 14:08: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 18RE8crw082387; Mon, 27 Sep 2021 14:08:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8cfL082386; Mon, 27 Sep 2021 14:08:38 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:38 GMT Message-Id: <202109271408.18RE8cfL082386@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: b54a69251823 - stable/13 - Remove an unused arm64 panic string MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b54a69251823cb17d43e154ba1cd28d5d8d7fe68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:38 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b54a69251823cb17d43e154ba1cd28d5d8d7fe68 commit b54a69251823cb17d43e154ba1cd28d5d8d7fe68 Author: Andrew Turner AuthorDate: 2021-08-08 21:28:25 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 08:36:38 +0000 Remove an unused arm64 panic string This was added early in the development of the arm64 port when cpu_switch was just a stub. It should have been removed when cpu_switch was implemented, however this didn't seem to be the case, and the '%p' was added. As this hasn't been needed in 7 years we can remove it. Sponsored by: The FreeBSD Foundation (cherry picked from commit 267d55fa2a74a6e04eb760e4cbb07c7f66729ac9) --- sys/arm64/arm64/swtch.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index 266a5343d7cb..5d0cf1c59465 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -203,8 +203,6 @@ ENTRY(cpu_switch) str xzr, [x4, #PCB_REGS + 18 * 8] ret -.Lcpu_switch_panic_str: - .asciz "cpu_switch: %p\0" END(cpu_switch) ENTRY(fork_trampoline) From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31C5C6B6A28; Mon, 27 Sep 2021 14:08: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 4HJ4HZ0SDjz3LB8; Mon, 27 Sep 2021 14:08:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF225124D1; Mon, 27 Sep 2021 14:08: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 18RE8fnX082466; Mon, 27 Sep 2021 14:08:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8fqd082465; Mon, 27 Sep 2021 14:08:41 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:41 GMT Message-Id: <202109271408.18RE8fqd082465@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 9e93fb11a7fa - stable/13 - Sort the arm64 cpu_implementers list by name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9e93fb11a7faf914c1a18d556d002c3166ca9f35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:42 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9e93fb11a7faf914c1a18d556d002c3166ca9f35 commit 9e93fb11a7faf914c1a18d556d002c3166ca9f35 Author: Andrew Turner AuthorDate: 2021-08-11 15:29:09 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 08:36:38 +0000 Sort the arm64 cpu_implementers list by name We perform a linear search, so make it easier to add new entries in the correct place. Sponsored by: The FreeBSD Foundation (cherry picked from commit 29b25b13c777a682e33edc9e2d05e87339b03cc3) --- sys/arm64/arm64/identcpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 37330a8f0e3f..581e16ee82f6 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -220,17 +220,17 @@ static const struct cpu_parts cpu_parts_none[] = { * Implementers table. */ const struct cpu_implementers cpu_implementers[] = { + { CPU_IMPL_APM, "APM", cpu_parts_apm }, { CPU_IMPL_ARM, "ARM", cpu_parts_arm }, { CPU_IMPL_BROADCOM, "Broadcom", cpu_parts_none }, { CPU_IMPL_CAVIUM, "Cavium", cpu_parts_cavium }, { CPU_IMPL_DEC, "DEC", cpu_parts_none }, - { CPU_IMPL_INFINEON, "IFX", cpu_parts_none }, { CPU_IMPL_FREESCALE, "Freescale", cpu_parts_none }, + { CPU_IMPL_INFINEON, "IFX", cpu_parts_none }, + { CPU_IMPL_INTEL, "Intel", cpu_parts_none }, + { CPU_IMPL_MARVELL, "Marvell", cpu_parts_none }, { CPU_IMPL_NVIDIA, "NVIDIA", cpu_parts_none }, - { CPU_IMPL_APM, "APM", cpu_parts_apm }, { CPU_IMPL_QUALCOMM, "Qualcomm", cpu_parts_none }, - { CPU_IMPL_MARVELL, "Marvell", cpu_parts_none }, - { CPU_IMPL_INTEL, "Intel", cpu_parts_none }, CPU_IMPLEMENTER_NONE, }; From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DD8A6B67D6; Mon, 27 Sep 2021 14:08: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 4HJ4Hb1Ldkz3LTh; Mon, 27 Sep 2021 14:08:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DF9612705; Mon, 27 Sep 2021 14:08: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 18RE8g7c082490; Mon, 27 Sep 2021 14:08:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8gh9082489; Mon, 27 Sep 2021 14:08:42 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:42 GMT Message-Id: <202109271408.18RE8gh9082489@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 935bb48b953d - stable/13 - Add the Apple arm64 implementer ID MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 935bb48b953d2106779a44bde84f914948ac5c7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:43 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=935bb48b953d2106779a44bde84f914948ac5c7b commit 935bb48b953d2106779a44bde84f914948ac5c7b Author: Andrew Turner AuthorDate: 2021-08-11 15:30:44 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 08:36:38 +0000 Add the Apple arm64 implementer ID Sponsored by: The FreeBSD Foundation (cherry picked from commit a7fcda1b8c21a47ac8cdd2e7cfae298d67467e3b) --- sys/arm64/arm64/identcpu.c | 1 + sys/arm64/include/cpu.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 581e16ee82f6..dabfe6f99d3a 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -220,6 +220,7 @@ static const struct cpu_parts cpu_parts_none[] = { * Implementers table. */ const struct cpu_implementers cpu_implementers[] = { + { CPU_IMPL_APPLE, "Apple", cpu_parts_none }, { CPU_IMPL_APM, "APM", cpu_parts_apm }, { CPU_IMPL_ARM, "ARM", cpu_parts_arm }, { CPU_IMPL_BROADCOM, "Broadcom", cpu_parts_none }, diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h index d58cf6f113c6..0b1aa2d93b03 100644 --- a/sys/arm64/include/cpu.h +++ b/sys/arm64/include/cpu.h @@ -77,6 +77,7 @@ #define CPU_IMPL_APM 0x50 #define CPU_IMPL_QUALCOMM 0x51 #define CPU_IMPL_MARVELL 0x56 +#define CPU_IMPL_APPLE 0x61 #define CPU_IMPL_INTEL 0x69 /* ARM Part numbers */ From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 595306B65C6; Mon, 27 Sep 2021 14:08: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 4HJ4HY1NXjz3LKF; Mon, 27 Sep 2021 14:08:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEE6012590; Mon, 27 Sep 2021 14:08: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 18RE8eej082441; Mon, 27 Sep 2021 14:08:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8egD082440; Mon, 27 Sep 2021 14:08:40 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:40 GMT Message-Id: <202109271408.18RE8egD082440@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 53192f33198a - stable/13 - Read the arm64 midr register earlier MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 53192f33198ac8c225579934f258db115ae7139a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:41 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=53192f33198ac8c225579934f258db115ae7139a commit 53192f33198ac8c225579934f258db115ae7139a Author: Andrew Turner AuthorDate: 2021-08-11 15:01:25 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 08:36:38 +0000 Read the arm64 midr register earlier We use the midr_el1 register to decode which CPU type we are booting from. Read it on the secondary CPUs before waiting for the boot CPU to release us as it will need to use it before the release. Sponsored by: The FreeBSD Foundation (cherry picked from commit 6b22840ed0e8f9ceb34465987b8469a43ebb4582) --- sys/arm64/arm64/mp_machdep.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index 3b1a8cc89cab..547bd576362e 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -239,6 +239,7 @@ init_secondary(uint64_t cpu) * We need this before signalling the CPU is ready to * let the boot CPU use the results. */ + pcpup->pc_midr = get_midr(); identify_cpu(cpu); /* Ensure the stores in identify_cpu have completed */ @@ -249,8 +250,6 @@ init_secondary(uint64_t cpu) while (!atomic_load_int(&aps_ready)) __asm __volatile("wfe"); - pcpup->pc_midr = get_midr(); - /* Initialize curthread */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); pcpup->pc_curthread = pcpup->pc_idlethread; From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B68C6B689E; Mon, 27 Sep 2021 14:08: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 4HJ4Hf4jWHz3LKZ; Mon, 27 Sep 2021 14:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7025B126C6; Mon, 27 Sep 2021 14:08: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 18RE8kmX082562; Mon, 27 Sep 2021 14:08:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8klu082561; Mon, 27 Sep 2021 14:08:46 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:46 GMT Message-Id: <202109271408.18RE8klu082561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: a15507a1d5f1 - stable/13 - Restrict spsr updated in the arm64 set_regs* MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a15507a1d5f1f5837cc7b41f2259543a7d429a61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:47 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=a15507a1d5f1f5837cc7b41f2259543a7d429a61 commit a15507a1d5f1f5837cc7b41f2259543a7d429a61 Author: Andrew Turner AuthorDate: 2021-09-13 15:24:34 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 09:55:27 +0000 Restrict spsr updated in the arm64 set_regs* When using ptrace(2) on arm64 to set registers in a 32-bit program we need to take care to only set some of the fields. Follow the existing arm64 path and only let the user set the flags fields. This is also the case in the arm kernel so fixes a change in behaviour between the two. While here update set_regs to only set spsr and elr once. Sponsored by: The FreeBSD Foundation (cherry picked from commit b029ef7fe618c6fa0482958422cc362905c15376) --- sys/arm64/arm64/machdep.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 1fbe3fbebb6f..eedde49e5de9 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -254,9 +254,7 @@ set_regs(struct thread *td, struct reg *regs) frame = td->td_frame; frame->tf_sp = regs->sp; frame->tf_lr = regs->lr; - frame->tf_elr = regs->elr; frame->tf_spsr &= ~PSR_FLAGS; - frame->tf_spsr |= regs->spsr & PSR_FLAGS; memcpy(frame->tf_x, regs->x, sizeof(frame->tf_x)); @@ -268,9 +266,13 @@ set_regs(struct thread *td, struct reg *regs) * it put it. */ frame->tf_elr = regs->x[15]; - frame->tf_spsr = regs->x[16] & PSR_FLAGS; - } + frame->tf_spsr |= regs->x[16] & PSR_FLAGS; + } else #endif + { + frame->tf_elr = regs->elr; + frame->tf_spsr |= regs->spsr & PSR_FLAGS; + } return (0); } @@ -490,7 +492,8 @@ set_regs32(struct thread *td, struct reg32 *regs) tf->tf_x[13] = regs->r_sp; tf->tf_x[14] = regs->r_lr; tf->tf_elr = regs->r_pc; - tf->tf_spsr = regs->r_cpsr; + tf->tf_spsr &= ~PSR_FLAGS; + tf->tf_spsr |= regs->r_cpsr & PSR_FLAGS; return (0); } From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E014C6B6A1B; Mon, 27 Sep 2021 14:08: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 4HJ4HW5bGgz3LMw; Mon, 27 Sep 2021 14:08:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A69A12704; Mon, 27 Sep 2021 14:08: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 18RE8drM082411; Mon, 27 Sep 2021 14:08:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8dq7082410; Mon, 27 Sep 2021 14:08:39 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:39 GMT Message-Id: <202109271408.18RE8dq7082410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 273fef1f9b0f - stable/13 - Only use byte register access in legacy virtio pci MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 273fef1f9b0f60ef37f85a6067299a07bca2ec82 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:40 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=273fef1f9b0f60ef37f85a6067299a07bca2ec82 commit 273fef1f9b0f60ef37f85a6067299a07bca2ec82 Author: Andrew Turner AuthorDate: 2021-08-05 14:36:07 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 08:36:38 +0000 Only use byte register access in legacy virtio pci Some simulators don't implement arbitrary sized memory access to the virtio PCI registers. Follow Linux and use single byte accesses to read and write to these registers. Reviewed by: bryanv, emaste (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31424 (cherry picked from commit 89c085b8993d7d1e7b137f99fa6df94c37c3a68a) --- sys/dev/virtio/pci/virtio_pci_legacy.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index a17dd22aa953..2cebee720975 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -506,22 +506,14 @@ vtpci_legacy_read_dev_config(device_t dev, bus_size_t offset, struct vtpci_legacy_softc *sc; bus_size_t off; uint8_t *d; - int size; + int i; sc = device_get_softc(dev); off = VIRTIO_PCI_LEGACY_CONFIG(sc) + offset; - for (d = dst; length > 0; d += size, off += size, length -= size) { - if (length >= 4) { - size = 4; - *(uint32_t *)d = vtpci_legacy_read_config_4(sc, off); - } else if (length >= 2) { - size = 2; - *(uint16_t *)d = vtpci_legacy_read_config_2(sc, off); - } else { - size = 1; - *d = vtpci_legacy_read_config_1(sc, off); - } + d = dst; + for (i = 0; i < length; i++) { + d[i] = vtpci_legacy_read_config_1(sc, off + i); } } @@ -532,22 +524,14 @@ vtpci_legacy_write_dev_config(device_t dev, bus_size_t offset, struct vtpci_legacy_softc *sc; bus_size_t off; uint8_t *s; - int size; + int i; sc = device_get_softc(dev); off = VIRTIO_PCI_LEGACY_CONFIG(sc) + offset; - for (s = src; length > 0; s += size, off += size, length -= size) { - if (length >= 4) { - size = 4; - vtpci_legacy_write_config_4(sc, off, *(uint32_t *)s); - } else if (length >= 2) { - size = 2; - vtpci_legacy_write_config_2(sc, off, *(uint16_t *)s); - } else { - size = 1; - vtpci_legacy_write_config_1(sc, off, *s); - } + s = src; + for (i = 0; i < length; i++) { + vtpci_legacy_write_config_1(sc, off + i, s[i]); } } From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82BCB6B689A; Mon, 27 Sep 2021 14:08: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 4HJ4Hc2kRzz3LF2; Mon, 27 Sep 2021 14:08:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33BFA12591; Mon, 27 Sep 2021 14:08: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 18RE8i2m082514; Mon, 27 Sep 2021 14:08:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8icT082513; Mon, 27 Sep 2021 14:08:44 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:44 GMT Message-Id: <202109271408.18RE8icT082513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 9a83fcad145c - stable/13 - Enable arm64 SError exceptions in the kernel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9a83fcad145c41d339e1ec07b405c54ae171341d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:44 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9a83fcad145c41d339e1ec07b405c54ae171341d commit 9a83fcad145c41d339e1ec07b405c54ae171341d Author: Andrew Turner AuthorDate: 2021-08-09 16:30:44 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 08:36:38 +0000 Enable arm64 SError exceptions in the kernel These are needed to signal to the kernel when a Reliability, Availability, and Serviceability (RAS) exception has triggered. Reviewed by: mhorne Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31477 (cherry picked from commit 17b6ee96138220a164d632f0be69d3df77bdd61a) --- sys/arm64/arm64/exception.S | 24 ++++++++++++++---------- sys/arm64/arm64/machdep.c | 6 ++++++ sys/arm64/arm64/vm_machdep.c | 4 ++-- sys/arm64/include/armreg.h | 8 ++------ sys/arm64/include/cpufunc.h | 7 +++++++ 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index 52586d9c225e..4fcf2ea6ece6 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -76,23 +76,25 @@ __FBSDID("$FreeBSD$"); ldr x0, [x18, #(PC_CURTHREAD)] bl dbg_monitor_enter - msr daifclr, #DAIF_D /* Enable the debug exception */ -.endif + + /* Unmask debug and SError exceptions */ + msr daifclr, #(DAIF_D | DAIF_A) +.else /* + * Unmask debug and SError exceptions. * For EL1, debug exceptions are conditionally unmasked in * do_el1h_sync(). */ + msr daifclr, #(DAIF_A) +.endif .endm .macro restore_registers el -.if \el == 1 /* - * Disable interrupts and debug exceptions, x18 may change in the - * interrupt exception handler. For EL0 exceptions, do_ast already - * did this. + * Mask all exceptions, x18 may change in the interrupt exception + * handler. */ - msr daifset, #(DAIF_D | DAIF_INTR) -.endif + msr daifset, #(DAIF_ALL) .if \el == 0 ldr x0, [x18, #PC_CURTHREAD] mov x1, sp @@ -148,8 +150,10 @@ __FBSDID("$FreeBSD$"); /* Make sure the IRQs are enabled before calling ast() */ bic x19, x19, #PSR_I 1: - /* Disable interrupts */ - msr daifset, #(DAIF_D | DAIF_INTR) + /* + * Mask interrupts while checking the ast pending flag + */ + msr daifset, #(DAIF_INTR) /* Read the current thread flags */ ldr x1, [x18, #PC_CURTHREAD] /* Load curthread */ diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index a2db5e2b67af..1fbe3fbebb6f 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -931,6 +931,12 @@ init_proc0(vm_offset_t kstack) thread0.td_pcb->pcb_vfpcpu = UINT_MAX; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; + + /* + * Unmask SError exceptions. They are used to signal a RAS failure, + * or other hardware error. + */ + serror_enable(); } typedef struct { diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index b2ab8bb463b0..a8690eeb67da 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -114,7 +114,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Setup to release spin count in fork_exit(). */ td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_daif = td1->td_md.md_saved_daif & ~DAIF_I_MASKED; + td2->td_md.md_saved_daif = PSR_DAIF_DEFAULT; } void @@ -186,7 +186,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Setup to release spin count in fork_exit(). */ td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_daif = td0->td_md.md_saved_daif & ~DAIF_I_MASKED; + td->td_md.md_saved_daif = PSR_DAIF_DEFAULT; } /* diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index b6acec3144fe..0057a353de66 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -124,12 +124,6 @@ #define CTR_ILINE_VAL(reg) ((reg) & CTR_ILINE_MASK) #define CTR_ILINE_SIZE(reg) (4 << (CTR_ILINE_VAL(reg) >> CTR_ILINE_SHIFT)) -/* DAIF - Interrupt Mask Bits */ -#define DAIF_D_MASKED (1 << 9) -#define DAIF_A_MASKED (1 << 8) -#define DAIF_I_MASKED (1 << 7) -#define DAIF_F_MASKED (1 << 6) - /* DAIFSet/DAIFClear */ #define DAIF_D (1 << 3) #define DAIF_A (1 << 2) @@ -1077,6 +1071,8 @@ #define PSR_A 0x00000100 #define PSR_D 0x00000200 #define PSR_DAIF (PSR_D | PSR_A | PSR_I | PSR_F) +/* The default DAIF mask. These bits are valid in spsr_el1 and daif */ +#define PSR_DAIF_DEFAULT (PSR_F) #define PSR_IL 0x00100000 #define PSR_SS 0x00200000 #define PSR_V 0x10000000 diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h index 7f13972e838b..94af62380de3 100644 --- a/sys/arm64/include/cpufunc.h +++ b/sys/arm64/include/cpufunc.h @@ -147,6 +147,13 @@ intr_enable(void) __asm __volatile("msr daifclr, #(" __XSTRING(DAIF_INTR) ")"); } +static __inline void +serror_enable(void) +{ + + __asm __volatile("msr daifclr, #(" __XSTRING(DAIF_A) ")"); +} + static __inline register_t get_midr(void) { From owner-dev-commits-src-all@freebsd.org Mon Sep 27 14:08:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 034B16B676C; Mon, 27 Sep 2021 14:08: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 4HJ4Hd41ZLz3LGX; Mon, 27 Sep 2021 14:08:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E32D12706; Mon, 27 Sep 2021 14:08: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 18RE8jlT082538; Mon, 27 Sep 2021 14:08:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RE8jSp082537; Mon, 27 Sep 2021 14:08:45 GMT (envelope-from git) Date: Mon, 27 Sep 2021 14:08:45 GMT Message-Id: <202109271408.18RE8jSp082537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: c30a7ae6384d - stable/13 - Add arm64 ifunc support in static binaries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c30a7ae6384dcf5f998b6366b3b2189094c94cee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:46 -0000 The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c30a7ae6384dcf5f998b6366b3b2189094c94cee commit c30a7ae6384dcf5f998b6366b3b2189094c94cee Author: Andrew Turner AuthorDate: 2021-08-20 08:22:48 +0000 Commit: Andrew Turner CommitDate: 2021-09-27 09:55:16 +0000 Add arm64 ifunc support in static binaries Add support for the R_AARCH64_IRELATIVE relocation type in static binaries on arm64. This is based on the powerpc code, updating it to use the arm64 resolver ABI, and use the arm64 relocation type. Tested by: brd Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31641 (cherry picked from commit bc5304a006238115291e7568583632889dffbab9) --- lib/csu/aarch64/Makefile | 3 ++- lib/csu/aarch64/crt1_c.c | 4 +++- lib/csu/aarch64/reloc.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/lib/csu/aarch64/Makefile b/lib/csu/aarch64/Makefile index 666bf569b786..e4c9029fcacc 100644 --- a/lib/csu/aarch64/Makefile +++ b/lib/csu/aarch64/Makefile @@ -2,7 +2,8 @@ .PATH: ${.CURDIR:H}/common -CFLAGS+= -DCRT_IRELOC_SUPPRESS +CFLAGS+= -I${.CURDIR} +CFLAGS+= -DCRT_IRELOC_RELA CRT1OBJS+= crt1_s.o diff --git a/lib/csu/aarch64/crt1_c.c b/lib/csu/aarch64/crt1_c.c index d8c2156ffc21..9b3ffbff22d0 100644 --- a/lib/csu/aarch64/crt1_c.c +++ b/lib/csu/aarch64/crt1_c.c @@ -57,8 +57,10 @@ __start(int argc, char *argv[], char *env[], void (*cleanup)(void)) if (&_DYNAMIC != NULL) atexit(cleanup); - else + else { + process_irelocs(); _init_tls(); + } #ifdef GCRT atexit(_mcleanup); diff --git a/lib/csu/aarch64/reloc.c b/lib/csu/aarch64/reloc.c new file mode 100644 index 000000000000..f3dbf3e3b570 --- /dev/null +++ b/lib/csu/aarch64/reloc.c @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2019 Leandro Lupori + * Copyright (c) 2021 The FreeBSD Foundation + * + * Portions of this software were developed by Andrew Turner + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +static void +crt1_handle_rela(const Elf_Rela *r) +{ + typedef Elf_Addr (*ifunc_resolver_t)( + uint64_t, uint64_t, uint64_t, uint64_t, + uint64_t, uint64_t, uint64_t, uint64_t); + Elf_Addr *ptr, *where, target; + + switch (ELF_R_TYPE(r->r_info)) { + case R_AARCH64_IRELATIVE: + ptr = (Elf_Addr *)r->r_addend; + where = (Elf_Addr *)r->r_offset; + target = ((ifunc_resolver_t)ptr)(0, 0, 0, 0, 0, 0, 0, 0); + *where = target; + break; + } +} From owner-dev-commits-src-all@freebsd.org Mon Sep 27 16:29:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88C3F66B108; Mon, 27 Sep 2021 16:29: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 4HJ7QD3Pgrz3sH1; Mon, 27 Sep 2021 16:29:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 465711442F; Mon, 27 Sep 2021 16:29: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 18RGTee4074871; Mon, 27 Sep 2021 16:29:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RGTeOG074870; Mon, 27 Sep 2021 16:29:40 GMT (envelope-from git) Date: Mon, 27 Sep 2021 16:29:40 GMT Message-Id: <202109271629.18RGTeOG074870@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 450c3f8b3d25 - main - e1000: Re-arm link changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 450c3f8b3d259c7eb82488319aff45f1f6554aaf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 16:29:40 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=450c3f8b3d259c7eb82488319aff45f1f6554aaf commit 450c3f8b3d259c7eb82488319aff45f1f6554aaf Author: Kevin Bowling AuthorDate: 2021-09-27 16:17:48 +0000 Commit: Kevin Bowling CommitDate: 2021-09-27 16:25:58 +0000 e1000: Re-arm link changes A change to MSI-X link handler was somehow causing issues on MSI-based em(4) NICs. Revert the change based on user reports and testing. PR: 258551 Reported by: Franco Fichtner , t_uemura@macome.co.jp Reviewed by: markj, Franco Fichtner Tested by: t_uemura@macome.co.jp MFC after: 1 day --- sys/dev/e1000/if_em.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 47513c5d9e1e..34d7b8f5f87e 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1495,7 +1495,6 @@ em_msix_link(void *arg) { struct e1000_softc *sc = arg; u32 reg_icr; - bool notlink = false; ++sc->link_irq; MPASS(sc->hw.back != NULL); @@ -1506,17 +1505,14 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) em_handle_link(sc->ctx); - else - notlink = true; - /* Re-arm for other/spurious interrupts */ - if (notlink && sc->hw.mac.type >= igb_mac_min) { + /* Re-arm unconditionally */ + if (sc->hw.mac.type >= igb_mac_min) { E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); E1000_WRITE_REG(&sc->hw, E1000_EIMS, sc->link_mask); } else if (sc->hw.mac.type == e1000_82574) { - if (notlink) - E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC | - E1000_IMS_OTHER); + E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC | + E1000_IMS_OTHER); /* * Because we must read the ICR for this interrupt it may * clear other causes using autoclear, for this reason we @@ -1524,7 +1520,8 @@ em_msix_link(void *arg) */ if (reg_icr) E1000_WRITE_REG(&sc->hw, E1000_ICS, sc->ims); - } + } else + E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); return (FILTER_HANDLED); } @@ -1873,13 +1870,6 @@ em_if_update_admin_status(if_ctx_t ctx) if (hw->mac.type < em_mac_min) lem_smartspeed(sc); - else if (hw->mac.type >= igb_mac_min && - sc->intr_type == IFLIB_INTR_MSIX) { - E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); - E1000_WRITE_REG(&sc->hw, E1000_EIMS, sc->link_mask); - } else if (hw->mac.type == e1000_82574 && - sc->intr_type == IFLIB_INTR_MSIX) - E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_LSC | E1000_IMS_OTHER); } static void From owner-dev-commits-src-all@freebsd.org Mon Sep 27 16:32:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 084C266B7E4; Mon, 27 Sep 2021 16:32: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 4HJ7TT6mSPz3sZC; Mon, 27 Sep 2021 16:32:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C88811462E; Mon, 27 Sep 2021 16:32: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 18RGWT8h088098; Mon, 27 Sep 2021 16:32:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RGWTpP088097; Mon, 27 Sep 2021 16:32:29 GMT (envelope-from git) Date: Mon, 27 Sep 2021 16:32:29 GMT Message-Id: <202109271632.18RGWTpP088097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 860ee1792a6b - main - Fix gssd rc.d installation 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/main X-Git-Reftype: branch X-Git-Commit: 860ee1792a6b37cc531fcae94c2144c8d62e8fc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 16:32:30 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=860ee1792a6b37cc531fcae94c2144c8d62e8fc2 commit 860ee1792a6b37cc531fcae94c2144c8d62e8fc2 Author: Emmanuel Vadot AuthorDate: 2021-09-27 16:31:20 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-27 16:31:20 +0000 Fix gssd rc.d installation CONFGROUPS needs to be in CAPS Fixes: a30235a4c360 ("pkgbase: Create a FreeBSD-kerberos package") Reported by: kp --- libexec/rc/rc.d/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 2271c27b7f89..5981b3b03d17 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -191,7 +191,7 @@ CONFS+= ftpd .endif .if ${MK_GSSAPI} != "no" -CONFGROUPS+= gssd +CONFGROUPS+= GSSD GSSD= gssd GSSDPACKAGE= kerberos .endif From owner-dev-commits-src-all@freebsd.org Mon Sep 27 16:34:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B6B866B837 for ; Mon, 27 Sep 2021 16:34:36 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ7Ww2Lkkz3sXG for ; Mon, 27 Sep 2021 16:34:36 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb2c.google.com with SMTP id i84so25310740ybc.12 for ; Mon, 27 Sep 2021 09:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hxMHvxFZt9nZAp4eX+0WN7TJLO2HL7cZ5LjwJc+147s=; b=qEKZxwO2nir5rRE8A2a+OduA9e6yu97ulJmP/PJifO+SdgbkKHXK4B2gJOTfYY4/BO wMv1/ZGQad8A/ZtYN0JpGZIXKe+maGygBYU34nzMnQKsV9QoPjlu5Ne4TMnGnpWC1+Xk nygPKFv8jS5CJozHVSAO2ZIRvntPGqs9H+jd0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hxMHvxFZt9nZAp4eX+0WN7TJLO2HL7cZ5LjwJc+147s=; b=tPJ54fvY3a0hqkrt0XqfN8+dEF2yQO0RZRzY95jiKaRvo2tzLWcEJDwtIinCoWvlHP JaG/YCjzeTKqLscZmMy/PwJ5IknwJEYfN7Fpq7OkGp6oQnM1vHBVEyw8pxsyErVSiOo+ qN6H637hHQbVqWHK4+t9S84iX0JwmQg05XV7CV2pJF2UpIx7uAYy0MDoiHimny/HRKgG X7SFt7L61Hby1CAwkIO8LmLqQFGevMIfU2wpNrkZ5sEijL1q8LmDGkjLKhy0DMSoza7o KG1pXWAgIjCgr4VAl6UW8hMU6zLuI+yn9Zx8KNe/L6MBkSNE/0bzk0uwU9Bh5xtOoNIn 0d2g== X-Gm-Message-State: AOAM533Zq1EawqnlQG3sXeSh9+7c9sDcOmBJVfyVrWQIK4FnZBfiGtFx dQ6Nq7An9QaTEtdHXDGUIQMmu2UPzP0geWtPf8HjlmMV1td1rF7G X-Google-Smtp-Source: ABdhPJzfl9XqiwOckKN15TC7DGZxTpIzUYyxX5JIs7GiHs5WzADbx2+RgMI+kwPfgTZLOHjTiAYJQW0M0vfQQcni7ow= X-Received: by 2002:a5b:cd0:: with SMTP id e16mr816000ybr.533.1632760469862; Mon, 27 Sep 2021 09:34:29 -0700 (PDT) MIME-Version: 1.0 References: <202109271629.18RGTeOG074870@gitrepo.freebsd.org> In-Reply-To: <202109271629.18RGTeOG074870@gitrepo.freebsd.org> From: Kevin Bowling Date: Mon, 27 Sep 2021 09:34:18 -0700 Message-ID: Subject: Re: git: 450c3f8b3d25 - main - e1000: Re-arm link changes To: Kevin Bowling Cc: src-committers , "" , "dev-commits-src-main@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HJ7Ww2Lkkz3sXG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 16:34:36 -0000 On Mon, Sep 27, 2021 at 9:29 AM Kevin Bowling wrote: > > The branch main has been updated by kbowling (ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=450c3f8b3d259c7eb82488319aff45f1f6554aaf > > commit 450c3f8b3d259c7eb82488319aff45f1f6554aaf > Author: Kevin Bowling > AuthorDate: 2021-09-27 16:17:48 +0000 > Commit: Kevin Bowling > CommitDate: 2021-09-27 16:25:58 +0000 > > e1000: Re-arm link changes > > A change to MSI-X link handler was somehow causing issues on > MSI-based em(4) NICs. If anyone has any deeper insight here, I'd like to fill in my knowledge. A 'device_printf' in 'em_msix_link()' never fires on em(4) using MSI so I do not see the relationship between this code and the experienced issues. > Revert the change based on user reports and testing. > > PR: 258551 > Reported by: Franco Fichtner , t_uemura@macome.co.jp > Reviewed by: markj, Franco Fichtner > Tested by: t_uemura@macome.co.jp > MFC after: 1 day > --- > sys/dev/e1000/if_em.c | 22 ++++++---------------- > 1 file changed, 6 insertions(+), 16 deletions(-) > > diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c > index 47513c5d9e1e..34d7b8f5f87e 100644 > --- a/sys/dev/e1000/if_em.c > +++ b/sys/dev/e1000/if_em.c > @@ -1495,7 +1495,6 @@ em_msix_link(void *arg) > { > struct e1000_softc *sc = arg; > u32 reg_icr; > - bool notlink = false; > > ++sc->link_irq; > MPASS(sc->hw.back != NULL); > @@ -1506,17 +1505,14 @@ em_msix_link(void *arg) > > if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) > em_handle_link(sc->ctx); > - else > - notlink = true; > > - /* Re-arm for other/spurious interrupts */ > - if (notlink && sc->hw.mac.type >= igb_mac_min) { > + /* Re-arm unconditionally */ > + if (sc->hw.mac.type >= igb_mac_min) { > E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); > E1000_WRITE_REG(&sc->hw, E1000_EIMS, sc->link_mask); > } else if (sc->hw.mac.type == e1000_82574) { > - if (notlink) > - E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC | > - E1000_IMS_OTHER); > + E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC | > + E1000_IMS_OTHER); > /* > * Because we must read the ICR for this interrupt it may > * clear other causes using autoclear, for this reason we > @@ -1524,7 +1520,8 @@ em_msix_link(void *arg) > */ > if (reg_icr) > E1000_WRITE_REG(&sc->hw, E1000_ICS, sc->ims); > - } > + } else > + E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); > > return (FILTER_HANDLED); > } > @@ -1873,13 +1870,6 @@ em_if_update_admin_status(if_ctx_t ctx) > > if (hw->mac.type < em_mac_min) > lem_smartspeed(sc); > - else if (hw->mac.type >= igb_mac_min && > - sc->intr_type == IFLIB_INTR_MSIX) { > - E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); > - E1000_WRITE_REG(&sc->hw, E1000_EIMS, sc->link_mask); > - } else if (hw->mac.type == e1000_82574 && > - sc->intr_type == IFLIB_INTR_MSIX) > - E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_LSC | E1000_IMS_OTHER); > } > > static void > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" From owner-dev-commits-src-all@freebsd.org Mon Sep 27 17:12:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B54C66C35E; Mon, 27 Sep 2021 17:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ8N53P2mz3w2Q; Mon, 27 Sep 2021 17:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55C1215014; Mon, 27 Sep 2021 17:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18RHCrhe041754; Mon, 27 Sep 2021 17:12:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RHCrTl041753; Mon, 27 Sep 2021 17:12:53 GMT (envelope-from git) Date: Mon, 27 Sep 2021 17:12:53 GMT Message-Id: <202109271712.18RHCrTl041753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b1e2f063ae91 - main - amd64 sendsig: fix context corruption 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/main X-Git-Reftype: branch X-Git-Commit: b1e2f063ae912dc5b7a7f6638ccb3aff14f299cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 17:12:53 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b1e2f063ae912dc5b7a7f6638ccb3aff14f299cf commit b1e2f063ae912dc5b7a7f6638ccb3aff14f299cf Author: Konstantin Belousov AuthorDate: 2021-09-27 16:57:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-27 17:12:46 +0000 amd64 sendsig: fix context corruption Drop fpstate only after copying out xfpustate from the thread usermode save area. Otherwise a context switch between get_fpcontext(), which now returns the pointer directly into user save area, and copyout, would cause reinit of the save area, loosing user registers. Reported, reviewed, and tested by: markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D32159 --- sys/amd64/amd64/exec_machdep.c | 2 +- sys/amd64/ia32/ia32_signal.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index d605f080871a..b93fe7c4b3c7 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -143,7 +143,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len); - fpstate_drop(td); update_pcb_bases(pcb); sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase; @@ -203,6 +202,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sigexit(td, SIGILL); } + fpstate_drop(td); regs->tf_rsp = (long)sfp; regs->tf_rip = p->p_sysent->sv_sigcode_base; regs->tf_rflags &= ~(PSL_T | PSL_D); diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index ab7100f5b9fb..6c879eccfc77 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -607,7 +607,6 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sf.sf_uc.uc_mcontext.mc_gs = regs->tf_gs; sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len); - fpstate_drop(td); sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase; sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase; @@ -661,6 +660,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sigexit(td, SIGILL); } + fpstate_drop(td); regs->tf_rsp = (uintptr_t)sfp; regs->tf_rip = p->p_sysent->sv_sigcode_base; regs->tf_rflags &= ~(PSL_T | PSL_D); From owner-dev-commits-src-all@freebsd.org Mon Sep 27 17:24:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D564C66C4D4; Mon, 27 Sep 2021 17:24: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 4HJ8d15Rzdz4RGf; Mon, 27 Sep 2021 17:24:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BAC91529F; Mon, 27 Sep 2021 17:24: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 18RHO5Mr055521; Mon, 27 Sep 2021 17:24:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RHO5TT055520; Mon, 27 Sep 2021 17:24:05 GMT (envelope-from git) Date: Mon, 27 Sep 2021 17:24:05 GMT Message-Id: <202109271724.18RHO5TT055520@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0eb901f76007 - main - pci_host_generic: implement bus_translate_resource (for LinuxKPI) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0eb901f760078c9d0402fa4df522c099f0e96cb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 17:24:05 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0eb901f760078c9d0402fa4df522c099f0e96cb0 commit 0eb901f760078c9d0402fa4df522c099f0e96cb0 Author: Greg V AuthorDate: 2021-09-20 20:05:49 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-27 17:19:05 +0000 pci_host_generic: implement bus_translate_resource (for LinuxKPI) In D21096 BUS_TRANSLATE_RESOURCE was introduced to allow LinuxKPI to get physical addresses in pci_resource_start for PowerPC and implemented in ofw_pci. When the translation was implemented in pci_host_generic in 372c142b4fc, this method was not implemented; instead a local static function was added for a similar purpose. Rename the static function to "_common" and implement the bus function as a wrapper around that. With this a LinuxKPI driver using physical addresses correctly finds the configuration registers of the GPU. This unbreaks amdgpu on NXP Layerscape LX2160A SoC (SolidRun HoneyComb LX2K workstation) which has a Translation Offset in ACPI for below-4G PCI addresses. More info: https://github.com/freebsd/drm-kmod/issues/84 Tested by: dan.kotowski_a9development.com Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30986 --- sys/dev/pci/pci_host_generic.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 22b3ccdc17b1..03e8baa1b5cf 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -326,7 +326,7 @@ pci_host_generic_core_release_resource(device_t dev, device_t child, int type, } static bool -generic_pcie_translate_resource(device_t dev, int type, rman_res_t start, +generic_pcie_translate_resource_common(device_t dev, int type, rman_res_t start, rman_res_t end, rman_res_t *new_start, rman_res_t *new_end) { struct generic_pcie_core_softc *sc; @@ -382,6 +382,16 @@ generic_pcie_translate_resource(device_t dev, int type, rman_res_t start, return (found); } +static int +generic_pcie_translate_resource(device_t bus, int type, + rman_res_t start, rman_res_t *newstart) +{ + rman_res_t newend; /* unused */ + + return (!generic_pcie_translate_resource_common( + bus, type, start, 0, newstart, &newend)); +} + struct resource * pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) @@ -406,7 +416,7 @@ pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type, type, rid, start, end, count, flags)); /* Translate the address from a PCI address to a physical address */ - if (!generic_pcie_translate_resource(dev, type, start, end, &phys_start, + if (!generic_pcie_translate_resource_common(dev, type, start, end, &phys_start, &phys_end)) { device_printf(dev, "Failed to translate resource %jx-%jx type %x for %s\n", @@ -458,7 +468,7 @@ generic_pcie_activate_resource(device_t dev, device_t child, int type, start = rman_get_start(r); end = rman_get_end(r); - if (!generic_pcie_translate_resource(dev, type, start, end, &start, + if (!generic_pcie_translate_resource_common(dev, type, start, end, &start, &end)) return (EINVAL); rman_set_start(r, start); @@ -529,6 +539,7 @@ static device_method_t generic_pcie_methods[] = { DEVMETHOD(bus_activate_resource, generic_pcie_activate_resource), DEVMETHOD(bus_deactivate_resource, generic_pcie_deactivate_resource), DEVMETHOD(bus_release_resource, pci_host_generic_core_release_resource), + DEVMETHOD(bus_translate_resource, generic_pcie_translate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), From owner-dev-commits-src-all@freebsd.org Mon Sep 27 17:39:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D33266C7F3; Mon, 27 Sep 2021 17:39: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 4HJ8yR2tPPz4SkC; Mon, 27 Sep 2021 17:39:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 438B815515; Mon, 27 Sep 2021 17:39: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 18RHdBbT068994; Mon, 27 Sep 2021 17:39:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RHdBFT068993; Mon, 27 Sep 2021 17:39:11 GMT (envelope-from git) Date: Mon, 27 Sep 2021 17:39:11 GMT Message-Id: <202109271739.18RHdBFT068993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: bcddaadbef58 - main - rman: fix overflow in rman_reserve_resource_bound() 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/main X-Git-Reftype: branch X-Git-Commit: bcddaadbef5850ed9f040836d3f25ff57138ae28 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 17:39:11 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bcddaadbef5850ed9f040836d3f25ff57138ae28 commit bcddaadbef5850ed9f040836d3f25ff57138ae28 Author: Elliott Mitchell AuthorDate: 2021-09-27 17:13:19 +0000 Commit: Mitchell Horne CommitDate: 2021-09-27 17:38:26 +0000 rman: fix overflow in rman_reserve_resource_bound() If the default range of [0, ~0] is given, then (~0 - 0) + 1 == 0. This in turn will cause any allocation of non-zero size to fail. Zero-sized allocations are prohibited, so add a KASSERT to this effect. History indicates it is part of the original rman code. This bug may in fact be older than some contributors. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30280 --- sys/kern/subr_rman.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index a8f5188e7f54..1bbaff8264ef 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -445,6 +445,8 @@ rman_reserve_resource_bound(struct rman *rm, rman_res_t start, rman_res_t end, "length %#jx, flags %x, device %s\n", rm->rm_descr, start, end, count, flags, dev == NULL ? "" : device_get_nameunit(dev))); + KASSERT(count != 0, ("%s: attempted to allocate an empty range", + __func__)); KASSERT((flags & RF_FIRSTSHARE) == 0, ("invalid flags %#x", flags)); new_rflags = (flags & ~RF_FIRSTSHARE) | RF_ALLOCATED; @@ -520,7 +522,7 @@ rman_reserve_resource_bound(struct rman *rm, rman_res_t start, rman_res_t end, DPRINTF(("truncated region: [%#jx, %#jx]; size %#jx (requested %#jx)\n", rstart, rend, (rend - rstart + 1), count)); - if ((rend - rstart + 1) >= count) { + if ((rend - rstart) >= (count - 1)) { DPRINTF(("candidate region: [%#jx, %#jx], size %#jx\n", rstart, rend, (rend - rstart + 1))); if ((s->r_end - s->r_start + 1) == count) { From owner-dev-commits-src-all@freebsd.org Mon Sep 27 17:48:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED8F766CE56; Mon, 27 Sep 2021 17: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 4HJ9996C63z4T6x; Mon, 27 Sep 2021 17:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4D2D153BD; Mon, 27 Sep 2021 17: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 18RHmT1L082073; Mon, 27 Sep 2021 17: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 18RHmTAt082072; Mon, 27 Sep 2021 17:48:29 GMT (envelope-from git) Date: Mon, 27 Sep 2021 17:48:29 GMT Message-Id: <202109271748.18RHmTAt082072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 93b14194acaf - main - LinuxKPI: disable device_release_driver() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93b14194acaf2c2d80df9c4900a90c6644dcd92b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 17:48:30 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=93b14194acaf2c2d80df9c4900a90c6644dcd92b commit 93b14194acaf2c2d80df9c4900a90c6644dcd92b Author: Bjoern A. Zeeb AuthorDate: 2021-09-27 17:38:41 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-27 17:45:06 +0000 LinuxKPI: disable device_release_driver() As reported by multiple people testing iwlwifi, device_release_driver() can lead to a panic on secondary errors (usually during attach). Disable device_release_driver() for the short-term to prevent the panic but leave it in place so it can be re-worked and fixed properly for the long-term more easily. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/include/linux/device.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 4bdc3b831e58..abafcd7ba5c4 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -506,6 +506,9 @@ static inline void device_release_driver(struct device *dev) { +#if 0 + /* This leads to panics. Disable temporarily. Keep to rework. */ + /* We also need to cleanup LinuxKPI bits. What else? */ lkpi_devres_release_free_list(dev); dev_set_drvdata(dev, NULL); @@ -515,6 +518,7 @@ device_release_driver(struct device *dev) if (device_is_attached(dev->bsddev)) device_detach(dev->bsddev); mtx_unlock(&Giant); +#endif } static inline int From owner-dev-commits-src-all@freebsd.org Mon Sep 27 18:14:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9227A66D1D5; Mon, 27 Sep 2021 18:14:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ9lf3QyFz4VmG; Mon, 27 Sep 2021 18:14:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5642815A57; Mon, 27 Sep 2021 18:14:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18RIEsAf022536; Mon, 27 Sep 2021 18:14:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RIEsvf022535; Mon, 27 Sep 2021 18:14:54 GMT (envelope-from git) Date: Mon, 27 Sep 2021 18:14:54 GMT Message-Id: <202109271814.18RIEsvf022535@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: df38343e7130 - main - ipfilter: Print the correct TCP sequence index number MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df38343e71304169ebca0e4c4fa24b339982d7be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 18:14:54 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=df38343e71304169ebca0e4c4fa24b339982d7be commit df38343e71304169ebca0e4c4fa24b339982d7be Author: Cy Schubert AuthorDate: 2021-09-25 00:00:20 +0000 Commit: Cy Schubert CommitDate: 2021-09-27 18:13:50 +0000 ipfilter: Print the correct TCP sequence index number TCP sequence numbers in the FTP proxy are maintained in a two dimensional array. The debug message prints the same seq[N] for both. Fix that. MFC after: 3 days --- sys/contrib/ipfilter/netinet/ip_ftp_pxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c b/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c index c4ee0ef593df..f4b40f3601d9 100644 --- a/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c +++ b/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c @@ -1415,7 +1415,7 @@ ipf_p_ftp_process(softf, fin, nat, ftp, rv) printf("%s:seq[0](%u) + (%d) != (%u)\n", "ipf_p_ftp_process", t->ftps_seq[0], ackoff, thack); - printf("%s:seq[0](%u) + (%d) != (%u)\n", + printf("%s:seq[1](%u) + (%d) != (%u)\n", "ipf_p_ftp_process", t->ftps_seq[1], ackoff, thack); } From owner-dev-commits-src-all@freebsd.org Mon Sep 27 18:14:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7BFE66D55C; Mon, 27 Sep 2021 18:14:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ9lg4DLzz4Vjk; Mon, 27 Sep 2021 18:14:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F52E15C15; Mon, 27 Sep 2021 18:14: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 18RIEttQ022560; Mon, 27 Sep 2021 18:14:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RIEt1g022559; Mon, 27 Sep 2021 18:14:55 GMT (envelope-from git) Date: Mon, 27 Sep 2021 18:14:55 GMT Message-Id: <202109271814.18RIEt1g022559@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: aa6cfcc820b4 - main - ipfilter: Correct a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa6cfcc820b438cec58fbe0af408d4457f8daf9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 18:14:55 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=aa6cfcc820b438cec58fbe0af408d4457f8daf9d commit aa6cfcc820b438cec58fbe0af408d4457f8daf9d Author: Cy Schubert AuthorDate: 2021-09-25 06:41:22 +0000 Commit: Cy Schubert CommitDate: 2021-09-27 18:13:50 +0000 ipfilter: Correct a comment Correct a comment's grammar and while at it clarify its meaining. MFC after: 3 days --- sys/contrib/ipfilter/netinet/ip_proxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index 4399a9cde8e4..a1a9379b95a6 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1060,7 +1060,7 @@ ipf_proxy_check(fin, nat) /* pr(I) - protocol number for proxy */ /* name(I) - proxy name */ /* */ -/* Search for an proxy by the protocol it is being used with and its name. */ +/* Search for a proxy by the protocol being used and by its name. */ /* ------------------------------------------------------------------------ */ aproxy_t * ipf_proxy_lookup(arg, pr, name) From owner-dev-commits-src-all@freebsd.org Mon Sep 27 19:15:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 791F066E09D; Mon, 27 Sep 2021 19:15: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 4HJC5C2yhcz4Zpg; Mon, 27 Sep 2021 19:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4549C1656C; Mon, 27 Sep 2021 19:15: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 18RJFBm2002308; Mon, 27 Sep 2021 19:15:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RJFBUp002307; Mon, 27 Sep 2021 19:15:11 GMT (envelope-from git) Date: Mon, 27 Sep 2021 19:15:11 GMT Message-Id: <202109271915.18RJFBUp002307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Bright Subject: git: e3cf7ebc1d36 - main - ntb_hw_intel: fix xeon NTB gen3 bar disable logic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dab X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3cf7ebc1d36d068f1d1a83ea73ce2eed547e3cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 19:15:11 -0000 The branch main has been updated by dab: URL: https://cgit.FreeBSD.org/src/commit/?id=e3cf7ebc1d36d068f1d1a83ea73ce2eed547e3cb commit e3cf7ebc1d36d068f1d1a83ea73ce2eed547e3cb Author: David Bright AuthorDate: 2021-09-27 13:18:46 +0000 Commit: David Bright CommitDate: 2021-09-27 19:13:03 +0000 ntb_hw_intel: fix xeon NTB gen3 bar disable logic In NTB gen3 driver, it was supposed to disable NTB bar access by default, but due to incorrect register access method, the bar disable logic does not work as expected. Those registers should be modified through NTB bar0 rather than PCI configuration space. Besides, we'd better to protect ourselves from a bad buddy node so ingress disable logic should be implemented together. Submitted by: Austin Zhang (austin.zhang@dell.com) Reviewers: markj, mav, vangyzen, dab Differential Revision: https://reviews.freebsd.org/D31736 Sponsored by: Dell EMC MFC to: stable/12, stable/13 MFC after: 1 week --- sys/dev/ntb/ntb_hw/ntb_hw_intel.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c index 06206f812d3f..00fcc4829b9c 100644 --- a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c +++ b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c @@ -2163,15 +2163,21 @@ xeon_gen3_setup_b2b_mw(struct ntb_softc *ntb) intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR2XBASE, 0); /* - * If the value in EMBAR1LIMIT is set equal to the value in EMBAR1, - * the memory window for EMBAR1 is disabled. - * Note: It is needed to avoid malacious access. + * If the value in IMBAR1XLIMIT is set equal to the value in IMBAR1XBASE, + * the local memory window exposure from EMBAR1 is disabled. + * Note: It is needed to avoid malicious access. */ - reg = pci_read_config(ntb->device, XEON_GEN3_EXT_REG_BAR1BASE, 8); - intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR1XLIMIT, reg); + intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR1XLIMIT, 0); + intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR2XLIMIT, 0); - reg = pci_read_config(ntb->device, XEON_GEN3_EXT_REG_BAR2BASE, 8); - intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR2XLIMIT, reg); + /* Config outgoing translation limits (whole bar size windows) */ + reg = intel_ntb_reg_read(8, XEON_GEN3_REG_EMBAR1XBASE); + reg += ntb->bar_info[NTB_B2B_BAR_1].size; + intel_ntb_reg_write(8, XEON_GEN3_REG_EMBAR1XLIMIT, reg); + + reg = intel_ntb_reg_read(8, XEON_GEN3_REG_EMBAR2XBASE); + reg += ntb->bar_info[NTB_B2B_BAR_2].size; + intel_ntb_reg_write(8, XEON_GEN3_REG_EMBAR2XLIMIT, reg); return (0); } @@ -3226,7 +3232,10 @@ intel_ntb_mw_set_trans(device_t dev, unsigned idx, bus_addr_t addr, size_t size) limit = 0; if (bar_is_64bit(ntb, bar_num)) { - base = intel_ntb_reg_read(8, base_reg) & BAR_HIGH_MASK; + if (ntb->type == NTB_XEON_GEN3) + base = addr; + else + base = intel_ntb_reg_read(8, base_reg) & BAR_HIGH_MASK; if (limit_reg != 0 && size != mw_size) limit = base + size; @@ -3249,18 +3258,6 @@ intel_ntb_mw_set_trans(device_t dev, unsigned idx, bus_addr_t addr, size_t size) intel_ntb_reg_write(8, xlat_reg, 0); return (EIO); } - - if (ntb->type == NTB_XEON_GEN3) { - limit = base + size; - - /* set EMBAR1/2XLIMIT */ - if (!idx) - intel_ntb_reg_write(8, - XEON_GEN3_REG_EMBAR1XLIMIT, limit); - else - intel_ntb_reg_write(8, - XEON_GEN3_REG_EMBAR2XLIMIT, limit); - } } else { /* Configure 32-bit (split) BAR MW */ if (ntb->type == NTB_XEON_GEN3) From owner-dev-commits-src-all@freebsd.org Mon Sep 27 20:56:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB3D167013D; Mon, 27 Sep 2021 20:56: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 4HJFLG4dCFz4pXv; Mon, 27 Sep 2021 20:56:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 743A518080; Mon, 27 Sep 2021 20:56: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 18RKucmN036961; Mon, 27 Sep 2021 20:56:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18RKucXG036960; Mon, 27 Sep 2021 20:56:38 GMT (envelope-from git) Date: Mon, 27 Sep 2021 20:56:38 GMT Message-Id: <202109272056.18RKucXG036960@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 72c89ce97ba3 - main - LinuxKPI: dma-mapping.h unify "mask" and "dma_mask" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72c89ce97ba3f023463930578c6df7f0374cbf17 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 20:56:38 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=72c89ce97ba3f023463930578c6df7f0374cbf17 commit 72c89ce97ba3f023463930578c6df7f0374cbf17 Author: Bjoern A. Zeeb AuthorDate: 2021-09-27 20:48:02 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-27 20:53:06 +0000 LinuxKPI: dma-mapping.h unify "mask" and "dma_mask" In some places we are using "mask" and others "dma_mask" for the same thing. Harmonize the various places to "dma_mask" as used in linux_pci.c. For the declaration remove the argument names to avoid the entire problem. This is in preparation for an upcoming change. No functional changes intended. Sponsored by: The FreeBSD Foundation MFC after: 5 days --- sys/compat/linuxkpi/common/include/linux/dma-mapping.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h index 5b5bc9e90815..554d4bd4e695 100644 --- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h @@ -91,7 +91,7 @@ struct dma_map_ops { #define DMA_BIT_MASK(n) ((2ULL << ((n) - 1)) - 1ULL) -int linux_dma_tag_init(struct device *dev, u64 mask); +int linux_dma_tag_init(struct device *, u64); void *linux_dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag); dma_addr_t linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len); @@ -104,7 +104,7 @@ void linux_dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, unsigned long attrs __unused); static inline int -dma_supported(struct device *dev, u64 mask) +dma_supported(struct device *dev, u64 dma_mask) { /* XXX busdma takes care of this elsewhere. */ @@ -122,23 +122,23 @@ dma_set_mask(struct device *dev, u64 dma_mask) } static inline int -dma_set_coherent_mask(struct device *dev, u64 mask) +dma_set_coherent_mask(struct device *dev, u64 dma_mask) { - if (!dma_supported(dev, mask)) + if (!dma_supported(dev, dma_mask)) return -EIO; /* XXX Currently we don't support a separate coherent mask. */ return 0; } static inline int -dma_set_mask_and_coherent(struct device *dev, u64 mask) +dma_set_mask_and_coherent(struct device *dev, u64 dma_mask) { int r; - r = dma_set_mask(dev, mask); + r = dma_set_mask(dev, dma_mask); if (r == 0) - dma_set_coherent_mask(dev, mask); + dma_set_coherent_mask(dev, dma_mask); return (r); } From owner-dev-commits-src-all@freebsd.org Tue Sep 28 00:32:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 954B0672FD8 for ; Tue, 28 Sep 2021 00:32:19 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJL766pmPz3Hlh for ; Tue, 28 Sep 2021 00:32:18 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-yb1-xb2e.google.com with SMTP id z5so27992359ybj.2 for ; Mon, 27 Sep 2021 17:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=x/hIE+TfQ7LP+yC/1pRdwcguGPKMPE2Y/NF68OXmXec=; b=VIbciaeqmWDlZkosHmPD+5SAAzYphYwjAoa2Gu0nRi6bN14qLAD7QkOxyNvVcqWOW+ SQn7zosZFcIWVv+L01N8oniyMgtBdHXQoX4N8K+CpsYqbROv5qJj2RtqpIuNLgLA1Rm/ EcDbaTXgRHWlctj43bE8ILWgPQsr413j+GKSX9cE2GIx+V87VrLrEcpc2fOsAdZx8JL/ FT/OqSWX5XInArBUwKLK/9H3vj4inx00Vb3HtGuF/i/My4kL/Lf0ey3KpbxkSQvq6uWb eghLsIqtckFjdNx/kiQJxkMNiT5lfwuAiKyoHZgzoCZ0xvjGtYjqxz19GO/WHCcGnno1 ePOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=x/hIE+TfQ7LP+yC/1pRdwcguGPKMPE2Y/NF68OXmXec=; b=HJHN2BC8myufK4iuykG9ZZjuSKsxRF/1ksjVca2GZanNzfWMjUVUPkkQSVIc9QbR+t 86K166edbSXAzaE3JbhSMqASDtbcpqGTOGq3r1dT9/6PKI8+m3tCKrAIyTiztASNBPcE hwkJVm1qUo/o6C+MVUo/PAfU53ZlQlAx8sIRVHyExY470xgMjBZ+oGYcjo1C5YruUtaR cn0ELqG1sPJgZdQnCOh9C2KqvH/sKYHQ0Yz21zoTpXZ5MTY6ek+8bna4Tur41ApeKh7M 0DMaUlJNlb627rLdenWfRhaOn0Soy/s6fQGwJ1jVqIE808o5c9YMU56pwpbJzH1WdK39 1gJw== X-Gm-Message-State: AOAM532TVY67LN3qo9HHpZZN3zQe+/evl2K+tZe76zMv1nsc3HaAir5R cMjI6WuwIFWHGYkwrgYd3AgoETQiAwj87yL+2eds0g== X-Google-Smtp-Source: ABdhPJx4m2nXjgYtSc0XIoBs8BEFa/ZJqBRWEQ3V7lQx5fk8M2OaPFqewqdMxV+oaN0kli2KQkb0f4Y8tUk3hcXt3hI= X-Received: by 2002:a25:541:: with SMTP id 62mr3104825ybf.165.1632789138072; Mon, 27 Sep 2021 17:32:18 -0700 (PDT) MIME-Version: 1.0 References: <202109141042.18EAgYCI041614@gitrepo.freebsd.org> In-Reply-To: <202109141042.18EAgYCI041614@gitrepo.freebsd.org> From: Marcin Wojtas Date: Tue, 28 Sep 2021 02:32:07 +0200 Message-ID: Subject: Re: git: c6f3076d4405 - main - Move the GICv2m msi handling to the parent To: Andrew Turner Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4HJL766pmPz3Hlh X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20210112.gappssmtp.com header.s=20210112 header.b=VIbciaeq; dmarc=none; spf=none (mx1.freebsd.org: domain of mw@semihalf.com has no SPF policy when checking 2607:f8b0:4864:20::b2e) smtp.mailfrom=mw@semihalf.com X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[semihalf-com.20210112.gappssmtp.com:s=20210112]; FREEFALL_USER(0.00)[mw]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20210112.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::b2e:from]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 00:32:19 -0000 Hi Andrew, wt., 14 wrz 2021 o 12:42 Andrew Turner napisa=C5=82(a)= : > > The branch main has been updated by andrew: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dc6f3076d44055f7b02467ce074= 210f73d0ce0ef6 > > commit c6f3076d44055f7b02467ce074210f73d0ce0ef6 > Author: Andrew Turner > AuthorDate: 2021-09-01 09:39:01 +0000 > Commit: Andrew Turner > CommitDate: 2021-09-14 07:24:52 +0000 > > Move the GICv2m msi handling to the parent > > This is in preperation for adding support for the GICv2m driver as a > child of the GICv3 driver. > > PR: 258136 > Reported by: trasz > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D31767 > --- > sys/arm/arm/gic.c | 296 ++++++++++++++++++++++++++++++-----------= ------ > sys/arm/arm/gic.h | 8 +- > sys/arm/arm/gic_common.h | 4 + > 3 files changed, 195 insertions(+), 113 deletions(-) > > diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c > index 1851e69644ed..bd34e92b9e28 100644 > --- a/sys/arm/arm/gic.c > +++ b/sys/arm/arm/gic.c > @@ -501,6 +501,56 @@ arm_gic_read_ivar(device_t dev, device_t child, int = which, uintptr_t *result) > ("arm_gic_read_ivar: Invalid bus type %u", sc->gic_bu= s)); > *result =3D sc->gic_bus; > return (0); > + case GIC_IVAR_MBI_START: > + *result =3D sc->sc_spi_start; > + return (0); > + case GIC_IVAR_MBI_COUNT: > + *result =3D sc->sc_spi_count; > + return (0); > + } > + > + return (ENOENT); > +} > + > +static int > +arm_gic_write_ivar(device_t dev, device_t child, int which, uintptr_t va= lue) > +{ > + struct arm_gic_softc *sc; > + > + sc =3D device_get_softc(dev); > + > + switch(which) { > + case GIC_IVAR_HW_REV: > + case GIC_IVAR_BUS: > + return (EINVAL); > + case GIC_IVAR_MBI_START: > + /* > + * GIC_IVAR_MBI_START must be set once and first. This al= lows > + * us to reserve the registers when GIC_IVAR_MBI_COUNT is= set. > + */ > + MPASS(sc->sc_spi_start =3D=3D 0); > + MPASS(sc->sc_spi_count =3D=3D 0); This patch breaks GICv2m on all Marvell Armada 7k8k and CN913x. After reverting it works as expected. I tried removing the above 2 asserts + the one in line 540 - instead of init it fails later, during PCIE endpoint msix configuration: em0: Using 1024 TX descriptors and 1024 RX descriptors em0: Using 2 RX queues 2 TX queues panic: mtx_lock() of spin mutex GIC lock @ /home/mw/current/sys/arm/arm/gic.c:1145 cpuid =3D 0 time =3D 1 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x30 vpanic() at vpanic+0x184 panic() at panic+0x44 __mtx_lock_flags() at __mtx_lock_flags+0x1a8 arm_gic_alloc_msix() at arm_gic_alloc_msix+0x40 intr_alloc_msix() at intr_alloc_msix+0x190 generic_pcie_acpi_alloc_msix() at generic_pcie_acpi_alloc_msix+0x78 pci_alloc_msix_method() at pci_alloc_msix_method+0x1a8 iflib_device_register() at iflib_device_register+0xae4 iflib_device_attach() at iflib_device_attach+0xd0 device_attach() at device_attach+0x410 device_probe_and_attach() at device_probe_and_attach+0x7c bus_generic_attach() at bus_generic_attach+0x18 pci_attach() at pci_attach+0xe8 device_attach() at device_attach+0x410 device_probe_and_attach() at device_probe_and_attach+0x7c bus_generic_attach() at bus_generic_attach+0x18 device_attach() at device_attach+0x410 device_probe_and_attach() at device_probe_and_attach+0x7c bus_generic_new_pass() at bus_generic_new_pass+0xec bus_generic_new_pass() at bus_generic_new_pass+0xd0 bus_generic_new_pass() at bus_generic_new_pass+0xd0 bus_set_pass() at bus_set_pass+0x8c mi_startup() at mi_startup+0x12c virtdone() at virtdone+0x6c KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at kdb_enter+0x44: undefined f900c11f Any ideas? Best regards, Marcin > + MPASS(value >=3D GIC_FIRST_SPI); > + MPASS(value < sc->nirqs); > + > + sc->sc_spi_start =3D value; > + return (0); > + case GIC_IVAR_MBI_COUNT: > + MPASS(sc->sc_spi_start !=3D 0); > + MPASS(sc->sc_spi_count =3D=3D 0); > + MPASS(value >=3D sc->sc_spi_start); > + MPASS(value >=3D GIC_FIRST_SPI); > + > + sc->sc_spi_count =3D value; > + sc->sc_spi_end =3D sc->sc_spi_start + sc->sc_spi_count; > + > + MPASS(sc->sc_spi_end <=3D sc->nirqs); > + > + /* Reserve these interrupts for MSI/MSI-X use */ > + arm_gic_reserve_msi_range(dev, sc->sc_spi_start, > + sc->sc_spi_count); > + > + return (0); > } > > return (ENOENT); > @@ -995,99 +1045,20 @@ arm_gic_ipi_setup(device_t dev, u_int ipi, struct = intr_irqsrc **isrcp) > } > #endif > > -static device_method_t arm_gic_methods[] =3D { > - /* Bus interface */ > - DEVMETHOD(bus_print_child, arm_gic_print_child), > - DEVMETHOD(bus_add_child, bus_generic_add_child), > - DEVMETHOD(bus_alloc_resource, arm_gic_alloc_resource), > - DEVMETHOD(bus_release_resource, bus_generic_release_resource), > - DEVMETHOD(bus_activate_resource,bus_generic_activate_resource), > - DEVMETHOD(bus_read_ivar, arm_gic_read_ivar), > - > - /* Interrupt controller interface */ > - DEVMETHOD(pic_disable_intr, arm_gic_disable_intr), > - DEVMETHOD(pic_enable_intr, arm_gic_enable_intr), > - DEVMETHOD(pic_map_intr, arm_gic_map_intr), > - DEVMETHOD(pic_setup_intr, arm_gic_setup_intr), > - DEVMETHOD(pic_teardown_intr, arm_gic_teardown_intr), > - DEVMETHOD(pic_post_filter, arm_gic_post_filter), > - DEVMETHOD(pic_post_ithread, arm_gic_post_ithread), > - DEVMETHOD(pic_pre_ithread, arm_gic_pre_ithread), > -#ifdef SMP > - DEVMETHOD(pic_bind_intr, arm_gic_bind_intr), > - DEVMETHOD(pic_init_secondary, arm_gic_init_secondary), > - DEVMETHOD(pic_ipi_send, arm_gic_ipi_send), > - DEVMETHOD(pic_ipi_setup, arm_gic_ipi_setup), > -#endif > - { 0, 0 } > -}; > - > -DEFINE_CLASS_0(gic, arm_gic_driver, arm_gic_methods, > - sizeof(struct arm_gic_softc)); > - > -/* > - * GICv2m support -- the GICv2 MSI/MSI-X controller. > - */ > - > -#define GICV2M_MSI_TYPER 0x008 > -#define MSI_TYPER_SPI_BASE(x) (((x) >> 16) & 0x3ff) > -#define MSI_TYPER_SPI_COUNT(x) (((x) >> 0) & 0x3ff) > -#define GICv2M_MSI_SETSPI_NS 0x040 > -#define GICV2M_MSI_IIDR 0xFCC > - > -int > -arm_gicv2m_attach(device_t dev) > -{ > - struct arm_gicv2m_softc *sc; > - uint32_t typer; > - int rid; > - > - sc =3D device_get_softc(dev); > - > - rid =3D 0; > - sc->sc_mem =3D bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, > - RF_ACTIVE); > - if (sc->sc_mem =3D=3D NULL) { > - device_printf(dev, "Unable to allocate resources\n"); > - return (ENXIO); > - } > - > - typer =3D bus_read_4(sc->sc_mem, GICV2M_MSI_TYPER); > - sc->sc_spi_start =3D MSI_TYPER_SPI_BASE(typer); > - sc->sc_spi_count =3D MSI_TYPER_SPI_COUNT(typer); > - sc->sc_spi_end =3D sc->sc_spi_start + sc->sc_spi_count; > - > - /* Reserve these interrupts for MSI/MSI-X use */ > - arm_gic_reserve_msi_range(device_get_parent(dev), sc->sc_spi_star= t, > - sc->sc_spi_count); > - > - mtx_init(&sc->sc_mutex, "GICv2m lock", NULL, MTX_DEF); > - > - intr_msi_register(dev, sc->sc_xref); > - > - if (bootverbose) > - device_printf(dev, "using spi %u to %u\n", sc->sc_spi_sta= rt, > - sc->sc_spi_start + sc->sc_spi_count - 1); > - > - return (0); > -} > - > static int > -arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcou= nt, > +arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, > device_t *pic, struct intr_irqsrc **srcs) > { > - struct arm_gic_softc *psc; > - struct arm_gicv2m_softc *sc; > + struct arm_gic_softc *sc; > int i, irq, end_irq; > bool found; > > KASSERT(powerof2(count), ("%s: bad count", __func__)); > KASSERT(powerof2(maxcount), ("%s: bad maxcount", __func__)); > > - psc =3D device_get_softc(device_get_parent(dev)); > sc =3D device_get_softc(dev); > > - mtx_lock(&sc->sc_mutex); > + mtx_lock(&sc->mutex); > > found =3D false; > for (irq =3D sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { > @@ -1106,11 +1077,11 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child= , int count, int maxcount, > break; > } > > - KASSERT((psc->gic_irqs[end_irq].gi_flags & GI_FLA= G_MSI)!=3D 0, > + KASSERT((sc->gic_irqs[end_irq].gi_flags & GI_FLAG= _MSI)!=3D 0, > ("%s: Non-MSI interrupt found", __func__)); > > /* This is already used */ > - if ((psc->gic_irqs[end_irq].gi_flags & GI_FLAG_MS= I_USED) =3D=3D > + if ((sc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI= _USED) =3D=3D > GI_FLAG_MSI_USED) { > found =3D false; > break; > @@ -1122,34 +1093,34 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child= , int count, int maxcount, > > /* Not enough interrupts were found */ > if (!found || irq =3D=3D sc->sc_spi_end) { > - mtx_unlock(&sc->sc_mutex); > + mtx_unlock(&sc->mutex); > return (ENXIO); > } > > for (i =3D 0; i < count; i++) { > /* Mark the interrupt as used */ > - psc->gic_irqs[irq + i].gi_flags |=3D GI_FLAG_MSI_USED; > + sc->gic_irqs[irq + i].gi_flags |=3D GI_FLAG_MSI_USED; > } > - mtx_unlock(&sc->sc_mutex); > + mtx_unlock(&sc->mutex); > > for (i =3D 0; i < count; i++) > - srcs[i] =3D (struct intr_irqsrc *)&psc->gic_irqs[irq + i]= ; > - *pic =3D device_get_parent(dev); > + srcs[i] =3D (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; > + *pic =3D dev; > > return (0); > } > > static int > -arm_gicv2m_release_msi(device_t dev, device_t child, int count, > +arm_gic_release_msi(device_t dev, device_t child, int count, > struct intr_irqsrc **isrc) > { > - struct arm_gicv2m_softc *sc; > + struct arm_gic_softc *sc; > struct gic_irqsrc *gi; > int i; > > sc =3D device_get_softc(dev); > > - mtx_lock(&sc->sc_mutex); > + mtx_lock(&sc->mutex); > for (i =3D 0; i < count; i++) { > gi =3D (struct gic_irqsrc *)isrc[i]; > > @@ -1159,50 +1130,48 @@ arm_gicv2m_release_msi(device_t dev, device_t chi= ld, int count, > > gi->gi_flags &=3D ~GI_FLAG_MSI_USED; > } > - mtx_unlock(&sc->sc_mutex); > + mtx_unlock(&sc->mutex); > > return (0); > } > > static int > -arm_gicv2m_alloc_msix(device_t dev, device_t child, device_t *pic, > +arm_gic_alloc_msix(device_t dev, device_t child, device_t *pic, > struct intr_irqsrc **isrcp) > { > - struct arm_gicv2m_softc *sc; > - struct arm_gic_softc *psc; > + struct arm_gic_softc *sc; > int irq; > > - psc =3D device_get_softc(device_get_parent(dev)); > sc =3D device_get_softc(dev); > > - mtx_lock(&sc->sc_mutex); > + mtx_lock(&sc->mutex); > /* Find an unused interrupt */ > for (irq =3D sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { > - KASSERT((psc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) !=3D = 0, > + KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) !=3D 0= , > ("%s: Non-MSI interrupt found", __func__)); > - if ((psc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) =3D= =3D 0) > + if ((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) =3D= =3D 0) > break; > } > /* No free interrupt was found */ > if (irq =3D=3D sc->sc_spi_end) { > - mtx_unlock(&sc->sc_mutex); > + mtx_unlock(&sc->mutex); > return (ENXIO); > } > > /* Mark the interrupt as used */ > - psc->gic_irqs[irq].gi_flags |=3D GI_FLAG_MSI_USED; > - mtx_unlock(&sc->sc_mutex); > + sc->gic_irqs[irq].gi_flags |=3D GI_FLAG_MSI_USED; > + mtx_unlock(&sc->mutex); > > - *isrcp =3D (struct intr_irqsrc *)&psc->gic_irqs[irq]; > - *pic =3D device_get_parent(dev); > + *isrcp =3D (struct intr_irqsrc *)&sc->gic_irqs[irq]; > + *pic =3D dev; > > return (0); > } > > static int > -arm_gicv2m_release_msix(device_t dev, device_t child, struct intr_irqsrc= *isrc) > +arm_gic_release_msix(device_t dev, device_t child, struct intr_irqsrc *i= src) > { > - struct arm_gicv2m_softc *sc; > + struct arm_gic_softc *sc; > struct gic_irqsrc *gi; > > sc =3D device_get_softc(dev); > @@ -1211,13 +1180,122 @@ arm_gicv2m_release_msix(device_t dev, device_t c= hild, struct intr_irqsrc *isrc) > KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) =3D=3D GI_FLAG_MSI_USED= , > ("%s: Trying to release an unused MSI-X interrupt", __func__)= ); > > - mtx_lock(&sc->sc_mutex); > + mtx_lock(&sc->mutex); > gi->gi_flags &=3D ~GI_FLAG_MSI_USED; > - mtx_unlock(&sc->sc_mutex); > + mtx_unlock(&sc->mutex); > > return (0); > } > > +static device_method_t arm_gic_methods[] =3D { > + /* Bus interface */ > + DEVMETHOD(bus_print_child, arm_gic_print_child), > + DEVMETHOD(bus_add_child, bus_generic_add_child), > + DEVMETHOD(bus_alloc_resource, arm_gic_alloc_resource), > + DEVMETHOD(bus_release_resource, bus_generic_release_resource), > + DEVMETHOD(bus_activate_resource,bus_generic_activate_resource), > + DEVMETHOD(bus_read_ivar, arm_gic_read_ivar), > + DEVMETHOD(bus_write_ivar, arm_gic_write_ivar), > + > + /* Interrupt controller interface */ > + DEVMETHOD(pic_disable_intr, arm_gic_disable_intr), > + DEVMETHOD(pic_enable_intr, arm_gic_enable_intr), > + DEVMETHOD(pic_map_intr, arm_gic_map_intr), > + DEVMETHOD(pic_setup_intr, arm_gic_setup_intr), > + DEVMETHOD(pic_teardown_intr, arm_gic_teardown_intr), > + DEVMETHOD(pic_post_filter, arm_gic_post_filter), > + DEVMETHOD(pic_post_ithread, arm_gic_post_ithread), > + DEVMETHOD(pic_pre_ithread, arm_gic_pre_ithread), > +#ifdef SMP > + DEVMETHOD(pic_bind_intr, arm_gic_bind_intr), > + DEVMETHOD(pic_init_secondary, arm_gic_init_secondary), > + DEVMETHOD(pic_ipi_send, arm_gic_ipi_send), > + DEVMETHOD(pic_ipi_setup, arm_gic_ipi_setup), > +#endif > + > + /* MSI/MSI-X */ > + DEVMETHOD(msi_alloc_msi, arm_gic_alloc_msi), > + DEVMETHOD(msi_release_msi, arm_gic_release_msi), > + DEVMETHOD(msi_alloc_msix, arm_gic_alloc_msix), > + DEVMETHOD(msi_release_msix, arm_gic_release_msix), > + > + { 0, 0 } > +}; > + > +DEFINE_CLASS_0(gic, arm_gic_driver, arm_gic_methods, > + sizeof(struct arm_gic_softc)); > + > +/* > + * GICv2m support -- the GICv2 MSI/MSI-X controller. > + */ > + > +#define GICV2M_MSI_TYPER 0x008 > +#define MSI_TYPER_SPI_BASE(x) (((x) >> 16) & 0x3ff) > +#define MSI_TYPER_SPI_COUNT(x) (((x) >> 0) & 0x3ff) > +#define GICv2M_MSI_SETSPI_NS 0x040 > +#define GICV2M_MSI_IIDR 0xFCC > + > +int > +arm_gicv2m_attach(device_t dev) > +{ > + struct arm_gicv2m_softc *sc; > + uint32_t typer; > + u_int spi_start, spi_count; > + int rid; > + > + sc =3D device_get_softc(dev); > + > + rid =3D 0; > + sc->sc_mem =3D bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, > + RF_ACTIVE); > + if (sc->sc_mem =3D=3D NULL) { > + device_printf(dev, "Unable to allocate resources\n"); > + return (ENXIO); > + } > + > + typer =3D bus_read_4(sc->sc_mem, GICV2M_MSI_TYPER); > + spi_start =3D MSI_TYPER_SPI_BASE(typer); > + spi_count =3D MSI_TYPER_SPI_COUNT(typer); > + gic_set_mbi_start(dev, spi_start); > + gic_set_mbi_count(dev, spi_count); > + > + intr_msi_register(dev, sc->sc_xref); > + > + if (bootverbose) > + device_printf(dev, "using spi %u to %u\n", spi_start, > + spi_start + spi_count - 1); > + > + return (0); > +} > + > +static int > +arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcou= nt, > + device_t *pic, struct intr_irqsrc **srcs) > +{ > + return (MSI_ALLOC_MSI(device_get_parent(dev), child, count, maxco= unt, > + pic, srcs)); > +} > + > +static int > +arm_gicv2m_release_msi(device_t dev, device_t child, int count, > + struct intr_irqsrc **isrc) > +{ > + return (MSI_RELEASE_MSI(device_get_parent(dev), child, count, isr= c)); > +} > + > +static int > +arm_gicv2m_alloc_msix(device_t dev, device_t child, device_t *pic, > + struct intr_irqsrc **isrcp) > +{ > + return (MSI_ALLOC_MSIX(device_get_parent(dev), child, pic, isrcp)= ); > +} > + > +static int > +arm_gicv2m_release_msix(device_t dev, device_t child, struct intr_irqsrc= *isrc) > +{ > + return (MSI_RELEASE_MSIX(device_get_parent(dev), child, isrc)); > +} > + > static int > arm_gicv2m_map_msi(device_t dev, device_t child, struct intr_irqsrc *isr= c, > uint64_t *addr, uint32_t *data) > diff --git a/sys/arm/arm/gic.h b/sys/arm/arm/gic.h > index 74cfbbee9d5a..55f7f0cc5e44 100644 > --- a/sys/arm/arm/gic.h > +++ b/sys/arm/arm/gic.h > @@ -63,17 +63,17 @@ struct arm_gic_softc { > > int nranges; > struct arm_gic_range * ranges; > + > + u_int sc_spi_start; > + u_int sc_spi_end; > + u_int sc_spi_count; > }; > > DECLARE_CLASS(arm_gic_driver); > > struct arm_gicv2m_softc { > struct resource *sc_mem; > - struct mtx sc_mutex; > uintptr_t sc_xref; > - u_int sc_spi_start; > - u_int sc_spi_end; > - u_int sc_spi_count; > }; > > DECLARE_CLASS(arm_gicv2m_driver); > diff --git a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h > index 9e8fb19300ca..52827d03e600 100644 > --- a/sys/arm/arm/gic_common.h > +++ b/sys/arm/arm/gic_common.h > @@ -33,6 +33,8 @@ > > #define GIC_IVAR_HW_REV 500 > #define GIC_IVAR_BUS 501 > +#define GIC_IVAR_MBI_START 510 > +#define GIC_IVAR_MBI_COUNT 511 > > /* GIC_IVAR_BUS values */ > #define GIC_BUS_UNKNOWN 0 > @@ -42,6 +44,8 @@ > > __BUS_ACCESSOR(gic, hw_rev, GIC, HW_REV, u_int); > __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); > +__BUS_ACCESSOR(gic, mbi_start, GIC, MBI_START, u_int); > +__BUS_ACCESSOR(gic, mbi_count, GIC, MBI_COUNT, u_int); > > /* Software Generated Interrupts */ > #define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPI= s. */ From owner-dev-commits-src-all@freebsd.org Tue Sep 28 00:34:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 410C0673791; Tue, 28 Sep 2021 00:34: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 4HJL941LXBz3Hxx; Tue, 28 Sep 2021 00:34:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EB7A1AC6C; Tue, 28 Sep 2021 00:34: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 18S0Xx2F029360; Tue, 28 Sep 2021 00: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 18S0XxAO029359; Tue, 28 Sep 2021 00:33:59 GMT (envelope-from git) Date: Tue, 28 Sep 2021 00:33:59 GMT Message-Id: <202109280033.18S0XxAO029359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: f8416be761db - stable/13 - Allow setting NFS server scope and owner. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f8416be761dbf5fff20a48e5c08c1ea81f720fd7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 00:34:00 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=f8416be761dbf5fff20a48e5c08c1ea81f720fd7 commit f8416be761dbf5fff20a48e5c08c1ea81f720fd7 Author: Alexander Motin AuthorDate: 2021-09-14 18:14:30 +0000 Commit: Alexander Motin CommitDate: 2021-09-28 00:33:57 +0000 Allow setting NFS server scope and owner. By default NFS server reports as scope and owner major the host UUID value and zero for owner minor. It works good in case of standalone server. But in case of CARP-based HA cluster failover the values should remain persistent, otherwise some clients like VMware ESXi get confused by the change and fail to reconnect automatically. The patch makes server scope, major owner and minor owner values configurable via sysctls. If not set (by default) the host UUID value is still used. Reviewed by: rmacklem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31952 (cherry picked from commit 272c4a4dc5fbe3d82d735c5b9a3b6faab052808b) --- sys/fs/nfsserver/nfs_nfsdserv.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 33af169f4e98..ab02df2c4a46 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -82,6 +82,15 @@ static bool nfsrv_openaccess = true; SYSCTL_BOOL(_vfs_nfsd, OID_AUTO, v4openaccess, CTLFLAG_RW, &nfsrv_openaccess, 0, "Enable Linux style NFSv4 Open access check"); +static char nfsrv_scope[NFSV4_OPAQUELIMIT]; +SYSCTL_STRING(_vfs_nfsd, OID_AUTO, scope, CTLFLAG_RWTUN, + &nfsrv_scope, NFSV4_OPAQUELIMIT, "Server scope"); +static char nfsrv_owner_major[NFSV4_OPAQUELIMIT]; +SYSCTL_STRING(_vfs_nfsd, OID_AUTO, owner_major, CTLFLAG_RWTUN, + &nfsrv_owner_major, NFSV4_OPAQUELIMIT, "Server owner major"); +static uint64_t nfsrv_owner_minor; +SYSCTL_U64(_vfs_nfsd, OID_AUTO, owner_minor, CTLFLAG_RWTUN, + &nfsrv_owner_minor, 0, "Server owner minor"); /* * This list defines the GSS mechanisms supported. @@ -4253,7 +4262,6 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, nfsquad_t clientid, confirm; uint8_t *verf; uint32_t sp4type, v41flags; - uint64_t owner_minor; struct timespec verstime; #ifdef INET struct sockaddr_in *sin, *rin; @@ -4262,6 +4270,7 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, struct sockaddr_in6 *sin6, *rin6; #endif struct thread *p = curthread; + char *s; if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; @@ -4376,12 +4385,17 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, *tl++ = txdr_unsigned(confirm.lval[0]); /* SequenceID */ *tl++ = txdr_unsigned(v41flags); /* Exch flags */ *tl++ = txdr_unsigned(NFSV4EXCH_SP4NONE); /* No SSV */ - owner_minor = 0; /* Owner */ - txdr_hyper(owner_minor, tl); /* Minor */ - (void)nfsm_strtom(nd, nd->nd_cred->cr_prison->pr_hostuuid, - strlen(nd->nd_cred->cr_prison->pr_hostuuid)); /* Major */ - (void)nfsm_strtom(nd, nd->nd_cred->cr_prison->pr_hostuuid, - strlen(nd->nd_cred->cr_prison->pr_hostuuid)); /* Scope */ + txdr_hyper(nfsrv_owner_minor, tl); /* Owner Minor */ + if (nfsrv_owner_major[0] != 0) + s = nfsrv_owner_major; + else + s = nd->nd_cred->cr_prison->pr_hostuuid; + nfsm_strtom(nd, s, strlen(s)); /* Owner Major */ + if (nfsrv_scope[0] != 0) + s = nfsrv_scope; + else + s = nd->nd_cred->cr_prison->pr_hostuuid; + nfsm_strtom(nd, s, strlen(s) ); /* Scope */ NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(1); (void)nfsm_strtom(nd, "freebsd.org", strlen("freebsd.org")); From owner-dev-commits-src-all@freebsd.org Tue Sep 28 00:41:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 044A16738A3 for ; Tue, 28 Sep 2021 00:41:56 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJLLC6bLZz3J6f for ; Tue, 28 Sep 2021 00:41:55 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f48.google.com with SMTP id b192so1976001wmb.2 for ; Mon, 27 Sep 2021 17:41:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=K69RWyW5Qg3EE9s3ByFGM2CuIrjDZD4vZJSeNDZWrng=; b=UjZJK4A0V3y1GEPxnL3+N5bUH+1S9xSguxRNfdYLSCwhvLh+HnFhgjgF/14J0Dr8uH CkHlTnli2wws/kWQe8sI4LqkwAW/EM0oWc4yqmfjdxbPsIziJERHwhDdih8lWxjdld14 wucemVdYGzRA+pxIjnP3kEWDq7ESx3/ZOrwW+ZUAIxDMpjqtTZ+BIxZBBUVhzKN9D6TS Vi3yvpaENp0tU6tK7knBobbKDvIm65E38T1A9yoUuc5kzAh5cHeA3Y8EYvJ5HpybQYJN YSX5YyqqXIWZBMR+i7EGmzoO4TuRc3LskOc0rgW+ZYDrntBo0m1flCi/s3TXwIXiLgdc 7azQ== X-Gm-Message-State: AOAM531WX/IRJ1sgunWHrEl7oHHKeiG65C1ms10UvUccOg8U0lannuaa IUSHQsMdFnTb8RALVQLCwuGl2w== X-Google-Smtp-Source: ABdhPJwv3ZsCHHD4rdNf6zonY4DcNpBubUog72EIM+46afjxb8Y3Xer9QIdeMlI3NrCzQcnIT3HoTQ== X-Received: by 2002:a1c:ac03:: with SMTP id v3mr1969414wme.127.1632789714900; Mon, 27 Sep 2021 17:41:54 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id d70sm970950wmd.3.2021.09.27.17.41.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Sep 2021 17:41:54 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: c6f3076d4405 - main - Move the GICv2m msi handling to the parent From: Jessica Clarke In-Reply-To: Date: Tue, 28 Sep 2021 01:41:53 +0100 Cc: Andrew Turner , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <57F5F872-08A5-45D0-AD47-C0F39B0FDFD9@freebsd.org> References: <202109141042.18EAgYCI041614@gitrepo.freebsd.org> To: Marcin Wojtas X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HJLLC6bLZz3J6f X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 00:41:56 -0000 On 28 Sep 2021, at 01:32, Marcin Wojtas wrote: >=20 > Hi Andrew, >=20 >=20 > wt., 14 wrz 2021 o 12:42 Andrew Turner = napisa=C5=82(a): >>=20 >> The branch main has been updated by andrew: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dc6f3076d44055f7b02467ce074210f73= d0ce0ef6 >>=20 >> commit c6f3076d44055f7b02467ce074210f73d0ce0ef6 >> Author: Andrew Turner >> AuthorDate: 2021-09-01 09:39:01 +0000 >> Commit: Andrew Turner >> CommitDate: 2021-09-14 07:24:52 +0000 >>=20 >> Move the GICv2m msi handling to the parent >>=20 >> This is in preperation for adding support for the GICv2m driver as = a >> child of the GICv3 driver. >>=20 >> PR: 258136 >> Reported by: trasz >> Sponsored by: The FreeBSD Foundation >> Differential Revision: https://reviews.freebsd.org/D31767 >> --- >> sys/arm/arm/gic.c | 296 = ++++++++++++++++++++++++++++++----------------- >> sys/arm/arm/gic.h | 8 +- >> sys/arm/arm/gic_common.h | 4 + >> 3 files changed, 195 insertions(+), 113 deletions(-) >>=20 >> diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c >> index 1851e69644ed..bd34e92b9e28 100644 >> --- a/sys/arm/arm/gic.c >> +++ b/sys/arm/arm/gic.c >> @@ -501,6 +501,56 @@ arm_gic_read_ivar(device_t dev, device_t child, = int which, uintptr_t *result) >> ("arm_gic_read_ivar: Invalid bus type %u", = sc->gic_bus)); >> *result =3D sc->gic_bus; >> return (0); >> + case GIC_IVAR_MBI_START: >> + *result =3D sc->sc_spi_start; >> + return (0); >> + case GIC_IVAR_MBI_COUNT: >> + *result =3D sc->sc_spi_count; >> + return (0); >> + } >> + >> + return (ENOENT); >> +} >> + >> +static int >> +arm_gic_write_ivar(device_t dev, device_t child, int which, = uintptr_t value) >> +{ >> + struct arm_gic_softc *sc; >> + >> + sc =3D device_get_softc(dev); >> + >> + switch(which) { >> + case GIC_IVAR_HW_REV: >> + case GIC_IVAR_BUS: >> + return (EINVAL); >> + case GIC_IVAR_MBI_START: >> + /* >> + * GIC_IVAR_MBI_START must be set once and first. = This allows >> + * us to reserve the registers when = GIC_IVAR_MBI_COUNT is set. >> + */ >> + MPASS(sc->sc_spi_start =3D=3D 0); >> + MPASS(sc->sc_spi_count =3D=3D 0); >=20 > This patch breaks GICv2m on all Marvell Armada 7k8k and CN913x. After > reverting it works as expected. I tried removing the above 2 asserts + > the one in line 540 - instead of init it fails later, during PCIE > endpoint msix configuration: >=20 > em0: Using 1024 TX descriptors and 1024 RX descriptors > em0: Using 2 RX queues 2 TX queues > panic: mtx_lock() of spin mutex GIC lock @ > /home/mw/current/sys/arm/arm/gic.c:1145 > cpuid =3D 0 > time =3D 1 > KDB: stack backtrace: > db_trace_self() at db_trace_self > db_trace_self_wrapper() at db_trace_self_wrapper+0x30 > vpanic() at vpanic+0x184 > panic() at panic+0x44 > __mtx_lock_flags() at __mtx_lock_flags+0x1a8 > arm_gic_alloc_msix() at arm_gic_alloc_msix+0x40 > intr_alloc_msix() at intr_alloc_msix+0x190 > generic_pcie_acpi_alloc_msix() at generic_pcie_acpi_alloc_msix+0x78 > pci_alloc_msix_method() at pci_alloc_msix_method+0x1a8 > iflib_device_register() at iflib_device_register+0xae4 > iflib_device_attach() at iflib_device_attach+0xd0 > device_attach() at device_attach+0x410 > device_probe_and_attach() at device_probe_and_attach+0x7c > bus_generic_attach() at bus_generic_attach+0x18 > pci_attach() at pci_attach+0xe8 > device_attach() at device_attach+0x410 > device_probe_and_attach() at device_probe_and_attach+0x7c > bus_generic_attach() at bus_generic_attach+0x18 > device_attach() at device_attach+0x410 > device_probe_and_attach() at device_probe_and_attach+0x7c > bus_generic_new_pass() at bus_generic_new_pass+0xec > bus_generic_new_pass() at bus_generic_new_pass+0xd0 > bus_generic_new_pass() at bus_generic_new_pass+0xd0 > bus_set_pass() at bus_set_pass+0x8c > mi_startup() at mi_startup+0x12c > virtdone() at virtdone+0x6c > KDB: enter: panic > [ thread pid 0 tid 100000 ] > Stopped at kdb_enter+0x44: undefined f900c11f >=20 > Any ideas? Change all the mtx_(un)lock(&sc->mutex) to be the _spin versions. Jess From owner-dev-commits-src-all@freebsd.org Tue Sep 28 03:05:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C02D675584; Tue, 28 Sep 2021 03:05: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 4HJPWT3FcKz3hR8; Tue, 28 Sep 2021 03:05:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 457111C779; Tue, 28 Sep 2021 03:05: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 18S359xO029010; Tue, 28 Sep 2021 03:05:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S359dk029009; Tue, 28 Sep 2021 03:05:09 GMT (envelope-from git) Date: Tue, 28 Sep 2021 03:05:09 GMT Message-Id: <202109280305.18S359dk029009@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 1c8d670cb633 - main - Bring the tags and links entries for amd64 up to date. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c8d670cb633d39cea68cdeecab507d2ee264705 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 03:05:09 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=1c8d670cb633d39cea68cdeecab507d2ee264705 commit 1c8d670cb633d39cea68cdeecab507d2ee264705 Author: Kirk McKusick AuthorDate: 2021-09-23 23:38:37 +0000 Commit: Kirk McKusick CommitDate: 2021-09-28 03:04:51 +0000 Bring the tags and links entries for amd64 up to date. MFC after: 1 week Sponsored by: Netflix --- sys/amd64/Makefile | 8 +++++--- sys/kern/Make.tags.inc | 6 ------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/sys/amd64/Makefile b/sys/amd64/Makefile index 2e87b95895e7..0f1367f859f2 100644 --- a/sys/amd64/Makefile +++ b/sys/amd64/Makefile @@ -14,7 +14,7 @@ all: @echo "make links or tags only" # Directories in which to place amd64 tags links -DAMD64= acpica amd64 ia32 include linux linux32 pci vmm +DAMD64= acpica amd64 ia32 include linux linux32 pci sgx vmm links:: -for i in ${COMMDIR1}; do \ @@ -22,13 +22,13 @@ links:: -for i in ${COMMDIR2}; do \ (cd $$i && { rm -f tags; ln -s ../../${TAGDIR}/tags tags; }) done -for i in ${DAMD64}; do \ - (cd $$i && { rm -f tags; ln -s ../tags tags; }) done + (cd ${SYS}/amd64/$$i && { rm -f tags; ln -s ../tags tags; }) done SAMD64= ${SYS}/amd64/acpica/*.[ch] \ ${SYS}/amd64/amd64/*.[ch] ${SYS}/amd64/ia32/*.[ch] \ ${SYS}/amd64/include/*.[ch] ${SYS}/amd64/linux/*.[ch] \ ${SYS}/amd64/linux32/*.[ch] ${SYS}/amd64/pci/*.[ch] \ - ${SYS}/amd64/vmm/*.[ch] + ${SYS}/amd64/sgx/*.[ch] ${SYS}/amd64/vmm/*.[ch] AAMD64= ${SYS}/amd64/amd64/*.S tags:: @@ -38,3 +38,5 @@ tags:: >> tags sort -o tags tags chmod 444 tags + rm -f ${SYS}/amd64/tags + mv tags ${SYS}/amd64/tags diff --git a/sys/kern/Make.tags.inc b/sys/kern/Make.tags.inc index cdefa98a32f6..23a85150c19a 100644 --- a/sys/kern/Make.tags.inc +++ b/sys/kern/Make.tags.inc @@ -12,12 +12,10 @@ SYS?= ${.CURDIR}/.. COMM= ${SYS}/sys/vnode.h \ ${SYS}/dev/alc/*.[ch] \ - ${SYS}/dev/en/*.[ch] \ ${SYS}/dev/iicbus/*.[ch] \ ${SYS}/dev/isp/*.[ch] \ ${SYS}/dev/ppbus/*.[ch] \ ${SYS}/dev/smbus/*.[ch] \ - ${SYS}/dev/vx/*.[ch] \ ${SYS}/fs/autofs/*.[ch] \ ${SYS}/fs/cd9660/*.[ch] \ ${SYS}/fs/cuse/*.[ch] \ @@ -44,7 +42,6 @@ COMM= ${SYS}/sys/vnode.h \ ${SYS}/netinet/*.[ch] \ ${SYS}/netinet6/*.[ch] \ ${SYS}/netipsec/*.[ch] \ - ${SYS}/netnatm/*.[ch] \ ${SYS}/ddb/*.[ch] \ ${SYS}/ufs/ffs/*.[ch] \ ${SYS}/ufs/ufs/*.[ch] \ @@ -58,19 +55,16 @@ COMMDIR1= ${SYS}/conf \ ${SYS}/netinet \ ${SYS}/netinet6 \ ${SYS}/netipsec \ - ${SYS}/netnatm \ ${SYS}/ddb \ ${SYS}/vm \ ${SYS}/sys COMMDIR2= ${SYS}/dev/alc \ - ${SYS}/dev/en \ ${SYS}/dev/iicbus \ ${SYS}/dev/isp \ ${SYS}/dev/md \ ${SYS}/dev/ppbus \ ${SYS}/dev/smbus \ - ${SYS}/dev/vx \ ${SYS}/fs/autofs \ ${SYS}/fs/cd9660 \ ${SYS}/fs/cuse \ From owner-dev-commits-src-all@freebsd.org Tue Sep 28 03:05:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBD646756FE; Tue, 28 Sep 2021 03:05: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 4HJPWV4rGFz3hWh; Tue, 28 Sep 2021 03:05:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72D0D1CCFA; Tue, 28 Sep 2021 03:05: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 18S35AGS029034; Tue, 28 Sep 2021 03:05:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S35AmF029033; Tue, 28 Sep 2021 03:05:10 GMT (envelope-from git) Date: Tue, 28 Sep 2021 03:05:10 GMT Message-Id: <202109280305.18S35AmF029033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 4a365e863f20 - main - Avoid "consumer not attached in g_io_request" panic when disk lost while using a UFS snapshot. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a365e863f209b0c82641c909a858dab53b19134 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 03:05:10 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=4a365e863f209b0c82641c909a858dab53b19134 commit 4a365e863f209b0c82641c909a858dab53b19134 Author: Kirk McKusick AuthorDate: 2021-09-28 03:03:43 +0000 Commit: Kirk McKusick CommitDate: 2021-09-28 03:04:51 +0000 Avoid "consumer not attached in g_io_request" panic when disk lost while using a UFS snapshot. The UFS filesystem supports snapshots. Each snapshot is a file whose contents are a frozen image of the disk partition on which the filesystem resides. Each time an existing block in the filesystem is modified, the filesystem checks whether that block was in use at the time that the snapshot was taken. If so, and if it has not already been copied, a new block is allocated from among the blocks that were not in use at the time that the snapshot was taken and placed in the snapshot file to replace the entry that has not yet been copied. The previous contents of the block are copied to the newly allocated snapshot file block, and the write to the original is then allowed to proceed. The block allocation is done using the usual UFS_BALLOC() routine which allocates the needed block in the snapshot and returns a buffer that is set up to write data into the newly allocated block. In usual filesystem operation, the contents for the new block is copied from user space into the buffer and the buffer is then written to the file using bwrite(), bawrite(), or bdwrite(). In the case of a snapshot the new block must be filled from the disk block that is about to be rewritten. The snapshot routine has a function readblock() that it uses to read the `about to be rewritten' disk block. /* * Read the specified block into the given buffer. */ static int readblock(snapvp, bp, lbn) struct vnode *snapvp; struct buf *bp; ufs2_daddr_t lbn; { struct inode *ip; struct bio *bip; struct fs *fs; ip = VTOI(snapvp); fs = ITOFS(ip); bip = g_alloc_bio(); bip->bio_cmd = BIO_READ; bip->bio_offset = dbtob(fsbtodb(fs, blkstofrags(fs, lbn))); bip->bio_data = bp->b_data; bip->bio_length = bp->b_bcount; bip->bio_done = NULL; g_io_request(bip, ITODEVVP(ip)->v_bufobj.bo_private); bp->b_error = biowait(bip, "snaprdb"); g_destroy_bio(bip); return (bp->b_error); } When the underlying disk fails, its GEOM module is removed. Subsequent attempts to access it should return the ENXIO error. The functionality of checking for the lost disk and returning ENXIO is handled by the g_vfs_strategy() routine: void g_vfs_strategy(struct bufobj *bo, struct buf *bp) { struct g_vfs_softc *sc; struct g_consumer *cp; struct bio *bip; cp = bo->bo_private; sc = cp->geom->softc; /* * If the provider has orphaned us, just return ENXIO. */ mtx_lock(&sc->sc_mtx); if (sc->sc_orphaned || sc->sc_enxio_active) { mtx_unlock(&sc->sc_mtx); bp->b_error = ENXIO; bp->b_ioflags |= BIO_ERROR; bufdone(bp); return; } sc->sc_active++; mtx_unlock(&sc->sc_mtx); bip = g_alloc_bio(); bip->bio_cmd = bp->b_iocmd; bip->bio_offset = bp->b_iooffset; bip->bio_length = bp->b_bcount; bdata2bio(bp, bip); if ((bp->b_flags & B_BARRIER) != 0) { bip->bio_flags |= BIO_ORDERED; bp->b_flags &= ~B_BARRIER; } if (bp->b_iocmd == BIO_SPEEDUP) bip->bio_flags |= bp->b_ioflags; bip->bio_done = g_vfs_done; bip->bio_caller2 = bp; g_io_request(bip, cp); } Only after checking that the device is present does it construct the "bio" request and call g_io_request(). When readblock() constructs its own "bio" request and calls g_io_request() directly it panics with "consumer not attached in g_io_request" when the underlying device no longer exists. The fix is to have readblock() call g_vfs_strategy() rather than constructing its own "bio" request: /* * Read the specified block into the given buffer. */ static int readblock(snapvp, bp, lbn) struct vnode *snapvp; struct buf *bp; ufs2_daddr_t lbn; { struct inode *ip; struct fs *fs; ip = VTOI(snapvp); fs = ITOFS(ip); bp->b_iocmd = BIO_READ; bp->b_iooffset = dbtob(fsbtodb(fs, blkstofrags(fs, lbn))); bp->b_iodone = bdone; g_vfs_strategy(&ITODEVVP(ip)->v_bufobj, bp); bufwait(bp); return (bp->b_error); } Here it uses the buffer that will eventually be written to the disk. The g_vfs_strategy() routine uses four parts of the buffer: b_bcount, b_iocmd, b_iooffset, and b_data. The b_bcount field is already correctly set for the buffer. It is safe to set the b_iocmd and b_iooffset fields as they are set correctly when the later write is done. The write path will also clear the B_DONE flag that our use of the buffer will set. The b_iodone callback has to be set to bdone() which will do just notification that the I/O is done in bufdone(). The rest of bufdone() includes things like processing the softdeps associated with the buffer should not be done until the buffer has been written. Bufdone() will set b_iodone back to NULL after using it, so the full bufdone() processing will be done when the buffer is written. The final change from the previous version of readblock() is that it used the b_data for the destination of the read while g_vfs_strategy() uses the bdata2bio() function to take advantage of VMIO when it is available. Differential revision: https://reviews.freebsd.org/D32150 Reviewed by: kib, chs MFC after: 1 week Sponsored by: Netflix --- sys/ufs/ffs/ffs_snapshot.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index baad50cab2ba..5855a679ab84 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -2554,22 +2555,16 @@ readblock(vp, bp, lbn) ufs2_daddr_t lbn; { struct inode *ip; - struct bio *bip; struct fs *fs; ip = VTOI(vp); fs = ITOFS(ip); - bip = g_alloc_bio(); - bip->bio_cmd = BIO_READ; - bip->bio_offset = dbtob(fsbtodb(fs, blkstofrags(fs, lbn))); - bip->bio_data = bp->b_data; - bip->bio_length = bp->b_bcount; - bip->bio_done = NULL; - - g_io_request(bip, ITODEVVP(ip)->v_bufobj.bo_private); - bp->b_error = biowait(bip, "snaprdb"); - g_destroy_bio(bip); + bp->b_iocmd = BIO_READ; + bp->b_iooffset = dbtob(fsbtodb(fs, blkstofrags(fs, lbn))); + bp->b_iodone = bdone; + g_vfs_strategy(&ITODEVVP(ip)->v_bufobj, bp); + bufwait(bp); return (bp->b_error); } From owner-dev-commits-src-all@freebsd.org Tue Sep 28 03:15:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 311946757B1; Tue, 28 Sep 2021 03:15: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 4HJPl30dtrz3j3w; Tue, 28 Sep 2021 03:15:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA6D91CEBB; Tue, 28 Sep 2021 03:15: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 18S3FArA042799; Tue, 28 Sep 2021 03:15:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S3FA8n042798; Tue, 28 Sep 2021 03:15:10 GMT (envelope-from git) Date: Tue, 28 Sep 2021 03:15:10 GMT Message-Id: <202109280315.18S3FA8n042798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 5c6b3e4b5dfa - stable/13 - Eliminate snaplk / bufwait LOR when creating UFS snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5c6b3e4b5dfa554e7e6eb246481e654402de1ca0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 03:15:11 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=5c6b3e4b5dfa554e7e6eb246481e654402de1ca0 commit 5c6b3e4b5dfa554e7e6eb246481e654402de1ca0 Author: Kirk McKusick AuthorDate: 2021-09-18 23:51:07 +0000 Commit: Kirk McKusick CommitDate: 2021-09-28 03:13:38 +0000 Eliminate snaplk / bufwait LOR when creating UFS snapshots (cherry picked from commit d7770a5495b19a987dddc77cabcdeadf18413b4d) --- sys/ufs/ffs/ffs_snapshot.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 6da84fb46bb0..baad50cab2ba 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -650,6 +650,27 @@ loop: BLK_NOCOPY, 0); vput(xvp); } + /* + * Preallocate all the direct blocks in the snapshot inode so + * that we never have to write the inode itself to commit an + * update to the contents of the snapshot. Note that once + * created, the size of the snapshot will never change, so + * there will never be a need to write the inode except to + * update the non-integrity-critical time fields and + * allocated-block count. + */ + for (blockno = 0; blockno < UFS_NDADDR; blockno++) { + if (DIP(ip, i_db[blockno]) != 0) + continue; + error = UFS_BALLOC(vp, lblktosize(fs, blockno), + fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); + if (error) + goto resumefs; + error = readblock(vp, bp, blockno); + bawrite(bp); + if (error != 0) + goto resumefs; + } /* * Acquire a lock on the snapdata structure, creating it if necessary. */ @@ -691,27 +712,6 @@ loop: sn->sn_listsize = blkp - snapblklist; VI_UNLOCK(devvp); } - /* - * Preallocate all the direct blocks in the snapshot inode so - * that we never have to write the inode itself to commit an - * update to the contents of the snapshot. Note that once - * created, the size of the snapshot will never change, so - * there will never be a need to write the inode except to - * update the non-integrity-critical time fields and - * allocated-block count. - */ - for (blockno = 0; blockno < UFS_NDADDR; blockno++) { - if (DIP(ip, i_db[blockno]) != 0) - continue; - error = UFS_BALLOC(vp, lblktosize(fs, blockno), - fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); - if (error) - goto resumefs; - error = readblock(vp, bp, blockno); - bawrite(bp); - if (error != 0) - goto resumefs; - } /* * Record snapshot inode. Since this is the newest snapshot, * it must be placed at the end of the list. From owner-dev-commits-src-all@freebsd.org Tue Sep 28 06:56:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5237E678147; Tue, 28 Sep 2021 06:56: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 4HJVfL1mjGz4WPD; Tue, 28 Sep 2021 06:56:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C7201F779; Tue, 28 Sep 2021 06:56: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 18S6uQnT035764; Tue, 28 Sep 2021 06:56:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S6uPZ5035763; Tue, 28 Sep 2021 06:56:25 GMT (envelope-from git) Date: Tue, 28 Sep 2021 06:56:25 GMT Message-Id: <202109280656.18S6uPZ5035763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 45d6fbaec23e - main - cxgbe(4): Update firmwares to 1.26.2.0. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45d6fbaec23eee457197a14517e715c947114d99 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 06:56:26 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=45d6fbaec23eee457197a14517e715c947114d99 commit 45d6fbaec23eee457197a14517e715c947114d99 Author: Navdeep Parhar AuthorDate: 2021-09-27 23:45:56 +0000 Commit: Navdeep Parhar CommitDate: 2021-09-28 06:52:51 +0000 cxgbe(4): Update firmwares to 1.26.2.0. The firmwares and the following changelog are from the "Chelsio Unified Wire v3.15.0.0 for Linux." Version : 1.26.2.0 Date : 09/24/2021 ==================== FIXES ----- BASE: - Added support for SFP+ RJ45 (0x1C). - Fixing backward compatibility issue with older drivers when multiple speeds are passed to firmware. OFLD: - Do not touch tp_plen_max if driver is supplying tp_plen_max. This fixes a connection reset issue in iscsi. ENHANCEMENTS ------------ BASE: - Firmware header modified to add firmware binary signature. MFC after: 1 month Sponsored by: Chelsio Communications --- sys/conf/files | 6 +++--- .../{t4fw-1.26.0.0.bin => t4fw-1.26.2.0.bin} | Bin 570368 -> 570368 bytes sys/dev/cxgbe/firmware/t4fw_interface.h | 12 ++++++++---- .../{t5fw-1.26.0.0.bin => t5fw-1.26.2.0.bin} | Bin 675840 -> 676352 bytes .../{t6fw-1.26.0.0.bin => t6fw-1.26.2.0.bin} | Bin 729088 -> 729088 bytes sys/modules/cxgbe/t4_firmware/Makefile | 2 +- sys/modules/cxgbe/t5_firmware/Makefile | 2 +- sys/modules/cxgbe/t6_firmware/Makefile | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index be8acb32d14c..eaf356d8dce4 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1495,7 +1495,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.26.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.26.2.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1529,7 +1529,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule \ clean "t5fw.fwo" t5fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.26.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.26.2.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1563,7 +1563,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule \ clean "t6fw.fwo" t6fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.26.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.26.2.0.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" diff --git a/sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin b/sys/dev/cxgbe/firmware/t4fw-1.26.2.0.bin similarity index 57% rename from sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin rename to sys/dev/cxgbe/firmware/t4fw-1.26.2.0.bin index 04e96d16c57a..a8f611628dcc 100644 Binary files a/sys/dev/cxgbe/firmware/t4fw-1.26.0.0.bin and b/sys/dev/cxgbe/firmware/t4fw-1.26.2.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h index acb7a6481d9c..876fd61b4b21 100644 --- a/sys/dev/cxgbe/firmware/t4fw_interface.h +++ b/sys/dev/cxgbe/firmware/t4fw_interface.h @@ -9952,7 +9952,10 @@ struct fw_hdr { __u32 reserved3; __be32 magic; /* runtime or bootstrap fw */ __be32 flags; - __be32 reserved6[23]; + __be32 reserved6[4]; + __u8 reserved7[3]; + __u8 dsign_len; + __u8 dsign[72]; /* fw binary digital signature */ }; enum fw_hdr_chip { @@ -9992,17 +9995,17 @@ enum fw_hdr_chip { enum { T4FW_VERSION_MAJOR = 1, T4FW_VERSION_MINOR = 26, - T4FW_VERSION_MICRO = 0, + T4FW_VERSION_MICRO = 2, T4FW_VERSION_BUILD = 0, T5FW_VERSION_MAJOR = 1, T5FW_VERSION_MINOR = 26, - T5FW_VERSION_MICRO = 0, + T5FW_VERSION_MICRO = 2, T5FW_VERSION_BUILD = 0, T6FW_VERSION_MAJOR = 1, T6FW_VERSION_MINOR = 26, - T6FW_VERSION_MICRO = 0, + T6FW_VERSION_MICRO = 2, T6FW_VERSION_BUILD = 0, }; @@ -10052,6 +10055,7 @@ enum { enum fw_hdr_flags { FW_HDR_FLAGS_RESET_HALT = 0x00000001, + FW_HDR_FLAGS_SIGNED_FW = 0x00000002, }; /* diff --git a/sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin b/sys/dev/cxgbe/firmware/t5fw-1.26.2.0.bin similarity index 55% rename from sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin rename to sys/dev/cxgbe/firmware/t5fw-1.26.2.0.bin index f72bd502ea1f..b11d6d0bf49f 100644 Binary files a/sys/dev/cxgbe/firmware/t5fw-1.26.0.0.bin and b/sys/dev/cxgbe/firmware/t5fw-1.26.2.0.bin differ diff --git a/sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin b/sys/dev/cxgbe/firmware/t6fw-1.26.2.0.bin similarity index 61% rename from sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin rename to sys/dev/cxgbe/firmware/t6fw-1.26.2.0.bin index ee4341d5074f..f43d9953a7a4 100644 Binary files a/sys/dev/cxgbe/firmware/t6fw-1.26.0.0.bin and b/sys/dev/cxgbe/firmware/t6fw-1.26.2.0.bin differ diff --git a/sys/modules/cxgbe/t4_firmware/Makefile b/sys/modules/cxgbe/t4_firmware/Makefile index a202c5d2a6a0..e525edf96ce2 100644 --- a/sys/modules/cxgbe/t4_firmware/Makefile +++ b/sys/modules/cxgbe/t4_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.26.0.0 +T4FW_VER= 1.26.2.0 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include diff --git a/sys/modules/cxgbe/t5_firmware/Makefile b/sys/modules/cxgbe/t5_firmware/Makefile index 371df89f233b..74e89e4174b5 100644 --- a/sys/modules/cxgbe/t5_firmware/Makefile +++ b/sys/modules/cxgbe/t5_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T5FW_VER= 1.26.0.0 +T5FW_VER= 1.26.2.0 FIRMWS+= t5fw-${T5FW_VER}.bin:t5fw:${T5FW_VER} .include diff --git a/sys/modules/cxgbe/t6_firmware/Makefile b/sys/modules/cxgbe/t6_firmware/Makefile index 074c3991bc37..2ea01e7b776a 100644 --- a/sys/modules/cxgbe/t6_firmware/Makefile +++ b/sys/modules/cxgbe/t6_firmware/Makefile @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T6FW_VER= 1.26.0.0 +T6FW_VER= 1.26.2.0 FIRMWS+= t6fw-${T6FW_VER}.bin:t6fw:${T6FW_VER} .include From owner-dev-commits-src-all@freebsd.org Tue Sep 28 07:33:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24DD1678776; Tue, 28 Sep 2021 07:33: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 4HJWTJ0WKYz4ZFG; Tue, 28 Sep 2021 07:33:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E600A20375; Tue, 28 Sep 2021 07:33: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 18S7XdM3089293; Tue, 28 Sep 2021 07:33:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S7XdFp089292; Tue, 28 Sep 2021 07:33:39 GMT (envelope-from git) Date: Tue, 28 Sep 2021 07:33:39 GMT Message-Id: <202109280733.18S7XdFp089292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wojciech Macek Subject: git: fea962297f1f - stable/13 - umodem: Add Huawei E3372h-320 device id MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fea962297f1f26d49885845ad36590ca6bcfbe3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 07:33:40 -0000 The branch stable/13 has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=fea962297f1f26d49885845ad36590ca6bcfbe3e commit fea962297f1f26d49885845ad36590ca6bcfbe3e Author: Kornel Duleba AuthorDate: 2021-08-31 06:44:36 +0000 Commit: Wojciech Macek CommitDate: 2021-09-28 07:03:48 +0000 umodem: Add Huawei E3372h-320 device id After switching the dongle to the Huawei alternate mode(modem mode) with usb_modeswitch the serial interfaces had all of their ids set to 0xFF. After modifying umodem to work with that it attached successfully and I've managed to configure device with standard AT commands to get internet connection. (cherry picked from commit 28d549826844b89224f0335b6318eb277031ea78) --- sys/dev/usb/serial/umodem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c index 573d74cdb526..4fa108e962f2 100644 --- a/sys/dev/usb/serial/umodem.c +++ b/sys/dev/usb/serial/umodem.c @@ -146,6 +146,8 @@ static const STRUCT_USB_HOST_ID umodem_host_devs[] = { {USB_VENDOR(USB_VENDOR_HUAWEI),USB_IFACE_CLASS(UICLASS_CDC), USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL), USB_IFACE_PROTOCOL(0xFF)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(0xFF), + USB_IFACE_SUBCLASS(0xF), USB_IFACE_PROTOCOL(0xFF)}, /* Kyocera AH-K3001V */ {USB_VPI(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_AHK3001V, 1)}, {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720, 1)}, From owner-dev-commits-src-all@freebsd.org Tue Sep 28 07:33:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AFEF678562; Tue, 28 Sep 2021 07:33: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 4HJWTK1n7tz4Z9t; Tue, 28 Sep 2021 07:33:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 160E0208FF; Tue, 28 Sep 2021 07:33: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 18S7Xfbn089317; Tue, 28 Sep 2021 07:33:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S7XfmK089316; Tue, 28 Sep 2021 07:33:41 GMT (envelope-from git) Date: Tue, 28 Sep 2021 07:33:41 GMT Message-Id: <202109280733.18S7XfmK089316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wojciech Macek Subject: git: 973fb85188ea - stable/13 - Add support for link status, media and VLAN MTU (if supported) to if_cdce... MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 973fb85188eaf6ee9f8a2d0265c0d666ce7f19e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 07:33:41 -0000 The branch stable/13 has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=973fb85188eaf6ee9f8a2d0265c0d666ce7f19e3 commit 973fb85188eaf6ee9f8a2d0265c0d666ce7f19e3 Author: John-Mark Gurney AuthorDate: 2021-06-26 00:47:02 +0000 Commit: Wojciech Macek CommitDate: 2021-09-28 07:03:48 +0000 Add support for link status, media and VLAN MTU (if supported) to if_cdce... This makes it more usable in that dhclient will autolaunch from devd now when cdce devices are plugged in.. It also sets the baudrate, but this isn't exported via tools, and CDCE doesn't have a good way to specify the media type, so there isn't a good way to tell userland what the speed is currently... Reviewed by: hps Relnotes: yes Differential Revision: https://reviews.freebsd.org/D30625 (cherry picked from commit b43d600c839a9a4d66139c93506e26128370ed7c) --- sys/dev/usb/net/if_cdce.c | 152 +++++++++++++++++++++++++++++++++++++++++-- sys/dev/usb/net/if_cdcereg.h | 3 + 2 files changed, 150 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index 96df8b73f8ce..64c31896d417 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -111,6 +111,10 @@ static uether_fn_t cdce_stop; static uether_fn_t cdce_start; static uether_fn_t cdce_setmulti; static uether_fn_t cdce_setpromisc; +static int cdce_attach_post_sub(struct usb_ether *); +static int cdce_ioctl(struct ifnet *, u_long, caddr_t); +static int cdce_media_change_cb(struct ifnet *); +static void cdce_media_status_cb(struct ifnet *, struct ifmediareq *); static uint32_t cdce_m_crc32(struct mbuf *, uint32_t, uint32_t); @@ -124,6 +128,8 @@ SYSCTL_INT(_hw_usb_cdce, OID_AUTO, debug, CTLFLAG_RWTUN, &cdce_debug, 0, "Debug level"); SYSCTL_INT(_hw_usb_cdce, OID_AUTO, interval, CTLFLAG_RWTUN, &cdce_tx_interval, 0, "NCM transmit interval in ms"); +#else +#define cdce_debug 0 #endif static const struct usb_config cdce_config[CDCE_N_TRANSFER] = { @@ -307,6 +313,7 @@ USB_PNP_DUAL_INFO(cdce_dual_devs); static const struct usb_ether_methods cdce_ue_methods = { .ue_attach_post = cdce_attach_post, + .ue_attach_post_sub = cdce_attach_post_sub, .ue_start = cdce_start, .ue_init = cdce_init, .ue_stop = cdce_stop, @@ -560,6 +567,36 @@ cdce_attach_post(struct usb_ether *ue) return; } +static int +cdce_attach_post_sub(struct usb_ether *ue) +{ + struct cdce_softc *sc = uether_getsc(ue); + struct ifnet *ifp = uether_getifp(ue); + + /* mostly copied from usb_ethernet.c */ + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_start = uether_start; + ifp->if_ioctl = cdce_ioctl; + ifp->if_init = uether_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + if ((sc->sc_flags & CDCE_FLAG_VLAN) == CDCE_FLAG_VLAN) + if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0); + + if_setcapabilitiesbit(ifp, IFCAP_LINKSTATE, 0); + if_setcapenable(ifp, if_getcapabilities(ifp)); + + ifmedia_init(&sc->sc_media, IFM_IMASK, cdce_media_change_cb, + cdce_media_status_cb); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); + sc->sc_media.ifm_media = sc->sc_media.ifm_cur->ifm_media; + + return 0; +} + static int cdce_attach(device_t dev) { @@ -676,6 +713,14 @@ alloc_transfers: eaddr_str, sizeof(eaddr_str), ued->iMacAddress); } + /* + * ECM 1.2 doesn't say it excludes the CRC, but states that it's + * normally 1514, which excludes the CRC. + */ + DPRINTF("max segsize: %d\n", UGETW(ued->wMaxSegmentSize)); + if (UGETW(ued->wMaxSegmentSize) >= (ETHER_MAX_LEN - ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN)) + sc->sc_flags |= CDCE_FLAG_VLAN; + if (error) { /* fake MAC address */ @@ -742,6 +787,8 @@ cdce_detach(device_t dev) uether_ifdetach(ue); mtx_destroy(&sc->sc_mtx); + ifmedia_removeall(&sc->sc_media); + return (0); } @@ -757,6 +804,29 @@ cdce_start(struct usb_ether *ue) usbd_transfer_start(sc->sc_xfer[CDCE_BULK_RX]); } +static int +cdce_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct usb_ether *ue = ifp->if_softc; + struct cdce_softc *sc = uether_getsc(ue); + struct ifreq *ifr = (struct ifreq *)data; + int error; + + error = 0; + + switch(command) { + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, command); + break; + default: + error = uether_ioctl(ifp, command, data); + break; + } + + return (error); +} + static void cdce_free_queue(struct mbuf **ppm, uint8_t n) { @@ -769,6 +839,26 @@ cdce_free_queue(struct mbuf **ppm, uint8_t n) } } +static int +cdce_media_change_cb(struct ifnet *ifp) +{ + + return (EOPNOTSUPP); +} + +static void +cdce_media_status_cb(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + + if ((if_getflags(ifp) & IFF_UP) == 0) + return; + + ifmr->ifm_active = IFM_ETHER; + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_status |= + ifp->if_link_state == LINK_STATE_UP ? IFM_ACTIVE : 0; +} + static void cdce_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { @@ -1043,17 +1133,69 @@ tr_stall: static void cdce_intr_read_callback(struct usb_xfer *xfer, usb_error_t error) { - struct cdce_softc *sc = usbd_xfer_softc(xfer); - int actlen; + u_char buf[CDCE_IND_SIZE_MAX]; + struct usb_cdc_notification ucn; + struct cdce_softc *sc; + struct ifnet *ifp; + struct usb_page_cache *pc; + int off, actlen; + uint32_t downrate, uprate; + + sc = usbd_xfer_softc(xfer); + ifp = uether_getifp(&sc->sc_ue); + pc = usbd_xfer_get_frame(xfer, 0); usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: + if (USB_DEBUG_VAR) + usbd_copy_out(pc, 0, buf, MIN(actlen, sizeof buf)); + DPRINTF("Received %d bytes: %*D\n", actlen, + (int)MIN(actlen, sizeof buf), buf, ""); + + off = 0; + while (actlen - off >= UCDC_NOTIFICATION_LENGTH) { + usbd_copy_out(pc, off, &ucn, UCDC_NOTIFICATION_LENGTH); + + do { + if (ucn.bmRequestType != 0xa1) + break; + + switch (ucn.bNotification) { + case UCDC_N_NETWORK_CONNECTION: + DPRINTF("changing link state: %d\n", + UGETW(ucn.wValue)); + if_link_state_change(ifp, + UGETW(ucn.wValue) ? LINK_STATE_UP : + LINK_STATE_DOWN); + break; + + case UCDC_N_CONNECTION_SPEED_CHANGE: + if (UGETW(ucn.wLength) != 8) + break; + + usbd_copy_out(pc, off + + UCDC_NOTIFICATION_LENGTH, + &ucn.data, UGETW(ucn.wLength)); + downrate = UGETDW(ucn.data); + uprate = UGETDW(ucn.data); + if (downrate != uprate) + break; + + /* set rate */ + DPRINTF("changing baudrate: %u\n", + downrate); + if_setbaudrate(ifp, downrate); + break; + + default: + break; + } + } while (0); - DPRINTF("Received %d bytes\n", actlen); - - /* TODO: decode some indications */ + off += UCDC_NOTIFICATION_LENGTH + UGETW(ucn.wLength); + } /* FALLTHROUGH */ case USB_ST_SETUP: diff --git a/sys/dev/usb/net/if_cdcereg.h b/sys/dev/usb/net/if_cdcereg.h index 26d037c593b8..724aa0b9b017 100644 --- a/sys/dev/usb/net/if_cdcereg.h +++ b/sys/dev/usb/net/if_cdcereg.h @@ -88,10 +88,13 @@ struct cdce_softc { struct mbuf *sc_rx_buf[CDCE_FRAMES_MAX]; struct mbuf *sc_tx_buf[CDCE_FRAMES_MAX]; + struct ifmedia sc_media; + int sc_flags; #define CDCE_FLAG_ZAURUS 0x0001 #define CDCE_FLAG_NO_UNION 0x0002 #define CDCE_FLAG_RX_DATA 0x0010 +#define CDCE_FLAG_VLAN 0x0020 uint8_t sc_eaddr_str_index; uint8_t sc_ifaces_index[2]; From owner-dev-commits-src-all@freebsd.org Tue Sep 28 07:33:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86CC767896C; Tue, 28 Sep 2021 07:33: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 4HJWTL2sNHz4ZFJ; Tue, 28 Sep 2021 07:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34C1220980; Tue, 28 Sep 2021 07:33: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 18S7XgXO089348; Tue, 28 Sep 2021 07:33:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S7Xgqx089346; Tue, 28 Sep 2021 07:33:42 GMT (envelope-from git) Date: Tue, 28 Sep 2021 07:33:42 GMT Message-Id: <202109280733.18S7Xgqx089346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wojciech Macek Subject: git: 87e560496fc1 - stable/13 - ued may be NULL here which will cause a panic... reproducable by simply doing a usbconfig reset on a device which doesn't reset itself properly... MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 87e560496fc11391cd170c84b42f107f630653d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 07:33:42 -0000 The branch stable/13 has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=87e560496fc11391cd170c84b42f107f630653d5 commit 87e560496fc11391cd170c84b42f107f630653d5 Author: John-Mark Gurney AuthorDate: 2021-06-29 01:09:14 +0000 Commit: Wojciech Macek CommitDate: 2021-09-28 07:03:48 +0000 ued may be NULL here which will cause a panic... reproducable by simply doing a usbconfig reset on a device which doesn't reset itself properly... (cherry picked from commit 3d5104182c2eb4336905e89aa0d089b67aa746e3) --- sys/dev/usb/net/if_cdce.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index 64c31896d417..24813ea305e4 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -709,18 +709,18 @@ alloc_transfers: if ((ued == NULL) || (ued->bLength < sizeof(*ued))) { error = USB_ERR_INVAL; } else { + /* + * ECM 1.2 doesn't say it excludes the CRC, but states that it's + * normally 1514, which excludes the CRC. + */ + DPRINTF("max segsize: %d\n", UGETW(ued->wMaxSegmentSize)); + if (UGETW(ued->wMaxSegmentSize) >= (ETHER_MAX_LEN - ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN)) + sc->sc_flags |= CDCE_FLAG_VLAN; + error = usbd_req_get_string_any(uaa->device, NULL, eaddr_str, sizeof(eaddr_str), ued->iMacAddress); } - /* - * ECM 1.2 doesn't say it excludes the CRC, but states that it's - * normally 1514, which excludes the CRC. - */ - DPRINTF("max segsize: %d\n", UGETW(ued->wMaxSegmentSize)); - if (UGETW(ued->wMaxSegmentSize) >= (ETHER_MAX_LEN - ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN)) - sc->sc_flags |= CDCE_FLAG_VLAN; - if (error) { /* fake MAC address */ From owner-dev-commits-src-all@freebsd.org Tue Sep 28 07:33:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D390E678465; Tue, 28 Sep 2021 07:33: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 4HJWTM4q1hz4ZHd; Tue, 28 Sep 2021 07:33:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D81220981; Tue, 28 Sep 2021 07:33: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 18S7Xh3p089372; Tue, 28 Sep 2021 07:33:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S7Xhsr089371; Tue, 28 Sep 2021 07:33:43 GMT (envelope-from git) Date: Tue, 28 Sep 2021 07:33:43 GMT Message-Id: <202109280733.18S7Xhsr089371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wojciech Macek Subject: git: 28df957acb93 - stable/13 - if_cdce: Add support for setting RX filtering MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 28df957acb9342c52587774d3c4c530ea9980a85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 07:33:44 -0000 The branch stable/13 has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=28df957acb9342c52587774d3c4c530ea9980a85 commit 28df957acb9342c52587774d3c4c530ea9980a85 Author: Kornel Duleba AuthorDate: 2021-08-31 12:22:30 +0000 Commit: Wojciech Macek CommitDate: 2021-09-28 07:03:48 +0000 if_cdce: Add support for setting RX filtering We can now set promisc and allmulti modes. Filtering of given multicast addresses is not supported. Changing the mode is done by sending a command described in: "USB CDC Subclass Specification for Ethernet Devices v1.2, section 6.2.4". This means that at least in theory this feature should work with all modems that are using this driver. This fixes Huawei E3372h-320 running new firmware in "HiLink" mode. Previously it would reset a few seconds after its mode was changed with "usb_modeswitch". Setting RX filter to default value at the end of attach function fixed that. Sponsored by: Stormshield Obtained from: Semihalf Differential revision: https://reviews.freebsd.org/D31766 MFC after: 2 weeks Reviewed by: hps (cherry picked from commit f0c393f781f01ffa727f90a8593e26a20869438b) --- sys/dev/usb/net/if_cdce.c | 41 +++++++++++++++++++++++++++++++++++++---- sys/dev/usb/net/if_cdcereg.h | 15 +++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index 24813ea305e4..ebc68e1f71cc 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -117,6 +117,7 @@ static int cdce_media_change_cb(struct ifnet *); static void cdce_media_status_cb(struct ifnet *, struct ifmediareq *); static uint32_t cdce_m_crc32(struct mbuf *, uint32_t, uint32_t); +static void cdce_set_filter(struct usb_ether *); #ifdef USB_DEBUG static int cdce_debug = 0; @@ -593,6 +594,9 @@ cdce_attach_post_sub(struct usb_ether *ue) ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); sc->sc_media.ifm_media = sc->sc_media.ifm_cur->ifm_media; + CDCE_LOCK(sc); + cdce_set_filter(ue); + CDCE_UNLOCK(sc); return 0; } @@ -1025,15 +1029,44 @@ cdce_stop(struct usb_ether *ue) static void cdce_setmulti(struct usb_ether *ue) { - /* no-op */ - return; + + cdce_set_filter(ue); } static void cdce_setpromisc(struct usb_ether *ue) { - /* no-op */ - return; + + cdce_set_filter(ue); +} + +static void +cdce_set_filter(struct usb_ether *ue) +{ + struct cdce_softc *sc = uether_getsc(ue); + struct ifnet *ifp = uether_getifp(ue); + struct usb_device_request req; + uint16_t value; + + value = CDC_PACKET_TYPE_DIRECTED | CDC_PACKET_TYPE_BROADCAST; + if (if_getflags(ifp) & IFF_PROMISC) + value |= CDC_PACKET_TYPE_PROMISC; + if (if_getflags(ifp) & IFF_ALLMULTI) + value |= CDC_PACKET_TYPE_ALL_MULTICAST; + + req.bmRequestType = UT_CLASS | UT_INTERFACE; + req.bRequest = CDC_SET_ETHERNET_PACKET_FILTER; + USETW(req.wValue, value); + req.wIndex[0] = sc->sc_ifaces_index[1]; + req.wIndex[1] = 0; + USETW(req.wLength, 0); + + /* + * Function below will drop the sc mutex. + * We can do that since we're called from a separate task, + * that simply wraps the setpromisc/setmulti methods. + */ + usbd_do_request(sc->sc_ue.ue_udev, &sc->sc_mtx, &req, NULL); } static int diff --git a/sys/dev/usb/net/if_cdcereg.h b/sys/dev/usb/net/if_cdcereg.h index 724aa0b9b017..19a7ac354341 100644 --- a/sys/dev/usb/net/if_cdcereg.h +++ b/sys/dev/usb/net/if_cdcereg.h @@ -37,6 +37,8 @@ #ifndef _USB_IF_CDCEREG_H_ #define _USB_IF_CDCEREG_H_ +#define CDCE_BIT(x) (1 << (x)) + #define CDCE_FRAMES_MAX 8 /* units */ #define CDCE_IND_SIZE_MAX 32 /* bytes */ @@ -104,6 +106,19 @@ struct cdce_softc { #define CDCE_NOTIFY_DONE 2 }; +/* + * Taken from USB CDC Subclass Specification for Ethernet Devices v1.2, + * section 6.2.4. + */ + +#define CDC_SET_ETHERNET_PACKET_FILTER 0x43 /* Command code. */ + +#define CDC_PACKET_TYPE_PROMISC CDCE_BIT(0) +#define CDC_PACKET_TYPE_ALL_MULTICAST CDCE_BIT(1) /* Allmulti. */ +#define CDC_PACKET_TYPE_DIRECTED CDCE_BIT(2) /* Filter unicast by mac. */ +#define CDC_PACKET_TYPE_BROADCAST CDCE_BIT(3) +#define CDC_PACKET_TYPE_MULTICAST CDCE_BIT(4) /* Multicast filtering, not supported. */ + #define CDCE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define CDCE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define CDCE_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->sc_mtx, t) From owner-dev-commits-src-all@freebsd.org Tue Sep 28 07:36:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E96E678AD1; Tue, 28 Sep 2021 07:36: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 4HJWXM3cKpz4ZGh; Tue, 28 Sep 2021 07:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5161420983; Tue, 28 Sep 2021 07:36: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 18S7aJL8089682; Tue, 28 Sep 2021 07:36:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S7aJcG089681; Tue, 28 Sep 2021 07:36:19 GMT (envelope-from git) Date: Tue, 28 Sep 2021 07:36:19 GMT Message-Id: <202109280736.18S7aJcG089681@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wojciech Macek Subject: git: dcd0d08b692f - stable/13 - mvneta: Fix MTU update sequence MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dcd0d08b692fc1377ab07c3d9260ad1c93944c5c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 07:36:19 -0000 The branch stable/13 has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=dcd0d08b692fc1377ab07c3d9260ad1c93944c5c commit dcd0d08b692fc1377ab07c3d9260ad1c93944c5c Author: Kornel Duleba AuthorDate: 2021-08-31 06:22:29 +0000 Commit: Wojciech Macek CommitDate: 2021-09-28 07:35:41 +0000 mvneta: Fix MTU update sequence After MTU is updated we might start using allocating RX buffers from different pool. (MJUM9BYTES vs MCLBYTES) Because of that we need to update the RX buffer size in hardware. Previously it was done only when the interface was up, which is incorrect since MTU can be changed at any time. Differential revision: https://reviews.freebsd.org/D31724 Sponsored by: Stormshield Obtained from: Semihalf MFC after: 2 weeks Reviewed by: wma (cherry picked from commit 5438ef47e377d659acf7f97a66fe418223f2c847) --- sys/dev/neta/if_mvneta.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index 4ff830731e94..debb4a922cbc 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -2168,29 +2168,28 @@ mvneta_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP; } - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - /* Stop hardware */ + /* + * Reinitialize RX queues. + * We need to update RX descriptor size. + */ + if (ifp->if_drv_flags & IFF_DRV_RUNNING) mvneta_stop_locked(sc); - /* - * Reinitialize RX queues. - * We need to update RX descriptor size. - */ - for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) { - mvneta_rx_lockq(sc, q); - if (mvneta_rx_queue_init(ifp, q) != 0) { - device_printf(sc->dev, - "initialization failed:" - " cannot initialize queue\n"); - mvneta_rx_unlockq(sc, q); - error = ENOBUFS; - break; - } + + for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) { + mvneta_rx_lockq(sc, q); + if (mvneta_rx_queue_init(ifp, q) != 0) { + device_printf(sc->dev, + "initialization failed:" + " cannot initialize queue\n"); mvneta_rx_unlockq(sc, q); + error = ENOBUFS; + break; } - /* Trigger reinitialization */ - mvneta_init_locked(sc); + mvneta_rx_unlockq(sc, q); } + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + mvneta_init_locked(sc); + mvneta_sc_unlock(sc); } break; From owner-dev-commits-src-all@freebsd.org Tue Sep 28 09:28:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F68B679FEF; Tue, 28 Sep 2021 09:28: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 4HJZ1c22TFz4h2x; Tue, 28 Sep 2021 09:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25A0221BF2; Tue, 28 Sep 2021 09:28: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 18S9SKgL036469; Tue, 28 Sep 2021 09:28:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S9SKhX036468; Tue, 28 Sep 2021 09:28:20 GMT (envelope-from git) Date: Tue, 28 Sep 2021 09:28:20 GMT Message-Id: <202109280928.18S9SKhX036468@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 4a83ca1078e3 - main - sound(4): Implement mixer mute control for feeder channels. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a83ca1078e3ec70159741b51a6b48e844ada9f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 09:28:20 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4a83ca1078e3ec70159741b51a6b48e844ada9f5 commit 4a83ca1078e3ec70159741b51a6b48e844ada9f5 Author: Hans Petter Selasky AuthorDate: 2021-09-28 07:41:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-28 09:20:09 +0000 sound(4): Implement mixer mute control for feeder channels. PR: 258711 Differential Revision: https://reviews.freebsd.org/D31636 MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/sound/pcm/channel.c | 71 ++++++++++++++++++++++ sys/dev/sound/pcm/channel.h | 8 ++- sys/dev/sound/pcm/dsp.c | 121 +++++++++++++++++++++++--------------- sys/dev/sound/pcm/feeder_volume.c | 19 ++++-- 4 files changed, 167 insertions(+), 52 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 38c578ba8282..4d56eee6847e 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1223,6 +1223,8 @@ chn_init(struct pcm_channel *c, void *devinfo, int dir, int direction) c->volume[SND_VOL_C_MASTER][SND_CHN_T_VOL_0DB] = SND_VOL_0DB_MASTER; c->volume[SND_VOL_C_PCM][SND_CHN_T_VOL_0DB] = chn_vol_0db_pcm; + memset(c->muted, 0, sizeof(c->muted)); + chn_vpc_reset(c, SND_VOL_C_PCM, 1); ret = ENODEV; @@ -1394,6 +1396,75 @@ chn_getvolume_matrix(struct pcm_channel *c, int vc, int vt) return (c->volume[vc][vt]); } +int +chn_setmute_multi(struct pcm_channel *c, int vc, int mute) +{ + int i, ret; + + ret = 0; + + for (i = 0; i < SND_CHN_T_MAX; i++) { + if ((1 << i) & SND_CHN_LEFT_MASK) + ret |= chn_setmute_matrix(c, vc, i, mute); + else if ((1 << i) & SND_CHN_RIGHT_MASK) + ret |= chn_setmute_matrix(c, vc, i, mute) << 8; + else + ret |= chn_setmute_matrix(c, vc, i, mute) << 16; + } + return (ret); +} + +int +chn_setmute_matrix(struct pcm_channel *c, int vc, int vt, int mute) +{ + int i; + + KASSERT(c != NULL && vc >= SND_VOL_C_MASTER && vc < SND_VOL_C_MAX && + (vc == SND_VOL_C_MASTER || (vc & 1)) && + (vt == SND_CHN_T_VOL_0DB || (vt >= SND_CHN_T_BEGIN && vt <= SND_CHN_T_END)), + ("%s(): invalid mute matrix c=%p vc=%d vt=%d mute=%d", + __func__, c, vc, vt, mute)); + + CHN_LOCKASSERT(c); + + mute = (mute != 0); + + c->muted[vc][vt] = mute; + + /* + * Do relative calculation here and store it into class + 1 + * to ease the job of feeder_volume. + */ + if (vc == SND_VOL_C_MASTER) { + for (vc = SND_VOL_C_BEGIN; vc <= SND_VOL_C_END; + vc += SND_VOL_C_STEP) + c->muted[SND_VOL_C_VAL(vc)][vt] = mute; + } else if (vc & 1) { + if (vt == SND_CHN_T_VOL_0DB) { + for (i = SND_CHN_T_BEGIN; i <= SND_CHN_T_END; + i += SND_CHN_T_STEP) { + c->muted[SND_VOL_C_VAL(vc)][i] = mute; + } + } else { + c->muted[SND_VOL_C_VAL(vc)][vt] = mute; + } + } + return (mute); +} + +int +chn_getmute_matrix(struct pcm_channel *c, int vc, int vt) +{ + KASSERT(c != NULL && vc >= SND_VOL_C_MASTER && vc < SND_VOL_C_MAX && + (vt == SND_CHN_T_VOL_0DB || + (vt >= SND_CHN_T_BEGIN && vt <= SND_CHN_T_END)), + ("%s(): invalid mute matrix c=%p vc=%d vt=%d", + __func__, c, vc, vt)); + CHN_LOCKASSERT(c); + + return (c->muted[vc][vt]); +} + struct pcmchan_matrix * chn_getmatrix(struct pcm_channel *c) { diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 34d62f4e15c2..60b7b3416cc3 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -166,7 +166,8 @@ struct pcm_channel { struct pcmchan_matrix matrix; struct pcmchan_matrix matrix_scratch; - int volume[SND_VOL_C_MAX][SND_CHN_T_VOL_MAX]; + int16_t volume[SND_VOL_C_MAX][SND_CHN_T_VOL_MAX]; + int8_t muted[SND_VOL_C_MAX][SND_CHN_T_VOL_MAX]; void *data1, *data2; }; @@ -271,6 +272,9 @@ int chn_setvolume_multi(struct pcm_channel *c, int vc, int left, int right, int center); int chn_setvolume_matrix(struct pcm_channel *c, int vc, int vt, int val); int chn_getvolume_matrix(struct pcm_channel *c, int vc, int vt); +int chn_setmute_multi(struct pcm_channel *c, int vc, int mute); +int chn_setmute_matrix(struct pcm_channel *c, int vc, int vt, int mute); +int chn_getmute_matrix(struct pcm_channel *c, int vc, int vt); void chn_vpc_reset(struct pcm_channel *c, int vc, int force); int chn_setparam(struct pcm_channel *c, uint32_t format, uint32_t speed); int chn_setspeed(struct pcm_channel *c, uint32_t speed); @@ -307,6 +311,8 @@ int chn_syncdestroy(struct pcm_channel *c); #define CHN_GETVOLUME(x, y, z) ((x)->volume[y][z]) #endif +#define CHN_GETMUTE(x, y, z) ((x)->muted[y][z]) + #ifdef OSSV4_EXPERIMENT int chn_getpeaks(struct pcm_channel *c, int *lpeak, int *rpeak); #endif diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index cce05f4ecf37..15f437b8627c 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -965,6 +965,7 @@ dsp_ioctl_channel(struct cdev *dev, struct pcm_channel *volch, u_long cmd, struct snddev_info *d; struct pcm_channel *rdch, *wrch; int j, devtype, ret; + int left, right, center, mute; d = dsp_get_info(dev); if (!PCM_REGISTERED(d) || !(dsp_get_flags(dev) & SD_F_VPC)) @@ -1003,67 +1004,95 @@ dsp_ioctl_channel(struct cdev *dev, struct pcm_channel *volch, u_long cmd, } /* Final validation */ - if (volch != NULL) { - CHN_LOCK(volch); - if (!(volch->feederflags & (1 << FEEDER_VOLUME))) { - CHN_UNLOCK(volch); - return (-1); - } - if (volch->direction == PCMDIR_PLAY) - wrch = volch; - else - rdch = volch; - } - - ret = EINVAL; + if (volch == NULL) + return (EINVAL); - if (volch != NULL && - ((j == SOUND_MIXER_PCM && volch->direction == PCMDIR_PLAY) || - (j == SOUND_MIXER_RECLEV && volch->direction == PCMDIR_REC))) { - if ((cmd & ~0xff) == MIXER_WRITE(0)) { - int left, right, center; + CHN_LOCK(volch); + if (!(volch->feederflags & (1 << FEEDER_VOLUME))) { + CHN_UNLOCK(volch); + return (EINVAL); + } + switch (cmd & ~0xff) { + case MIXER_WRITE(0): + switch (j) { + case SOUND_MIXER_MUTE: + if (volch->direction == PCMDIR_REC) { + chn_setmute_multi(volch, SND_VOL_C_PCM, (*(int *)arg & SOUND_MASK_RECLEV) != 0); + } else { + chn_setmute_multi(volch, SND_VOL_C_PCM, (*(int *)arg & SOUND_MASK_PCM) != 0); + } + break; + case SOUND_MIXER_PCM: + if (volch->direction != PCMDIR_PLAY) + break; left = *(int *)arg & 0x7f; right = ((*(int *)arg) >> 8) & 0x7f; center = (left + right) >> 1; - chn_setvolume_multi(volch, SND_VOL_C_PCM, left, right, - center); - } else if ((cmd & ~0xff) == MIXER_READ(0)) { - *(int *)arg = CHN_GETVOLUME(volch, - SND_VOL_C_PCM, SND_CHN_T_FL); - *(int *)arg |= CHN_GETVOLUME(volch, - SND_VOL_C_PCM, SND_CHN_T_FR) << 8; + chn_setvolume_multi(volch, SND_VOL_C_PCM, + left, right, center); + break; + case SOUND_MIXER_RECLEV: + if (volch->direction != PCMDIR_REC) + break; + left = *(int *)arg & 0x7f; + right = ((*(int *)arg) >> 8) & 0x7f; + center = (left + right) >> 1; + chn_setvolume_multi(volch, SND_VOL_C_PCM, + left, right, center); + break; + default: + /* ignore all other mixer writes */ + break; } - ret = 0; - } else if (rdch != NULL || wrch != NULL) { + break; + + case MIXER_READ(0): switch (j) { + case SOUND_MIXER_MUTE: + mute = CHN_GETMUTE(volch, SND_VOL_C_PCM, SND_CHN_T_FL) || + CHN_GETMUTE(volch, SND_VOL_C_PCM, SND_CHN_T_FR); + if (volch->direction == PCMDIR_REC) { + *(int *)arg = mute << SOUND_MIXER_RECLEV; + } else { + *(int *)arg = mute << SOUND_MIXER_PCM; + } + break; + case SOUND_MIXER_PCM: + if (volch->direction != PCMDIR_PLAY) + break; + *(int *)arg = CHN_GETVOLUME(volch, + SND_VOL_C_PCM, SND_CHN_T_FL); + *(int *)arg |= CHN_GETVOLUME(volch, + SND_VOL_C_PCM, SND_CHN_T_FR) << 8; + break; + case SOUND_MIXER_RECLEV: + if (volch->direction != PCMDIR_REC) + break; + *(int *)arg = CHN_GETVOLUME(volch, + SND_VOL_C_PCM, SND_CHN_T_FL); + *(int *)arg |= CHN_GETVOLUME(volch, + SND_VOL_C_PCM, SND_CHN_T_FR) << 8; + break; case SOUND_MIXER_DEVMASK: case SOUND_MIXER_CAPS: case SOUND_MIXER_STEREODEVS: - if ((cmd & ~0xff) == MIXER_READ(0)) { - *(int *)arg = 0; - if (rdch != NULL) - *(int *)arg |= SOUND_MASK_RECLEV; - if (wrch != NULL) - *(int *)arg |= SOUND_MASK_PCM; - } - ret = 0; - break; - case SOUND_MIXER_RECMASK: - case SOUND_MIXER_RECSRC: - if ((cmd & ~0xff) == MIXER_READ(0)) - *(int *)arg = 0; - ret = 0; + if (volch->direction == PCMDIR_REC) + *(int *)arg = SOUND_MASK_RECLEV; + else + *(int *)arg = SOUND_MASK_PCM; break; default: + *(int *)arg = 0; break; } - } - - if (volch != NULL) - CHN_UNLOCK(volch); + break; - return (ret); + default: + break; + } + CHN_UNLOCK(volch); + return (0); } static int diff --git a/sys/dev/sound/pcm/feeder_volume.c b/sys/dev/sound/pcm/feeder_volume.c index 322d7f6b2c84..2312bd89c9d4 100644 --- a/sys/dev/sound/pcm/feeder_volume.c +++ b/sys/dev/sound/pcm/feeder_volume.c @@ -237,10 +237,13 @@ static int feed_volume_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, uint32_t count, void *source) { + int temp_vol[SND_CHN_T_VOL_MAX]; struct feed_volume_info *info; uint32_t j, align; - int i, *vol, *matrix; + int i, *matrix; uint8_t *dst; + const int16_t *vol; + const int8_t *muted; /* * Fetch filter data operation. @@ -251,6 +254,7 @@ feed_volume_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, return (FEEDER_FEED(f->source, c, b, count, source)); vol = c->volume[SND_VOL_C_VAL(info->volume_class)]; + muted = c->muted[SND_VOL_C_VAL(info->volume_class)]; matrix = info->matrix; /* @@ -258,17 +262,22 @@ feed_volume_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, */ j = 0; i = info->channels; - do { - if (vol[matrix[--i]] != SND_VOL_FLAT) { + while (i--) { + if (vol[matrix[i]] != SND_VOL_FLAT || + muted[matrix[i]] != 0) { j = 1; break; } - } while (i != 0); + } /* Nope, just bypass entirely. */ if (j == 0) return (FEEDER_FEED(f->source, c, b, count, source)); + /* Check if any controls are muted. */ + for (j = 0; j != SND_CHN_T_VOL_MAX; j++) + temp_vol[j] = muted[j] ? 0 : vol[j]; + dst = b; align = info->bps * info->channels; @@ -281,7 +290,7 @@ feed_volume_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, if (j == 0) break; - info->apply(vol, matrix, info->channels, dst, j); + info->apply(temp_vol, matrix, info->channels, dst, j); j *= align; dst += j; From owner-dev-commits-src-all@freebsd.org Tue Sep 28 09:28:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C8C067A609; Tue, 28 Sep 2021 09:28: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 4HJZ1d31Bhz4h30; Tue, 28 Sep 2021 09:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 473BD22202; Tue, 28 Sep 2021 09:28: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 18S9SLrp036493; Tue, 28 Sep 2021 09:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18S9SLYD036492; Tue, 28 Sep 2021 09:28:21 GMT (envelope-from git) Date: Tue, 28 Sep 2021 09:28:21 GMT Message-Id: <202109280928.18S9SLYD036492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 3984400149a5 - main - mixer(3): Add support for controlling mixer mute and volume on feeder channels. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3984400149a53982f1254cfaf7b73fd2acda460a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 09:28:21 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=3984400149a53982f1254cfaf7b73fd2acda460a commit 3984400149a53982f1254cfaf7b73fd2acda460a Author: Hans Petter Selasky AuthorDate: 2021-09-28 07:53:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-28 09:20:23 +0000 mixer(3): Add support for controlling mixer mute and volume on feeder channels. PR: 258711 Reported by: jbeich@FreeBSD.org Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- lib/libmixer/mixer.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/libmixer/mixer.c b/lib/libmixer/mixer.c index b10d5c6607cf..4bae6980c1c4 100644 --- a/lib/libmixer/mixer.c +++ b/lib/libmixer/mixer.c @@ -77,13 +77,13 @@ mixer_open(const char *name) if (name != NULL) { /* `name` does not start with "/dev/mixer". */ if (strncmp(name, BASEPATH, strlen(BASEPATH)) != 0) { - errno = EINVAL; - goto fail; + m->unit = -1; + } else { + /* `name` is "/dev/mixer" so, we'll use the default unit. */ + if (strncmp(name, BASEPATH, strlen(name)) == 0) + goto dunit; + m->unit = strtol(name + strlen(BASEPATH), NULL, 10); } - /* `name` is "/dev/mixer" so, we'll use the default unit. */ - if (strncmp(name, BASEPATH, strlen(name)) == 0) - goto dunit; - m->unit = strtol(name + strlen(BASEPATH), NULL, 10); (void)strlcpy(m->name, name, sizeof(m->name)); } else { dunit: @@ -101,9 +101,13 @@ dunit: /* The unit number _must_ be set before the ioctl. */ m->mi.dev = m->unit; m->ci.card = m->unit; - if (ioctl(m->fd, SNDCTL_MIXERINFO, &m->mi) < 0 || - ioctl(m->fd, SNDCTL_CARDINFO, &m->ci) < 0 || - ioctl(m->fd, SOUND_MIXER_READ_DEVMASK, &m->devmask) < 0 || + if (ioctl(m->fd, SNDCTL_MIXERINFO, &m->mi) < 0) { + memset(&m->mi, 0, sizeof(m->mi)); + strlcpy(m->mi.name, m->name, sizeof(m->mi.name)); + } + if (ioctl(m->fd, SNDCTL_CARDINFO, &m->ci) < 0) + memset(&m->ci, 0, sizeof(m->ci)); + if (ioctl(m->fd, SOUND_MIXER_READ_DEVMASK, &m->devmask) < 0 || ioctl(m->fd, SOUND_MIXER_READ_MUTE, &m->mutemask) < 0 || ioctl(m->fd, SOUND_MIXER_READ_RECMASK, &m->recmask) < 0 || ioctl(m->fd, SOUND_MIXER_READ_RECSRC, &m->recsrc) < 0) @@ -463,7 +467,7 @@ mixer_get_mode(int unit) (void)snprintf(buf, sizeof(buf), "dev.pcm.%d.mode", unit); size = sizeof(unsigned int); if (sysctlbyname(buf, &mode, &size, NULL, 0) < 0) - return (-1); + return (0); return (mode); } From owner-dev-commits-src-all@freebsd.org Tue Sep 28 12:43:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32F9567C9EF; Tue, 28 Sep 2021 12:43: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 4HJfM80fmdz4v7x; Tue, 28 Sep 2021 12:43:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA8C424C9F; Tue, 28 Sep 2021 12:43: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 18SChllv001989; Tue, 28 Sep 2021 12:43:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SChldh001988; Tue, 28 Sep 2021 12:43:47 GMT (envelope-from git) Date: Tue, 28 Sep 2021 12:43:47 GMT Message-Id: <202109281243.18SChldh001988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: f3aa0098a82e - main - Use mtx_lock_spin in the gic driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f3aa0098a82ebf7712aa13716d794aa7e4ac59cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 12:43:48 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f3aa0098a82ebf7712aa13716d794aa7e4ac59cd commit f3aa0098a82ebf7712aa13716d794aa7e4ac59cd Author: Andrew Turner AuthorDate: 2021-09-28 11:36:42 +0000 Commit: Andrew Turner CommitDate: 2021-09-28 11:42:06 +0000 Use mtx_lock_spin in the gic driver The mutex was changed to a spin lock when the MSI/MSI-X handling was moved from the gicv2m to the gic driver. Update the calls to lock and unlock the mutex to the spin variant. Submitted by: jrtc27 ("Change all the mtx_(un)lock(&sc->mutex) to be the _spin versions.") Reported by: mw, antranigv@freebsd.am Sponsored by: The FreeBSD Foundation --- sys/arm/arm/gic.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index d7edd7885404..89db4e324600 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -1056,7 +1056,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, sc = device_get_softc(dev); - mtx_lock(&sc->mutex); + mtx_lock_spin(&sc->mutex); found = false; for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { @@ -1091,7 +1091,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, /* Not enough interrupts were found */ if (!found || irq == sc->sc_spi_end) { - mtx_unlock(&sc->mutex); + mtx_unlock_spin(&sc->mutex); return (ENXIO); } @@ -1099,7 +1099,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, /* Mark the interrupt as used */ sc->gic_irqs[irq + i].gi_flags |= GI_FLAG_MSI_USED; } - mtx_unlock(&sc->mutex); + mtx_unlock_spin(&sc->mutex); for (i = 0; i < count; i++) srcs[i] = (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; @@ -1118,7 +1118,7 @@ arm_gic_release_msi(device_t dev, device_t child, int count, sc = device_get_softc(dev); - mtx_lock(&sc->mutex); + mtx_lock_spin(&sc->mutex); for (i = 0; i < count; i++) { gi = (struct gic_irqsrc *)isrc[i]; @@ -1128,7 +1128,7 @@ arm_gic_release_msi(device_t dev, device_t child, int count, gi->gi_flags &= ~GI_FLAG_MSI_USED; } - mtx_unlock(&sc->mutex); + mtx_unlock_spin(&sc->mutex); return (0); } @@ -1142,7 +1142,7 @@ arm_gic_alloc_msix(device_t dev, device_t child, device_t *pic, sc = device_get_softc(dev); - mtx_lock(&sc->mutex); + mtx_lock_spin(&sc->mutex); /* Find an unused interrupt */ for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) != 0, @@ -1152,13 +1152,13 @@ arm_gic_alloc_msix(device_t dev, device_t child, device_t *pic, } /* No free interrupt was found */ if (irq == sc->sc_spi_end) { - mtx_unlock(&sc->mutex); + mtx_unlock_spin(&sc->mutex); return (ENXIO); } /* Mark the interrupt as used */ sc->gic_irqs[irq].gi_flags |= GI_FLAG_MSI_USED; - mtx_unlock(&sc->mutex); + mtx_unlock_spin(&sc->mutex); *isrcp = (struct intr_irqsrc *)&sc->gic_irqs[irq]; *pic = dev; @@ -1178,9 +1178,9 @@ arm_gic_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) == GI_FLAG_MSI_USED, ("%s: Trying to release an unused MSI-X interrupt", __func__)); - mtx_lock(&sc->mutex); + mtx_lock_spin(&sc->mutex); gi->gi_flags &= ~GI_FLAG_MSI_USED; - mtx_unlock(&sc->mutex); + mtx_unlock_spin(&sc->mutex); return (0); } From owner-dev-commits-src-all@freebsd.org Tue Sep 28 13:22:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E3E167C568; Tue, 28 Sep 2021 13:22: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 4HJgCD3yNCz3Fb5; Tue, 28 Sep 2021 13:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67F0124B6A; Tue, 28 Sep 2021 13:22: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 18SDM0WZ053457; Tue, 28 Sep 2021 13:22:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SDM0FL053456; Tue, 28 Sep 2021 13:22:00 GMT (envelope-from git) Date: Tue, 28 Sep 2021 13:22:00 GMT Message-Id: <202109281322.18SDM0FL053456@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: 742450a7eb40 - stable/13 - syslog.conf.5: Fix the message priority order 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: 742450a7eb40e2b44326c0a400b9c61bad6c4d38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 13:22:00 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=742450a7eb40e2b44326c0a400b9c61bad6c4d38 commit 742450a7eb40e2b44326c0a400b9c61bad6c4d38 Author: Felix Guest AuthorDate: 2021-09-21 15:29:39 +0000 Commit: Mark Johnston CommitDate: 2021-09-28 13:21:51 +0000 syslog.conf.5: Fix the message priority order PR: 219942 (cherry picked from commit 8678140127296c15894094087b81f71fe79a21d9) --- usr.sbin/syslogd/syslog.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/syslogd/syslog.conf.5 b/usr.sbin/syslogd/syslog.conf.5 index 48f5c88048cb..7afd6b94cdf7 100644 --- a/usr.sbin/syslogd/syslog.conf.5 +++ b/usr.sbin/syslogd/syslog.conf.5 @@ -144,7 +144,7 @@ The .Em level describes the severity of the message, and is a keyword from the following ordered list (higher to lower): -.Cm emerg , crit , alert , err , warning , notice , info +.Cm emerg , alert , crit , err , warning , notice , info and .Cm debug . These keywords correspond to From owner-dev-commits-src-all@freebsd.org Tue Sep 28 13:22:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29FCF67D2FD; Tue, 28 Sep 2021 13:22: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 4HJgCY0k4Mz3FSG; Tue, 28 Sep 2021 13:22:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE7FF24E44; Tue, 28 Sep 2021 13:22: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 18SDMGmb054429; Tue, 28 Sep 2021 13:22:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SDMGAI054428; Tue, 28 Sep 2021 13:22:16 GMT (envelope-from git) Date: Tue, 28 Sep 2021 13:22:16 GMT Message-Id: <202109281322.18SDMGAI054428@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: e6e5d9bf9744 - stable/12 - syslog.conf.5: Fix the message priority order MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e6e5d9bf97440cdf510a410225cad0f507a1eed7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 13:22:17 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e6e5d9bf97440cdf510a410225cad0f507a1eed7 commit e6e5d9bf97440cdf510a410225cad0f507a1eed7 Author: Felix Guest AuthorDate: 2021-09-21 15:29:39 +0000 Commit: Mark Johnston CommitDate: 2021-09-28 13:22:14 +0000 syslog.conf.5: Fix the message priority order PR: 219942 (cherry picked from commit 8678140127296c15894094087b81f71fe79a21d9) --- usr.sbin/syslogd/syslog.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/syslogd/syslog.conf.5 b/usr.sbin/syslogd/syslog.conf.5 index 26595c3e9f0a..06b4bbc8b1c3 100644 --- a/usr.sbin/syslogd/syslog.conf.5 +++ b/usr.sbin/syslogd/syslog.conf.5 @@ -144,7 +144,7 @@ The .Em level describes the severity of the message, and is a keyword from the following ordered list (higher to lower): -.Cm emerg , crit , alert , err , warning , notice , info +.Cm emerg , alert , crit , err , warning , notice , info and .Cm debug . These keywords correspond to From owner-dev-commits-src-all@freebsd.org Tue Sep 28 13:42:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2997567D806; Tue, 28 Sep 2021 13:42: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 4HJgfw0ZPYz3Hjj; Tue, 28 Sep 2021 13:42:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7DDC25906; Tue, 28 Sep 2021 13:42: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 18SDgVDW081761; Tue, 28 Sep 2021 13:42:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SDgVBP081760; Tue, 28 Sep 2021 13:42:31 GMT (envelope-from git) Date: Tue, 28 Sep 2021 13:42:31 GMT Message-Id: <202109281342.18SDgVBP081760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 171633765c43 - main - sctp: avoid locking an already locked mutex MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 171633765c4367dc233a4bf0e5926cb7c4decfc1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 13:42:32 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=171633765c4367dc233a4bf0e5926cb7c4decfc1 commit 171633765c4367dc233a4bf0e5926cb7c4decfc1 Author: Michael Tuexen AuthorDate: 2021-09-28 03:14:56 +0000 Commit: Michael Tuexen CommitDate: 2021-09-28 03:17:03 +0000 sctp: avoid locking an already locked mutex Reported by: syzbot+f048680690f2e8d7ddad@syzkaller.appspotmail.com Reported by: syzbot+0725c712ba89d123c2e9@syzkaller.appspotmail.com MFC after: 1 week --- sys/netinet/sctp_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index c994b90b8353..17d834cd2734 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -1387,6 +1387,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, struct sctp_tcb *stcb) SCTP_PRINTF("Hmm, stream queue cnt at %d I counted %d in stream out wheel\n", stcb->asoc.stream_queue_cnt, chks_in_queue); } + SCTP_TCB_SEND_UNLOCK(stcb); if (chks_in_queue) { /* call the output queue function */ sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED); @@ -1406,7 +1407,6 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, struct sctp_tcb *stcb) (u_long)stcb->asoc.total_output_queue_size); stcb->asoc.total_output_queue_size = 0; } - SCTP_TCB_SEND_UNLOCK(stcb); } int From owner-dev-commits-src-all@freebsd.org Tue Sep 28 13:55:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAA0267DA03; Tue, 28 Sep 2021 13:55: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 4HJgy85ljFz3K4J; Tue, 28 Sep 2021 13:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A553925A9D; Tue, 28 Sep 2021 13:55: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 18SDtiZf095203; Tue, 28 Sep 2021 13:55:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SDtidU095202; Tue, 28 Sep 2021 13:55:44 GMT (envelope-from git) Date: Tue, 28 Sep 2021 13:55:44 GMT Message-Id: <202109281355.18SDtidU095202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 5b53e749a95e - main - sctp: fix usage of stream scheduler functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b53e749a95e7f18475df9f9ce7984a31880a7ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 13:55:44 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=5b53e749a95e7f18475df9f9ce7984a31880a7ee commit 5b53e749a95e7f18475df9f9ce7984a31880a7ee Author: Michael Tuexen AuthorDate: 2021-09-28 03:25:58 +0000 Commit: Michael Tuexen CommitDate: 2021-09-28 03:25:58 +0000 sctp: fix usage of stream scheduler functions sctp_ss_scheduled() should only be called for streams that are scheduled. So call sctp_ss_remove_from_stream() before it. This bug was uncovered by the earlier cleanup. Reported by: syzbot+bbf739922346659df4b2@syzkaller.appspotmail.com Reported by: syzbot+0a0857458f4a7b0507c8@syzkaller.appspotmail.com Reported by: syzbot+a0b62c6107b34a04e54d@syzkaller.appspotmail.com Reported by: syzbot+0aa0d676429ebcd53299@syzkaller.appspotmail.com Reported by: syzbot+104cc0c1d3ccf2921c1d@syzkaller.appspotmail.com MFC after: 1 week --- sys/netinet/sctp_output.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index cad15be7a57b..cb8b8030b6ea 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -7142,6 +7142,7 @@ sctp_can_we_split_this(struct sctp_tcb *stcb, uint32_t length, static uint32_t sctp_move_to_outqueue(struct sctp_tcb *stcb, + struct sctp_nets *net, struct sctp_stream_out *strq, uint32_t space_left, uint32_t frag_point, @@ -7555,6 +7556,7 @@ dont_do_it: sctp_auth_key_acquire(stcb, chk->auth_keyid); chk->holds_key_ref = 1; } + stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, to_move); chk->rec.data.tsn = atomic_fetchadd_int(&asoc->sending_seq, 1); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_AT_SEND_2_OUTQ) { sctp_misc_ints(SCTP_STRMOUT_LOG_SEND, @@ -7672,8 +7674,8 @@ out_of: } static void -sctp_fill_outqueue(struct sctp_tcb *stcb, - struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked) +sctp_fill_outqueue(struct sctp_tcb *stcb, struct sctp_nets *net, int frag_point, + int eeor_mode, int *quit_now, int so_locked) { struct sctp_association *asoc; struct sctp_stream_out *strq; @@ -7708,9 +7710,9 @@ sctp_fill_outqueue(struct sctp_tcb *stcb, giveup = 0; bail = 0; while ((space_left > 0) && (strq != NULL)) { - moved = sctp_move_to_outqueue(stcb, strq, space_left, frag_point, - &giveup, eeor_mode, &bail, so_locked); - stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved); + moved = sctp_move_to_outqueue(stcb, net, strq, space_left, + frag_point, &giveup, eeor_mode, + &bail, so_locked); if ((giveup != 0) || (bail != 0)) { break; } From owner-dev-commits-src-all@freebsd.org Tue Sep 28 14:22:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B93D167E358; Tue, 28 Sep 2021 14:22: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 4HJhXx4w73z3Lr4; Tue, 28 Sep 2021 14:22:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88E0426098; Tue, 28 Sep 2021 14:22: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 18SEMPrM035459; Tue, 28 Sep 2021 14:22:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SEMPwH035458; Tue, 28 Sep 2021 14:22:25 GMT (envelope-from git) Date: Tue, 28 Sep 2021 14:22:25 GMT Message-Id: <202109281422.18SEMPwH035458@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: a7a54bf8c33f - stable/13 - bcm2835_sdhci: don't use DMA for kernel dumps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a7a54bf8c33f2c9322bb94759ad71ea6c15b20b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 14:22:25 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a7a54bf8c33f2c9322bb94759ad71ea6c15b20b3 commit a7a54bf8c33f2c9322bb94759ad71ea6c15b20b3 Author: Mitchell Horne AuthorDate: 2021-09-09 18:07:06 +0000 Commit: Mitchell Horne CommitDate: 2021-09-28 14:21:38 +0000 bcm2835_sdhci: don't use DMA for kernel dumps When handling a data irq, the sdhci driver calls the sdhci_platform_will_handle() method, to determine if it should allow the platform driver to handle the transfer or fall back to programmed I/O. While dumping, the data irq path may be invoked directly (not from an interrupt context), which the bcm2835_sdhci DMA code is not prepared to handle. Return early in this case, to force the fallback to PIO. Otherwise, the KASSERT that follows will be triggered, and the dump will fail. On non-INVARIANTS kernels, the system will hang, waiting for a DMA interrupt that will never arrive. Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31893 (cherry picked from commit 806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e) --- sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c index cd9b60743be3..9d8be703983d 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -762,6 +763,13 @@ bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); #endif + /* + * We don't want to perform DMA in this context -- interrupts are + * disabled, and a transaction may already be in progress. + */ + if (dumping) + return (0); + /* * This indicates that we somehow let a data interrupt slip by into the * SDHCI framework, when it should not have. This really needs to be From owner-dev-commits-src-all@freebsd.org Tue Sep 28 14:24:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9881167E1B7; Tue, 28 Sep 2021 14:24: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 4HJhb33tC7z3LxB; Tue, 28 Sep 2021 14:24:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A6EC26192; Tue, 28 Sep 2021 14:24: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 18SEOF5u035707; Tue, 28 Sep 2021 14:24:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SEOFBD035706; Tue, 28 Sep 2021 14:24:15 GMT (envelope-from git) Date: Tue, 28 Sep 2021 14:24:15 GMT Message-Id: <202109281424.18SEOFBD035706@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: 22e68eadc50d - stable/12 - bcm2835_sdhci: don't use DMA for kernel dumps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 22e68eadc50d7e750e0108688ad7ddaadc115a6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 14:24:15 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=22e68eadc50d7e750e0108688ad7ddaadc115a6b commit 22e68eadc50d7e750e0108688ad7ddaadc115a6b Author: Mitchell Horne AuthorDate: 2021-09-09 18:07:06 +0000 Commit: Mitchell Horne CommitDate: 2021-09-28 14:23:50 +0000 bcm2835_sdhci: don't use DMA for kernel dumps When handling a data irq, the sdhci driver calls the sdhci_platform_will_handle() method, to determine if it should allow the platform driver to handle the transfer or fall back to programmed I/O. While dumping, the data irq path may be invoked directly (not from an interrupt context), which the bcm2835_sdhci DMA code is not prepared to handle. Return early in this case, to force the fallback to PIO. Otherwise, the KASSERT that follows will be triggered, and the dump will fail. On non-INVARIANTS kernels, the system will hang, waiting for a DMA interrupt that will never arrive. Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31893 (cherry picked from commit 806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e) --- sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c index 621b3291bf12..4b0255d3fac8 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -722,6 +723,13 @@ bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); #endif + /* + * We don't want to perform DMA in this context -- interrupts are + * disabled, and a transaction may already be in progress. + */ + if (dumping) + return (0); + /* * This indicates that we somehow let a data interrupt slip by into the * SDHCI framework, when it should not have. This really needs to be From owner-dev-commits-src-all@freebsd.org Tue Sep 28 14:38:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55BC567E633; Tue, 28 Sep 2021 14:38: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 4HJhv61yh3z3N0Y; Tue, 28 Sep 2021 14:38:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F8C926435; Tue, 28 Sep 2021 14:38: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 18SEcAUs049396; Tue, 28 Sep 2021 14:38:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SEcAoI049395; Tue, 28 Sep 2021 14:38:10 GMT (envelope-from git) Date: Tue, 28 Sep 2021 14:38:10 GMT Message-Id: <202109281438.18SEcAoI049395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 800e74955d4e - main - boot(9): update to match reality 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/main X-Git-Reftype: branch X-Git-Commit: 800e74955d4e5f90e7258956ba42228350f71049 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 14:38:10 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=800e74955d4e5f90e7258956ba42228350f71049 commit 800e74955d4e5f90e7258956ba42228350f71049 Author: Mitchell Horne AuthorDate: 2021-09-28 14:36:09 +0000 Commit: Mitchell Horne CommitDate: 2021-09-28 14:36:09 +0000 boot(9): update to match reality This function was renamed to kern_reboot() in 2010, but the man page has failed to keep in sync. Bring it up to date on the rename, add the shutdown hooks to the synopsis, and document the (obvious) fact that kern_reboot() does not return. Fix an outdated reference to the old name in kern_reboot(), and leave a reference to the man page so future readers might find it before any large changes. Reviewed by: imp, markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32085 --- ObsoleteFiles.inc | 3 +++ share/man/man9/Makefile | 2 +- share/man/man9/{boot.9 => kern_reboot.9} | 26 ++++++++++++++++++-------- sys/kern/kern_shutdown.c | 5 +++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 87a7f95b67a1..19e0428a5017 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210923: rename boot(9) to kern_reboot(9) +OLD_FILES+=usr/share/man/man9/boot.9.gz + # 20210921: remove cloudabi OLD_FILES+=usr/share/man/man4/cloudabi.4.gz diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 49601b9b7f48..fdaa14bc93e4 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -15,7 +15,6 @@ MAN= accept_filter.9 \ bhnd_erom.9 \ bios.9 \ bitset.9 \ - boot.9 \ bpf.9 \ buf.9 \ buf_ring.9 \ @@ -195,6 +194,7 @@ MAN= accept_filter.9 \ ithread.9 \ kasan.9 \ KASSERT.9 \ + kern_reboot.9 \ kern_testfrwk.9 \ kernacc.9 \ kernel_mount.9 \ diff --git a/share/man/man9/boot.9 b/share/man/man9/kern_reboot.9 similarity index 85% rename from share/man/man9/boot.9 rename to share/man/man9/kern_reboot.9 index cbd0099e4e18..587d4ab114db 100644 --- a/share/man/man9/boot.9 +++ b/share/man/man9/kern_reboot.9 @@ -34,21 +34,25 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 1997 -.Dt BOOT 9 +.Dd Sept 23, 2021 +.Dt KERN_REBOOT 9 .Os .Sh NAME -.Nm boot +.Nm kern_reboot .Nd halt or reboot the system .Sh SYNOPSIS .In sys/types.h .In sys/systm.h .In sys/reboot.h .Ft void -.Fn boot "int howto" +.Fn kern_reboot "int howto" +.In sys/eventhandler.h +.Fn EVENTHANDLER_REGISTER "shutdown_pre_sync" "shutdown_fn" "private" "priority" +.Fn EVENTHANDLER_REGISTER "shutdown_post_sync" "shutdown_fn" "private" "priority" +.Fn EVENTHANDLER_REGISTER "shutdown_final" "shutdown_fn" "private" "priority" .Sh DESCRIPTION The -.Fn boot +.Fn kern_reboot function handles final system shutdown, and either halts or reboots the system. The exact action to be taken is determined by the flags passed in @@ -56,12 +60,12 @@ The exact action to be taken is determined by the flags passed in and by whether or not the system has finished autoconfiguration. .Pp If the system has finished autoconfiguration, -.Fn boot +.Fn kern_reboot does the following: .Bl -enum -offset indent .It If this is the first invocation of -.Fn boot +.Fn kern_reboot and the .Dv RB_NOSYNC flag is not set in @@ -93,8 +97,14 @@ Otherwise, reboots the system. .El .Pp If the system has not finished autoconfiguration, -.Fn boot +.Fn kern_reboot runs any shutdown hooks previously registered, prints a message, and halts the system. +.Sh RETURN VALUES +The +.Fn kern_reboot +function does not return. .Sh SEE ALSO +.Xr reboot 2 +.Xr EVENTHANDLER 9 .Xr vfs_unmountall 9 diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 3cc51fd31956..efd7009df8f6 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -421,7 +421,8 @@ doadump(boolean_t textdump) } /* - * Shutdown the system cleanly to prepare for reboot, halt, or power off. + * kern_reboot(9): Shut down the system cleanly to prepare for reboot, halt, or + * power off. */ void kern_reboot(int howto) @@ -450,7 +451,7 @@ kern_reboot(int howto) sched_bind(curthread, CPU_FIRST()); thread_unlock(curthread); KASSERT(PCPU_GET(cpuid) == CPU_FIRST(), - ("boot: not running on cpu 0")); + ("%s: not running on cpu 0", __func__)); } #endif /* We're in the process of rebooting. */ From owner-dev-commits-src-all@freebsd.org Tue Sep 28 15:36:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DFCA67EB4E for ; Tue, 28 Sep 2021 15:36:39 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJkBb0v5Zz3k4v for ; Tue, 28 Sep 2021 15:36:39 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-yb1-xb32.google.com with SMTP id u32so11914043ybd.9 for ; Tue, 28 Sep 2021 08:36:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=uh5xAj6E7QII6QFkS+2H8Me9eGbnj23770z6A0qXmxY=; b=U8mghCTPfRYmuxEpsguLvc2p1RID8Tvo+J5YDx3ZGWUVV3Rd0J75Ysn0wW5lTZBucu EIPU2LfMEw1hhhSMzufeMZvzFO9x7vhtbfjqB1MWbIGdzeLsq2IgnT+TyrkAbh+P1awc r23tcnzB9BCBMQmX+JIxsAWLtdmE0vJpwWHv4F8jUVkAWvZjL74jBV7LCNFEJta815J7 +U1ZQNiFvO24CTXhtaqocsYoJ7Xnu/lzNNIGqbug1F+6CqSBdCmcDK8B3YGoFRGOTvy5 XE9r9HJGs3UWHQPiKBFGp/Jb8/R5IQP2OUxghQx4ZI59N9oadI30u9iVAhklG8GNeaZx /4ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=uh5xAj6E7QII6QFkS+2H8Me9eGbnj23770z6A0qXmxY=; b=Rq5u0O7RIG5T0mZC76orFWbwPLHatAlT+bAzzFOnHDA7Rm51tK+RYA/j3Xjd9FTK52 IJEsTjgeZOhJ9akjqLI2dud70v5PwG+MRmibShwyHp/8Tq+ejDEee5bJwh0RtZXEE97h 1RdZ4cL8LjNPFf2U9CKDqae25Ww9nMgBh5A+i1H1bzwP9US7XX9waaxbNC02AI34U4Fj NXZY28jr5Fxn6uwUZ/kU67BzCgFjkdBe7zVff5Asrc5HChRmibq4GkUSBsumy6zUBZDs bYb4oit9OST3BUiLU0fHYjTxTSRKLMQ7Y3i1TJqcH2POwi5Ue/MdxrC8Cf19Ip3c6Nsp WItQ== X-Gm-Message-State: AOAM533UywXhRSjODkYhT9gWRWdh4ytNvACCYGBY3J/BVF4aLkA4YVRs aVHewNGjJNyschfj2VhJe9I/OqGYwQqdQbZaS5a4Bg== X-Google-Smtp-Source: ABdhPJxVeXkgJncIyHKTn9WNNZYopjgTExBTz77SS7+akOfUNu8qn02zijIssqle9meTNYOR/HSH4fh6KvsDwTuBaqM= X-Received: by 2002:a5b:783:: with SMTP id b3mr7122459ybq.328.1632843398313; Tue, 28 Sep 2021 08:36:38 -0700 (PDT) MIME-Version: 1.0 References: <202109281243.18SChldh001988@gitrepo.freebsd.org> In-Reply-To: <202109281243.18SChldh001988@gitrepo.freebsd.org> From: Marcin Wojtas Date: Tue, 28 Sep 2021 17:36:27 +0200 Message-ID: Subject: Re: git: f3aa0098a82e - main - Use mtx_lock_spin in the gic driver To: Andrew Turner Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4HJkBb0v5Zz3k4v X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 15:36:39 -0000 Hi Andrew, wt., 28 wrz 2021 o 14:43 Andrew Turner napisa=C5=82(a)= : > > The branch main has been updated by andrew: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Df3aa0098a82ebf7712aa13716d= 794aa7e4ac59cd > > commit f3aa0098a82ebf7712aa13716d794aa7e4ac59cd > Author: Andrew Turner > AuthorDate: 2021-09-28 11:36:42 +0000 > Commit: Andrew Turner > CommitDate: 2021-09-28 11:42:06 +0000 > > Use mtx_lock_spin in the gic driver > > The mutex was changed to a spin lock when the MSI/MSI-X handling was > moved from the gicv2m to the gic driver. Update the calls to lock > and unlock the mutex to the spin variant. > > Submitted by: jrtc27 ("Change all the mtx_(un)lock(&sc->mutex) to b= e the _spin versions.") > Reported by: mw, antranigv@freebsd.am > Sponsored by: The FreeBSD Foundation > --- > sys/arm/arm/gic.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c > index d7edd7885404..89db4e324600 100644 > --- a/sys/arm/arm/gic.c > +++ b/sys/arm/arm/gic.c > @@ -1056,7 +1056,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int= count, int maxcount, > > sc =3D device_get_softc(dev); > > - mtx_lock(&sc->mutex); > + mtx_lock_spin(&sc->mutex); > > found =3D false; > for (irq =3D sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { > @@ -1091,7 +1091,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int= count, int maxcount, > > /* Not enough interrupts were found */ > if (!found || irq =3D=3D sc->sc_spi_end) { > - mtx_unlock(&sc->mutex); > + mtx_unlock_spin(&sc->mutex); > return (ENXIO); > } > > @@ -1099,7 +1099,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int= count, int maxcount, > /* Mark the interrupt as used */ > sc->gic_irqs[irq + i].gi_flags |=3D GI_FLAG_MSI_USED; > } > - mtx_unlock(&sc->mutex); > + mtx_unlock_spin(&sc->mutex); > > for (i =3D 0; i < count; i++) > srcs[i] =3D (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; > @@ -1118,7 +1118,7 @@ arm_gic_release_msi(device_t dev, device_t child, i= nt count, > > sc =3D device_get_softc(dev); > > - mtx_lock(&sc->mutex); > + mtx_lock_spin(&sc->mutex); > for (i =3D 0; i < count; i++) { > gi =3D (struct gic_irqsrc *)isrc[i]; > > @@ -1128,7 +1128,7 @@ arm_gic_release_msi(device_t dev, device_t child, i= nt count, > > gi->gi_flags &=3D ~GI_FLAG_MSI_USED; > } > - mtx_unlock(&sc->mutex); > + mtx_unlock_spin(&sc->mutex); > > return (0); > } > @@ -1142,7 +1142,7 @@ arm_gic_alloc_msix(device_t dev, device_t child, de= vice_t *pic, > > sc =3D device_get_softc(dev); > > - mtx_lock(&sc->mutex); > + mtx_lock_spin(&sc->mutex); > /* Find an unused interrupt */ > for (irq =3D sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { > KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) !=3D 0= , > @@ -1152,13 +1152,13 @@ arm_gic_alloc_msix(device_t dev, device_t child, = device_t *pic, > } > /* No free interrupt was found */ > if (irq =3D=3D sc->sc_spi_end) { > - mtx_unlock(&sc->mutex); > + mtx_unlock_spin(&sc->mutex); > return (ENXIO); > } > > /* Mark the interrupt as used */ > sc->gic_irqs[irq].gi_flags |=3D GI_FLAG_MSI_USED; > - mtx_unlock(&sc->mutex); > + mtx_unlock_spin(&sc->mutex); > > *isrcp =3D (struct intr_irqsrc *)&sc->gic_irqs[irq]; > *pic =3D dev; > @@ -1178,9 +1178,9 @@ arm_gic_release_msix(device_t dev, device_t child, = struct intr_irqsrc *isrc) > KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) =3D=3D GI_FLAG_MSI_USED= , > ("%s: Trying to release an unused MSI-X interrupt", __func__)= ); > > - mtx_lock(&sc->mutex); > + mtx_lock_spin(&sc->mutex); > gi->gi_flags &=3D ~GI_FLAG_MSI_USED; > - mtx_unlock(&sc->mutex); > + mtx_unlock_spin(&sc->mutex); > > return (0); > } Thank you for the patch, it fixes the MSI-X in my setup, but in order to operate properly on Marvell SoCs (equipped with a standard GICv2m), I have to remove the asserts, which were added in c6f3076d4405 (Move the GICv2m msi handling to the parent): diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index 89db4e324600..b5d72a2a6c49 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -528,8 +528,6 @@ arm_gic_write_ivar(device_t dev, device_t child, int which, uintptr_t value) * GIC_IVAR_MBI_START must be set once and first. This allo= ws * us to reserve the registers when GIC_IVAR_MBI_COUNT is s= et. */ - MPASS(sc->sc_spi_start =3D=3D 0); - MPASS(sc->sc_spi_count =3D=3D 0); MPASS(value >=3D GIC_FIRST_SPI); MPASS(value < sc->nirqs); @@ -537,7 +535,6 @@ arm_gic_write_ivar(device_t dev, device_t child, int which, uintptr_t value) return (0); case GIC_IVAR_MBI_COUNT: MPASS(sc->sc_spi_start !=3D 0); - MPASS(sc->sc_spi_count =3D=3D 0); sc->sc_spi_count =3D value; sc->sc_spi_end =3D sc->sc_spi_start + sc->sc_spi_count; Any thoughts? Best regards, Marcin From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:33:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8B3967FE26; Tue, 28 Sep 2021 16:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJlRw4JVRz3spk; Tue, 28 Sep 2021 16:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7423F27965; Tue, 28 Sep 2021 16:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18SGXGmu008167; Tue, 28 Sep 2021 16:33:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SGXGf7008166; Tue, 28 Sep 2021 16:33:16 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:33:16 GMT Message-Id: <202109281633.18SGXGf7008166@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: 9c6432dc4bb9 - stable/13 - e1000: Fix up HW vlan ops 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: 9c6432dc4bb936f0842d766d8b3b19dfcde15da2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:33:16 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9c6432dc4bb936f0842d766d8b3b19dfcde15da2 commit 9c6432dc4bb936f0842d766d8b3b19dfcde15da2 Author: Kevin Bowling AuthorDate: 2021-09-15 14:47:19 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 16:31:52 +0000 e1000: Fix up HW vlan ops 2796f7ca: * Don't reset the entire adapter for vlan changes, fix up the problems * Add some functions for vlan filter (vfta) manipulation * Don't muck with the vfta if we aren't doing HW vlan filtering * Disable interrupts when manipulating vfta on lem(4)-class NICs * On the I350 there is a specification update (2.4.20) in which the suggested workaround is to write to the vfta 10 times (if at first you don't succeed, try, try again). Our shared code has the goods, use it * Increase a VF's frame receive size in the case of vlans From the referenced PR, this reduced vlan configuration from minutes to seconds with hundreds or thousands of vlans and prevents wedging the adapter with needless adapter reinitialization for each vlan ID. PR: 230996 Reviewed by: markj Tested by: Ozkan KIRIK Differential Revision: https://reviews.freebsd.org/D30002 22b20b45: e1000: Fix variable typo Forgot to git add this in last commit Reported by: jenkins Fixes: 2796f7cab107 (cherry picked from commit 2796f7cab10785ef40efbba97ef67ab319c96e9c) (cherry picked from commit 22b20b45c9118bf6ef313c074cdb107a1eaca78e) --- sys/dev/e1000/if_em.c | 166 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 126 insertions(+), 40 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 5b7437fc5a58..6942fd47b471 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -297,6 +297,11 @@ static void em_if_debug(if_ctx_t ctx); static void em_update_stats_counters(struct adapter *); static void em_add_hw_stats(struct adapter *adapter); static int em_if_set_promisc(if_ctx_t ctx, int flags); +static bool em_if_vlan_filter_capable(struct adapter *); +static bool em_if_vlan_filter_used(struct adapter *); +static void em_if_vlan_filter_enable(struct adapter *); +static void em_if_vlan_filter_disable(struct adapter *); +static void em_if_vlan_filter_write(struct adapter *); static void em_setup_vlan_hw_support(struct adapter *); static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void em_print_nvm_info(struct adapter *); @@ -906,6 +911,9 @@ em_if_attach_pre(if_ctx_t ctx) scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS; if (hw->mac.type < e1000_82543) scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); + /* 82541ER doesn't do HW tagging */ + if (hw->device_id == E1000_DEV_ID_82541ER || hw->device_id == E1000_DEV_ID_82541ER_LOM) + scctx->isc_capenable &= ~IFCAP_VLAN_HWTAGGING; /* INTx only */ scctx->isc_msix_bar = 0; } @@ -1338,23 +1346,8 @@ em_if_init(if_ctx_t ctx) adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); em_initialize_receive_unit(ctx); - /* Use real VLAN Filter support? */ - if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) { - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - /* Use real VLAN Filter support */ - em_setup_vlan_hw_support(adapter); - else { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } - } else { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl &= ~E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } + /* Set up VLAN support and filter */ + em_setup_vlan_hw_support(adapter); /* Don't lose promiscuous settings */ em_if_set_promisc(ctx, if_getflags(ifp)); @@ -1673,14 +1666,19 @@ em_if_set_promisc(if_ctx_t ctx, int flags) if (flags & IFF_PROMISC) { reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); + em_if_vlan_filter_disable(adapter); /* Turn this on if you want to see bad packets */ if (em_debug_sbp) reg_rctl |= E1000_RCTL_SBP; E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); - } else if (flags & IFF_ALLMULTI) { - reg_rctl |= E1000_RCTL_MPE; - reg_rctl &= ~E1000_RCTL_UPE; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } else { + if (flags & IFF_ALLMULTI) { + reg_rctl |= E1000_RCTL_MPE; + reg_rctl &= ~E1000_RCTL_UPE; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } + if (em_if_vlan_filter_used(adapter)) + em_if_vlan_filter_enable(adapter); } return (0); } @@ -3326,7 +3324,11 @@ em_initialize_receive_unit(if_ctx_t ctx) /* are we on a vlan? */ if (ifp->if_vlantrunk != NULL) psize += VLAN_TAG_SIZE; - E1000_WRITE_REG(hw, E1000_RLPML, psize); + + if (adapter->vf_ifp) + e1000_rlpml_set_vf(hw, psize); + else + E1000_WRITE_REG(hw, E1000_RLPML, psize); } /* Set maximum packet buffer len */ @@ -3423,6 +3425,7 @@ em_if_vlan_register(if_ctx_t ctx, u16 vtag) bit = vtag & 0x1F; adapter->shadow_vfta[index] |= (1 << bit); ++adapter->num_vlans; + em_if_vlan_filter_write(adapter); } static void @@ -3435,41 +3438,121 @@ em_if_vlan_unregister(if_ctx_t ctx, u16 vtag) bit = vtag & 0x1F; adapter->shadow_vfta[index] &= ~(1 << bit); --adapter->num_vlans; + em_if_vlan_filter_write(adapter); +} + +static bool +em_if_vlan_filter_capable(struct adapter *adapter) +{ + if_softc_ctx_t scctx = adapter->shared; + + if ((scctx->isc_capenable & IFCAP_VLAN_HWFILTER) && + !em_disable_crc_stripping) + return (true); + + return (false); +} + +static bool +em_if_vlan_filter_used(struct adapter *adapter) +{ + if (!em_if_vlan_filter_capable(adapter)) + return (false); + + for (int i = 0; i < EM_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) + return (true); + + return (false); +} + +static void +em_if_vlan_filter_enable(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~E1000_RCTL_CFIEN; + reg |= E1000_RCTL_VFE; + E1000_WRITE_REG(hw, E1000_RCTL, reg); +} + +static void +em_if_vlan_filter_disable(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~(E1000_RCTL_VFE | E1000_RCTL_CFIEN); + E1000_WRITE_REG(hw, E1000_RCTL, reg); +} + +static void +em_if_vlan_filter_write(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + + if (adapter->vf_ifp) + return; + + /* Disable interrupts for lem-class devices during the filter change */ + if (hw->mac.type < em_mac_min) + em_if_intr_disable(adapter->ctx); + + for (int i = 0; i < EM_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) { + /* XXXKB: incomplete VF support, we return early above */ + if (adapter->vf_ifp) + e1000_vfta_set_vf(hw, adapter->shadow_vfta[i], TRUE); + else + e1000_write_vfta(hw, i, adapter->shadow_vfta[i]); + } + + /* Re-enable interrupts for lem-class devices */ + if (hw->mac.type < em_mac_min) + em_if_intr_enable(adapter->ctx); } static void em_setup_vlan_hw_support(struct adapter *adapter) { + if_softc_ctx_t scctx = adapter->shared; struct e1000_hw *hw = &adapter->hw; u32 reg; - /* - * We get here thru init_locked, meaning - * a soft reset, this has already cleared - * the VFTA and other state, so if there - * have been no vlan's registered do nothing. + /* XXXKB: Return early if we are a VF until VF decap and filter management + * is ready and tested. */ - if (adapter->num_vlans == 0) + if (adapter->vf_ifp) + return; + + if (scctx->isc_capenable & IFCAP_VLAN_HWTAGGING && + !em_disable_crc_stripping) { + reg = E1000_READ_REG(hw, E1000_CTRL); + reg |= E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + } else { + reg = E1000_READ_REG(hw, E1000_CTRL); + reg &= ~E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + } + + /* If we aren't doing HW filtering, we're done */ + if (!em_if_vlan_filter_capable(adapter)) { + em_if_vlan_filter_disable(adapter); return; + } /* * A soft reset zero's out the VFTA, so * we need to repopulate it now. */ - for (int i = 0; i < EM_VFTA_SIZE; i++) - if (adapter->shadow_vfta[i] != 0) - E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, - i, adapter->shadow_vfta[i]); - - reg = E1000_READ_REG(hw, E1000_CTRL); - reg |= E1000_CTRL_VME; - E1000_WRITE_REG(hw, E1000_CTRL, reg); + em_if_vlan_filter_write(adapter); /* Enable the Filter Table */ - reg = E1000_READ_REG(hw, E1000_RCTL); - reg &= ~E1000_RCTL_CFIEN; - reg |= E1000_RCTL_VFE; - E1000_WRITE_REG(hw, E1000_RCTL, reg); + em_if_vlan_filter_enable(adapter); } static void @@ -3484,6 +3567,7 @@ em_if_intr_enable(if_ctx_t ctx) ims_mask |= adapter->ims; } E1000_WRITE_REG(hw, E1000_IMS, ims_mask); + E1000_WRITE_FLUSH(hw); } static void @@ -3495,6 +3579,7 @@ em_if_intr_disable(if_ctx_t ctx) if (adapter->intr_type == IFLIB_INTR_MSIX) E1000_WRITE_REG(hw, EM_EIAC, 0); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); + E1000_WRITE_FLUSH(hw); } static void @@ -4100,6 +4185,7 @@ em_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event) { switch (event) { case IFLIB_RESTART_VLAN_CONFIG: + return (false); default: return (true); } From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:34:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DBA767FC45; Tue, 28 Sep 2021 16: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 4HJlTW2fLVz3tTx; Tue, 28 Sep 2021 16:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C17C27A59; Tue, 28 Sep 2021 16: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 18SGYdJp008387; Tue, 28 Sep 2021 16: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 18SGYdGd008386; Tue, 28 Sep 2021 16:34:39 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:34:39 GMT Message-Id: <202109281634.18SGYdGd008386@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: ecac5c2928ee - main - mgb: enable multicast in mgb_init MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ecac5c2928eead57c05ee7d376ff58de0a575d49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:34:39 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ecac5c2928eead57c05ee7d376ff58de0a575d49 commit ecac5c2928eead57c05ee7d376ff58de0a575d49 Author: Ed Maste AuthorDate: 2021-09-28 16:06:04 +0000 Commit: Ed Maste CommitDate: 2021-09-28 16:32:44 +0000 mgb: enable multicast in mgb_init Receive Filtering Engine (RFE) configuration is not yet implemented, and mgb intended to enable all broadcast, multicast, and unicast. However, MGB_RFE_ALLOW_MULTICAST was missed (MGB_RFE_ALLOW_UNICAST was included twice). MFC after: 1 week Fixes: 8890ab7758b8 ("Introduce if_mgb driver...") Sponsored by: The FreeBSD Foundation --- sys/dev/mgb/if_mgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index e1381dbc307d..472de84c13b1 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -611,7 +611,7 @@ mgb_init(if_ctx_t ctx) CSR_CLEAR_REG(sc, MGB_RFE_CTL, MGB_RFE_ALLOW_PERFECT_FILTER); CSR_UPDATE_REG(sc, MGB_RFE_CTL, MGB_RFE_ALLOW_BROADCAST | - MGB_RFE_ALLOW_UNICAST | + MGB_RFE_ALLOW_MULTICAST | MGB_RFE_ALLOW_UNICAST); error = mii_mediachg(miid); From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:35:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDCD467FC5A; Tue, 28 Sep 2021 16:35: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 4HJlVS5Pnsz3tVm; Tue, 28 Sep 2021 16:35:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A2B927E0E; Tue, 28 Sep 2021 16:35: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 18SGZSAT008566; Tue, 28 Sep 2021 16:35:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SGZSfr008565; Tue, 28 Sep 2021 16:35:28 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:35:28 GMT Message-Id: <202109281635.18SGZSfr008565@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: d239e11a57c9 - stable/12 - e1000: Fix up HW vlan ops 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: d239e11a57c9b4ebc5e4289a8520511bb7b40b2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:35:28 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d239e11a57c9b4ebc5e4289a8520511bb7b40b2d commit d239e11a57c9b4ebc5e4289a8520511bb7b40b2d Author: Kevin Bowling AuthorDate: 2021-09-15 14:47:19 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 16:34:18 +0000 e1000: Fix up HW vlan ops 2796f7ca: * Don't reset the entire adapter for vlan changes, fix up the problems * Add some functions for vlan filter (vfta) manipulation * Don't muck with the vfta if we aren't doing HW vlan filtering * Disable interrupts when manipulating vfta on lem(4)-class NICs * On the I350 there is a specification update (2.4.20) in which the suggested workaround is to write to the vfta 10 times (if at first you don't succeed, try, try again). Our shared code has the goods, use it * Increase a VF's frame receive size in the case of vlans From the referenced PR, this reduced vlan configuration from minutes to seconds with hundreds or thousands of vlans and prevents wedging the adapter with needless adapter reinitialization for each vlan ID. PR: 230996 Reviewed by: markj Tested by: Ozkan KIRIK Differential Revision: https://reviews.freebsd.org/D30002 22b20b45: e1000: Fix variable typo Forgot to git add this in last commit Reported by: jenkins Fixes: 2796f7cab107 (cherry picked from commit 2796f7cab10785ef40efbba97ef67ab319c96e9c) (cherry picked from commit 22b20b45c9118bf6ef313c074cdb107a1eaca78e) --- sys/dev/e1000/if_em.c | 166 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 126 insertions(+), 40 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index ce13d57da60b..68937925a2aa 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -297,6 +297,11 @@ static void em_if_debug(if_ctx_t ctx); static void em_update_stats_counters(struct adapter *); static void em_add_hw_stats(struct adapter *adapter); static int em_if_set_promisc(if_ctx_t ctx, int flags); +static bool em_if_vlan_filter_capable(struct adapter *); +static bool em_if_vlan_filter_used(struct adapter *); +static void em_if_vlan_filter_enable(struct adapter *); +static void em_if_vlan_filter_disable(struct adapter *); +static void em_if_vlan_filter_write(struct adapter *); static void em_setup_vlan_hw_support(struct adapter *); static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void em_print_nvm_info(struct adapter *); @@ -909,6 +914,9 @@ em_if_attach_pre(if_ctx_t ctx) scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS; if (hw->mac.type < e1000_82543) scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); + /* 82541ER doesn't do HW tagging */ + if (hw->device_id == E1000_DEV_ID_82541ER || hw->device_id == E1000_DEV_ID_82541ER_LOM) + scctx->isc_capenable &= ~IFCAP_VLAN_HWTAGGING; /* INTx only */ scctx->isc_msix_bar = 0; } @@ -1341,23 +1349,8 @@ em_if_init(if_ctx_t ctx) adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); em_initialize_receive_unit(ctx); - /* Use real VLAN Filter support? */ - if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) { - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - /* Use real VLAN Filter support */ - em_setup_vlan_hw_support(adapter); - else { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } - } else { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl &= ~E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } + /* Set up VLAN support and filter */ + em_setup_vlan_hw_support(adapter); /* Don't lose promiscuous settings */ em_if_set_promisc(ctx, if_getflags(ifp)); @@ -1676,14 +1669,19 @@ em_if_set_promisc(if_ctx_t ctx, int flags) if (flags & IFF_PROMISC) { reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); + em_if_vlan_filter_disable(adapter); /* Turn this on if you want to see bad packets */ if (em_debug_sbp) reg_rctl |= E1000_RCTL_SBP; E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); - } else if (flags & IFF_ALLMULTI) { - reg_rctl |= E1000_RCTL_MPE; - reg_rctl &= ~E1000_RCTL_UPE; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } else { + if (flags & IFF_ALLMULTI) { + reg_rctl |= E1000_RCTL_MPE; + reg_rctl &= ~E1000_RCTL_UPE; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } + if (em_if_vlan_filter_used(adapter)) + em_if_vlan_filter_enable(adapter); } return (0); } @@ -3322,7 +3320,11 @@ em_initialize_receive_unit(if_ctx_t ctx) /* are we on a vlan? */ if (ifp->if_vlantrunk != NULL) psize += VLAN_TAG_SIZE; - E1000_WRITE_REG(hw, E1000_RLPML, psize); + + if (adapter->vf_ifp) + e1000_rlpml_set_vf(hw, psize); + else + E1000_WRITE_REG(hw, E1000_RLPML, psize); } /* Set maximum packet buffer len */ @@ -3419,6 +3421,7 @@ em_if_vlan_register(if_ctx_t ctx, u16 vtag) bit = vtag & 0x1F; adapter->shadow_vfta[index] |= (1 << bit); ++adapter->num_vlans; + em_if_vlan_filter_write(adapter); } static void @@ -3431,41 +3434,121 @@ em_if_vlan_unregister(if_ctx_t ctx, u16 vtag) bit = vtag & 0x1F; adapter->shadow_vfta[index] &= ~(1 << bit); --adapter->num_vlans; + em_if_vlan_filter_write(adapter); +} + +static bool +em_if_vlan_filter_capable(struct adapter *adapter) +{ + if_softc_ctx_t scctx = adapter->shared; + + if ((scctx->isc_capenable & IFCAP_VLAN_HWFILTER) && + !em_disable_crc_stripping) + return (true); + + return (false); +} + +static bool +em_if_vlan_filter_used(struct adapter *adapter) +{ + if (!em_if_vlan_filter_capable(adapter)) + return (false); + + for (int i = 0; i < EM_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) + return (true); + + return (false); +} + +static void +em_if_vlan_filter_enable(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~E1000_RCTL_CFIEN; + reg |= E1000_RCTL_VFE; + E1000_WRITE_REG(hw, E1000_RCTL, reg); +} + +static void +em_if_vlan_filter_disable(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~(E1000_RCTL_VFE | E1000_RCTL_CFIEN); + E1000_WRITE_REG(hw, E1000_RCTL, reg); +} + +static void +em_if_vlan_filter_write(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + + if (adapter->vf_ifp) + return; + + /* Disable interrupts for lem-class devices during the filter change */ + if (hw->mac.type < em_mac_min) + em_if_intr_disable(adapter->ctx); + + for (int i = 0; i < EM_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) { + /* XXXKB: incomplete VF support, we return early above */ + if (adapter->vf_ifp) + e1000_vfta_set_vf(hw, adapter->shadow_vfta[i], TRUE); + else + e1000_write_vfta(hw, i, adapter->shadow_vfta[i]); + } + + /* Re-enable interrupts for lem-class devices */ + if (hw->mac.type < em_mac_min) + em_if_intr_enable(adapter->ctx); } static void em_setup_vlan_hw_support(struct adapter *adapter) { + if_softc_ctx_t scctx = adapter->shared; struct e1000_hw *hw = &adapter->hw; u32 reg; - /* - * We get here thru init_locked, meaning - * a soft reset, this has already cleared - * the VFTA and other state, so if there - * have been no vlan's registered do nothing. + /* XXXKB: Return early if we are a VF until VF decap and filter management + * is ready and tested. */ - if (adapter->num_vlans == 0) + if (adapter->vf_ifp) + return; + + if (scctx->isc_capenable & IFCAP_VLAN_HWTAGGING && + !em_disable_crc_stripping) { + reg = E1000_READ_REG(hw, E1000_CTRL); + reg |= E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + } else { + reg = E1000_READ_REG(hw, E1000_CTRL); + reg &= ~E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + } + + /* If we aren't doing HW filtering, we're done */ + if (!em_if_vlan_filter_capable(adapter)) { + em_if_vlan_filter_disable(adapter); return; + } /* * A soft reset zero's out the VFTA, so * we need to repopulate it now. */ - for (int i = 0; i < EM_VFTA_SIZE; i++) - if (adapter->shadow_vfta[i] != 0) - E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, - i, adapter->shadow_vfta[i]); - - reg = E1000_READ_REG(hw, E1000_CTRL); - reg |= E1000_CTRL_VME; - E1000_WRITE_REG(hw, E1000_CTRL, reg); + em_if_vlan_filter_write(adapter); /* Enable the Filter Table */ - reg = E1000_READ_REG(hw, E1000_RCTL); - reg &= ~E1000_RCTL_CFIEN; - reg |= E1000_RCTL_VFE; - E1000_WRITE_REG(hw, E1000_RCTL, reg); + em_if_vlan_filter_enable(adapter); } static void @@ -3480,6 +3563,7 @@ em_if_intr_enable(if_ctx_t ctx) ims_mask |= adapter->ims; } E1000_WRITE_REG(hw, E1000_IMS, ims_mask); + E1000_WRITE_FLUSH(hw); } static void @@ -3491,6 +3575,7 @@ em_if_intr_disable(if_ctx_t ctx) if (adapter->intr_type == IFLIB_INTR_MSIX) E1000_WRITE_REG(hw, EM_EIAC, 0); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); + E1000_WRITE_FLUSH(hw); } static void @@ -4096,6 +4181,7 @@ em_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event) { switch (event) { case IFLIB_RESTART_VLAN_CONFIG: + return (false); default: return (true); } From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:57:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AD856A83A1; Tue, 28 Sep 2021 16:57: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 4HJlzx3B3cz4RMv; Tue, 28 Sep 2021 16:57:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EF87279F2; Tue, 28 Sep 2021 16:57: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 18SGvXfV035368; Tue, 28 Sep 2021 16:57:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SGvXCI035367; Tue, 28 Sep 2021 16:57:33 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:57:33 GMT Message-Id: <202109281657.18SGvXCI035367@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: e6f324c15f7a - stable/13 - e1000: Use C99 bool types 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: e6f324c15f7ab1d85700ab08f16787c5625a1483 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:57:33 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e6f324c15f7ab1d85700ab08f16787c5625a1483 commit e6f324c15f7ab1d85700ab08f16787c5625a1483 Author: Kevin Bowling AuthorDate: 2021-09-17 03:08:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 16:55:53 +0000 e1000: Use C99 bool types Approved by: imp MFC after: 1 week (cherry picked from commit 1bbdc25fc1edb43562bf2a5f30df7381078991d4) --- sys/dev/e1000/e1000_80003es2lan.c | 12 +++--- sys/dev/e1000/e1000_82541.c | 10 ++--- sys/dev/e1000/e1000_82543.c | 22 +++++------ sys/dev/e1000/e1000_82571.c | 60 ++++++++++++++--------------- sys/dev/e1000/e1000_82575.c | 58 ++++++++++++++-------------- sys/dev/e1000/e1000_api.c | 12 +++--- sys/dev/e1000/e1000_api.h | 4 +- sys/dev/e1000/e1000_hw.h | 2 +- sys/dev/e1000/e1000_i210.c | 4 +- sys/dev/e1000/e1000_ich8lan.c | 78 +++++++++++++++++++------------------- sys/dev/e1000/e1000_mac.c | 62 +++++++++++++++--------------- sys/dev/e1000/e1000_manage.c | 28 +++++++------- sys/dev/e1000/e1000_mbx.c | 2 +- sys/dev/e1000/e1000_mbx.h | 2 +- sys/dev/e1000/e1000_osdep.h | 2 - sys/dev/e1000/e1000_phy.c | 80 +++++++++++++++++++-------------------- sys/dev/e1000/e1000_vf.c | 14 +++---- sys/dev/e1000/e1000_vf.h | 2 +- sys/dev/e1000/em_txrx.c | 12 +++--- sys/dev/e1000/if_em.c | 46 +++++++++++----------- sys/dev/e1000/igb_txrx.c | 2 +- 21 files changed, 256 insertions(+), 258 deletions(-) diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index db6f1aeb65fb..ac35b4eabf28 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -219,14 +219,14 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = !!(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK); /* Adaptive IFS not supported */ - mac->adaptive_ifs = FALSE; + mac->adaptive_ifs = false; /* Function pointers */ @@ -891,8 +891,8 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) reg_data &= ~0x00100000; E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data); - /* default to TRUE to enable the MDIC W/A */ - hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE; + /* default to true to enable the MDIC W/A */ + hw->dev_spec._80003es2lan.mdic_wa_enable = true; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET >> @@ -900,7 +900,7 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) if (!ret_val) { if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) == E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO) - hw->dev_spec._80003es2lan.mdic_wa_enable = FALSE; + hw->dev_spec._80003es2lan.mdic_wa_enable = false; } /* Clear all of the statistics registers (clear on read). It is diff --git a/sys/dev/e1000/e1000_82541.c b/sys/dev/e1000/e1000_82541.c index aaa3de7f02ce..7bb2e8ea9449 100644 --- a/sys/dev/e1000/e1000_82541.c +++ b/sys/dev/e1000/e1000_82541.c @@ -230,7 +230,7 @@ static s32 e1000_init_mac_params_82541(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* Function Pointers */ @@ -611,11 +611,11 @@ static s32 e1000_check_for_link_82541(struct e1000_hw *hw) goto out; if (!link) { - ret_val = e1000_config_dsp_after_link_change_82541(hw, FALSE); + ret_val = e1000_config_dsp_after_link_change_82541(hw, false); goto out; /* No link detected */ } - mac->get_link_status = FALSE; + mac->get_link_status = false; /* * Check if there was DownShift, must be checked @@ -632,7 +632,7 @@ static s32 e1000_check_for_link_82541(struct e1000_hw *hw) goto out; } - ret_val = e1000_config_dsp_after_link_change_82541(hw, TRUE); + ret_val = e1000_config_dsp_after_link_change_82541(hw, true); /* * Auto-Neg is enabled. Auto Speed Detection takes care @@ -937,7 +937,7 @@ out: * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is diff --git a/sys/dev/e1000/e1000_82543.c b/sys/dev/e1000/e1000_82543.c index 49049b8646cd..9a93090c2d33 100644 --- a/sys/dev/e1000/e1000_82543.c +++ b/sys/dev/e1000/e1000_82543.c @@ -256,7 +256,7 @@ static s32 e1000_init_mac_params_82543(struct e1000_hw *hw) /* Set tbi compatibility */ if ((hw->mac.type != e1000_82543) || (hw->phy.media_type == e1000_media_type_fiber)) - e1000_set_tbi_compatibility_82543(hw, FALSE); + e1000_set_tbi_compatibility_82543(hw, false); return E1000_SUCCESS; } @@ -286,7 +286,7 @@ void e1000_init_function_pointers_82543(struct e1000_hw *hw) static bool e1000_tbi_compatibility_enabled_82543(struct e1000_hw *hw) { struct e1000_dev_spec_82543 *dev_spec = &hw->dev_spec._82543; - bool state = FALSE; + bool state = false; DEBUGFUNC("e1000_tbi_compatibility_enabled_82543"); @@ -338,7 +338,7 @@ out: bool e1000_tbi_sbp_enabled_82543(struct e1000_hw *hw) { struct e1000_dev_spec_82543 *dev_spec = &hw->dev_spec._82543; - bool state = FALSE; + bool state = false; DEBUGFUNC("e1000_tbi_sbp_enabled_82543"); @@ -379,7 +379,7 @@ static void e1000_set_tbi_sbp_82543(struct e1000_hw *hw, bool state) * @hw: pointer to the HW structure * * Returns the current status of whether PHY initialization is disabled. - * True if PHY initialization is disabled else FALSE. + * True if PHY initialization is disabled else false. **/ static bool e1000_init_phy_disabled_82543(struct e1000_hw *hw) { @@ -389,7 +389,7 @@ static bool e1000_init_phy_disabled_82543(struct e1000_hw *hw) DEBUGFUNC("e1000_init_phy_disabled_82543"); if (hw->mac.type != e1000_82543) { - ret_val = FALSE; + ret_val = false; goto out; } @@ -913,7 +913,7 @@ static s32 e1000_reset_hw_82543(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP); E1000_WRITE_FLUSH(hw); - e1000_set_tbi_sbp_82543(hw, FALSE); + e1000_set_tbi_sbp_82543(hw, false); /* * Delay to allow any outstanding PCI transactions to complete before @@ -1217,7 +1217,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) if (!link) goto out; /* No link detected */ - mac->get_link_status = FALSE; + mac->get_link_status = false; e1000_check_downshift_generic(hw); @@ -1299,7 +1299,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) * If we previously were in the mode, * turn it off. */ - e1000_set_tbi_sbp_82543(hw, FALSE); + e1000_set_tbi_sbp_82543(hw, false); rctl = E1000_READ_REG(hw, E1000_RCTL); rctl &= ~E1000_RCTL_SBP; E1000_WRITE_REG(hw, E1000_RCTL, rctl); @@ -1313,7 +1313,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) * will look like CRC errors to the hardware. */ if (!e1000_tbi_sbp_enabled_82543(hw)) { - e1000_set_tbi_sbp_82543(hw, TRUE); + e1000_set_tbi_sbp_82543(hw, true); rctl = E1000_READ_REG(hw, E1000_RCTL); rctl |= E1000_RCTL_SBP; E1000_WRITE_REG(hw, E1000_RCTL, rctl); @@ -1356,7 +1356,7 @@ static s32 e1000_check_for_fiber_link_82543(struct e1000_hw *hw) (!(status & E1000_STATUS_LU)) && (!(rxcw & E1000_RXCW_C))) { if (!mac->autoneg_failed) { - mac->autoneg_failed = TRUE; + mac->autoneg_failed = true; ret_val = 0; goto out; } @@ -1387,7 +1387,7 @@ static s32 e1000_check_for_fiber_link_82543(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); E1000_WRITE_REG(hw, E1000_CTRL, (ctrl & ~E1000_CTRL_SLU)); - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } out: diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index 8db1fcb921a9..cae9afcb2d78 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -285,7 +285,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) struct e1000_mac_info *mac = &hw->mac; u32 swsm = 0; u32 swsm2 = 0; - bool force_clear_smbi = FALSE; + bool force_clear_smbi = false; DEBUGFUNC("e1000_init_mac_params_82571"); @@ -327,9 +327,9 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* Adaptive IFS supported */ - mac->adaptive_ifs = TRUE; + mac->adaptive_ifs = true; /* Function pointers */ @@ -369,7 +369,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->ops.blink_led = e1000_blink_led_generic; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are * enabled. */ @@ -388,7 +388,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->ops.blink_led = e1000_blink_led_generic; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; break; } @@ -407,13 +407,13 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) /* Only do this for the first interface on this card */ E1000_WRITE_REG(hw, E1000_SWSM2, swsm2 | E1000_SWSM2_LOCK); - force_clear_smbi = TRUE; + force_clear_smbi = true; } else { - force_clear_smbi = FALSE; + force_clear_smbi = false; } break; default: - force_clear_smbi = TRUE; + force_clear_smbi = true; break; } @@ -563,7 +563,7 @@ e1000_put_hw_semaphore_82574(struct e1000_hw *hw) /** * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. * LPLU will not be activated unless the @@ -593,7 +593,7 @@ static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active) * @active: boolean used to enable/disable lplu * * The low power link up (lplu) state is set to the power management level D3 - * when active is TRUE, else clear lplu for D3. LPLU + * when active is true, else clear lplu for D3. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is * maintained. @@ -860,7 +860,7 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) /** * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When activating LPLU * this function also disables smart speed and vice versa. LPLU will not be @@ -1051,7 +1051,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) if (ret_val) return ret_val; - e1000_set_laa_state_82571(hw, TRUE); + e1000_set_laa_state_82571(hw, true); } /* Reinitialize the 82571 serdes link state machine */ @@ -1327,8 +1327,8 @@ static void e1000_clear_vfta_82571(struct e1000_hw *hw) * e1000_check_mng_mode_82574 - Check manageability is enabled * @hw: pointer to the HW structure * - * Reads the NVM Initialization Control Word 2 and returns TRUE - * (>0) if any manageability is enabled, else FALSE (0). + * Reads the NVM Initialization Control Word 2 and returns true + * (>0) if any manageability is enabled, else false (0). **/ static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) { @@ -1339,7 +1339,7 @@ static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &data); if (ret_val) - return FALSE; + return false; return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0; } @@ -1392,18 +1392,18 @@ bool e1000_check_phy_82574(struct e1000_hw *hw) ret_val = hw->phy.ops.read_reg(hw, E1000_RECEIVE_ERROR_COUNTER, &receive_errors); if (ret_val) - return FALSE; + return false; if (receive_errors == E1000_RECEIVE_ERROR_MAX) { ret_val = hw->phy.ops.read_reg(hw, E1000_BASE1000T_STATUS, &status_1kbt); if (ret_val) - return FALSE; + return false; if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) == E1000_IDLE_ERROR_COUNT_MASK) - return TRUE; + return true; } - return FALSE; + return false; } @@ -1556,10 +1556,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) */ mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("AN_UP -> AN_PROG\n"); } else { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } break; @@ -1576,10 +1576,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) (ctrl & ~E1000_CTRL_SLU)); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("FORCED_UP -> AN_PROG\n"); } else { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } break; @@ -1593,7 +1593,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) mac->serdes_link_state = e1000_serdes_link_autoneg_complete; DEBUGOUT("AN_PROG -> AN_UP\n"); - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } else { /* Autoneg completed, but failed. */ mac->serdes_link_state = @@ -1619,7 +1619,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) } mac->serdes_link_state = e1000_serdes_link_forced_up; - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; DEBUGOUT("AN_PROG -> FORCED_UP\n"); } break; @@ -1635,13 +1635,13 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) ~E1000_CTRL_SLU)); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("DOWN -> AN_PROG\n"); break; } } else { if (!(rxcw & E1000_RXCW_SYNCH)) { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; mac->serdes_link_state = e1000_serdes_link_down; DEBUGOUT("ANYSTATE -> DOWN\n"); } else { @@ -1657,7 +1657,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) continue; if (rxcw & E1000_RXCW_IV) { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; mac->serdes_link_state = e1000_serdes_link_down; DEBUGOUT("ANYSTATE -> DOWN\n"); @@ -1671,7 +1671,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TXCW, txcw); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("ANYSTATE -> AN_PROG\n"); } } @@ -1728,7 +1728,7 @@ bool e1000_get_laa_state_82571(struct e1000_hw *hw) DEBUGFUNC("e1000_get_laa_state_82571"); if (hw->mac.type != e1000_82571) - return FALSE; + return false; return hw->dev_spec._82571.laa_is_present; } diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 29805270f8dc..59d8b9c85dc3 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -128,7 +128,7 @@ static const u16 e1000_82580_rxpbs_table[] = { static bool e1000_sgmii_uses_mdio_82575(struct e1000_hw *hw) { u32 reg = 0; - bool ext_mdio = FALSE; + bool ext_mdio = false; DEBUGFUNC("e1000_sgmii_uses_mdio_82575"); @@ -348,16 +348,16 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) /* Enable EEE default settings for EEE supported devices */ if (mac->type >= e1000_i350) - dev_spec->eee_disable = FALSE; + dev_spec->eee_disable = false; /* Allow a single clear of the SW semaphore on I210 and newer */ if (mac->type >= e1000_i210) - dev_spec->clear_semaphore_once = TRUE; + dev_spec->clear_semaphore_once = true; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = !!(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK); @@ -716,7 +716,7 @@ static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_phy_hw_reset_sgmii_82575"); /* - * This isn't a TRUE "hard" reset, but is the only reset + * This isn't a true "hard" reset, but is the only reset * available to us at this time. */ @@ -746,7 +746,7 @@ out: /** * e1000_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -832,7 +832,7 @@ out: /** * e1000_set_d0_lplu_state_82580 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -883,7 +883,7 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is @@ -1139,7 +1139,7 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw) /* Determine if a swap needs to happen. */ if (port && (hw->dev_spec._82575.media_port != port)) { hw->dev_spec._82575.media_port = port; - hw->dev_spec._82575.media_changed = TRUE; + hw->dev_spec._82575.media_changed = true; } if (port == E1000_MEDIA_PORT_COPPER) { @@ -1217,7 +1217,7 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, * The link up bit determines when link is up on autoneg. */ if (pcs & E1000_PCS_LSTS_LINK_OK) { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; /* Detect and store PCS speed */ if (pcs & E1000_PCS_LSTS_SPEED_1000) @@ -1246,7 +1246,7 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, } } else { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; *speed = 0; *duplex = 0; } @@ -1527,13 +1527,13 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) { case E1000_CTRL_EXT_LINK_MODE_SGMII: /* sgmii mode lets the phy handle forcing speed/duplex */ - pcs_autoneg = TRUE; + pcs_autoneg = true; /* autoneg time out should be disabled for SGMII mode */ reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT); break; case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: /* disable PCS autoneg and support parallel detect only */ - pcs_autoneg = FALSE; + pcs_autoneg = false; /* FALLTHROUGH */ default: if (hw->mac.type == e1000_82575 || @@ -1545,7 +1545,7 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) } if (data & E1000_EEPROM_PCS_AUTONEG_DISABLE_BIT) - pcs_autoneg = FALSE; + pcs_autoneg = false; } /* @@ -1637,8 +1637,8 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) u32 link_mode = 0; /* Set internal phy as default */ - dev_spec->sgmii_active = FALSE; - dev_spec->module_plugged = FALSE; + dev_spec->sgmii_active = false; + dev_spec->module_plugged = false; /* Get CSR setting */ ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -1657,7 +1657,7 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) /* Get phy control interface type set (MDIO vs. I2C)*/ if (e1000_sgmii_uses_mdio_82575(hw)) { hw->phy.media_type = e1000_media_type_copper; - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; break; } /* fall through for I2C based SGMII */ @@ -1675,7 +1675,7 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) if (link_mode == E1000_CTRL_EXT_LINK_MODE_SGMII) { hw->phy.media_type = e1000_media_type_copper; - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; } break; @@ -1746,14 +1746,14 @@ static s32 e1000_set_sfp_media_type_82575(struct e1000_hw *hw) /* Check if there is some SFP module plugged and powered */ if ((tranceiver_type == E1000_SFF_IDENTIFIER_SFP) || (tranceiver_type == E1000_SFF_IDENTIFIER_SFF)) { - dev_spec->module_plugged = TRUE; + dev_spec->module_plugged = true; if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) { hw->phy.media_type = e1000_media_type_internal_serdes; } else if (eth_flags->e100_base_fx) { - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; hw->phy.media_type = e1000_media_type_internal_serdes; } else if (eth_flags->e1000_base_t) { - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; hw->phy.media_type = e1000_media_type_copper; } else { hw->phy.media_type = e1000_media_type_unknown; @@ -2224,11 +2224,11 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) DEBUGFUNC("e1000_reset_hw_82580"); - hw->dev_spec._82575.global_device_reset = FALSE; + hw->dev_spec._82575.global_device_reset = false; /* 82580 does not reliably do global_device_reset due to hw errata */ if (hw->mac.type == e1000_82580) - global_device_reset = FALSE; + global_device_reset = false; /* Get current control state. */ ctrl = E1000_READ_REG(hw, E1000_CTRL); @@ -2252,7 +2252,7 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) /* Determine whether or not a global dev reset is requested */ if (global_device_reset && hw->mac.ops.acquire_swfw_sync(hw, swmbsw_mask)) - global_device_reset = FALSE; + global_device_reset = false; if (global_device_reset && !(E1000_READ_REG(hw, E1000_STATUS) & E1000_STAT_DEV_RST_SET)) @@ -2572,7 +2572,7 @@ s32 e1000_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data) { DEBUGFUNC("e1000_read_emi_reg"); - return __e1000_access_emi_reg(hw, addr, data, TRUE); + return __e1000_access_emi_reg(hw, addr, data, true); } /** @@ -2930,7 +2930,7 @@ s32 e1000_get_eee_status_i354(struct e1000_hw *hw, bool *status) goto out; *status = phy_data & (E1000_PCS_STATUS_TX_LPI_RCVD | - E1000_PCS_STATUS_RX_LPI_RCVD) ? TRUE : FALSE; + E1000_PCS_STATUS_RX_LPI_RCVD) ? true : false; out: return ret_val; @@ -3032,7 +3032,7 @@ s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, u32 retry = 1; u16 swfw_mask = 0; - bool nack = TRUE; + bool nack = true; DEBUGFUNC("e1000_read_i2c_byte_generic"); @@ -3299,7 +3299,7 @@ static s32 e1000_get_i2c_ack(struct e1000_hw *hw) u32 i = 0; u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); u32 timeout = 10; - bool ack = TRUE; + bool ack = true; DEBUGFUNC("e1000_get_i2c_ack"); diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index b28ab77f3794..5c778a48bba0 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -421,10 +421,10 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) /** * e1000_setup_init_funcs - Initializes function pointers * @hw: pointer to the HW structure - * @init_device: TRUE will initialize the rest of the function pointers - * getting the device ready for use. FALSE will only set + * @init_device: true will initialize the rest of the function pointers + * getting the device ready for use. false will only set * MAC type and the function pointers for the other init - * functions. Passing FALSE will not generate any hardware + * functions. Passing false will not generate any hardware * reads or writes. * * This function must be called by a driver in order to use the rest @@ -656,7 +656,7 @@ bool e1000_check_mng_mode(struct e1000_hw *hw) if (hw->mac.ops.check_mng_mode) return hw->mac.ops.check_mng_mode(hw); - return FALSE; + return false; } /** @@ -1186,7 +1186,7 @@ s32 e1000_phy_commit(struct e1000_hw *hw) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D0 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D0 + * and SmartSpeed is disabled when active is true, else clear lplu for D0 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is @@ -1208,7 +1208,7 @@ s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index c96030b567db..48cf33213043 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -140,11 +140,11 @@ u32 e1000_translate_register_82542(u32 reg); * Typical use: * ... * if (TBI_ACCEPT) { - * accept_frame = TRUE; + * accept_frame = true; * e1000_tbi_adjust_stats(adapter, MacAddress); * frame_length--; * } else { - * accept_frame = FALSE; + * accept_frame = false; * } * ... */ diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index 90bc652861b5..6ee252e147a4 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -275,7 +275,7 @@ enum e1000_mac_type { e1000_i211, e1000_vfadapt, e1000_vfadapt_i350, - e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */ + e1000_num_macs /* List is 1-based, so subtract 1 for true count. */ }; enum e1000_media_type { diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 0d810fecf3bd..da2e786130c8 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -552,14 +552,14 @@ out: bool e1000_get_flash_presence_i210(struct e1000_hw *hw) { u32 eec = 0; - bool ret_val = FALSE; + bool ret_val = false; DEBUGFUNC("e1000_get_flash_presence_i210"); eec = E1000_READ_REG(hw, E1000_EECD); if (eec & E1000_EECD_FLASH_DETECTED_I210) - ret_val = TRUE; + ret_val = true; return ret_val; } diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index dd4e85d64aff..5cd13579d50c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -242,7 +242,7 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) } if (ret_val) - return FALSE; + return false; out: if (hw->mac.type >= e1000_pch_lpt) { /* Only unforce SMBus if ME is not active */ @@ -260,7 +260,7 @@ out: } } - return TRUE; + return true; } /** @@ -324,7 +324,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) /* Gate automatic PHY configuration by hardware on managed and * non-managed 82579 and newer adapters. */ - e1000_gate_hw_phy_config_ich8lan(hw, TRUE); + e1000_gate_hw_phy_config_ich8lan(hw, true); /* It is not possible to be certain of the current state of ULP * so forcibly disable it. @@ -439,7 +439,7 @@ out: if ((hw->mac.type == e1000_pch2lan) && !(fwsm & E1000_ICH_FWSM_FW_VALID)) { msec_delay(10); - e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + e1000_gate_hw_phy_config_ich8lan(hw, false); } return ret_val; @@ -699,7 +699,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) /* Clear shadow ram */ for (i = 0; i < nvm->word_size; i++) { - dev_spec->shadow_ram[i].modified = FALSE; + dev_spec->shadow_ram[i].modified = false; dev_spec->shadow_ram[i].value = 0xFFFF; } @@ -743,13 +743,13 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) if (mac->type == e1000_ich8lan) mac->rar_entry_count--; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC subsystem not supported */ - mac->arc_subsystem_valid = FALSE; + mac->arc_subsystem_valid = false; /* Adaptive IFS supported */ - mac->adaptive_ifs = TRUE; + mac->adaptive_ifs = true; /* Function pointers */ @@ -833,7 +833,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /* Enable PCS Lock-loss workaround for ICH8 */ if (mac->type == e1000_ich8lan) - e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, TRUE); + e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, true); return E1000_SUCCESS; } @@ -880,7 +880,7 @@ s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data) { DEBUGFUNC("e1000_read_emi_reg_locked"); - return __e1000_access_emi_reg_locked(hw, addr, data, TRUE); + return __e1000_access_emi_reg_locked(hw, addr, data, true); } /** @@ -895,7 +895,7 @@ s32 e1000_write_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 data) { DEBUGFUNC("e1000_read_emi_reg_locked"); - return __e1000_access_emi_reg_locked(hw, addr, &data, FALSE); + return __e1000_access_emi_reg_locked(hw, addr, &data, false); } /** @@ -1112,7 +1112,7 @@ static u64 e1000_ltr2ns(u16 ltr) * GbE MAC in the Lynx Point PCH based on Rx buffer size and link speed * when link is up (which must not exceed the maximum latency supported * by the platform), otherwise specify there is no LTR requirement. - * Unlike TRUE-PCIe devices which set the LTR maximum snoop/no-snoop + * Unlike true-PCIe devices which set the LTR maximum snoop/no-snoop * latencies in the LTR Extended Capability Structure in the PCIe Extended * Capability register set, on this device LTR is set by writing the * equivalent snoop/no-snoop latencies in the LTRV register in the MAC and @@ -1410,8 +1410,8 @@ out: * If not on an ME enabled system, un-configure the ULP mode by software. * * During nominal operation, this function is called when link is acquired - * to disable ULP mode (force=FALSE); otherwise, for example when unloading - * the driver or during Sx->S0 transitions, this is called with force=TRUE + * to disable ULP mode (force=false); otherwise, for example when unloading + * the driver or during Sx->S0 transitions, this is called with force=true * to forcibly disable ULP. */ s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) @@ -1745,7 +1745,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; } - if (hw->dev_spec.ich8lan.disable_k1_off == TRUE) + if (hw->dev_spec.ich8lan.disable_k1_off == true) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; E1000_WRITE_REG(hw, E1000_FEXTNVM6, fextnvm6); @@ -1754,7 +1754,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (!link) return E1000_SUCCESS; /* No link detected */ - mac->get_link_status = FALSE; + mac->get_link_status = false; switch (hw->mac.type) { case e1000_pch2lan: @@ -2209,7 +2209,7 @@ release: static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) { u32 fwsm; - bool blocked = FALSE; + bool blocked = false; int i = 0; DEBUGFUNC("e1000_check_reset_block_ich8lan"); @@ -2217,11 +2217,11 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) do { fwsm = E1000_READ_REG(hw, E1000_FWSM); if (!(fwsm & E1000_ICH_FWSM_RSPCIPHY)) { - blocked = TRUE; + blocked = true; msec_delay(10); continue; } - blocked = FALSE; + blocked = false; } while (blocked && (i++ < 30)); return blocked ? E1000_BLK_PHY_RESET : E1000_SUCCESS; } @@ -2435,7 +2435,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) if (status_reg == (BM_CS_STATUS_LINK_UP | BM_CS_STATUS_RESOLVED | BM_CS_STATUS_SPEED_1000)) - k1_enable = FALSE; + k1_enable = false; } if (hw->phy.type == e1000_phy_82577) { @@ -2451,7 +2451,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) if (status_reg == (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE | HV_M_STATUS_SPEED_1000)) - k1_enable = FALSE; + k1_enable = false; } /* Link stall fix for link up */ @@ -2688,7 +2688,7 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) /* Configure the K1 Si workaround during phy reset assuming there is * link so that it disables K1 if link is in 1Gbps. */ - ret_val = e1000_k1_gig_workaround_hv(hw, TRUE); + ret_val = e1000_k1_gig_workaround_hv(hw, true); if (ret_val) return ret_val; @@ -3033,7 +3033,7 @@ static s32 e1000_k1_workaround_lv(struct e1000_hw *hw) /** * e1000_gate_hw_phy_config_ich8lan - disable PHY config via hardware * @hw: pointer to the HW structure - * @gate: boolean set to TRUE to gate, FALSE to ungate + * @gate: boolean set to true to gate, false to ungate * * Gate/ungate the automatic PHY configuration via hardware; perform * the configuration via software instead. @@ -3136,14 +3136,14 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw) return ret_val; /* Configure the LCD with the OEM bits in NVM */ - ret_val = e1000_oem_bits_config_ich8lan(hw, TRUE); + ret_val = e1000_oem_bits_config_ich8lan(hw, true); if (hw->mac.type == e1000_pch2lan) { /* Ungate automatic PHY configuration on non-managed 82579 */ if (!(E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID)) { msec_delay(10); - e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + e1000_gate_hw_phy_config_ich8lan(hw, false); } *** 1091 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:57:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 970CF6A83A3; Tue, 28 Sep 2021 16:57: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 4HJlzy3tKgz4RkM; Tue, 28 Sep 2021 16:57:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CF46206; Tue, 28 Sep 2021 16:57: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 18SGvYqT035392; Tue, 28 Sep 2021 16:57:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SGvYkv035391; Tue, 28 Sep 2021 16:57:34 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:57:34 GMT Message-Id: <202109281657.18SGvYkv035391@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: 1f80b2b78d24 - stable/13 - e1000: Consistently use FALLTHROUGH 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: 1f80b2b78d240c46867c85ac1376228c5eb16664 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:57:34 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1f80b2b78d240c46867c85ac1376228c5eb16664 commit 1f80b2b78d240c46867c85ac1376228c5eb16664 Author: Kevin Bowling AuthorDate: 2021-09-17 03:13:26 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 16:55:59 +0000 e1000: Consistently use FALLTHROUGH Approved by: imp MFC after: 1 week (cherry picked from commit e05d9788b7e90ffd6405dc59656b52a63ba7ff3e) --- sys/dev/e1000/e1000_82540.c | 2 +- sys/dev/e1000/e1000_82571.c | 4 ++-- sys/dev/e1000/e1000_82575.c | 6 ++++++ sys/dev/e1000/e1000_ich8lan.c | 16 ++++++++-------- sys/dev/e1000/e1000_nvm.c | 2 +- sys/dev/e1000/e1000_phy.c | 6 +++++- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/sys/dev/e1000/e1000_82540.c b/sys/dev/e1000/e1000_82540.c index 720798260f8a..e60fc8ebf08e 100644 --- a/sys/dev/e1000/e1000_82540.c +++ b/sys/dev/e1000/e1000_82540.c @@ -100,7 +100,7 @@ static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) case e1000_82546_rev_3: if (phy->id == M88E1011_I_PHY_ID) break; - /* Fall Through */ + /* FALLTHROUGH */ default: ret_val = -E1000_ERR_PHY; goto out; diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index cae9afcb2d78..ce9ae8791654 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -238,7 +238,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_EECD, eecd); break; } - /* Fall Through */ + /* FALLTHROUGH */ default: nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> @@ -1115,7 +1115,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) switch (mac->type) { case e1000_82573: e1000_enable_tx_pkt_filtering_generic(hw); - /* fall through */ + /* FALLTHROUGH */ case e1000_82574: case e1000_82583: reg_data = E1000_READ_REG(hw, E1000_GCR); diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 59d8b9c85dc3..a0c057e5f07f 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -1443,13 +1443,19 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) } switch (hw->phy.type) { case e1000_phy_i210: + /* FALLTHROUGH */ case e1000_phy_m88: switch (hw->phy.id) { case I347AT4_E_PHY_ID: + /* FALLTHROUGH */ case M88E1112_E_PHY_ID: + /* FALLTHROUGH */ case M88E1340M_E_PHY_ID: + /* FALLTHROUGH */ case M88E1543_E_PHY_ID: + /* FALLTHROUGH */ case M88E1512_E_PHY_ID: + /* FALLTHROUGH */ case I210_I_PHY_ID: ret_val = e1000_copper_link_setup_m88_gen2(hw); break; diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 5cd13579d50c..4209595a911c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -365,12 +365,12 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) */ msec_delay(50); - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch2lan: if (e1000_phy_is_accessible_pchlan(hw)) break; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pchlan: if ((hw->mac.type == e1000_pchlan) && (fwsm & E1000_ICH_FWSM_FW_VALID)) @@ -493,7 +493,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) return ret_val; if ((phy->id != 0) && (phy->id != PHY_REVISION_MASK)) break; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: @@ -796,7 +796,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) case e1000_pch2lan: mac->rar_entry_count = E1000_PCH2_RAR_ENTRIES; mac->ops.rar_set = e1000_rar_set_pch2lan; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: @@ -806,7 +806,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pchlan: /* check management mode */ mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan; @@ -1761,7 +1761,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) ret_val = e1000_k1_workaround_lv(hw); if (ret_val) return ret_val; - /* fall-thru */ + /* FALLTHROUGH */ case e1000_pchlan: if (hw->phy.type == e1000_phy_82578) { ret_val = e1000_link_stall_workaround_hv(hw); @@ -2299,7 +2299,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; break; } - /* Fall-thru */ + /* FALLTHROUGH */ case e1000_pchlan: case e1000_pch2lan: case e1000_pch_lpt: @@ -3479,7 +3479,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) return E1000_SUCCESS; } DEBUGOUT("Unable to determine valid NVM bank via EEC - reading flash signature\n"); - /* fall-thru */ + /* FALLTHROUGH */ default: /* set bank to 0 in case flash read fails */ *bank = 0; diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 31bbfcc6981d..8911204f0b91 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -1321,7 +1321,7 @@ void e1000_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers) e1000_read_invm_version(hw, fw_vers); return; } - /* fall through */ + /* FALLTHROUGH */ case e1000_i350: hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); /* find combo image version */ diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index e5fd942464b6..872a5267bfdb 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -1038,7 +1038,7 @@ static s32 e1000_set_master_slave_mode(struct e1000_hw *hw) break; case e1000_ms_auto: phy_data &= ~CR_1000T_MS_ENABLE; - /* fall-through */ + /* FALLTHROUGH */ default: break; } @@ -1098,6 +1098,7 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) phy_data |= I82577_PHY_CTRL2_MANUAL_MDIX; break; case 0: + /* FALLTHROUGH */ default: phy_data |= I82577_PHY_CTRL2_AUTO_MDI_MDIX; break; @@ -1154,6 +1155,7 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) phy_data |= M88E1000_PSCR_AUTO_X_1000T; break; case 0: + /* FALLTHROUGH */ default: phy_data |= M88E1000_PSCR_AUTO_X_MODE; break; @@ -1306,6 +1308,7 @@ s32 e1000_copper_link_setup_m88_gen2(struct e1000_hw *hw) } /* FALLTHROUGH */ case 0: + /* FALLTHROUGH */ default: phy_data |= M88E1000_PSCR_AUTO_X_MODE; break; @@ -1420,6 +1423,7 @@ s32 e1000_copper_link_setup_igp(struct e1000_hw *hw) data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; break; case 0: + /* FALLTHROUGH */ default: data |= IGP01E1000_PSCR_AUTO_MDIX; break; From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:57:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F04D767FDF3; Tue, 28 Sep 2021 16:57: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 4HJlzz4vscz4RRx; Tue, 28 Sep 2021 16:57:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CFDA207; Tue, 28 Sep 2021 16:57: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 18SGvZkd035423; Tue, 28 Sep 2021 16:57:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SGvZta035422; Tue, 28 Sep 2021 16:57:35 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:57:35 GMT Message-Id: <202109281657.18SGvZta035422@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: 717bed4f6f18 - stable/13 - e1000: Rename 'struct adapter' to 'struct e1000_sc' 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: 717bed4f6f1808d91f8ec7a1f5952052035b8dc7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:57:36 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=717bed4f6f1808d91f8ec7a1f5952052035b8dc7 commit 717bed4f6f1808d91f8ec7a1f5952052035b8dc7 Author: Kevin Bowling AuthorDate: 2021-09-25 00:09:43 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 16:55:59 +0000 e1000: Rename 'struct adapter' to 'struct e1000_sc' Rename the 'struct adapter' to 'struct e1000_sc' to avoid type ambiguity in things like kgdb. Reviewed by: jhb, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32129 (cherry picked from commit dc9260515449cde9a4b26b5448f7386388c55bbd) --- sys/dev/e1000/em_txrx.c | 80 +-- sys/dev/e1000/if_em.c | 1556 +++++++++++++++++++++++----------------------- sys/dev/e1000/if_em.h | 308 +++++---- sys/dev/e1000/igb_txrx.c | 40 +- 4 files changed, 987 insertions(+), 997 deletions(-) diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c index cc5313a749bd..6ac66a9011f4 100644 --- a/sys/dev/e1000/em_txrx.c +++ b/sys/dev/e1000/em_txrx.c @@ -42,9 +42,9 @@ /********************************************************************* * Local Function prototypes *********************************************************************/ -static int em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, +static int em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower); -static int em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, +static int em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower); static int em_isc_txd_encap(void *arg, if_pkt_info_t pi); static void em_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); @@ -91,9 +91,9 @@ struct if_txrx lem_txrx = { extern if_shared_ctx_t em_sctx; void -em_dump_rs(struct adapter *adapter) +em_dump_rs(struct e1000_softc *sc) { - if_softc_ctx_t scctx = adapter->shared; + if_softc_ctx_t scctx = sc->shared; struct em_tx_queue *que; struct tx_ring *txr; qidx_t i, ntxd, qid, cur; @@ -102,8 +102,8 @@ em_dump_rs(struct adapter *adapter) printf("\n"); ntxd = scctx->isc_ntxd[0]; - for (qid = 0; qid < adapter->tx_num_queues; qid++) { - que = &adapter->tx_queues[qid]; + for (qid = 0; qid < sc->tx_num_queues; qid++) { + que = &sc->tx_queues[qid]; txr = &que->txr; rs_cidx = txr->tx_rs_cidx; if (rs_cidx != txr->tx_rs_pidx) { @@ -132,10 +132,10 @@ em_dump_rs(struct adapter *adapter) * **********************************************************************/ static int -em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) +em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) { - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[pi->ipi_qsidx]; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; struct e1000_context_desc *TXD; int cur, hdr_len; @@ -178,7 +178,7 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd TXD->tcp_seg_setup.fields.mss = htole16(pi->ipi_tso_segsz); TXD->tcp_seg_setup.fields.hdr_len = hdr_len; - TXD->cmd_and_length = htole32(adapter->txd_cmd | + TXD->cmd_and_length = htole32(sc->txd_cmd | E1000_TXD_CMD_DEXT | /* Extended descr */ E1000_TXD_CMD_TSE | /* TSE context */ E1000_TXD_CMD_IP | /* Do IP csum */ @@ -189,7 +189,7 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd if (++cur == scctx->isc_ntxd[0]) { cur = 0; } - DPRINTF(iflib_get_dev(adapter->ctx), "%s: pidx: %d cur: %d\n", __FUNCTION__, pi->ipi_pidx, cur); + DPRINTF(iflib_get_dev(sc->ctx), "%s: pidx: %d cur: %d\n", __FUNCTION__, pi->ipi_pidx, cur); return (cur); } @@ -215,11 +215,11 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd **********************************************************************/ static int -em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) +em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) { struct e1000_context_desc *TXD = NULL; - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[pi->ipi_qsidx]; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; int csum_flags = pi->ipi_csum_flags; int cur, hdr_len; @@ -227,7 +227,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u cur = pi->ipi_pidx; hdr_len = pi->ipi_ehdrlen + pi->ipi_ip_hlen; - cmd = adapter->txd_cmd; + cmd = sc->txd_cmd; /* * The 82574L can only remember the *last* context used @@ -237,7 +237,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u * second note. */ if (DONT_FORCE_CTX && - adapter->tx_num_queues == 1 && + sc->tx_num_queues == 1 && txr->csum_lhlen == pi->ipi_ehdrlen && txr->csum_iphlen == pi->ipi_ip_hlen && txr->csum_flags == csum_flags) { @@ -293,7 +293,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u if (++cur == scctx->isc_ntxd[0]) { cur = 0; } - DPRINTF(iflib_get_dev(adapter->ctx), "checksum_setup csum_flags=%x txd_upper=%x txd_lower=%x hdr_len=%d cmd=%x\n", + DPRINTF(iflib_get_dev(sc->ctx), "checksum_setup csum_flags=%x txd_upper=%x txd_lower=%x hdr_len=%d cmd=%x\n", csum_flags, *txd_upper, *txd_lower, hdr_len, cmd); return (cur); } @@ -301,7 +301,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u static int em_isc_txd_encap(void *arg, if_pkt_info_t pi) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; @@ -348,7 +348,7 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) } DPRINTF(iflib_get_dev(sc->ctx), "encap: set up tx: nsegs=%d first=%d i=%d\n", nsegs, first, i); - /* XXX adapter->pcix_82544 -- lem_fill_descriptors */ + /* XXX sc->pcix_82544 -- lem_fill_descriptors */ /* Set up our transmit descriptors */ for (j = 0; j < nsegs; j++) { @@ -416,19 +416,19 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) static void em_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx) { - struct adapter *adapter = arg; - struct em_tx_queue *que = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = arg; + struct em_tx_queue *que = &sc->tx_queues[txqid]; struct tx_ring *txr = &que->txr; - E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), pidx); + E1000_WRITE_REG(&sc->hw, E1000_TDT(txr->me), pidx); } static int em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[txqid]; struct tx_ring *txr = &que->txr; qidx_t processed = 0; @@ -461,7 +461,7 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) if (delta < 0) delta += ntxd; MPASS(delta > 0); - DPRINTF(iflib_get_dev(adapter->ctx), + DPRINTF(iflib_get_dev(sc->ctx), "%s: cidx_processed=%u cur=%u clear=%d delta=%d\n", __FUNCTION__, prev, cur, clear, delta); @@ -483,7 +483,7 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) static void lem_isc_rxd_refill(void *arg, if_rxd_update_t iru) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[iru->iru_qsidx]; struct rx_ring *rxr = &que->rxr; @@ -511,7 +511,7 @@ lem_isc_rxd_refill(void *arg, if_rxd_update_t iru) static void em_isc_rxd_refill(void *arg, if_rxd_update_t iru) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; uint16_t rxqid = iru->iru_qsidx; struct em_rx_queue *que = &sc->rx_queues[rxqid]; @@ -540,7 +540,7 @@ em_isc_rxd_refill(void *arg, if_rxd_update_t iru) static void em_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -550,7 +550,7 @@ em_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx) static int lem_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -575,7 +575,7 @@ lem_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) static int em_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -600,9 +600,9 @@ em_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) static int lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; struct e1000_rx_desc *rxd; u16 len; @@ -628,7 +628,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (errors & E1000_RXD_ERR_FRAME_ERR_MASK) { - adapter->dropped_pkts++; + sc->dropped_pkts++; /* XXX fixup if common */ return (EBADMSG); } @@ -645,7 +645,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) } while (!eop); /* XXX add a faster way to look this up */ - if (adapter->hw.mac.type >= e1000_82543) + if (sc->hw.mac.type >= e1000_82543) em_receive_checksum(status, errors, ri); if (status & E1000_RXD_STAT_VP) { @@ -661,9 +661,9 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) static int em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; union e1000_rx_desc_extended *rxd; @@ -691,7 +691,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) { - adapter->dropped_pkts++; + sc->dropped_pkts++; return EBADMSG; } diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 89ccb30ce922..47513c5d9e1e 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -294,33 +294,33 @@ static int igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid); static void em_if_multi_set(if_ctx_t ctx); static void em_if_update_admin_status(if_ctx_t ctx); static void em_if_debug(if_ctx_t ctx); -static void em_update_stats_counters(struct adapter *); -static void em_add_hw_stats(struct adapter *adapter); +static void em_update_stats_counters(struct e1000_softc *); +static void em_add_hw_stats(struct e1000_softc *); static int em_if_set_promisc(if_ctx_t ctx, int flags); -static bool em_if_vlan_filter_capable(struct adapter *); -static bool em_if_vlan_filter_used(struct adapter *); -static void em_if_vlan_filter_enable(struct adapter *); -static void em_if_vlan_filter_disable(struct adapter *); -static void em_if_vlan_filter_write(struct adapter *); -static void em_setup_vlan_hw_support(struct adapter *); +static bool em_if_vlan_filter_capable(struct e1000_softc *); +static bool em_if_vlan_filter_used(struct e1000_softc *); +static void em_if_vlan_filter_enable(struct e1000_softc *); +static void em_if_vlan_filter_disable(struct e1000_softc *); +static void em_if_vlan_filter_write(struct e1000_softc *); +static void em_setup_vlan_hw_support(struct e1000_softc *); static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); -static void em_print_nvm_info(struct adapter *); +static void em_print_nvm_info(struct e1000_softc *); static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); static int em_get_rs(SYSCTL_HANDLER_ARGS); -static void em_print_debug_info(struct adapter *); +static void em_print_debug_info(struct e1000_softc *); static int em_is_valid_ether_addr(u8 *); static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); -static void em_add_int_delay_sysctl(struct adapter *, const char *, +static void em_add_int_delay_sysctl(struct e1000_softc *, const char *, const char *, struct em_int_delay_info *, int, int); /* Management and WOL Support */ -static void em_init_manageability(struct adapter *); -static void em_release_manageability(struct adapter *); -static void em_get_hw_control(struct adapter *); -static void em_release_hw_control(struct adapter *); +static void em_init_manageability(struct e1000_softc *); +static void em_release_manageability(struct e1000_softc *); +static void em_get_hw_control(struct e1000_softc *); +static void em_release_hw_control(struct e1000_softc *); static void em_get_wakeup(if_ctx_t ctx); static void em_enable_wakeup(if_ctx_t ctx); -static int em_enable_phy_wakeup(struct adapter *); -static void em_disable_aspm(struct adapter *); +static int em_enable_phy_wakeup(struct e1000_softc *); +static void em_disable_aspm(struct e1000_softc *); int em_intr(void *arg); @@ -337,8 +337,8 @@ static void em_if_led_func(if_ctx_t ctx, int onoff); static int em_get_regs(SYSCTL_HANDLER_ARGS); -static void lem_smartspeed(struct adapter *adapter); -static void igb_configure_queues(struct adapter *adapter); +static void lem_smartspeed(struct e1000_softc *); +static void igb_configure_queues(struct e1000_softc *); /********************************************************************* @@ -370,7 +370,7 @@ static device_method_t igb_methods[] = { static driver_t em_driver = { - "em", em_methods, sizeof(struct adapter), + "em", em_methods, sizeof(struct e1000_softc), }; static devclass_t em_devclass; @@ -383,7 +383,7 @@ MODULE_DEPEND(em, iflib, 1, 1, 1); IFLIB_PNP_INFO(pci, em, em_vendor_info_array); static driver_t igb_driver = { - "igb", igb_methods, sizeof(struct adapter), + "igb", igb_methods, sizeof(struct e1000_softc), }; static devclass_t igb_devclass; @@ -430,7 +430,7 @@ static device_method_t em_if_methods[] = { }; static driver_t em_if_driver = { - "em_if", em_if_methods, sizeof(struct adapter) + "em_if", em_if_methods, sizeof(struct e1000_softc) }; static device_method_t igb_if_methods[] = { @@ -468,7 +468,7 @@ static device_method_t igb_if_methods[] = { }; static driver_t igb_if_driver = { - "igb_if", igb_if_methods, sizeof(struct adapter) + "igb_if", igb_if_methods, sizeof(struct e1000_softc) }; /********************************************************************* @@ -609,8 +609,8 @@ static struct if_shared_ctx igb_sctx_init = { static int em_get_regs(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *)arg1; - struct e1000_hw *hw = &adapter->hw; + struct e1000_softc *sc = (struct e1000_softc *)arg1; + struct e1000_hw *hw = &sc->hw; struct sbuf *sb; u32 *regs_buff; int rc; @@ -690,7 +690,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) #ifdef DUMP_DESCS { - if_softc_ctx_t scctx = adapter->shared; + if_softc_ctx_t scctx = sc->shared; struct rx_ring *rxr = &rx_que->rxr; struct tx_ring *txr = &tx_que->txr; int ntxd = scctx->isc_ntxd[0]; @@ -734,11 +734,11 @@ igb_register(device_t dev) static int em_set_num_queues(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); int maxqueues; /* Sanity check based on HW */ - switch (adapter->hw.mac.type) { + switch (sc->hw.mac.type) { case e1000_82576: case e1000_82580: case e1000_i350: @@ -788,7 +788,7 @@ em_set_num_queues(if_ctx_t ctx) static int em_if_attach_pre(if_ctx_t ctx) { - struct adapter *adapter; + struct e1000_softc *sc; if_softc_ctx_t scctx; device_t dev; struct e1000_hw *hw; @@ -796,42 +796,42 @@ em_if_attach_pre(if_ctx_t ctx) INIT_DEBUGOUT("em_if_attach_pre: begin"); dev = iflib_get_dev(ctx); - adapter = iflib_get_softc(ctx); + sc = iflib_get_softc(ctx); - adapter->ctx = adapter->osdep.ctx = ctx; - adapter->dev = adapter->osdep.dev = dev; - scctx = adapter->shared = iflib_get_softc_ctx(ctx); - adapter->media = iflib_get_media(ctx); - hw = &adapter->hw; + sc->ctx = sc->osdep.ctx = ctx; + sc->dev = sc->osdep.dev = dev; + scctx = sc->shared = iflib_get_softc_ctx(ctx); + sc->media = iflib_get_media(ctx); + hw = &sc->hw; - adapter->tx_process_limit = scctx->isc_ntxd[0]; + sc->tx_process_limit = scctx->isc_ntxd[0]; /* SYSCTL stuff */ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "nvm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, em_sysctl_nvm_info, "I", "NVM Information"); + sc, 0, em_sysctl_nvm_info, "I", "NVM Information"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, em_sysctl_debug_info, "I", "Debug Information"); + sc, 0, em_sysctl_debug_info, "I", "Debug Information"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, em_set_flowcntl, "I", "Flow Control"); + sc, 0, em_set_flowcntl, "I", "Flow Control"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "reg_dump", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, em_get_regs, "A", "Dump Registers"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "rs_dump", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, em_get_rs, "I", "Dump RS indexes"); /* Determine hardware and mac info */ @@ -938,19 +938,19 @@ em_if_attach_pre(if_ctx_t ctx) (hw->mac.type == e1000_pch2lan) || (hw->mac.type == e1000_pch_lpt)) { int rid = EM_BAR_TYPE_FLASH; - adapter->flash = bus_alloc_resource_any(dev, + sc->flash = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (adapter->flash == NULL) { + if (sc->flash == NULL) { device_printf(dev, "Mapping of Flash failed\n"); error = ENXIO; goto err_pci; } /* This is used in the shared code */ - hw->flash_address = (u8 *)adapter->flash; - adapter->osdep.flash_bus_space_tag = - rman_get_bustag(adapter->flash); - adapter->osdep.flash_bus_space_handle = - rman_get_bushandle(adapter->flash); + hw->flash_address = (u8 *)sc->flash; + sc->osdep.flash_bus_space_tag = + rman_get_bustag(sc->flash); + sc->osdep.flash_bus_space_handle = + rman_get_bushandle(sc->flash); } /* ** In the new SPT device flash is not a @@ -959,10 +959,10 @@ em_if_attach_pre(if_ctx_t ctx) ** FLASH read/write macros in the shared code. */ else if (hw->mac.type >= e1000_pch_spt) { - adapter->osdep.flash_bus_space_tag = - adapter->osdep.mem_bus_space_tag; - adapter->osdep.flash_bus_space_handle = - adapter->osdep.mem_bus_space_handle + sc->osdep.flash_bus_space_tag = + sc->osdep.mem_bus_space_tag; + sc->osdep.flash_bus_space_handle = + sc->osdep.mem_bus_space_handle + E1000_FLASH_BASE_ADDR; } @@ -979,25 +979,25 @@ em_if_attach_pre(if_ctx_t ctx) e1000_get_bus_info(hw); /* Set up some sysctls for the tunable interrupt delays */ - em_add_int_delay_sysctl(adapter, "rx_int_delay", - "receive interrupt delay in usecs", &adapter->rx_int_delay, + em_add_int_delay_sysctl(sc, "rx_int_delay", + "receive interrupt delay in usecs", &sc->rx_int_delay, E1000_REGISTER(hw, E1000_RDTR), em_rx_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "tx_int_delay", - "transmit interrupt delay in usecs", &adapter->tx_int_delay, + em_add_int_delay_sysctl(sc, "tx_int_delay", + "transmit interrupt delay in usecs", &sc->tx_int_delay, E1000_REGISTER(hw, E1000_TIDV), em_tx_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "rx_abs_int_delay", + em_add_int_delay_sysctl(sc, "rx_abs_int_delay", "receive interrupt delay limit in usecs", - &adapter->rx_abs_int_delay, + &sc->rx_abs_int_delay, E1000_REGISTER(hw, E1000_RADV), em_rx_abs_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "tx_abs_int_delay", + em_add_int_delay_sysctl(sc, "tx_abs_int_delay", "transmit interrupt delay limit in usecs", - &adapter->tx_abs_int_delay, + &sc->tx_abs_int_delay, E1000_REGISTER(hw, E1000_TADV), em_tx_abs_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "itr", + em_add_int_delay_sysctl(sc, "itr", "interrupt delay limit in usecs/4", - &adapter->tx_itr, + &sc->tx_itr, E1000_REGISTER(hw, E1000_ITR), DEFAULT_ITR); @@ -1030,9 +1030,9 @@ em_if_attach_pre(if_ctx_t ctx) hw->mac.report_tx_early = 1; /* Allocate multicast array memory. */ - adapter->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * + sc->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); - if (adapter->mta == NULL) { + if (sc->mta == NULL) { device_printf(dev, "Can not allocate multicast setup array\n"); error = ENOMEM; goto err_late; @@ -1049,7 +1049,7 @@ em_if_attach_pre(if_ctx_t ctx) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "eee_control", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, em_sysctl_eee, "I", + sc, 0, em_sysctl_eee, "I", "Disable Energy Efficient Ethernet"); /* @@ -1083,7 +1083,7 @@ em_if_attach_pre(if_ctx_t ctx) } if (!em_is_valid_ether_addr(hw->mac.addr)) { - if (adapter->vf_ifp) { + if (sc->vf_ifp) { ether_gen_addr(iflib_get_ifp(ctx), (struct ether_addr *)hw->mac.addr); } else { @@ -1103,7 +1103,7 @@ em_if_attach_pre(if_ctx_t ctx) /* Enable only WOL MAGIC by default */ scctx->isc_capenable &= ~IFCAP_WOL; - if (adapter->wol != 0) + if (sc->wol != 0) scctx->isc_capenable |= IFCAP_WOL_MAGIC; iflib_set_mac(ctx, hw->mac.addr); @@ -1111,10 +1111,10 @@ em_if_attach_pre(if_ctx_t ctx) return (0); err_late: - em_release_hw_control(adapter); + em_release_hw_control(sc); err_pci: em_free_pci_resources(ctx); - free(adapter->mta, M_DEVBUF); + free(sc->mta, M_DEVBUF); return (error); } @@ -1122,28 +1122,28 @@ err_pci: static int em_if_attach_post(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - struct e1000_hw *hw = &adapter->hw; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct e1000_hw *hw = &sc->hw; int error = 0; /* Setup OS specific network interface */ error = em_setup_interface(ctx); if (error != 0) { - device_printf(adapter->dev, "Interface setup failed: %d\n", error); + device_printf(sc->dev, "Interface setup failed: %d\n", error); goto err_late; } em_reset(ctx); /* Initialize statistics */ - em_update_stats_counters(adapter); + em_update_stats_counters(sc); hw->mac.get_link_status = 1; em_if_update_admin_status(ctx); - em_add_hw_stats(adapter); + em_add_hw_stats(sc); /* Non-AMT based hardware can now take control from firmware */ - if (adapter->has_manage && !adapter->has_amt) - em_get_hw_control(adapter); + if (sc->has_manage && !sc->has_amt) + em_get_hw_control(sc); INIT_DEBUGOUT("em_if_attach_post: end"); @@ -1166,17 +1166,17 @@ err_late: static int em_if_detach(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); INIT_DEBUGOUT("em_if_detach: begin"); - e1000_phy_hw_reset(&adapter->hw); + e1000_phy_hw_reset(&sc->hw); - em_release_manageability(adapter); - em_release_hw_control(adapter); + em_release_manageability(sc); + em_release_hw_control(sc); em_free_pci_resources(ctx); - free(adapter->mta, M_DEVBUF); - adapter->mta = NULL; + free(sc->mta, M_DEVBUF); + sc->mta = NULL; return (0); } @@ -1199,10 +1199,10 @@ em_if_shutdown(if_ctx_t ctx) static int em_if_suspend(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); - em_release_manageability(adapter); - em_release_hw_control(adapter); + em_release_manageability(sc); + em_release_hw_control(sc); em_enable_wakeup(ctx); return (0); } @@ -1210,12 +1210,12 @@ em_if_suspend(if_ctx_t ctx) static int em_if_resume(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); - if (adapter->hw.mac.type == e1000_pch2lan) - e1000_resume_workarounds_pchlan(&adapter->hw); + if (sc->hw.mac.type == e1000_pch2lan) + e1000_resume_workarounds_pchlan(&sc->hw); em_if_init(ctx); - em_init_manageability(adapter); + em_init_manageability(sc); return(0); } @@ -1224,12 +1224,12 @@ static int em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) { int max_frame_size; - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = iflib_get_softc_ctx(ctx); IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); - switch (adapter->hw.mac.type) { + switch (sc->hw.mac.type) { case e1000_82571: case e1000_82572: case e1000_ich9lan: @@ -1256,7 +1256,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) max_frame_size = ETHER_MAX_LEN; break; default: - if (adapter->hw.mac.type >= igb_mac_min) + if (sc->hw.mac.type >= igb_mac_min) max_frame_size = 9234; else /* lem */ max_frame_size = MAX_JUMBO_FRAME_SIZE; @@ -1265,7 +1265,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) return (EINVAL); } - scctx->isc_max_frame_size = adapter->hw.mac.max_frame_size = + scctx->isc_max_frame_size = sc->hw.mac.max_frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; return (0); } @@ -1282,8 +1282,8 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) static void em_if_init(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - if_softc_ctx_t scctx = adapter->shared; + struct e1000_softc *sc = iflib_get_softc(ctx); + if_softc_ctx_t scctx = sc->shared; struct ifnet *ifp = iflib_get_ifp(ctx); struct em_tx_queue *tx_que; int i; @@ -1291,11 +1291,11 @@ em_if_init(if_ctx_t ctx) INIT_DEBUGOUT("em_if_init: begin"); /* Get the latest mac address, User can use a LAA */ - bcopy(if_getlladdr(ifp), adapter->hw.mac.addr, + bcopy(if_getlladdr(ifp), sc->hw.mac.addr, ETHER_ADDR_LEN); /* Put the address into the Receive Address Array */ - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); + e1000_rar_set(&sc->hw, sc->hw.mac.addr, 0); /* * With the 82571 adapter, RAR[0] may be overwritten @@ -1303,9 +1303,9 @@ em_if_init(if_ctx_t ctx) * in RAR[14] for that eventuality, this assures * the interface continues to function. */ - if (adapter->hw.mac.type == e1000_82571) { - e1000_set_laa_state_82571(&adapter->hw, true); - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, + if (sc->hw.mac.type == e1000_82571) { + e1000_set_laa_state_82571(&sc->hw, true); + e1000_rar_set(&sc->hw, sc->hw.mac.addr, E1000_RAR_ENTRIES - 1); } @@ -1314,7 +1314,7 @@ em_if_init(if_ctx_t ctx) em_reset(ctx); em_if_update_admin_status(ctx); - for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) { + for (i = 0, tx_que = sc->tx_queues; i < sc->tx_num_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; txr->tx_rs_cidx = txr->tx_rs_pidx; @@ -1328,14 +1328,14 @@ em_if_init(if_ctx_t ctx) } /* Setup VLAN support, basic and offload if available */ - E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); + E1000_WRITE_REG(&sc->hw, E1000_VET, ETHERTYPE_VLAN); /* Clear bad data from Rx FIFOs */ - if (adapter->hw.mac.type >= igb_mac_min) - e1000_rx_fifo_flush_base(&adapter->hw); + if (sc->hw.mac.type >= igb_mac_min) + e1000_rx_fifo_flush_base(&sc->hw); /* Configure for OS presence */ - em_init_manageability(adapter); + em_init_manageability(sc); /* Prepare transmit descriptors and buffers */ em_initialize_transmit_unit(ctx); @@ -1343,42 +1343,42 @@ em_if_init(if_ctx_t ctx) /* Setup Multicast table */ em_if_multi_set(ctx); - adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); + sc->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); em_initialize_receive_unit(ctx); /* Set up VLAN support and filter */ - em_setup_vlan_hw_support(adapter); + em_setup_vlan_hw_support(sc); /* Don't lose promiscuous settings */ em_if_set_promisc(ctx, if_getflags(ifp)); - e1000_clear_hw_cntrs_base_generic(&adapter->hw); + e1000_clear_hw_cntrs_base_generic(&sc->hw); /* MSI-X configuration for 82574 */ - if (adapter->hw.mac.type == e1000_82574) { - int tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + if (sc->hw.mac.type == e1000_82574) { + int tmp = E1000_READ_REG(&sc->hw, E1000_CTRL_EXT); tmp |= E1000_CTRL_EXT_PBA_CLR; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); + E1000_WRITE_REG(&sc->hw, E1000_CTRL_EXT, tmp); /* Set the IVAR - interrupt vector routing. */ - E1000_WRITE_REG(&adapter->hw, E1000_IVAR, adapter->ivars); - } else if (adapter->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ - igb_configure_queues(adapter); + E1000_WRITE_REG(&sc->hw, E1000_IVAR, sc->ivars); + } else if (sc->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ + igb_configure_queues(sc); /* this clears any pending interrupts */ - E1000_READ_REG(&adapter->hw, E1000_ICR); - E1000_WRITE_REG(&adapter->hw, E1000_ICS, E1000_ICS_LSC); + E1000_READ_REG(&sc->hw, E1000_ICR); + E1000_WRITE_REG(&sc->hw, E1000_ICS, E1000_ICS_LSC); /* AMT based hardware can now take control from firmware */ - if (adapter->has_manage && adapter->has_amt) - em_get_hw_control(adapter); + if (sc->has_manage && sc->has_amt) + em_get_hw_control(sc); /* Set Energy Efficient Ethernet */ - if (adapter->hw.mac.type >= igb_mac_min && - adapter->hw.phy.media_type == e1000_media_type_copper) { - if (adapter->hw.mac.type == e1000_i354) - e1000_set_eee_i354(&adapter->hw, true, true); + if (sc->hw.mac.type >= igb_mac_min && + sc->hw.phy.media_type == e1000_media_type_copper) { + if (sc->hw.mac.type == e1000_i354) + e1000_set_eee_i354(&sc->hw, true, true); else - e1000_set_eee_i350(&adapter->hw, true, true); + e1000_set_eee_i350(&sc->hw, true, true); } } @@ -1390,11 +1390,11 @@ em_if_init(if_ctx_t ctx) int em_intr(void *arg) { - struct adapter *adapter = arg; - if_ctx_t ctx = adapter->ctx; + struct e1000_softc *sc = arg; + if_ctx_t ctx = sc->ctx; u32 reg_icr; - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + reg_icr = E1000_READ_REG(&sc->hw, E1000_ICR); /* Hot eject? */ if (reg_icr == 0xffffffff) @@ -1408,7 +1408,7 @@ em_intr(void *arg) * Starting with the 82571 chip, bit 31 should be used to * determine whether the interrupt belongs to us. */ - if (adapter->hw.mac.type >= e1000_82571 && + if (sc->hw.mac.type >= e1000_82571 && (reg_icr & E1000_ICR_INT_ASSERTED) == 0) return FILTER_STRAY; @@ -1425,7 +1425,7 @@ em_intr(void *arg) em_handle_link(ctx); if (reg_icr & E1000_ICR_RXO) - adapter->rx_overruns++; + sc->rx_overruns++; return (FILTER_SCHEDULE_THREAD); } @@ -1433,40 +1433,40 @@ em_intr(void *arg) static int em_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_rx_queue *rxq = &adapter->rx_queues[rxqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_rx_queue *rxq = &sc->rx_queues[rxqid]; - E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxq->eims); + E1000_WRITE_REG(&sc->hw, E1000_IMS, rxq->eims); return (0); } static int em_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_tx_queue *txq = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_tx_queue *txq = &sc->tx_queues[txqid]; - E1000_WRITE_REG(&adapter->hw, E1000_IMS, txq->eims); + E1000_WRITE_REG(&sc->hw, E1000_IMS, txq->eims); return (0); } static int igb_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_rx_queue *rxq = &adapter->rx_queues[rxqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_rx_queue *rxq = &sc->rx_queues[rxqid]; - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, rxq->eims); + E1000_WRITE_REG(&sc->hw, E1000_EIMS, rxq->eims); return (0); } static int igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_tx_queue *txq = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_tx_queue *txq = &sc->tx_queues[txqid]; - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, txq->eims); + E1000_WRITE_REG(&sc->hw, E1000_EIMS, txq->eims); return (0); } @@ -1493,29 +1493,29 @@ em_msix_que(void *arg) static int em_msix_link(void *arg) { - struct adapter *adapter = arg; + struct e1000_softc *sc = arg; u32 reg_icr; bool notlink = false; - ++adapter->link_irq; - MPASS(adapter->hw.back != NULL); - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + ++sc->link_irq; + MPASS(sc->hw.back != NULL); + reg_icr = E1000_READ_REG(&sc->hw, E1000_ICR); if (reg_icr & E1000_ICR_RXO) - adapter->rx_overruns++; + sc->rx_overruns++; if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) - em_handle_link(adapter->ctx); + em_handle_link(sc->ctx); else notlink = true; /* Re-arm for other/spurious interrupts */ - if (notlink && adapter->hw.mac.type >= igb_mac_min) { - E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_LSC); *** 3447 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:57:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60AD067FDF5; Tue, 28 Sep 2021 16:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJm020chzz4Rkd; Tue, 28 Sep 2021 16:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCAE8301; Tue, 28 Sep 2021 16:57:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18SGvbpu035471; Tue, 28 Sep 2021 16:57:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SGvbXo035470; Tue, 28 Sep 2021 16:57:37 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:57:37 GMT Message-Id: <202109281657.18SGvbXo035470@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: dc3c7c11063b - stable/13 - uart: Add PCI ID for intel 100 Series/C230 Series AMT 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: dc3c7c11063bc37671e18a317596ee696b3a94fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:57:38 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=dc3c7c11063bc37671e18a317596ee696b3a94fe commit dc3c7c11063bc37671e18a317596ee696b3a94fe Author: Sean Bruno AuthorDate: 2021-09-25 22:23:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 16:56:50 +0000 uart: Add PCI ID for intel 100 Series/C230 Series AMT Reviewed by: kib Tested by: kbowling Differential Revision: https://reviews.freebsd.org/D32146 (cherry picked from commit fb640be4e9443f1890680c27b213825300bc65f4) --- sys/dev/uart/uart_bus_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index f7e9bd6ac401..92046261f544 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -170,6 +170,8 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x8c3d, 0xffff, 0, "Intel Lynx Point KT Controller", 0x10 }, { 0x8086, 0x8cbd, 0xffff, 0, "Intel Wildcat Point KT Controller", 0x10 }, { 0x8086, 0x9c3d, 0xffff, 0, "Intel Lynx Point-LP HECI KT", 0x10 }, +{ 0x8086, 0xa13d, 0xffff, 0, + "100 Series/C230 Series Chipset Family KT Redirection", 0x10 }, { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:57:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EC2F6A81A4; Tue, 28 Sep 2021 16:57: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 4HJm031D3Tz4Rf6; Tue, 28 Sep 2021 16:57:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDD5B302; Tue, 28 Sep 2021 16:57: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 18SGvc2V035495; Tue, 28 Sep 2021 16:57:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SGvcPY035494; Tue, 28 Sep 2021 16:57:38 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:57:38 GMT Message-Id: <202109281657.18SGvcPY035494@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: e265ddaac1f4 - stable/13 - e1000: Fix tabstop width in if_em.h 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: e265ddaac1f48d13f13039e5eafc48a058a74d5b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:57:39 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e265ddaac1f48d13f13039e5eafc48a058a74d5b commit e265ddaac1f48d13f13039e5eafc48a058a74d5b Author: Kevin Bowling AuthorDate: 2021-09-26 16:24:53 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 16:56:51 +0000 e1000: Fix tabstop width in if_em.h Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D32145 (cherry picked from commit 21ab8c75c940dd15343b4af28b18a66f377e670a) --- sys/dev/e1000/if_em.h | 236 +++++++++++++++++++++++++------------------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 7f259abfd9a6..41deecb69bf3 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -111,11 +111,11 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define EM_MIN_TXD 128 -#define EM_MAX_TXD 4096 -#define EM_DEFAULT_TXD 1024 +#define EM_MIN_TXD 128 +#define EM_MAX_TXD 4096 +#define EM_DEFAULT_TXD 1024 #define EM_DEFAULT_MULTI_TXD 4096 -#define IGB_MAX_TXD 4096 +#define IGB_MAX_TXD 4096 /* * EM_MAX_RXD - Maximum number of receive Descriptors @@ -130,11 +130,11 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define EM_MIN_RXD 128 -#define EM_MAX_RXD 4096 -#define EM_DEFAULT_RXD 1024 +#define EM_MIN_RXD 128 +#define EM_MAX_RXD 4096 +#define EM_DEFAULT_RXD 1024 #define EM_DEFAULT_MULTI_RXD 4096 -#define IGB_MAX_RXD 4096 +#define IGB_MAX_RXD 4096 /* * EM_TIDV - Transmit Interrupt Delay Value @@ -201,7 +201,7 @@ * 0 - Disable autonegotiation * 1 - Enable autonegotiation */ -#define DO_AUTO_NEG 1 +#define DO_AUTO_NEG 1 /* * This parameter control whether or not the driver will wait for @@ -214,8 +214,8 @@ /* Tunables -- End */ #define AUTONEG_ADV_DEFAULT (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \ - ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ - ADVERTISE_1000_FULL) + ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ + ADVERTISE_1000_FULL) #define AUTO_ALL_MODES 0 @@ -225,35 +225,35 @@ /* * Miscellaneous constants */ -#define EM_VENDOR_ID 0x8086 -#define EM_FLASH 0x0014 +#define EM_VENDOR_ID 0x8086 +#define EM_FLASH 0x0014 -#define EM_JUMBO_PBA 0x00000028 -#define EM_DEFAULT_PBA 0x00000030 +#define EM_JUMBO_PBA 0x00000028 +#define EM_DEFAULT_PBA 0x00000030 #define EM_SMARTSPEED_DOWNSHIFT 3 -#define EM_SMARTSPEED_MAX 15 -#define EM_MAX_LOOP 10 +#define EM_SMARTSPEED_MAX 15 +#define EM_MAX_LOOP 10 #define MAX_NUM_MULTICAST_ADDRESSES 128 -#define PCI_ANY_ID (~0U) -#define ETHER_ALIGN 2 -#define EM_FC_PAUSE_TIME 0x0680 -#define EM_EEPROM_APME 0x400; -#define EM_82544_APME 0x0004; +#define PCI_ANY_ID (~0U) +#define ETHER_ALIGN 2 +#define EM_FC_PAUSE_TIME 0x0680 +#define EM_EEPROM_APME 0x400; +#define EM_82544_APME 0x0004; /* Support AutoMediaDetect for Marvell M88 PHY in i354 */ -#define IGB_MEDIA_RESET (1 << 0) +#define IGB_MEDIA_RESET (1 << 0) /* Define the starting Interrupt rate per Queue */ -#define IGB_INTS_PER_SEC 8000 -#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) +#define IGB_INTS_PER_SEC 8000 +#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) -#define IGB_LINK_ITR 2000 -#define I210_LINK_DELAY 1000 +#define IGB_LINK_ITR 2000 +#define I210_LINK_DELAY 1000 -#define IGB_TXPBSIZE 20408 -#define IGB_HDR_BUF 128 -#define IGB_PKTTYPE_MASK 0x0000FFF0 +#define IGB_TXPBSIZE 20408 +#define IGB_HDR_BUF 128 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coalesce Flush */ /* @@ -265,25 +265,25 @@ * and compare to TX_MAXTRIES. When counter > TX_MAXTRIES, * reset adapter. */ -#define EM_TX_IDLE 0x00000000 -#define EM_TX_BUSY 0x00000001 -#define EM_TX_HUNG 0x80000000 +#define EM_TX_IDLE 0x00000000 +#define EM_TX_BUSY 0x00000001 +#define EM_TX_HUNG 0x80000000 #define EM_TX_MAXTRIES 10 -#define PCICFG_DESC_RING_STATUS 0xe4 -#define FLUSH_DESC_REQUIRED 0x100 +#define PCICFG_DESC_RING_STATUS 0xe4 +#define FLUSH_DESC_REQUIRED 0x100 -#define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ - ((hw->mac.type <= e1000_82576) ? 16 : 8)) -#define IGB_RX_HTHRESH 8 -#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ - (sc->intr_type == IFLIB_INTR_MSIX)) ? 1 : 4) +#define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ + ((hw->mac.type <= e1000_82576) ? 16 : 8)) +#define IGB_RX_HTHRESH 8 +#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ + (sc->intr_type == IFLIB_INTR_MSIX)) ? 1 : 4) -#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) -#define IGB_TX_HTHRESH 1 -#define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \ - sc->intr_type == IFLIB_INTR_MSIX) ? 1 : 16) +#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) +#define IGB_TX_HTHRESH 1 +#define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \ + sc->intr_type == IFLIB_INTR_MSIX) ? 1 : 16) /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be @@ -297,10 +297,10 @@ */ #define TARC_COMPENSATION_MODE (1 << 7) /* Compensation Mode */ #define TARC_SPEED_MODE_BIT (1 << 21) /* On PCI-E MACs only */ -#define TARC_MQ_FIX (1 << 23) | \ - (1 << 24) | \ - (1 << 25) /* Handle errata in MQ mode */ -#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */ +#define TARC_MQ_FIX (1 << 23) | \ + (1 << 24) | \ + (1 << 25) /* Handle errata in MQ mode */ +#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */ /* PCI Config defines */ #define EM_BAR_TYPE(v) ((v) & EM_BAR_TYPE_MASK) @@ -318,27 +318,27 @@ #define DEBUG_IOCTL 0 #define DEBUG_HW 0 -#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") +#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") #define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) #define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) -#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") +#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") #define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) #define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) -#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") -#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) +#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") +#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) #define EM_MAX_SCATTER 40 #define EM_VFTA_SIZE 128 -#define EM_TSO_SIZE 65535 +#define EM_TSO_SIZE 65535 #define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */ -#define ETH_ZLEN 60 +#define ETH_ZLEN 60 #define EM_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* Offload bits in mbuf flag */ #define IGB_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | \ - CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ - CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ + CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ + CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ -#define IGB_PKTTYPE_MASK 0x0000FFF0 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coalesce Flush */ /* @@ -361,15 +361,15 @@ struct e1000_softc; struct em_int_delay_info { struct e1000_softc *sc; /* Back-pointer to the sc struct */ - int offset; /* Register offset to read/write */ - int value; /* Current value in usecs */ + int offset; /* Register offset to read/write */ + int value; /* Current value in usecs */ }; /* * The transmit ring, one per tx queue */ struct tx_ring { - struct e1000_softc *sc; + struct e1000_softc *sc; struct e1000_tx_desc *tx_base; uint64_t tx_paddr; qidx_t *tx_rsq; @@ -380,8 +380,8 @@ struct tx_ring { qidx_t tx_cidx_processed; /* Interrupt resources */ void *tag; - struct resource *res; - unsigned long tx_irq; + struct resource *res; + unsigned long tx_irq; /* Saved csum offloading context information */ int csum_flags; @@ -402,10 +402,10 @@ struct tx_ring { struct rx_ring { struct e1000_softc *sc; struct em_rx_queue *que; - u32 me; - u32 payload; + u32 me; + u32 payload; union e1000_rx_desc_extended *rx_base; - uint64_t rx_paddr; + uint64_t rx_paddr; /* Interrupt resources */ void *tag; @@ -421,36 +421,36 @@ struct rx_ring { struct em_tx_queue { struct e1000_softc *sc; - u32 msix; - u32 eims; /* This queue's EIMS bit */ - u32 me; + u32 msix; + u32 eims; /* This queue's EIMS bit */ + u32 me; struct tx_ring txr; }; struct em_rx_queue { struct e1000_softc *sc; - u32 me; - u32 msix; - u32 eims; + u32 me; + u32 msix; + u32 eims; struct rx_ring rxr; - u64 irqs; + u64 irqs; struct if_irq que_irq; }; /* Our softc structure */ struct e1000_softc { - struct ifnet *ifp; - struct e1000_hw hw; + struct ifnet *ifp; + struct e1000_hw hw; - if_softc_ctx_t shared; - if_ctx_t ctx; -#define tx_num_queues shared->isc_ntxqsets -#define rx_num_queues shared->isc_nrxqsets + if_softc_ctx_t shared; + if_ctx_t ctx; +#define tx_num_queues shared->isc_ntxqsets +#define rx_num_queues shared->isc_nrxqsets #define intr_type shared->isc_intr /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; - device_t dev; - struct cdev *led_dev; + device_t dev; + struct cdev *led_dev; struct em_tx_queue *tx_queues; struct em_rx_queue *rx_queues; @@ -461,35 +461,35 @@ struct e1000_softc { struct resource *ioport; struct resource *res; - void *tag; - u32 linkvec; - u32 ivars; - - struct ifmedia *media; - int msix; - int if_flags; - int em_insert_vlan_header; - u32 ims; + void *tag; + u32 linkvec; + u32 ivars; + + struct ifmedia *media; + int msix; + int if_flags; + int em_insert_vlan_header; + u32 ims; bool in_detach; - u32 flags; + u32 flags; /* Task for FAST handling */ struct grouptask link_task; - u16 num_vlans; - u32 txd_cmd; + u16 num_vlans; + u32 txd_cmd; - u32 tx_process_limit; - u32 rx_process_limit; - u32 rx_mbuf_sz; + u32 tx_process_limit; + u32 rx_process_limit; + u32 rx_mbuf_sz; /* Management and WOL features */ - u32 wol; - bool has_manage; - bool has_amt; + u32 wol; + bool has_manage; + bool has_amt; /* Multicast array memory */ - u8 *mta; + u8 *mta; /* ** Shadow VFTA table, this is needed because @@ -497,18 +497,18 @@ struct e1000_softc { ** a soft reset and the driver needs to be able ** to repopulate it. */ - u32 shadow_vfta[EM_VFTA_SIZE]; + u32 shadow_vfta[EM_VFTA_SIZE]; /* Info about the interface */ - u16 link_active; - u16 fc; - u16 link_speed; - u16 link_duplex; - u32 smartspeed; - u32 dmac; - int link_mask; + u16 link_active; + u16 fc; + u16 link_speed; + u16 link_duplex; + u32 smartspeed; + u32 dmac; + int link_mask; - u64 que_mask; + u64 que_mask; struct em_int_delay_info tx_int_delay; struct em_int_delay_info tx_abs_int_delay; @@ -517,13 +517,13 @@ struct e1000_softc { struct em_int_delay_info tx_itr; /* Misc stats maintained by the driver */ - unsigned long dropped_pkts; - unsigned long link_irq; - unsigned long rx_overruns; - unsigned long watchdog_events; + unsigned long dropped_pkts; + unsigned long link_irq; + unsigned long rx_overruns; + unsigned long watchdog_events; - struct e1000_hw_stats stats; - u16 vf_ifp; + struct e1000_hw_stats stats; + u16 vf_ifp; }; /******************************************************************************** @@ -544,8 +544,8 @@ typedef struct _em_vendor_info_t { void em_dump_rs(struct e1000_softc *); #define EM_RSSRK_SIZE 4 -#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ - key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ - key[(i) * EM_RSSRK_SIZE + 2] << 16 | \ - key[(i) * EM_RSSRK_SIZE + 3] << 24) +#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ + key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ + key[(i) * EM_RSSRK_SIZE + 2] << 16 | \ + key[(i) * EM_RSSRK_SIZE + 3] << 24) #endif /* _EM_H_DEFINED_ */ From owner-dev-commits-src-all@freebsd.org Tue Sep 28 16:57:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAEFD6A8210; Tue, 28 Sep 2021 16:57: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 4HJm005t3nz4Rf1; Tue, 28 Sep 2021 16:57:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A19E227ED6; Tue, 28 Sep 2021 16:57: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 18SGvaKJ035447; Tue, 28 Sep 2021 16:57:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SGvalo035446; Tue, 28 Sep 2021 16:57:36 GMT (envelope-from git) Date: Tue, 28 Sep 2021 16:57:36 GMT Message-Id: <202109281657.18SGvalo035446@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: 594a25fa4304 - stable/13 - e1000: Re-arm link changes 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: 594a25fa43049c336d6016002538cad7a5383284 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:57:37 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=594a25fa43049c336d6016002538cad7a5383284 commit 594a25fa43049c336d6016002538cad7a5383284 Author: Kevin Bowling AuthorDate: 2021-09-27 16:17:48 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 16:55:59 +0000 e1000: Re-arm link changes A change to MSI-X link handler was somehow causing issues on MSI-based em(4) NICs. Revert the change based on user reports and testing. PR: 258551 Reported by: Franco Fichtner , t_uemura@macome.co.jp Reviewed by: markj, Franco Fichtner Tested by: t_uemura@macome.co.jp MFC after: 1 day (cherry picked from commit 450c3f8b3d259c7eb82488319aff45f1f6554aaf) --- sys/dev/e1000/if_em.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 47513c5d9e1e..34d7b8f5f87e 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1495,7 +1495,6 @@ em_msix_link(void *arg) { struct e1000_softc *sc = arg; u32 reg_icr; - bool notlink = false; ++sc->link_irq; MPASS(sc->hw.back != NULL); @@ -1506,17 +1505,14 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) em_handle_link(sc->ctx); - else - notlink = true; - /* Re-arm for other/spurious interrupts */ - if (notlink && sc->hw.mac.type >= igb_mac_min) { + /* Re-arm unconditionally */ + if (sc->hw.mac.type >= igb_mac_min) { E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); E1000_WRITE_REG(&sc->hw, E1000_EIMS, sc->link_mask); } else if (sc->hw.mac.type == e1000_82574) { - if (notlink) - E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC | - E1000_IMS_OTHER); + E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC | + E1000_IMS_OTHER); /* * Because we must read the ICR for this interrupt it may * clear other causes using autoclear, for this reason we @@ -1524,7 +1520,8 @@ em_msix_link(void *arg) */ if (reg_icr) E1000_WRITE_REG(&sc->hw, E1000_ICS, sc->ims); - } + } else + E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); return (FILTER_HANDLED); } @@ -1873,13 +1870,6 @@ em_if_update_admin_status(if_ctx_t ctx) if (hw->mac.type < em_mac_min) lem_smartspeed(sc); - else if (hw->mac.type >= igb_mac_min && - sc->intr_type == IFLIB_INTR_MSIX) { - E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); - E1000_WRITE_REG(&sc->hw, E1000_EIMS, sc->link_mask); - } else if (hw->mac.type == e1000_82574 && - sc->intr_type == IFLIB_INTR_MSIX) - E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_LSC | E1000_IMS_OTHER); } static void From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:25:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C72B26A886C; Tue, 28 Sep 2021 17:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJmbz4S8nz4TfJ; Tue, 28 Sep 2021 17:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A79F5E5; Tue, 28 Sep 2021 17:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18SHPJlY075700; Tue, 28 Sep 2021 17:25:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHPJaQ075699; Tue, 28 Sep 2021 17:25:19 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:25:19 GMT Message-Id: <202109281725.18SHPJaQ075699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ian Lepore Subject: git: 5e6f76f3704f - main - Add ethernet to the standard drivers for imx8. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e6f76f3704f2cc5db3dbc0628a12549de1c7795 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:25:19 -0000 The branch main has been updated by ian: URL: https://cgit.FreeBSD.org/src/commit/?id=5e6f76f3704f2cc5db3dbc0628a12549de1c7795 commit 5e6f76f3704f2cc5db3dbc0628a12549de1c7795 Author: Ian Lepore AuthorDate: 2021-09-28 17:18:51 +0000 Commit: Ian Lepore CommitDate: 2021-09-28 17:18:51 +0000 Add ethernet to the standard drivers for imx8. --- sys/arm64/conf/std.imx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/arm64/conf/std.imx b/sys/arm64/conf/std.imx index 7a7e25cd33c6..55baf1aa712d 100644 --- a/sys/arm64/conf/std.imx +++ b/sys/arm64/conf/std.imx @@ -15,6 +15,9 @@ device uart_imx # iMX8 UART # MMC/SD/SDIO Card slot support device sdhci +# Ethernet +device ffec + options FDT # DTBs From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:30:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F06FD6A8BDB; Tue, 28 Sep 2021 17: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 4HJmjX6MJ0z4TmD; Tue, 28 Sep 2021 17:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA6D5732; Tue, 28 Sep 2021 17: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 18SHU8Y9079063; Tue, 28 Sep 2021 17: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 18SHU83U079054; Tue, 28 Sep 2021 17:30:08 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:30:08 GMT Message-Id: <202109281730.18SHU83U079054@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: 1ffd931e1caa - stable/12 - e1000: Use C99 bool types 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: 1ffd931e1caab23e836168fbbb322f25d9e7f86d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:30:09 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1ffd931e1caab23e836168fbbb322f25d9e7f86d commit 1ffd931e1caab23e836168fbbb322f25d9e7f86d Author: Kevin Bowling AuthorDate: 2021-09-17 03:08:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 17:06:31 +0000 e1000: Use C99 bool types Approved by: imp MFC after: 1 week (cherry picked from commit 1bbdc25fc1edb43562bf2a5f30df7381078991d4) --- sys/dev/e1000/e1000_80003es2lan.c | 12 +++--- sys/dev/e1000/e1000_82541.c | 10 ++--- sys/dev/e1000/e1000_82543.c | 22 +++++------ sys/dev/e1000/e1000_82571.c | 60 ++++++++++++++--------------- sys/dev/e1000/e1000_82575.c | 58 ++++++++++++++-------------- sys/dev/e1000/e1000_api.c | 12 +++--- sys/dev/e1000/e1000_api.h | 4 +- sys/dev/e1000/e1000_hw.h | 2 +- sys/dev/e1000/e1000_i210.c | 4 +- sys/dev/e1000/e1000_ich8lan.c | 78 +++++++++++++++++++------------------- sys/dev/e1000/e1000_mac.c | 62 +++++++++++++++--------------- sys/dev/e1000/e1000_manage.c | 28 +++++++------- sys/dev/e1000/e1000_mbx.c | 2 +- sys/dev/e1000/e1000_mbx.h | 2 +- sys/dev/e1000/e1000_osdep.h | 2 - sys/dev/e1000/e1000_phy.c | 80 +++++++++++++++++++-------------------- sys/dev/e1000/e1000_vf.c | 14 +++---- sys/dev/e1000/e1000_vf.h | 2 +- sys/dev/e1000/em_txrx.c | 12 +++--- sys/dev/e1000/if_em.c | 46 +++++++++++----------- sys/dev/e1000/igb_txrx.c | 2 +- 21 files changed, 256 insertions(+), 258 deletions(-) diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index db6f1aeb65fb..ac35b4eabf28 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -219,14 +219,14 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = !!(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK); /* Adaptive IFS not supported */ - mac->adaptive_ifs = FALSE; + mac->adaptive_ifs = false; /* Function pointers */ @@ -891,8 +891,8 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) reg_data &= ~0x00100000; E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data); - /* default to TRUE to enable the MDIC W/A */ - hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE; + /* default to true to enable the MDIC W/A */ + hw->dev_spec._80003es2lan.mdic_wa_enable = true; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET >> @@ -900,7 +900,7 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) if (!ret_val) { if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) == E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO) - hw->dev_spec._80003es2lan.mdic_wa_enable = FALSE; + hw->dev_spec._80003es2lan.mdic_wa_enable = false; } /* Clear all of the statistics registers (clear on read). It is diff --git a/sys/dev/e1000/e1000_82541.c b/sys/dev/e1000/e1000_82541.c index bd5ff7e0d11f..2837fc0b6bd5 100644 --- a/sys/dev/e1000/e1000_82541.c +++ b/sys/dev/e1000/e1000_82541.c @@ -230,7 +230,7 @@ static s32 e1000_init_mac_params_82541(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* Function Pointers */ @@ -611,11 +611,11 @@ static s32 e1000_check_for_link_82541(struct e1000_hw *hw) goto out; if (!link) { - ret_val = e1000_config_dsp_after_link_change_82541(hw, FALSE); + ret_val = e1000_config_dsp_after_link_change_82541(hw, false); goto out; /* No link detected */ } - mac->get_link_status = FALSE; + mac->get_link_status = false; /* * Check if there was DownShift, must be checked @@ -632,7 +632,7 @@ static s32 e1000_check_for_link_82541(struct e1000_hw *hw) goto out; } - ret_val = e1000_config_dsp_after_link_change_82541(hw, TRUE); + ret_val = e1000_config_dsp_after_link_change_82541(hw, true); /* * Auto-Neg is enabled. Auto Speed Detection takes care @@ -937,7 +937,7 @@ out: * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is diff --git a/sys/dev/e1000/e1000_82543.c b/sys/dev/e1000/e1000_82543.c index b9c6e439480a..412fc7439c6c 100644 --- a/sys/dev/e1000/e1000_82543.c +++ b/sys/dev/e1000/e1000_82543.c @@ -256,7 +256,7 @@ static s32 e1000_init_mac_params_82543(struct e1000_hw *hw) /* Set tbi compatibility */ if ((hw->mac.type != e1000_82543) || (hw->phy.media_type == e1000_media_type_fiber)) - e1000_set_tbi_compatibility_82543(hw, FALSE); + e1000_set_tbi_compatibility_82543(hw, false); return E1000_SUCCESS; } @@ -286,7 +286,7 @@ void e1000_init_function_pointers_82543(struct e1000_hw *hw) static bool e1000_tbi_compatibility_enabled_82543(struct e1000_hw *hw) { struct e1000_dev_spec_82543 *dev_spec = &hw->dev_spec._82543; - bool state = FALSE; + bool state = false; DEBUGFUNC("e1000_tbi_compatibility_enabled_82543"); @@ -338,7 +338,7 @@ out: bool e1000_tbi_sbp_enabled_82543(struct e1000_hw *hw) { struct e1000_dev_spec_82543 *dev_spec = &hw->dev_spec._82543; - bool state = FALSE; + bool state = false; DEBUGFUNC("e1000_tbi_sbp_enabled_82543"); @@ -379,7 +379,7 @@ static void e1000_set_tbi_sbp_82543(struct e1000_hw *hw, bool state) * @hw: pointer to the HW structure * * Returns the current status of whether PHY initialization is disabled. - * True if PHY initialization is disabled else FALSE. + * True if PHY initialization is disabled else false. **/ static bool e1000_init_phy_disabled_82543(struct e1000_hw *hw) { @@ -389,7 +389,7 @@ static bool e1000_init_phy_disabled_82543(struct e1000_hw *hw) DEBUGFUNC("e1000_init_phy_disabled_82543"); if (hw->mac.type != e1000_82543) { - ret_val = FALSE; + ret_val = false; goto out; } @@ -913,7 +913,7 @@ static s32 e1000_reset_hw_82543(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP); E1000_WRITE_FLUSH(hw); - e1000_set_tbi_sbp_82543(hw, FALSE); + e1000_set_tbi_sbp_82543(hw, false); /* * Delay to allow any outstanding PCI transactions to complete before @@ -1217,7 +1217,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) if (!link) goto out; /* No link detected */ - mac->get_link_status = FALSE; + mac->get_link_status = false; e1000_check_downshift_generic(hw); @@ -1299,7 +1299,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) * If we previously were in the mode, * turn it off. */ - e1000_set_tbi_sbp_82543(hw, FALSE); + e1000_set_tbi_sbp_82543(hw, false); rctl = E1000_READ_REG(hw, E1000_RCTL); rctl &= ~E1000_RCTL_SBP; E1000_WRITE_REG(hw, E1000_RCTL, rctl); @@ -1313,7 +1313,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) * will look like CRC errors to the hardware. */ if (!e1000_tbi_sbp_enabled_82543(hw)) { - e1000_set_tbi_sbp_82543(hw, TRUE); + e1000_set_tbi_sbp_82543(hw, true); rctl = E1000_READ_REG(hw, E1000_RCTL); rctl |= E1000_RCTL_SBP; E1000_WRITE_REG(hw, E1000_RCTL, rctl); @@ -1356,7 +1356,7 @@ static s32 e1000_check_for_fiber_link_82543(struct e1000_hw *hw) (!(status & E1000_STATUS_LU)) && (!(rxcw & E1000_RXCW_C))) { if (!mac->autoneg_failed) { - mac->autoneg_failed = TRUE; + mac->autoneg_failed = true; ret_val = 0; goto out; } @@ -1387,7 +1387,7 @@ static s32 e1000_check_for_fiber_link_82543(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); E1000_WRITE_REG(hw, E1000_CTRL, (ctrl & ~E1000_CTRL_SLU)); - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } out: diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index 8db1fcb921a9..cae9afcb2d78 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -285,7 +285,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) struct e1000_mac_info *mac = &hw->mac; u32 swsm = 0; u32 swsm2 = 0; - bool force_clear_smbi = FALSE; + bool force_clear_smbi = false; DEBUGFUNC("e1000_init_mac_params_82571"); @@ -327,9 +327,9 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* Adaptive IFS supported */ - mac->adaptive_ifs = TRUE; + mac->adaptive_ifs = true; /* Function pointers */ @@ -369,7 +369,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->ops.blink_led = e1000_blink_led_generic; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are * enabled. */ @@ -388,7 +388,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->ops.blink_led = e1000_blink_led_generic; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; break; } @@ -407,13 +407,13 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) /* Only do this for the first interface on this card */ E1000_WRITE_REG(hw, E1000_SWSM2, swsm2 | E1000_SWSM2_LOCK); - force_clear_smbi = TRUE; + force_clear_smbi = true; } else { - force_clear_smbi = FALSE; + force_clear_smbi = false; } break; default: - force_clear_smbi = TRUE; + force_clear_smbi = true; break; } @@ -563,7 +563,7 @@ e1000_put_hw_semaphore_82574(struct e1000_hw *hw) /** * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. * LPLU will not be activated unless the @@ -593,7 +593,7 @@ static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active) * @active: boolean used to enable/disable lplu * * The low power link up (lplu) state is set to the power management level D3 - * when active is TRUE, else clear lplu for D3. LPLU + * when active is true, else clear lplu for D3. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is * maintained. @@ -860,7 +860,7 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) /** * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When activating LPLU * this function also disables smart speed and vice versa. LPLU will not be @@ -1051,7 +1051,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) if (ret_val) return ret_val; - e1000_set_laa_state_82571(hw, TRUE); + e1000_set_laa_state_82571(hw, true); } /* Reinitialize the 82571 serdes link state machine */ @@ -1327,8 +1327,8 @@ static void e1000_clear_vfta_82571(struct e1000_hw *hw) * e1000_check_mng_mode_82574 - Check manageability is enabled * @hw: pointer to the HW structure * - * Reads the NVM Initialization Control Word 2 and returns TRUE - * (>0) if any manageability is enabled, else FALSE (0). + * Reads the NVM Initialization Control Word 2 and returns true + * (>0) if any manageability is enabled, else false (0). **/ static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) { @@ -1339,7 +1339,7 @@ static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &data); if (ret_val) - return FALSE; + return false; return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0; } @@ -1392,18 +1392,18 @@ bool e1000_check_phy_82574(struct e1000_hw *hw) ret_val = hw->phy.ops.read_reg(hw, E1000_RECEIVE_ERROR_COUNTER, &receive_errors); if (ret_val) - return FALSE; + return false; if (receive_errors == E1000_RECEIVE_ERROR_MAX) { ret_val = hw->phy.ops.read_reg(hw, E1000_BASE1000T_STATUS, &status_1kbt); if (ret_val) - return FALSE; + return false; if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) == E1000_IDLE_ERROR_COUNT_MASK) - return TRUE; + return true; } - return FALSE; + return false; } @@ -1556,10 +1556,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) */ mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("AN_UP -> AN_PROG\n"); } else { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } break; @@ -1576,10 +1576,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) (ctrl & ~E1000_CTRL_SLU)); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("FORCED_UP -> AN_PROG\n"); } else { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } break; @@ -1593,7 +1593,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) mac->serdes_link_state = e1000_serdes_link_autoneg_complete; DEBUGOUT("AN_PROG -> AN_UP\n"); - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } else { /* Autoneg completed, but failed. */ mac->serdes_link_state = @@ -1619,7 +1619,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) } mac->serdes_link_state = e1000_serdes_link_forced_up; - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; DEBUGOUT("AN_PROG -> FORCED_UP\n"); } break; @@ -1635,13 +1635,13 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) ~E1000_CTRL_SLU)); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("DOWN -> AN_PROG\n"); break; } } else { if (!(rxcw & E1000_RXCW_SYNCH)) { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; mac->serdes_link_state = e1000_serdes_link_down; DEBUGOUT("ANYSTATE -> DOWN\n"); } else { @@ -1657,7 +1657,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) continue; if (rxcw & E1000_RXCW_IV) { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; mac->serdes_link_state = e1000_serdes_link_down; DEBUGOUT("ANYSTATE -> DOWN\n"); @@ -1671,7 +1671,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TXCW, txcw); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("ANYSTATE -> AN_PROG\n"); } } @@ -1728,7 +1728,7 @@ bool e1000_get_laa_state_82571(struct e1000_hw *hw) DEBUGFUNC("e1000_get_laa_state_82571"); if (hw->mac.type != e1000_82571) - return FALSE; + return false; return hw->dev_spec._82571.laa_is_present; } diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 29805270f8dc..59d8b9c85dc3 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -128,7 +128,7 @@ static const u16 e1000_82580_rxpbs_table[] = { static bool e1000_sgmii_uses_mdio_82575(struct e1000_hw *hw) { u32 reg = 0; - bool ext_mdio = FALSE; + bool ext_mdio = false; DEBUGFUNC("e1000_sgmii_uses_mdio_82575"); @@ -348,16 +348,16 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) /* Enable EEE default settings for EEE supported devices */ if (mac->type >= e1000_i350) - dev_spec->eee_disable = FALSE; + dev_spec->eee_disable = false; /* Allow a single clear of the SW semaphore on I210 and newer */ if (mac->type >= e1000_i210) - dev_spec->clear_semaphore_once = TRUE; + dev_spec->clear_semaphore_once = true; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = !!(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK); @@ -716,7 +716,7 @@ static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_phy_hw_reset_sgmii_82575"); /* - * This isn't a TRUE "hard" reset, but is the only reset + * This isn't a true "hard" reset, but is the only reset * available to us at this time. */ @@ -746,7 +746,7 @@ out: /** * e1000_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -832,7 +832,7 @@ out: /** * e1000_set_d0_lplu_state_82580 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -883,7 +883,7 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is @@ -1139,7 +1139,7 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw) /* Determine if a swap needs to happen. */ if (port && (hw->dev_spec._82575.media_port != port)) { hw->dev_spec._82575.media_port = port; - hw->dev_spec._82575.media_changed = TRUE; + hw->dev_spec._82575.media_changed = true; } if (port == E1000_MEDIA_PORT_COPPER) { @@ -1217,7 +1217,7 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, * The link up bit determines when link is up on autoneg. */ if (pcs & E1000_PCS_LSTS_LINK_OK) { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; /* Detect and store PCS speed */ if (pcs & E1000_PCS_LSTS_SPEED_1000) @@ -1246,7 +1246,7 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, } } else { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; *speed = 0; *duplex = 0; } @@ -1527,13 +1527,13 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) { case E1000_CTRL_EXT_LINK_MODE_SGMII: /* sgmii mode lets the phy handle forcing speed/duplex */ - pcs_autoneg = TRUE; + pcs_autoneg = true; /* autoneg time out should be disabled for SGMII mode */ reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT); break; case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: /* disable PCS autoneg and support parallel detect only */ - pcs_autoneg = FALSE; + pcs_autoneg = false; /* FALLTHROUGH */ default: if (hw->mac.type == e1000_82575 || @@ -1545,7 +1545,7 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) } if (data & E1000_EEPROM_PCS_AUTONEG_DISABLE_BIT) - pcs_autoneg = FALSE; + pcs_autoneg = false; } /* @@ -1637,8 +1637,8 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) u32 link_mode = 0; /* Set internal phy as default */ - dev_spec->sgmii_active = FALSE; - dev_spec->module_plugged = FALSE; + dev_spec->sgmii_active = false; + dev_spec->module_plugged = false; /* Get CSR setting */ ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -1657,7 +1657,7 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) /* Get phy control interface type set (MDIO vs. I2C)*/ if (e1000_sgmii_uses_mdio_82575(hw)) { hw->phy.media_type = e1000_media_type_copper; - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; break; } /* fall through for I2C based SGMII */ @@ -1675,7 +1675,7 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) if (link_mode == E1000_CTRL_EXT_LINK_MODE_SGMII) { hw->phy.media_type = e1000_media_type_copper; - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; } break; @@ -1746,14 +1746,14 @@ static s32 e1000_set_sfp_media_type_82575(struct e1000_hw *hw) /* Check if there is some SFP module plugged and powered */ if ((tranceiver_type == E1000_SFF_IDENTIFIER_SFP) || (tranceiver_type == E1000_SFF_IDENTIFIER_SFF)) { - dev_spec->module_plugged = TRUE; + dev_spec->module_plugged = true; if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) { hw->phy.media_type = e1000_media_type_internal_serdes; } else if (eth_flags->e100_base_fx) { - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; hw->phy.media_type = e1000_media_type_internal_serdes; } else if (eth_flags->e1000_base_t) { - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; hw->phy.media_type = e1000_media_type_copper; } else { hw->phy.media_type = e1000_media_type_unknown; @@ -2224,11 +2224,11 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) DEBUGFUNC("e1000_reset_hw_82580"); - hw->dev_spec._82575.global_device_reset = FALSE; + hw->dev_spec._82575.global_device_reset = false; /* 82580 does not reliably do global_device_reset due to hw errata */ if (hw->mac.type == e1000_82580) - global_device_reset = FALSE; + global_device_reset = false; /* Get current control state. */ ctrl = E1000_READ_REG(hw, E1000_CTRL); @@ -2252,7 +2252,7 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) /* Determine whether or not a global dev reset is requested */ if (global_device_reset && hw->mac.ops.acquire_swfw_sync(hw, swmbsw_mask)) - global_device_reset = FALSE; + global_device_reset = false; if (global_device_reset && !(E1000_READ_REG(hw, E1000_STATUS) & E1000_STAT_DEV_RST_SET)) @@ -2572,7 +2572,7 @@ s32 e1000_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data) { DEBUGFUNC("e1000_read_emi_reg"); - return __e1000_access_emi_reg(hw, addr, data, TRUE); + return __e1000_access_emi_reg(hw, addr, data, true); } /** @@ -2930,7 +2930,7 @@ s32 e1000_get_eee_status_i354(struct e1000_hw *hw, bool *status) goto out; *status = phy_data & (E1000_PCS_STATUS_TX_LPI_RCVD | - E1000_PCS_STATUS_RX_LPI_RCVD) ? TRUE : FALSE; + E1000_PCS_STATUS_RX_LPI_RCVD) ? true : false; out: return ret_val; @@ -3032,7 +3032,7 @@ s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, u32 retry = 1; u16 swfw_mask = 0; - bool nack = TRUE; + bool nack = true; DEBUGFUNC("e1000_read_i2c_byte_generic"); @@ -3299,7 +3299,7 @@ static s32 e1000_get_i2c_ack(struct e1000_hw *hw) u32 i = 0; u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); u32 timeout = 10; - bool ack = TRUE; + bool ack = true; DEBUGFUNC("e1000_get_i2c_ack"); diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index b28ab77f3794..5c778a48bba0 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -421,10 +421,10 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) /** * e1000_setup_init_funcs - Initializes function pointers * @hw: pointer to the HW structure - * @init_device: TRUE will initialize the rest of the function pointers - * getting the device ready for use. FALSE will only set + * @init_device: true will initialize the rest of the function pointers + * getting the device ready for use. false will only set * MAC type and the function pointers for the other init - * functions. Passing FALSE will not generate any hardware + * functions. Passing false will not generate any hardware * reads or writes. * * This function must be called by a driver in order to use the rest @@ -656,7 +656,7 @@ bool e1000_check_mng_mode(struct e1000_hw *hw) if (hw->mac.ops.check_mng_mode) return hw->mac.ops.check_mng_mode(hw); - return FALSE; + return false; } /** @@ -1186,7 +1186,7 @@ s32 e1000_phy_commit(struct e1000_hw *hw) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D0 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D0 + * and SmartSpeed is disabled when active is true, else clear lplu for D0 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is @@ -1208,7 +1208,7 @@ s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index c96030b567db..48cf33213043 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -140,11 +140,11 @@ u32 e1000_translate_register_82542(u32 reg); * Typical use: * ... * if (TBI_ACCEPT) { - * accept_frame = TRUE; + * accept_frame = true; * e1000_tbi_adjust_stats(adapter, MacAddress); * frame_length--; * } else { - * accept_frame = FALSE; + * accept_frame = false; * } * ... */ diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index 42dbb2e0717e..dc46c590d7c0 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -275,7 +275,7 @@ enum e1000_mac_type { e1000_i211, e1000_vfadapt, e1000_vfadapt_i350, - e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */ + e1000_num_macs /* List is 1-based, so subtract 1 for true count. */ }; enum e1000_media_type { diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 0d810fecf3bd..da2e786130c8 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -552,14 +552,14 @@ out: bool e1000_get_flash_presence_i210(struct e1000_hw *hw) { u32 eec = 0; - bool ret_val = FALSE; + bool ret_val = false; DEBUGFUNC("e1000_get_flash_presence_i210"); eec = E1000_READ_REG(hw, E1000_EECD); if (eec & E1000_EECD_FLASH_DETECTED_I210) - ret_val = TRUE; + ret_val = true; return ret_val; } diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 5d0c9fccf626..1f33e4182fa7 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -242,7 +242,7 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) } if (ret_val) - return FALSE; + return false; out: if (hw->mac.type >= e1000_pch_lpt) { /* Only unforce SMBus if ME is not active */ @@ -260,7 +260,7 @@ out: } } - return TRUE; + return true; } /** @@ -324,7 +324,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) /* Gate automatic PHY configuration by hardware on managed and * non-managed 82579 and newer adapters. */ - e1000_gate_hw_phy_config_ich8lan(hw, TRUE); + e1000_gate_hw_phy_config_ich8lan(hw, true); /* It is not possible to be certain of the current state of ULP * so forcibly disable it. @@ -439,7 +439,7 @@ out: if ((hw->mac.type == e1000_pch2lan) && !(fwsm & E1000_ICH_FWSM_FW_VALID)) { msec_delay(10); - e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + e1000_gate_hw_phy_config_ich8lan(hw, false); } return ret_val; @@ -699,7 +699,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) /* Clear shadow ram */ for (i = 0; i < nvm->word_size; i++) { - dev_spec->shadow_ram[i].modified = FALSE; + dev_spec->shadow_ram[i].modified = false; dev_spec->shadow_ram[i].value = 0xFFFF; } @@ -743,13 +743,13 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) if (mac->type == e1000_ich8lan) mac->rar_entry_count--; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC subsystem not supported */ - mac->arc_subsystem_valid = FALSE; + mac->arc_subsystem_valid = false; /* Adaptive IFS supported */ - mac->adaptive_ifs = TRUE; + mac->adaptive_ifs = true; /* Function pointers */ @@ -833,7 +833,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /* Enable PCS Lock-loss workaround for ICH8 */ if (mac->type == e1000_ich8lan) - e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, TRUE); + e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, true); return E1000_SUCCESS; } @@ -880,7 +880,7 @@ s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data) { DEBUGFUNC("e1000_read_emi_reg_locked"); - return __e1000_access_emi_reg_locked(hw, addr, data, TRUE); + return __e1000_access_emi_reg_locked(hw, addr, data, true); } /** @@ -895,7 +895,7 @@ s32 e1000_write_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 data) { DEBUGFUNC("e1000_read_emi_reg_locked"); - return __e1000_access_emi_reg_locked(hw, addr, &data, FALSE); + return __e1000_access_emi_reg_locked(hw, addr, &data, false); } /** @@ -1112,7 +1112,7 @@ static u64 e1000_ltr2ns(u16 ltr) * GbE MAC in the Lynx Point PCH based on Rx buffer size and link speed * when link is up (which must not exceed the maximum latency supported * by the platform), otherwise specify there is no LTR requirement. - * Unlike TRUE-PCIe devices which set the LTR maximum snoop/no-snoop + * Unlike true-PCIe devices which set the LTR maximum snoop/no-snoop * latencies in the LTR Extended Capability Structure in the PCIe Extended * Capability register set, on this device LTR is set by writing the * equivalent snoop/no-snoop latencies in the LTRV register in the MAC and @@ -1410,8 +1410,8 @@ out: * If not on an ME enabled system, un-configure the ULP mode by software. * * During nominal operation, this function is called when link is acquired - * to disable ULP mode (force=FALSE); otherwise, for example when unloading - * the driver or during Sx->S0 transitions, this is called with force=TRUE + * to disable ULP mode (force=false); otherwise, for example when unloading + * the driver or during Sx->S0 transitions, this is called with force=true * to forcibly disable ULP. */ s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) @@ -1745,7 +1745,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; } - if (hw->dev_spec.ich8lan.disable_k1_off == TRUE) + if (hw->dev_spec.ich8lan.disable_k1_off == true) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; E1000_WRITE_REG(hw, E1000_FEXTNVM6, fextnvm6); @@ -1754,7 +1754,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (!link) return E1000_SUCCESS; /* No link detected */ - mac->get_link_status = FALSE; + mac->get_link_status = false; switch (hw->mac.type) { case e1000_pch2lan: @@ -2209,7 +2209,7 @@ release: static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) { u32 fwsm; - bool blocked = FALSE; + bool blocked = false; int i = 0; DEBUGFUNC("e1000_check_reset_block_ich8lan"); @@ -2217,11 +2217,11 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) do { fwsm = E1000_READ_REG(hw, E1000_FWSM); if (!(fwsm & E1000_ICH_FWSM_RSPCIPHY)) { - blocked = TRUE; + blocked = true; msec_delay(10); continue; } - blocked = FALSE; + blocked = false; } while (blocked && (i++ < 30)); return blocked ? E1000_BLK_PHY_RESET : E1000_SUCCESS; } @@ -2435,7 +2435,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) if (status_reg == (BM_CS_STATUS_LINK_UP | BM_CS_STATUS_RESOLVED | BM_CS_STATUS_SPEED_1000)) - k1_enable = FALSE; + k1_enable = false; } if (hw->phy.type == e1000_phy_82577) { @@ -2451,7 +2451,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) if (status_reg == (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE | HV_M_STATUS_SPEED_1000)) - k1_enable = FALSE; + k1_enable = false; } /* Link stall fix for link up */ @@ -2688,7 +2688,7 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) /* Configure the K1 Si workaround during phy reset assuming there is * link so that it disables K1 if link is in 1Gbps. */ - ret_val = e1000_k1_gig_workaround_hv(hw, TRUE); + ret_val = e1000_k1_gig_workaround_hv(hw, true); if (ret_val) return ret_val; @@ -3033,7 +3033,7 @@ static s32 e1000_k1_workaround_lv(struct e1000_hw *hw) /** * e1000_gate_hw_phy_config_ich8lan - disable PHY config via hardware * @hw: pointer to the HW structure - * @gate: boolean set to TRUE to gate, FALSE to ungate + * @gate: boolean set to true to gate, false to ungate * * Gate/ungate the automatic PHY configuration via hardware; perform * the configuration via software instead. @@ -3136,14 +3136,14 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw) return ret_val; /* Configure the LCD with the OEM bits in NVM */ - ret_val = e1000_oem_bits_config_ich8lan(hw, TRUE); + ret_val = e1000_oem_bits_config_ich8lan(hw, true); if (hw->mac.type == e1000_pch2lan) { /* Ungate automatic PHY configuration on non-managed 82579 */ if (!(E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID)) { msec_delay(10); - e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + e1000_gate_hw_phy_config_ich8lan(hw, false); } *** 1091 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:30:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38B266A8E04; Tue, 28 Sep 2021 17:30: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 4HJmjb0qYwz4Tf8; Tue, 28 Sep 2021 17:30:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8E71733; Tue, 28 Sep 2021 17:30: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 18SHUAL7079484; Tue, 28 Sep 2021 17:30:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHUAAh079480; Tue, 28 Sep 2021 17:30:10 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:30:10 GMT Message-Id: <202109281730.18SHUAAh079480@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: 5b4cfd3f1315 - stable/12 - iflib: Free resources in a consistent order during detach 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: 5b4cfd3f1315856029256a9847d78d3b1b717fb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:30:11 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5b4cfd3f1315856029256a9847d78d3b1b717fb0 commit 5b4cfd3f1315856029256a9847d78d3b1b717fb0 Author: Sai Rajesh Tallamraju AuthorDate: 2021-02-01 16:13:00 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 17:21:52 +0000 iflib: Free resources in a consistent order during detach Memory and PCI resources are freed with no particular order. This could cause use-after-frees when detaching following a failed attach. For instance, iflib_tx_structures_free() frees ctx->ifc_txqs[] but iflib_tqg_detach() attempts to access this array. Similarly, adapter queues gets freed by IFDI_QUEUES_FREE() but IFDI_DETACH() attempts to access adapter queues to free PCI resources. MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D27634 (cherry picked from commit 38bfc6dee33bedb290e1ea2540f97a86fe3caee0) --- sys/dev/e1000/if_em.c | 19 ++++++------------- sys/dev/ixl/if_ixl.c | 2 +- sys/net/iflib.c | 22 +++++++++++++--------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index a571450a463e..7babe51c8c02 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1127,10 +1127,11 @@ em_if_attach_post(if_ctx_t ctx) struct adapter *adapter = iflib_get_softc(ctx); struct e1000_hw *hw = &adapter->hw; int error = 0; - + /* Setup OS specific network interface */ error = em_setup_interface(ctx); if (error != 0) { + device_printf(adapter->dev, "Interface setup failed: %d\n", error); goto err_late; } @@ -1148,14 +1149,10 @@ em_if_attach_post(if_ctx_t ctx) INIT_DEBUGOUT("em_if_attach_post: end"); - return (error); + return (0); err_late: - em_release_hw_control(adapter); - em_free_pci_resources(ctx); - em_if_queues_free(ctx); - free(adapter->mta, M_DEVBUF); - + /* upon attach_post() error, iflib calls _if_detach() to free resources. */ return (error); } @@ -1180,6 +1177,8 @@ em_if_detach(if_ctx_t ctx) em_release_manageability(adapter); em_release_hw_control(adapter); em_free_pci_resources(ctx); + free(adapter->mta, M_DEVBUF); + adapter->mta = NULL; return (0); } @@ -3012,12 +3011,6 @@ em_if_queues_free(if_ctx_t ctx) free(adapter->rx_queues, M_DEVBUF); adapter->rx_queues = NULL; } - - em_release_hw_control(adapter); - - if (adapter->mta != NULL) { - free(adapter->mta, M_DEVBUF); - } } /********************************************************************* diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 8741eb06ac18..45ac55ec2da8 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -1275,7 +1275,7 @@ ixl_if_queues_free(if_ctx_t ctx) struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; - if (!vsi->enable_head_writeback) { + if (vsi->tx_queues != NULL && !vsi->enable_head_writeback) { struct ixl_tx_queue *que; int i = 0; diff --git a/sys/net/iflib.c b/sys/net/iflib.c index f8d4c120b3ec..2d53b1ef8229 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -5157,7 +5157,7 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct device_printf(dev, "Cannot use iflib with only 1 MSI-X interrupt!\n"); err = ENODEV; - goto fail_intr_free; + goto fail_queues; } ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac); @@ -5192,13 +5192,14 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct fail_detach: ether_ifdetach(ctx->ifc_ifp); -fail_intr_free: - iflib_free_intr_mem(ctx); fail_queues: + iflib_tqg_detach(ctx); iflib_tx_structures_free(ctx); iflib_rx_structures_free(ctx); - iflib_tqg_detach(ctx); IFDI_DETACH(ctx); + IFDI_QUEUES_FREE(ctx); +fail_intr_free: + iflib_free_intr_mem(ctx); fail_unlock: CTX_UNLOCK(ctx); iflib_deregister(ctx); @@ -5397,11 +5398,12 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp, fail_detach: ether_ifdetach(ctx->ifc_ifp); fail_queues: + iflib_tqg_detach(ctx); iflib_tx_structures_free(ctx); iflib_rx_structures_free(ctx); - iflib_tqg_detach(ctx); fail_iflib_detach: IFDI_DETACH(ctx); + IFDI_QUEUES_FREE(ctx); fail_unlock: CTX_UNLOCK(ctx); iflib_deregister(ctx); @@ -5431,6 +5433,8 @@ iflib_pseudo_deregister(if_ctx_t ctx) iflib_tqg_detach(ctx); iflib_tx_structures_free(ctx); iflib_rx_structures_free(ctx); + IFDI_DETACH(ctx); + IFDI_QUEUES_FREE(ctx); iflib_deregister(ctx); @@ -5490,8 +5494,12 @@ iflib_device_deregister(if_ctx_t ctx) led_destroy(ctx->ifc_led_dev); iflib_tqg_detach(ctx); + iflib_tx_structures_free(ctx); + iflib_rx_structures_free(ctx); + CTX_LOCK(ctx); IFDI_DETACH(ctx); + IFDI_QUEUES_FREE(ctx); CTX_UNLOCK(ctx); /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/ @@ -5499,9 +5507,6 @@ iflib_device_deregister(if_ctx_t ctx) bus_generic_detach(dev); - iflib_tx_structures_free(ctx); - iflib_rx_structures_free(ctx); - iflib_deregister(ctx); device_set_softc(ctx->ifc_dev, NULL); @@ -6084,7 +6089,6 @@ iflib_tx_structures_free(if_ctx_t ctx) } free(ctx->ifc_txqs, M_IFLIB); ctx->ifc_txqs = NULL; - IFDI_QUEUES_FREE(ctx); } /********************************************************************* From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:30:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87C5E6A8F02; Tue, 28 Sep 2021 17:30: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 4HJmjc1bSHz4Tjw; Tue, 28 Sep 2021 17:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10F2F5E8; Tue, 28 Sep 2021 17:30: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 18SHUBeV079934; Tue, 28 Sep 2021 17:30:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHUBUo079918; Tue, 28 Sep 2021 17:30:11 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:30:11 GMT Message-Id: <202109281730.18SHUBUo079918@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: c98a58f6448f - stable/12 - e1000: Rename 'struct adapter' to 'struct e1000_sc' 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: c98a58f6448f6d3ff5ad5cb73b56f77ac3f3ca95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:30:12 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c98a58f6448f6d3ff5ad5cb73b56f77ac3f3ca95 commit c98a58f6448f6d3ff5ad5cb73b56f77ac3f3ca95 Author: Kevin Bowling AuthorDate: 2021-09-25 00:09:43 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 17:26:13 +0000 e1000: Rename 'struct adapter' to 'struct e1000_sc' Rename the 'struct adapter' to 'struct e1000_sc' to avoid type ambiguity in things like kgdb. Reviewed by: jhb, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32129 (cherry picked from commit dc9260515449cde9a4b26b5448f7386388c55bbd) --- sys/dev/e1000/em_txrx.c | 80 +-- sys/dev/e1000/if_em.c | 1556 +++++++++++++++++++++++----------------------- sys/dev/e1000/if_em.h | 306 +++++---- sys/dev/e1000/igb_txrx.c | 40 +- 4 files changed, 986 insertions(+), 996 deletions(-) diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c index cc5313a749bd..6ac66a9011f4 100644 --- a/sys/dev/e1000/em_txrx.c +++ b/sys/dev/e1000/em_txrx.c @@ -42,9 +42,9 @@ /********************************************************************* * Local Function prototypes *********************************************************************/ -static int em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, +static int em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower); -static int em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, +static int em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower); static int em_isc_txd_encap(void *arg, if_pkt_info_t pi); static void em_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); @@ -91,9 +91,9 @@ struct if_txrx lem_txrx = { extern if_shared_ctx_t em_sctx; void -em_dump_rs(struct adapter *adapter) +em_dump_rs(struct e1000_softc *sc) { - if_softc_ctx_t scctx = adapter->shared; + if_softc_ctx_t scctx = sc->shared; struct em_tx_queue *que; struct tx_ring *txr; qidx_t i, ntxd, qid, cur; @@ -102,8 +102,8 @@ em_dump_rs(struct adapter *adapter) printf("\n"); ntxd = scctx->isc_ntxd[0]; - for (qid = 0; qid < adapter->tx_num_queues; qid++) { - que = &adapter->tx_queues[qid]; + for (qid = 0; qid < sc->tx_num_queues; qid++) { + que = &sc->tx_queues[qid]; txr = &que->txr; rs_cidx = txr->tx_rs_cidx; if (rs_cidx != txr->tx_rs_pidx) { @@ -132,10 +132,10 @@ em_dump_rs(struct adapter *adapter) * **********************************************************************/ static int -em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) +em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) { - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[pi->ipi_qsidx]; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; struct e1000_context_desc *TXD; int cur, hdr_len; @@ -178,7 +178,7 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd TXD->tcp_seg_setup.fields.mss = htole16(pi->ipi_tso_segsz); TXD->tcp_seg_setup.fields.hdr_len = hdr_len; - TXD->cmd_and_length = htole32(adapter->txd_cmd | + TXD->cmd_and_length = htole32(sc->txd_cmd | E1000_TXD_CMD_DEXT | /* Extended descr */ E1000_TXD_CMD_TSE | /* TSE context */ E1000_TXD_CMD_IP | /* Do IP csum */ @@ -189,7 +189,7 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd if (++cur == scctx->isc_ntxd[0]) { cur = 0; } - DPRINTF(iflib_get_dev(adapter->ctx), "%s: pidx: %d cur: %d\n", __FUNCTION__, pi->ipi_pidx, cur); + DPRINTF(iflib_get_dev(sc->ctx), "%s: pidx: %d cur: %d\n", __FUNCTION__, pi->ipi_pidx, cur); return (cur); } @@ -215,11 +215,11 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd **********************************************************************/ static int -em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) +em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) { struct e1000_context_desc *TXD = NULL; - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[pi->ipi_qsidx]; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; int csum_flags = pi->ipi_csum_flags; int cur, hdr_len; @@ -227,7 +227,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u cur = pi->ipi_pidx; hdr_len = pi->ipi_ehdrlen + pi->ipi_ip_hlen; - cmd = adapter->txd_cmd; + cmd = sc->txd_cmd; /* * The 82574L can only remember the *last* context used @@ -237,7 +237,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u * second note. */ if (DONT_FORCE_CTX && - adapter->tx_num_queues == 1 && + sc->tx_num_queues == 1 && txr->csum_lhlen == pi->ipi_ehdrlen && txr->csum_iphlen == pi->ipi_ip_hlen && txr->csum_flags == csum_flags) { @@ -293,7 +293,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u if (++cur == scctx->isc_ntxd[0]) { cur = 0; } - DPRINTF(iflib_get_dev(adapter->ctx), "checksum_setup csum_flags=%x txd_upper=%x txd_lower=%x hdr_len=%d cmd=%x\n", + DPRINTF(iflib_get_dev(sc->ctx), "checksum_setup csum_flags=%x txd_upper=%x txd_lower=%x hdr_len=%d cmd=%x\n", csum_flags, *txd_upper, *txd_lower, hdr_len, cmd); return (cur); } @@ -301,7 +301,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u static int em_isc_txd_encap(void *arg, if_pkt_info_t pi) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; @@ -348,7 +348,7 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) } DPRINTF(iflib_get_dev(sc->ctx), "encap: set up tx: nsegs=%d first=%d i=%d\n", nsegs, first, i); - /* XXX adapter->pcix_82544 -- lem_fill_descriptors */ + /* XXX sc->pcix_82544 -- lem_fill_descriptors */ /* Set up our transmit descriptors */ for (j = 0; j < nsegs; j++) { @@ -416,19 +416,19 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) static void em_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx) { - struct adapter *adapter = arg; - struct em_tx_queue *que = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = arg; + struct em_tx_queue *que = &sc->tx_queues[txqid]; struct tx_ring *txr = &que->txr; - E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), pidx); + E1000_WRITE_REG(&sc->hw, E1000_TDT(txr->me), pidx); } static int em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[txqid]; struct tx_ring *txr = &que->txr; qidx_t processed = 0; @@ -461,7 +461,7 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) if (delta < 0) delta += ntxd; MPASS(delta > 0); - DPRINTF(iflib_get_dev(adapter->ctx), + DPRINTF(iflib_get_dev(sc->ctx), "%s: cidx_processed=%u cur=%u clear=%d delta=%d\n", __FUNCTION__, prev, cur, clear, delta); @@ -483,7 +483,7 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) static void lem_isc_rxd_refill(void *arg, if_rxd_update_t iru) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[iru->iru_qsidx]; struct rx_ring *rxr = &que->rxr; @@ -511,7 +511,7 @@ lem_isc_rxd_refill(void *arg, if_rxd_update_t iru) static void em_isc_rxd_refill(void *arg, if_rxd_update_t iru) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; uint16_t rxqid = iru->iru_qsidx; struct em_rx_queue *que = &sc->rx_queues[rxqid]; @@ -540,7 +540,7 @@ em_isc_rxd_refill(void *arg, if_rxd_update_t iru) static void em_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -550,7 +550,7 @@ em_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx) static int lem_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -575,7 +575,7 @@ lem_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) static int em_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -600,9 +600,9 @@ em_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) static int lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; struct e1000_rx_desc *rxd; u16 len; @@ -628,7 +628,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (errors & E1000_RXD_ERR_FRAME_ERR_MASK) { - adapter->dropped_pkts++; + sc->dropped_pkts++; /* XXX fixup if common */ return (EBADMSG); } @@ -645,7 +645,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) } while (!eop); /* XXX add a faster way to look this up */ - if (adapter->hw.mac.type >= e1000_82543) + if (sc->hw.mac.type >= e1000_82543) em_receive_checksum(status, errors, ri); if (status & E1000_RXD_STAT_VP) { @@ -661,9 +661,9 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) static int em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; union e1000_rx_desc_extended *rxd; @@ -691,7 +691,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) { - adapter->dropped_pkts++; + sc->dropped_pkts++; return EBADMSG; } diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 7babe51c8c02..c2c172f7ef2f 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -294,33 +294,33 @@ static int igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid); static void em_if_multi_set(if_ctx_t ctx); static void em_if_update_admin_status(if_ctx_t ctx); static void em_if_debug(if_ctx_t ctx); -static void em_update_stats_counters(struct adapter *); -static void em_add_hw_stats(struct adapter *adapter); +static void em_update_stats_counters(struct e1000_softc *); +static void em_add_hw_stats(struct e1000_softc *); static int em_if_set_promisc(if_ctx_t ctx, int flags); -static bool em_if_vlan_filter_capable(struct adapter *); -static bool em_if_vlan_filter_used(struct adapter *); -static void em_if_vlan_filter_enable(struct adapter *); -static void em_if_vlan_filter_disable(struct adapter *); -static void em_if_vlan_filter_write(struct adapter *); -static void em_setup_vlan_hw_support(struct adapter *); +static bool em_if_vlan_filter_capable(struct e1000_softc *); +static bool em_if_vlan_filter_used(struct e1000_softc *); +static void em_if_vlan_filter_enable(struct e1000_softc *); +static void em_if_vlan_filter_disable(struct e1000_softc *); +static void em_if_vlan_filter_write(struct e1000_softc *); +static void em_setup_vlan_hw_support(struct e1000_softc *); static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); -static void em_print_nvm_info(struct adapter *); +static void em_print_nvm_info(struct e1000_softc *); static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); static int em_get_rs(SYSCTL_HANDLER_ARGS); -static void em_print_debug_info(struct adapter *); +static void em_print_debug_info(struct e1000_softc *); static int em_is_valid_ether_addr(u8 *); static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); -static void em_add_int_delay_sysctl(struct adapter *, const char *, +static void em_add_int_delay_sysctl(struct e1000_softc *, const char *, const char *, struct em_int_delay_info *, int, int); /* Management and WOL Support */ -static void em_init_manageability(struct adapter *); -static void em_release_manageability(struct adapter *); -static void em_get_hw_control(struct adapter *); -static void em_release_hw_control(struct adapter *); +static void em_init_manageability(struct e1000_softc *); +static void em_release_manageability(struct e1000_softc *); +static void em_get_hw_control(struct e1000_softc *); +static void em_release_hw_control(struct e1000_softc *); static void em_get_wakeup(if_ctx_t ctx); static void em_enable_wakeup(if_ctx_t ctx); -static int em_enable_phy_wakeup(struct adapter *); -static void em_disable_aspm(struct adapter *); +static int em_enable_phy_wakeup(struct e1000_softc *); +static void em_disable_aspm(struct e1000_softc *); int em_intr(void *arg); @@ -337,8 +337,8 @@ static void em_if_led_func(if_ctx_t ctx, int onoff); static int em_get_regs(SYSCTL_HANDLER_ARGS); -static void lem_smartspeed(struct adapter *adapter); -static void igb_configure_queues(struct adapter *adapter); +static void lem_smartspeed(struct e1000_softc *); +static void igb_configure_queues(struct e1000_softc *); /********************************************************************* @@ -370,7 +370,7 @@ static device_method_t igb_methods[] = { static driver_t em_driver = { - "em", em_methods, sizeof(struct adapter), + "em", em_methods, sizeof(struct e1000_softc), }; static devclass_t em_devclass; @@ -383,7 +383,7 @@ MODULE_DEPEND(em, iflib, 1, 1, 1); IFLIB_PNP_INFO(pci, em, em_vendor_info_array); static driver_t igb_driver = { - "igb", igb_methods, sizeof(struct adapter), + "igb", igb_methods, sizeof(struct e1000_softc), }; static devclass_t igb_devclass; @@ -430,7 +430,7 @@ static device_method_t em_if_methods[] = { }; static driver_t em_if_driver = { - "em_if", em_if_methods, sizeof(struct adapter) + "em_if", em_if_methods, sizeof(struct e1000_softc) }; static device_method_t igb_if_methods[] = { @@ -468,7 +468,7 @@ static device_method_t igb_if_methods[] = { }; static driver_t igb_if_driver = { - "igb_if", igb_if_methods, sizeof(struct adapter) + "igb_if", igb_if_methods, sizeof(struct e1000_softc) }; /********************************************************************* @@ -612,8 +612,8 @@ if_shared_ctx_t igb_sctx = &igb_sctx_init; static int em_get_regs(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *)arg1; - struct e1000_hw *hw = &adapter->hw; + struct e1000_softc *sc = (struct e1000_softc *)arg1; + struct e1000_hw *hw = &sc->hw; struct sbuf *sb; u32 *regs_buff; int rc; @@ -693,7 +693,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) #ifdef DUMP_DESCS { - if_softc_ctx_t scctx = adapter->shared; + if_softc_ctx_t scctx = sc->shared; struct rx_ring *rxr = &rx_que->rxr; struct tx_ring *txr = &tx_que->txr; int ntxd = scctx->isc_ntxd[0]; @@ -737,11 +737,11 @@ igb_register(device_t dev) static int em_set_num_queues(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); int maxqueues; /* Sanity check based on HW */ - switch (adapter->hw.mac.type) { + switch (sc->hw.mac.type) { case e1000_82576: case e1000_82580: case e1000_i350: @@ -791,7 +791,7 @@ em_set_num_queues(if_ctx_t ctx) static int em_if_attach_pre(if_ctx_t ctx) { - struct adapter *adapter; + struct e1000_softc *sc; if_softc_ctx_t scctx; device_t dev; struct e1000_hw *hw; @@ -799,40 +799,40 @@ em_if_attach_pre(if_ctx_t ctx) INIT_DEBUGOUT("em_if_attach_pre: begin"); dev = iflib_get_dev(ctx); - adapter = iflib_get_softc(ctx); + sc = iflib_get_softc(ctx); - adapter->ctx = adapter->osdep.ctx = ctx; - adapter->dev = adapter->osdep.dev = dev; - scctx = adapter->shared = iflib_get_softc_ctx(ctx); - adapter->media = iflib_get_media(ctx); - hw = &adapter->hw; + sc->ctx = sc->osdep.ctx = ctx; + sc->dev = sc->osdep.dev = dev; + scctx = sc->shared = iflib_get_softc_ctx(ctx); + sc->media = iflib_get_media(ctx); + hw = &sc->hw; - adapter->tx_process_limit = scctx->isc_ntxd[0]; + sc->tx_process_limit = scctx->isc_ntxd[0]; /* SYSCTL stuff */ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, sc, 0, em_sysctl_nvm_info, "I", "NVM Information"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, sc, 0, em_sysctl_debug_info, "I", "Debug Information"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "fc", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + OID_AUTO, "fc", CTLTYPE_INT|CTLFLAG_RW, sc, 0, em_set_flowcntl, "I", "Flow Control"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "reg_dump", CTLTYPE_STRING | CTLFLAG_RD, adapter, 0, + OID_AUTO, "reg_dump", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, em_get_regs, "A", "Dump Registers"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "rs_dump", CTLTYPE_INT | CTLFLAG_RW, adapter, 0, + OID_AUTO, "rs_dump", CTLTYPE_INT | CTLFLAG_RW, sc, 0, em_get_rs, "I", "Dump RS indexes"); /* Determine hardware and mac info */ @@ -941,19 +941,19 @@ em_if_attach_pre(if_ctx_t ctx) (hw->mac.type == e1000_pch2lan) || (hw->mac.type == e1000_pch_lpt)) { int rid = EM_BAR_TYPE_FLASH; - adapter->flash = bus_alloc_resource_any(dev, + sc->flash = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (adapter->flash == NULL) { + if (sc->flash == NULL) { device_printf(dev, "Mapping of Flash failed\n"); error = ENXIO; goto err_pci; } /* This is used in the shared code */ - hw->flash_address = (u8 *)adapter->flash; - adapter->osdep.flash_bus_space_tag = - rman_get_bustag(adapter->flash); - adapter->osdep.flash_bus_space_handle = - rman_get_bushandle(adapter->flash); + hw->flash_address = (u8 *)sc->flash; + sc->osdep.flash_bus_space_tag = + rman_get_bustag(sc->flash); + sc->osdep.flash_bus_space_handle = + rman_get_bushandle(sc->flash); } /* ** In the new SPT device flash is not a @@ -962,10 +962,10 @@ em_if_attach_pre(if_ctx_t ctx) ** FLASH read/write macros in the shared code. */ else if (hw->mac.type >= e1000_pch_spt) { - adapter->osdep.flash_bus_space_tag = - adapter->osdep.mem_bus_space_tag; - adapter->osdep.flash_bus_space_handle = - adapter->osdep.mem_bus_space_handle + sc->osdep.flash_bus_space_tag = + sc->osdep.mem_bus_space_tag; + sc->osdep.flash_bus_space_handle = + sc->osdep.mem_bus_space_handle + E1000_FLASH_BASE_ADDR; } @@ -982,25 +982,25 @@ em_if_attach_pre(if_ctx_t ctx) e1000_get_bus_info(hw); /* Set up some sysctls for the tunable interrupt delays */ - em_add_int_delay_sysctl(adapter, "rx_int_delay", - "receive interrupt delay in usecs", &adapter->rx_int_delay, + em_add_int_delay_sysctl(sc, "rx_int_delay", + "receive interrupt delay in usecs", &sc->rx_int_delay, E1000_REGISTER(hw, E1000_RDTR), em_rx_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "tx_int_delay", - "transmit interrupt delay in usecs", &adapter->tx_int_delay, + em_add_int_delay_sysctl(sc, "tx_int_delay", + "transmit interrupt delay in usecs", &sc->tx_int_delay, E1000_REGISTER(hw, E1000_TIDV), em_tx_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "rx_abs_int_delay", + em_add_int_delay_sysctl(sc, "rx_abs_int_delay", "receive interrupt delay limit in usecs", - &adapter->rx_abs_int_delay, + &sc->rx_abs_int_delay, E1000_REGISTER(hw, E1000_RADV), em_rx_abs_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "tx_abs_int_delay", + em_add_int_delay_sysctl(sc, "tx_abs_int_delay", "transmit interrupt delay limit in usecs", - &adapter->tx_abs_int_delay, + &sc->tx_abs_int_delay, E1000_REGISTER(hw, E1000_TADV), em_tx_abs_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "itr", + em_add_int_delay_sysctl(sc, "itr", "interrupt delay limit in usecs/4", - &adapter->tx_itr, + &sc->tx_itr, E1000_REGISTER(hw, E1000_ITR), DEFAULT_ITR); @@ -1033,9 +1033,9 @@ em_if_attach_pre(if_ctx_t ctx) hw->mac.report_tx_early = 1; /* Allocate multicast array memory. */ - adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * + sc->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); - if (adapter->mta == NULL) { + if (sc->mta == NULL) { device_printf(dev, "Can not allocate multicast setup array\n"); error = ENOMEM; goto err_late; @@ -1051,7 +1051,7 @@ em_if_attach_pre(if_ctx_t ctx) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "eee_control", CTLTYPE_INT|CTLFLAG_RW, - adapter, 0, em_sysctl_eee, "I", + sc, 0, em_sysctl_eee, "I", "Disable Energy Efficient Ethernet"); /* @@ -1085,7 +1085,7 @@ em_if_attach_pre(if_ctx_t ctx) } if (!em_is_valid_ether_addr(hw->mac.addr)) { - if (adapter->vf_ifp) { + if (sc->vf_ifp) { ether_gen_addr(iflib_get_ifp(ctx), (struct ether_addr *)hw->mac.addr); } else { @@ -1105,7 +1105,7 @@ em_if_attach_pre(if_ctx_t ctx) /* Enable only WOL MAGIC by default */ scctx->isc_capenable &= ~IFCAP_WOL; - if (adapter->wol != 0) + if (sc->wol != 0) scctx->isc_capenable |= IFCAP_WOL_MAGIC; iflib_set_mac(ctx, hw->mac.addr); @@ -1113,10 +1113,10 @@ em_if_attach_pre(if_ctx_t ctx) return (0); err_late: - em_release_hw_control(adapter); + em_release_hw_control(sc); err_pci: em_free_pci_resources(ctx); - free(adapter->mta, M_DEVBUF); + free(sc->mta, M_DEVBUF); return (error); } @@ -1124,28 +1124,28 @@ err_pci: static int em_if_attach_post(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - struct e1000_hw *hw = &adapter->hw; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct e1000_hw *hw = &sc->hw; int error = 0; /* Setup OS specific network interface */ error = em_setup_interface(ctx); if (error != 0) { - device_printf(adapter->dev, "Interface setup failed: %d\n", error); + device_printf(sc->dev, "Interface setup failed: %d\n", error); goto err_late; } em_reset(ctx); /* Initialize statistics */ - em_update_stats_counters(adapter); + em_update_stats_counters(sc); hw->mac.get_link_status = 1; em_if_update_admin_status(ctx); - em_add_hw_stats(adapter); + em_add_hw_stats(sc); /* Non-AMT based hardware can now take control from firmware */ - if (adapter->has_manage && !adapter->has_amt) - em_get_hw_control(adapter); + if (sc->has_manage && !sc->has_amt) + em_get_hw_control(sc); INIT_DEBUGOUT("em_if_attach_post: end"); @@ -1168,17 +1168,17 @@ err_late: static int em_if_detach(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); INIT_DEBUGOUT("em_if_detach: begin"); - e1000_phy_hw_reset(&adapter->hw); + e1000_phy_hw_reset(&sc->hw); - em_release_manageability(adapter); - em_release_hw_control(adapter); + em_release_manageability(sc); + em_release_hw_control(sc); em_free_pci_resources(ctx); - free(adapter->mta, M_DEVBUF); - adapter->mta = NULL; + free(sc->mta, M_DEVBUF); + sc->mta = NULL; return (0); } @@ -1201,10 +1201,10 @@ em_if_shutdown(if_ctx_t ctx) static int em_if_suspend(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); - em_release_manageability(adapter); - em_release_hw_control(adapter); + em_release_manageability(sc); + em_release_hw_control(sc); em_enable_wakeup(ctx); return (0); } @@ -1212,12 +1212,12 @@ em_if_suspend(if_ctx_t ctx) static int em_if_resume(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); - if (adapter->hw.mac.type == e1000_pch2lan) - e1000_resume_workarounds_pchlan(&adapter->hw); + if (sc->hw.mac.type == e1000_pch2lan) + e1000_resume_workarounds_pchlan(&sc->hw); em_if_init(ctx); - em_init_manageability(adapter); + em_init_manageability(sc); return(0); } @@ -1226,12 +1226,12 @@ static int em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) { int max_frame_size; - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = iflib_get_softc_ctx(ctx); IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); - switch (adapter->hw.mac.type) { + switch (sc->hw.mac.type) { case e1000_82571: case e1000_82572: case e1000_ich9lan: @@ -1258,7 +1258,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) max_frame_size = ETHER_MAX_LEN; break; default: - if (adapter->hw.mac.type >= igb_mac_min) + if (sc->hw.mac.type >= igb_mac_min) max_frame_size = 9234; else /* lem */ max_frame_size = MAX_JUMBO_FRAME_SIZE; @@ -1267,7 +1267,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) return (EINVAL); } - scctx->isc_max_frame_size = adapter->hw.mac.max_frame_size = + scctx->isc_max_frame_size = sc->hw.mac.max_frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; return (0); } @@ -1284,8 +1284,8 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) static void em_if_init(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - if_softc_ctx_t scctx = adapter->shared; + struct e1000_softc *sc = iflib_get_softc(ctx); + if_softc_ctx_t scctx = sc->shared; struct ifnet *ifp = iflib_get_ifp(ctx); struct em_tx_queue *tx_que; int i; @@ -1293,11 +1293,11 @@ em_if_init(if_ctx_t ctx) INIT_DEBUGOUT("em_if_init: begin"); /* Get the latest mac address, User can use a LAA */ - bcopy(if_getlladdr(ifp), adapter->hw.mac.addr, + bcopy(if_getlladdr(ifp), sc->hw.mac.addr, ETHER_ADDR_LEN); /* Put the address into the Receive Address Array */ - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); + e1000_rar_set(&sc->hw, sc->hw.mac.addr, 0); /* * With the 82571 adapter, RAR[0] may be overwritten @@ -1305,9 +1305,9 @@ em_if_init(if_ctx_t ctx) * in RAR[14] for that eventuality, this assures * the interface continues to function. */ - if (adapter->hw.mac.type == e1000_82571) { - e1000_set_laa_state_82571(&adapter->hw, true); - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, + if (sc->hw.mac.type == e1000_82571) { + e1000_set_laa_state_82571(&sc->hw, true); + e1000_rar_set(&sc->hw, sc->hw.mac.addr, E1000_RAR_ENTRIES - 1); } @@ -1316,7 +1316,7 @@ em_if_init(if_ctx_t ctx) em_reset(ctx); em_if_update_admin_status(ctx); - for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) { + for (i = 0, tx_que = sc->tx_queues; i < sc->tx_num_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; txr->tx_rs_cidx = txr->tx_rs_pidx; @@ -1330,14 +1330,14 @@ em_if_init(if_ctx_t ctx) } /* Setup VLAN support, basic and offload if available */ - E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); + E1000_WRITE_REG(&sc->hw, E1000_VET, ETHERTYPE_VLAN); /* Clear bad data from Rx FIFOs */ - if (adapter->hw.mac.type >= igb_mac_min) - e1000_rx_fifo_flush_base(&adapter->hw); + if (sc->hw.mac.type >= igb_mac_min) + e1000_rx_fifo_flush_base(&sc->hw); /* Configure for OS presence */ - em_init_manageability(adapter); + em_init_manageability(sc); /* Prepare transmit descriptors and buffers */ em_initialize_transmit_unit(ctx); @@ -1345,42 +1345,42 @@ em_if_init(if_ctx_t ctx) /* Setup Multicast table */ em_if_multi_set(ctx); - adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); + sc->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); em_initialize_receive_unit(ctx); /* Set up VLAN support and filter */ - em_setup_vlan_hw_support(adapter); + em_setup_vlan_hw_support(sc); /* Don't lose promiscuous settings */ em_if_set_promisc(ctx, if_getflags(ifp)); - e1000_clear_hw_cntrs_base_generic(&adapter->hw); + e1000_clear_hw_cntrs_base_generic(&sc->hw); /* MSI-X configuration for 82574 */ - if (adapter->hw.mac.type == e1000_82574) { - int tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + if (sc->hw.mac.type == e1000_82574) { + int tmp = E1000_READ_REG(&sc->hw, E1000_CTRL_EXT); tmp |= E1000_CTRL_EXT_PBA_CLR; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); + E1000_WRITE_REG(&sc->hw, E1000_CTRL_EXT, tmp); /* Set the IVAR - interrupt vector routing. */ - E1000_WRITE_REG(&adapter->hw, E1000_IVAR, adapter->ivars); - } else if (adapter->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ - igb_configure_queues(adapter); + E1000_WRITE_REG(&sc->hw, E1000_IVAR, sc->ivars); + } else if (sc->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ + igb_configure_queues(sc); /* this clears any pending interrupts */ - E1000_READ_REG(&adapter->hw, E1000_ICR); - E1000_WRITE_REG(&adapter->hw, E1000_ICS, E1000_ICS_LSC); + E1000_READ_REG(&sc->hw, E1000_ICR); + E1000_WRITE_REG(&sc->hw, E1000_ICS, E1000_ICS_LSC); /* AMT based hardware can now take control from firmware */ - if (adapter->has_manage && adapter->has_amt) - em_get_hw_control(adapter); + if (sc->has_manage && sc->has_amt) + em_get_hw_control(sc); /* Set Energy Efficient Ethernet */ - if (adapter->hw.mac.type >= igb_mac_min && - adapter->hw.phy.media_type == e1000_media_type_copper) { - if (adapter->hw.mac.type == e1000_i354) - e1000_set_eee_i354(&adapter->hw, true, true); + if (sc->hw.mac.type >= igb_mac_min && + sc->hw.phy.media_type == e1000_media_type_copper) { + if (sc->hw.mac.type == e1000_i354) + e1000_set_eee_i354(&sc->hw, true, true); else - e1000_set_eee_i350(&adapter->hw, true, true); + e1000_set_eee_i350(&sc->hw, true, true); } } @@ -1392,11 +1392,11 @@ em_if_init(if_ctx_t ctx) int em_intr(void *arg) { - struct adapter *adapter = arg; - if_ctx_t ctx = adapter->ctx; + struct e1000_softc *sc = arg; + if_ctx_t ctx = sc->ctx; u32 reg_icr; - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + reg_icr = E1000_READ_REG(&sc->hw, E1000_ICR); /* Hot eject? */ if (reg_icr == 0xffffffff) @@ -1410,7 +1410,7 @@ em_intr(void *arg) * Starting with the 82571 chip, bit 31 should be used to * determine whether the interrupt belongs to us. */ - if (adapter->hw.mac.type >= e1000_82571 && + if (sc->hw.mac.type >= e1000_82571 && (reg_icr & E1000_ICR_INT_ASSERTED) == 0) return FILTER_STRAY; @@ -1427,7 +1427,7 @@ em_intr(void *arg) em_handle_link(ctx); if (reg_icr & E1000_ICR_RXO) - adapter->rx_overruns++; + sc->rx_overruns++; return (FILTER_SCHEDULE_THREAD); } @@ -1435,40 +1435,40 @@ em_intr(void *arg) static int em_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_rx_queue *rxq = &adapter->rx_queues[rxqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_rx_queue *rxq = &sc->rx_queues[rxqid]; - E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxq->eims); + E1000_WRITE_REG(&sc->hw, E1000_IMS, rxq->eims); return (0); } static int em_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_tx_queue *txq = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_tx_queue *txq = &sc->tx_queues[txqid]; - E1000_WRITE_REG(&adapter->hw, E1000_IMS, txq->eims); + E1000_WRITE_REG(&sc->hw, E1000_IMS, txq->eims); return (0); } static int igb_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_rx_queue *rxq = &adapter->rx_queues[rxqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_rx_queue *rxq = &sc->rx_queues[rxqid]; - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, rxq->eims); + E1000_WRITE_REG(&sc->hw, E1000_EIMS, rxq->eims); return (0); } static int igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_tx_queue *txq = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_tx_queue *txq = &sc->tx_queues[txqid]; - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, txq->eims); + E1000_WRITE_REG(&sc->hw, E1000_EIMS, txq->eims); return (0); } @@ -1495,29 +1495,29 @@ em_msix_que(void *arg) static int em_msix_link(void *arg) { - struct adapter *adapter = arg; + struct e1000_softc *sc = arg; u32 reg_icr; bool notlink = false; - ++adapter->link_irq; - MPASS(adapter->hw.back != NULL); - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + ++sc->link_irq; + MPASS(sc->hw.back != NULL); + reg_icr = E1000_READ_REG(&sc->hw, E1000_ICR); if (reg_icr & E1000_ICR_RXO) - adapter->rx_overruns++; + sc->rx_overruns++; if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) - em_handle_link(adapter->ctx); + em_handle_link(sc->ctx); else notlink = true; /* Re-arm for other/spurious interrupts */ - if (notlink && adapter->hw.mac.type >= igb_mac_min) { - E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_LSC); - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); - } else if (adapter->hw.mac.type == e1000_82574) { *** 3447 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:30:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75EFF6A8F01; Tue, 28 Sep 2021 17:30: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 4HJmjZ08PFz4Tpd; Tue, 28 Sep 2021 17:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1D335E7; Tue, 28 Sep 2021 17:30: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 18SHU9ZI079270; Tue, 28 Sep 2021 17:30:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHU9eg079266; Tue, 28 Sep 2021 17:30:09 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:30:09 GMT Message-Id: <202109281730.18SHU9eg079266@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: a02f614070a8 - stable/12 - e1000: Consistently use FALLTHROUGH 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: a02f614070a862b98dcb7c09fec7cfa9a701eefe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:30:10 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a02f614070a862b98dcb7c09fec7cfa9a701eefe commit a02f614070a862b98dcb7c09fec7cfa9a701eefe Author: Kevin Bowling AuthorDate: 2021-09-17 03:13:26 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 17:07:34 +0000 e1000: Consistently use FALLTHROUGH Approved by: imp MFC after: 1 week (cherry picked from commit e05d9788b7e90ffd6405dc59656b52a63ba7ff3e) --- sys/dev/e1000/e1000_82540.c | 2 +- sys/dev/e1000/e1000_82571.c | 4 ++-- sys/dev/e1000/e1000_82575.c | 6 ++++++ sys/dev/e1000/e1000_ich8lan.c | 16 ++++++++-------- sys/dev/e1000/e1000_nvm.c | 2 +- sys/dev/e1000/e1000_phy.c | 6 +++++- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/sys/dev/e1000/e1000_82540.c b/sys/dev/e1000/e1000_82540.c index 0296397ee013..903c2c924a05 100644 --- a/sys/dev/e1000/e1000_82540.c +++ b/sys/dev/e1000/e1000_82540.c @@ -100,7 +100,7 @@ static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) case e1000_82546_rev_3: if (phy->id == M88E1011_I_PHY_ID) break; - /* Fall Through */ + /* FALLTHROUGH */ default: ret_val = -E1000_ERR_PHY; goto out; diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index cae9afcb2d78..ce9ae8791654 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -238,7 +238,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_EECD, eecd); break; } - /* Fall Through */ + /* FALLTHROUGH */ default: nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> @@ -1115,7 +1115,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) switch (mac->type) { case e1000_82573: e1000_enable_tx_pkt_filtering_generic(hw); - /* fall through */ + /* FALLTHROUGH */ case e1000_82574: case e1000_82583: reg_data = E1000_READ_REG(hw, E1000_GCR); diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 59d8b9c85dc3..a0c057e5f07f 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -1443,13 +1443,19 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) } switch (hw->phy.type) { case e1000_phy_i210: + /* FALLTHROUGH */ case e1000_phy_m88: switch (hw->phy.id) { case I347AT4_E_PHY_ID: + /* FALLTHROUGH */ case M88E1112_E_PHY_ID: + /* FALLTHROUGH */ case M88E1340M_E_PHY_ID: + /* FALLTHROUGH */ case M88E1543_E_PHY_ID: + /* FALLTHROUGH */ case M88E1512_E_PHY_ID: + /* FALLTHROUGH */ case I210_I_PHY_ID: ret_val = e1000_copper_link_setup_m88_gen2(hw); break; diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 1f33e4182fa7..d9efc78e350c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -365,12 +365,12 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) */ msec_delay(50); - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch2lan: if (e1000_phy_is_accessible_pchlan(hw)) break; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pchlan: if ((hw->mac.type == e1000_pchlan) && (fwsm & E1000_ICH_FWSM_FW_VALID)) @@ -493,7 +493,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) return ret_val; if ((phy->id != 0) && (phy->id != PHY_REVISION_MASK)) break; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: @@ -796,7 +796,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) case e1000_pch2lan: mac->rar_entry_count = E1000_PCH2_RAR_ENTRIES; mac->ops.rar_set = e1000_rar_set_pch2lan; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: @@ -806,7 +806,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pchlan: /* check management mode */ mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan; @@ -1761,7 +1761,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) ret_val = e1000_k1_workaround_lv(hw); if (ret_val) return ret_val; - /* fall-thru */ + /* FALLTHROUGH */ case e1000_pchlan: if (hw->phy.type == e1000_phy_82578) { ret_val = e1000_link_stall_workaround_hv(hw); @@ -2299,7 +2299,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; break; } - /* Fall-thru */ + /* FALLTHROUGH */ case e1000_pchlan: case e1000_pch2lan: case e1000_pch_lpt: @@ -3479,7 +3479,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) return E1000_SUCCESS; } DEBUGOUT("Unable to determine valid NVM bank via EEC - reading flash signature\n"); - /* fall-thru */ + /* FALLTHROUGH */ default: /* set bank to 0 in case flash read fails */ *bank = 0; diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index ef6f31f30c18..15e7fc1fc03b 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -1321,7 +1321,7 @@ void e1000_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers) e1000_read_invm_version(hw, fw_vers); return; } - /* fall through */ + /* FALLTHROUGH */ case e1000_i350: hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); /* find combo image version */ diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index e5fd942464b6..872a5267bfdb 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -1038,7 +1038,7 @@ static s32 e1000_set_master_slave_mode(struct e1000_hw *hw) break; case e1000_ms_auto: phy_data &= ~CR_1000T_MS_ENABLE; - /* fall-through */ + /* FALLTHROUGH */ default: break; } @@ -1098,6 +1098,7 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) phy_data |= I82577_PHY_CTRL2_MANUAL_MDIX; break; case 0: + /* FALLTHROUGH */ default: phy_data |= I82577_PHY_CTRL2_AUTO_MDI_MDIX; break; @@ -1154,6 +1155,7 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) phy_data |= M88E1000_PSCR_AUTO_X_1000T; break; case 0: + /* FALLTHROUGH */ default: phy_data |= M88E1000_PSCR_AUTO_X_MODE; break; @@ -1306,6 +1308,7 @@ s32 e1000_copper_link_setup_m88_gen2(struct e1000_hw *hw) } /* FALLTHROUGH */ case 0: + /* FALLTHROUGH */ default: phy_data |= M88E1000_PSCR_AUTO_X_MODE; break; @@ -1420,6 +1423,7 @@ s32 e1000_copper_link_setup_igp(struct e1000_hw *hw) data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; break; case 0: + /* FALLTHROUGH */ default: data |= IGP01E1000_PSCR_AUTO_MDIX; break; From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:30:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A58216A8971; Tue, 28 Sep 2021 17:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJmjd2p4wz4Thb; Tue, 28 Sep 2021 17:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DB6E93D; Tue, 28 Sep 2021 17:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18SHUDtG080424; Tue, 28 Sep 2021 17:30:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHUDQQ080421; Tue, 28 Sep 2021 17:30:13 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:30:13 GMT Message-Id: <202109281730.18SHUDQQ080421@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: 9f451734952a - stable/12 - uart: Add PCI ID for intel 100 Series/C230 Series AMT 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: 9f451734952a52a90a89865e7668e944804a756b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:30:13 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9f451734952a52a90a89865e7668e944804a756b commit 9f451734952a52a90a89865e7668e944804a756b Author: Sean Bruno AuthorDate: 2021-09-25 22:23:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 17:26:34 +0000 uart: Add PCI ID for intel 100 Series/C230 Series AMT Reviewed by: kib Tested by: kbowling Differential Revision: https://reviews.freebsd.org/D32146 (cherry picked from commit fb640be4e9443f1890680c27b213825300bc65f4) --- sys/dev/uart/uart_bus_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index e41602a72f38..596e8afff929 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -170,6 +170,8 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x8c3d, 0xffff, 0, "Intel Lynx Point KT Controller", 0x10 }, { 0x8086, 0x8cbd, 0xffff, 0, "Intel Wildcat Point KT Controller", 0x10 }, { 0x8086, 0x9c3d, 0xffff, 0, "Intel Lynx Point-LP HECI KT", 0x10 }, +{ 0x8086, 0xa13d, 0xffff, 0, + "100 Series/C230 Series Chipset Family KT Redirection", 0x10 }, { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:30:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2C006A8973; Tue, 28 Sep 2021 17:30: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 4HJmjg5LH2z4Tv9; Tue, 28 Sep 2021 17:30:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C16579C; Tue, 28 Sep 2021 17:30: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 18SHUFJS081464; Tue, 28 Sep 2021 17:30:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHUFbE081458; Tue, 28 Sep 2021 17:30:15 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:30:15 GMT Message-Id: <202109281730.18SHUFbE081458@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: a6640bca4827 - stable/12 - e1000: Re-arm link changes 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: a6640bca4827036ad9374696381513da7d9df0f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:30:16 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a6640bca4827036ad9374696381513da7d9df0f9 commit a6640bca4827036ad9374696381513da7d9df0f9 Author: Kevin Bowling AuthorDate: 2021-09-27 16:17:48 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 17:28:54 +0000 e1000: Re-arm link changes A change to MSI-X link handler was somehow causing issues on MSI-based em(4) NICs. Revert the change based on user reports and testing. PR: 258551 Reported by: Franco Fichtner , t_uemura@macome.co.jp Reviewed by: markj, Franco Fichtner Tested by: t_uemura@macome.co.jp MFC after: 1 day (cherry picked from commit 450c3f8b3d259c7eb82488319aff45f1f6554aaf) --- sys/dev/e1000/if_em.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index c2c172f7ef2f..b7c241cddfc7 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1497,7 +1497,6 @@ em_msix_link(void *arg) { struct e1000_softc *sc = arg; u32 reg_icr; - bool notlink = false; ++sc->link_irq; MPASS(sc->hw.back != NULL); @@ -1508,17 +1507,14 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) em_handle_link(sc->ctx); - else - notlink = true; - /* Re-arm for other/spurious interrupts */ - if (notlink && sc->hw.mac.type >= igb_mac_min) { + /* Re-arm unconditionally */ + if (sc->hw.mac.type >= igb_mac_min) { E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); E1000_WRITE_REG(&sc->hw, E1000_EIMS, sc->link_mask); } else if (sc->hw.mac.type == e1000_82574) { - if (notlink) - E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC | - E1000_IMS_OTHER); + E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC | + E1000_IMS_OTHER); /* * Because we must read the ICR for this interrupt it may * clear other causes using autoclear, for this reason we @@ -1526,7 +1522,8 @@ em_msix_link(void *arg) */ if (reg_icr) E1000_WRITE_REG(&sc->hw, E1000_ICS, sc->ims); - } + } else + E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); return (FILTER_HANDLED); } @@ -1862,13 +1859,6 @@ em_if_update_admin_status(if_ctx_t ctx) if (hw->mac.type < em_mac_min) lem_smartspeed(sc); - else if (hw->mac.type >= igb_mac_min && - sc->intr_type == IFLIB_INTR_MSIX) { - E1000_WRITE_REG(&sc->hw, E1000_IMS, E1000_IMS_LSC); - E1000_WRITE_REG(&sc->hw, E1000_EIMS, sc->link_mask); - } else if (hw->mac.type == e1000_82574 && - sc->intr_type == IFLIB_INTR_MSIX) - E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_LSC | E1000_IMS_OTHER); } static void From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:30:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABEDD6A8A58; Tue, 28 Sep 2021 17:30: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 4HJmjf3gBjz4TRm; Tue, 28 Sep 2021 17:30:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D2B493E; Tue, 28 Sep 2021 17:30: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 18SHUE8B080946; Tue, 28 Sep 2021 17:30:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHUE9I080943; Tue, 28 Sep 2021 17:30:14 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:30:14 GMT Message-Id: <202109281730.18SHUE9I080943@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: 54b159f9c34a - stable/12 - e1000: Fix tabstop width in if_em.h 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: 54b159f9c34adbd82f61c38fae82e11e8cfaae43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:30:14 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=54b159f9c34adbd82f61c38fae82e11e8cfaae43 commit 54b159f9c34adbd82f61c38fae82e11e8cfaae43 Author: Kevin Bowling AuthorDate: 2021-09-26 16:24:53 +0000 Commit: Kevin Bowling CommitDate: 2021-09-28 17:28:28 +0000 e1000: Fix tabstop width in if_em.h Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D32145 (cherry picked from commit 21ab8c75c940dd15343b4af28b18a66f377e670a) --- sys/dev/e1000/if_em.h | 234 +++++++++++++++++++++++++------------------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 35be510320b3..48802163a673 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -111,11 +111,11 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define EM_MIN_TXD 128 -#define EM_MAX_TXD 4096 -#define EM_DEFAULT_TXD 1024 +#define EM_MIN_TXD 128 +#define EM_MAX_TXD 4096 +#define EM_DEFAULT_TXD 1024 #define EM_DEFAULT_MULTI_TXD 4096 -#define IGB_MAX_TXD 4096 +#define IGB_MAX_TXD 4096 /* * EM_MAX_RXD - Maximum number of receive Descriptors @@ -130,11 +130,11 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define EM_MIN_RXD 128 -#define EM_MAX_RXD 4096 -#define EM_DEFAULT_RXD 1024 +#define EM_MIN_RXD 128 +#define EM_MAX_RXD 4096 +#define EM_DEFAULT_RXD 1024 #define EM_DEFAULT_MULTI_RXD 4096 -#define IGB_MAX_RXD 4096 +#define IGB_MAX_RXD 4096 /* * EM_TIDV - Transmit Interrupt Delay Value @@ -201,7 +201,7 @@ * 0 - Disable autonegotiation * 1 - Enable autonegotiation */ -#define DO_AUTO_NEG 1 +#define DO_AUTO_NEG 1 /* * This parameter control whether or not the driver will wait for @@ -214,8 +214,8 @@ /* Tunables -- End */ #define AUTONEG_ADV_DEFAULT (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \ - ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ - ADVERTISE_1000_FULL) + ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ + ADVERTISE_1000_FULL) #define AUTO_ALL_MODES 0 @@ -225,35 +225,35 @@ /* * Miscellaneous constants */ -#define EM_VENDOR_ID 0x8086 -#define EM_FLASH 0x0014 +#define EM_VENDOR_ID 0x8086 +#define EM_FLASH 0x0014 -#define EM_JUMBO_PBA 0x00000028 -#define EM_DEFAULT_PBA 0x00000030 +#define EM_JUMBO_PBA 0x00000028 +#define EM_DEFAULT_PBA 0x00000030 #define EM_SMARTSPEED_DOWNSHIFT 3 -#define EM_SMARTSPEED_MAX 15 -#define EM_MAX_LOOP 10 +#define EM_SMARTSPEED_MAX 15 +#define EM_MAX_LOOP 10 #define MAX_NUM_MULTICAST_ADDRESSES 128 -#define PCI_ANY_ID (~0U) -#define ETHER_ALIGN 2 -#define EM_FC_PAUSE_TIME 0x0680 -#define EM_EEPROM_APME 0x400; -#define EM_82544_APME 0x0004; +#define PCI_ANY_ID (~0U) +#define ETHER_ALIGN 2 +#define EM_FC_PAUSE_TIME 0x0680 +#define EM_EEPROM_APME 0x400; +#define EM_82544_APME 0x0004; /* Support AutoMediaDetect for Marvell M88 PHY in i354 */ -#define IGB_MEDIA_RESET (1 << 0) +#define IGB_MEDIA_RESET (1 << 0) /* Define the starting Interrupt rate per Queue */ -#define IGB_INTS_PER_SEC 8000 -#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) +#define IGB_INTS_PER_SEC 8000 +#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) -#define IGB_LINK_ITR 2000 -#define I210_LINK_DELAY 1000 +#define IGB_LINK_ITR 2000 +#define I210_LINK_DELAY 1000 -#define IGB_TXPBSIZE 20408 -#define IGB_HDR_BUF 128 -#define IGB_PKTTYPE_MASK 0x0000FFF0 +#define IGB_TXPBSIZE 20408 +#define IGB_HDR_BUF 128 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coalesce Flush */ /* @@ -265,25 +265,25 @@ * and compare to TX_MAXTRIES. When counter > TX_MAXTRIES, * reset adapter. */ -#define EM_TX_IDLE 0x00000000 -#define EM_TX_BUSY 0x00000001 -#define EM_TX_HUNG 0x80000000 +#define EM_TX_IDLE 0x00000000 +#define EM_TX_BUSY 0x00000001 +#define EM_TX_HUNG 0x80000000 #define EM_TX_MAXTRIES 10 -#define PCICFG_DESC_RING_STATUS 0xe4 -#define FLUSH_DESC_REQUIRED 0x100 +#define PCICFG_DESC_RING_STATUS 0xe4 +#define FLUSH_DESC_REQUIRED 0x100 -#define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ - ((hw->mac.type <= e1000_82576) ? 16 : 8)) -#define IGB_RX_HTHRESH 8 -#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ - (sc->intr_type == IFLIB_INTR_MSIX)) ? 1 : 4) +#define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ + ((hw->mac.type <= e1000_82576) ? 16 : 8)) +#define IGB_RX_HTHRESH 8 +#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ + (sc->intr_type == IFLIB_INTR_MSIX)) ? 1 : 4) -#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) -#define IGB_TX_HTHRESH 1 -#define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \ - sc->intr_type == IFLIB_INTR_MSIX) ? 1 : 16) +#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) +#define IGB_TX_HTHRESH 1 +#define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \ + sc->intr_type == IFLIB_INTR_MSIX) ? 1 : 16) /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be @@ -297,10 +297,10 @@ */ #define TARC_COMPENSATION_MODE (1 << 7) /* Compensation Mode */ #define TARC_SPEED_MODE_BIT (1 << 21) /* On PCI-E MACs only */ -#define TARC_MQ_FIX (1 << 23) | \ - (1 << 24) | \ - (1 << 25) /* Handle errata in MQ mode */ -#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */ +#define TARC_MQ_FIX (1 << 23) | \ + (1 << 24) | \ + (1 << 25) /* Handle errata in MQ mode */ +#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */ /* PCI Config defines */ #define EM_BAR_TYPE(v) ((v) & EM_BAR_TYPE_MASK) @@ -319,28 +319,28 @@ #define DEBUG_IOCTL 0 #define DEBUG_HW 0 -#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") +#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") #define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) #define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) -#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") +#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") #define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) #define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) -#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") -#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) +#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") +#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) #define EM_MAX_SCATTER 40 #define EM_VFTA_SIZE 128 -#define EM_TSO_SIZE 65535 +#define EM_TSO_SIZE 65535 #define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */ #define ETH_ZLEN 60 #define ETH_ADDR_LEN 6 #define EM_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* Offload bits in mbuf flag */ #define IGB_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | \ - CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ - CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ + CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ + CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ -#define IGB_PKTTYPE_MASK 0x0000FFF0 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coalesce Flush */ /* @@ -363,15 +363,15 @@ struct e1000_softc; struct em_int_delay_info { struct e1000_softc *sc; /* Back-pointer to the sc struct */ - int offset; /* Register offset to read/write */ - int value; /* Current value in usecs */ + int offset; /* Register offset to read/write */ + int value; /* Current value in usecs */ }; /* * The transmit ring, one per tx queue */ struct tx_ring { - struct e1000_softc *sc; + struct e1000_softc *sc; struct e1000_tx_desc *tx_base; uint64_t tx_paddr; qidx_t *tx_rsq; @@ -382,8 +382,8 @@ struct tx_ring { qidx_t tx_cidx_processed; /* Interrupt resources */ void *tag; - struct resource *res; - unsigned long tx_irq; + struct resource *res; + unsigned long tx_irq; /* Saved csum offloading context information */ int csum_flags; @@ -404,10 +404,10 @@ struct tx_ring { struct rx_ring { struct e1000_softc *sc; struct em_rx_queue *que; - u32 me; - u32 payload; + u32 me; + u32 payload; union e1000_rx_desc_extended *rx_base; - uint64_t rx_paddr; + uint64_t rx_paddr; /* Interrupt resources */ void *tag; @@ -423,36 +423,36 @@ struct rx_ring { struct em_tx_queue { struct e1000_softc *sc; - u32 msix; - u32 eims; /* This queue's EIMS bit */ - u32 me; + u32 msix; + u32 eims; /* This queue's EIMS bit */ + u32 me; struct tx_ring txr; }; struct em_rx_queue { struct e1000_softc *sc; - u32 me; - u32 msix; - u32 eims; + u32 me; + u32 msix; + u32 eims; struct rx_ring rxr; - u64 irqs; + u64 irqs; struct if_irq que_irq; }; /* Our softc structure */ struct e1000_softc { - struct ifnet *ifp; - struct e1000_hw hw; + struct ifnet *ifp; + struct e1000_hw hw; - if_softc_ctx_t shared; - if_ctx_t ctx; -#define tx_num_queues shared->isc_ntxqsets -#define rx_num_queues shared->isc_nrxqsets + if_softc_ctx_t shared; + if_ctx_t ctx; +#define tx_num_queues shared->isc_ntxqsets +#define rx_num_queues shared->isc_nrxqsets #define intr_type shared->isc_intr /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; - device_t dev; - struct cdev *led_dev; + device_t dev; + struct cdev *led_dev; struct em_tx_queue *tx_queues; struct em_rx_queue *rx_queues; @@ -463,35 +463,35 @@ struct e1000_softc { struct resource *ioport; struct resource *res; - void *tag; - u32 linkvec; - u32 ivars; - - struct ifmedia *media; - int msix; - int if_flags; - int em_insert_vlan_header; - u32 ims; + void *tag; + u32 linkvec; + u32 ivars; + + struct ifmedia *media; + int msix; + int if_flags; + int em_insert_vlan_header; + u32 ims; bool in_detach; - u32 flags; + u32 flags; /* Task for FAST handling */ struct grouptask link_task; - u16 num_vlans; - u32 txd_cmd; + u16 num_vlans; + u32 txd_cmd; - u32 tx_process_limit; - u32 rx_process_limit; - u32 rx_mbuf_sz; + u32 tx_process_limit; + u32 rx_process_limit; + u32 rx_mbuf_sz; /* Management and WOL features */ - u32 wol; - bool has_manage; - bool has_amt; + u32 wol; + bool has_manage; + bool has_amt; /* Multicast array memory */ - u8 *mta; + u8 *mta; /* ** Shadow VFTA table, this is needed because @@ -499,18 +499,18 @@ struct e1000_softc { ** a soft reset and the driver needs to be able ** to repopulate it. */ - u32 shadow_vfta[EM_VFTA_SIZE]; + u32 shadow_vfta[EM_VFTA_SIZE]; /* Info about the interface */ - u16 link_active; - u16 fc; - u16 link_speed; - u16 link_duplex; - u32 smartspeed; - u32 dmac; - int link_mask; + u16 link_active; + u16 fc; + u16 link_speed; + u16 link_duplex; + u32 smartspeed; + u32 dmac; + int link_mask; - u64 que_mask; + u64 que_mask; struct em_int_delay_info tx_int_delay; struct em_int_delay_info tx_abs_int_delay; @@ -519,13 +519,13 @@ struct e1000_softc { struct em_int_delay_info tx_itr; /* Misc stats maintained by the driver */ - unsigned long dropped_pkts; - unsigned long link_irq; - unsigned long rx_overruns; - unsigned long watchdog_events; + unsigned long dropped_pkts; + unsigned long link_irq; + unsigned long rx_overruns; + unsigned long watchdog_events; - struct e1000_hw_stats stats; - u16 vf_ifp; + struct e1000_hw_stats stats; + u16 vf_ifp; }; /******************************************************************************** @@ -546,8 +546,8 @@ typedef struct _em_vendor_info_t { void em_dump_rs(struct e1000_softc *); #define EM_RSSRK_SIZE 4 -#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ - key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ - key[(i) * EM_RSSRK_SIZE + 2] << 16 | \ - key[(i) * EM_RSSRK_SIZE + 3] << 24) +#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ + key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ + key[(i) * EM_RSSRK_SIZE + 2] << 16 | \ + key[(i) * EM_RSSRK_SIZE + 3] << 24) #endif /* _EM_H_DEFINED_ */ From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:52:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA9916A96C6; Tue, 28 Sep 2021 17:52: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 4HJnCt5Gfmz4X47; Tue, 28 Sep 2021 17:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94BC3A78; Tue, 28 Sep 2021 17:52: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 18SHqwTd015566; Tue, 28 Sep 2021 17:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHqwY0015565; Tue, 28 Sep 2021 17:52:58 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:52:58 GMT Message-Id: <202109281752.18SHqwY0015565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ian Lepore Subject: git: ea5c0b7b140b - main - Add the clock for the imx8 thermal monitoring unit. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea5c0b7b140b745f8a34c313dc21432d9aaed574 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:52:58 -0000 The branch main has been updated by ian: URL: https://cgit.FreeBSD.org/src/commit/?id=ea5c0b7b140b745f8a34c313dc21432d9aaed574 commit ea5c0b7b140b745f8a34c313dc21432d9aaed574 Author: Ian Lepore AuthorDate: 2021-09-28 17:51:57 +0000 Commit: Ian Lepore CommitDate: 2021-09-28 17:51:57 +0000 Add the clock for the imx8 thermal monitoring unit. --- sys/arm64/freescale/imx/imx8mq_ccm.c | 2 ++ sys/arm64/freescale/imx/imx8mq_ccm.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sys/arm64/freescale/imx/imx8mq_ccm.c b/sys/arm64/freescale/imx/imx8mq_ccm.c index 5c9751791415..9a0c8f318e39 100644 --- a/sys/arm64/freescale/imx/imx8mq_ccm.c +++ b/sys/arm64/freescale/imx/imx8mq_ccm.c @@ -233,6 +233,8 @@ static struct imx_clk imx_clks[] = { ROOT_GATE(IMX8MQ_CLK_USDHC1_ROOT, "usdhc1_root_clk", "usdhc1", 0x4510), ROOT_GATE(IMX8MQ_CLK_USDHC2_ROOT, "usdhc2_root_clk", "usdhc2", 0x4520), + ROOT_GATE(IMX8MQ_CLK_TMU_ROOT, "tmu_root_clk", "ipg_root", 0x4620), + COMPOSITE(IMX8MQ_CLK_ENET_AXI, "enet_axi", enet_axi_p, 0x8800, 0), COMPOSITE(IMX8MQ_CLK_ENET_REF, "enet_ref", enet_ref_p, 0xa980, 0), COMPOSITE(IMX8MQ_CLK_ENET_TIMER, "enet_timer", enet_timer_p, 0xaa00, 0), diff --git a/sys/arm64/freescale/imx/imx8mq_ccm.h b/sys/arm64/freescale/imx/imx8mq_ccm.h index dcd016fc729f..762090c6b3b8 100644 --- a/sys/arm64/freescale/imx/imx8mq_ccm.h +++ b/sys/arm64/freescale/imx/imx8mq_ccm.h @@ -143,6 +143,8 @@ #define IMX8MQ_CLK_IPG_ROOT 236 +#define IMX8MQ_CLK_TMU_ROOT 246 + #define IMX8MQ_CLK_GPIO1_ROOT 259 #define IMX8MQ_CLK_GPIO2_ROOT 260 #define IMX8MQ_CLK_GPIO3_ROOT 261 From owner-dev-commits-src-all@freebsd.org Tue Sep 28 17:58:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38EDB6A92F8; Tue, 28 Sep 2021 17:58: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 4HJnL70QbTz4Xfb; Tue, 28 Sep 2021 17:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1DA1A79; Tue, 28 Sep 2021 17:58:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18SHwMQa016189; Tue, 28 Sep 2021 17:58:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SHwMPT016188; Tue, 28 Sep 2021 17:58:22 GMT (envelope-from git) Date: Tue, 28 Sep 2021 17:58:22 GMT Message-Id: <202109281758.18SHwMPT016188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 8b889b895382 - main - mgb: Do not KASSERT on error in mgb_init MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b889b8953828fe22e5de68647a35610dd87ff8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 17:58:23 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8b889b8953828fe22e5de68647a35610dd87ff8f commit 8b889b8953828fe22e5de68647a35610dd87ff8f Author: Ed Maste AuthorDate: 2021-09-28 17:48:49 +0000 Commit: Ed Maste CommitDate: 2021-09-28 17:57:36 +0000 mgb: Do not KASSERT on error in mgb_init There's not much we can do if mii_mediachg() fails, but KASSERT is not appropriate. MFC after: 1 week Fixes: 8890ab7758b8 ("Introduce if_mgb driver...") Sponsored by: The FreeBSD Foundation --- sys/dev/mgb/if_mgb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index 472de84c13b1..de4f78e0fd57 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -615,7 +615,10 @@ mgb_init(if_ctx_t ctx) MGB_RFE_ALLOW_UNICAST); error = mii_mediachg(miid); - KASSERT(!error, ("mii_mediachg returned: %d", error)); + /* Not much we can do if this fails. */ + if (error) + device_printf(sc->dev, "%s: mii_mediachg returned %d", __func__, + error); } #ifdef DEBUG From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:00:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF25D6A96DF for ; Tue, 28 Sep 2021 18:00:43 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJnNp5Fr8z4Y0D for ; Tue, 28 Sep 2021 18:00:42 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f45.google.com with SMTP id k7so7620249wrd.13 for ; Tue, 28 Sep 2021 11:00:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HIO+OZgAAJI9Ryrzp/WPMvtKYBIz4HIEJXrrOfxID9U=; b=qcCIxtABmCQaS6Sj020nZJyPCcV1LgBW3hwHKGIUoODpSkQTZ5nY74LhdpXtOufK+h VBUK3yuG7cw5NPtB81XaJ5rUzO3bB2iBajXNnrHhVsONMUYg0wU7cffCN13OZQ+WyM6k BLbDzptPmIlCCY4+4t33q6XAnjPgyZ2aghJ7UdEpyBCo9O0TBWPBjma2TYBsLcHOihlf IedBWJKQ8HWc6mjuwTa83ajsiwx7EK8ebFF0HuA2OCONFnYMyN4pcywqrBSPx5Ow10S8 KnvefLSYUjkFwzF4oDOlbt5YZbax2sLCqGw2loguyknsKsnL6m/VlIMm6EHz4qtClY3i N6tA== X-Gm-Message-State: AOAM530n84uK/qQnFL8MbZ0UPSjVuyR0NZ8EJBRKs9LkeP6u2s+XL8u+ fq8n5GR7793HKeMxAuZX5ycMaA== X-Google-Smtp-Source: ABdhPJxXALFZcwj/YtZw3ES9/Qcy46+STBuw5SqvNk2hHQvB6vU6A9wj7zIRe+m02KhFtQ0UYGGgPQ== X-Received: by 2002:adf:b60d:: with SMTP id f13mr1665843wre.239.1632852036305; Tue, 28 Sep 2021 11:00:36 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id o1sm3740722wmq.26.2021.09.28.11.00.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Sep 2021 11:00:35 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 8a8166e5bcfb - main - mmc: switch mmc_helper to device_ api From: Jessica Clarke In-Reply-To: <202109201518.18KFIKnL007451@gitrepo.freebsd.org> Date: Tue, 28 Sep 2021 19:00:34 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <6D76D431-43A6-4729-90A5-D19EDE05E998@freebsd.org> References: <202109201518.18KFIKnL007451@gitrepo.freebsd.org> To: Marcin Wojtas X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HJnNp5Fr8z4Y0D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.50 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.45:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.45:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:00:43 -0000 On 20 Sep 2021, at 16:18, Marcin Wojtas wrote: >=20 > The branch main has been updated by mw: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D8a8166e5bcfb50e2b7280581b600d098= fa6c9fc7 >=20 > commit 8a8166e5bcfb50e2b7280581b600d098fa6c9fc7 > Author: Bartlomiej Grzesik > AuthorDate: 2021-08-02 14:27:23 +0000 > Commit: Marcin Wojtas > CommitDate: 2021-09-20 15:18:02 +0000 >=20 > mmc: switch mmc_helper to device_ api >=20 > Add generic mmc_helper which uses newly introduced = device_*_property > api. Thanks to this change the sd/mmc drivers will be capable > of parsing both DT and ACPI description. >=20 > Ensure backward compatibility for all mmc_fdt_helper users. >=20 > Reviewed by: manu, mw > Sponsored by: Semihalf > Differential revision: https://reviews.freebsd.org/D31598 > --- > sys/arm/allwinner/aw_mmc.c | 2 +- > sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 2 +- > sys/conf/files | 1 + > sys/dev/mmc/host/dwmmc_var.h | 2 +- > sys/dev/mmc/mmc_fdt_helpers.c | 116 = ++++---------------------- > sys/dev/mmc/mmc_fdt_helpers.h | 42 ++-------- > sys/dev/mmc/mmc_helpers.c | 134 = +++++++++++++++++++++++++++++++ > sys/dev/mmc/mmc_helpers.h | 70 ++++++++++++++++ > sys/dev/sdhci/sdhci_fsl_fdt.c | 2 +- > sys/dev/sdhci/sdhci_xenon.c | 2 +- > 10 files changed, 234 insertions(+), 139 deletions(-) >=20 > diff --git a/sys/arm/allwinner/aw_mmc.c b/sys/arm/allwinner/aw_mmc.c > index 9f215399e62b..3271090f19e3 100644 > --- a/sys/arm/allwinner/aw_mmc.c > +++ b/sys/arm/allwinner/aw_mmc.c > @@ -130,7 +130,7 @@ struct aw_mmc_softc { > int aw_timeout; > struct callout aw_timeoutc; > struct mmc_host aw_host; > - struct mmc_fdt_helper mmc_helper; > + struct mmc_helper mmc_helper; > #ifdef MMCCAM > union ccb * ccb; > struct mmc_sim mmc_sim; > diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c = b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c > index cd9b60743be3..38617dcd38eb 100644 > --- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c > +++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c > @@ -156,7 +156,7 @@ struct bcm_sdhci_softc { > void * sc_intrhand; > struct mmc_request * sc_req; > struct sdhci_slot sc_slot; > - struct mmc_fdt_helper sc_mmc_helper; > + struct mmc_helper sc_mmc_helper; > int sc_dma_ch; > bus_dma_tag_t sc_dma_tag; > bus_dmamap_t sc_dma_map; > diff --git a/sys/conf/files b/sys/conf/files > index bf1c680093d1..1d3a36ac6bc7 100644 > --- a/sys/conf/files > +++ b/sys/conf/files > @@ -2483,6 +2483,7 @@ dev/mmc/mmcbr_if.m standard > dev/mmc/mmcbus_if.m standard > dev/mmc/mmcsd.c optional mmcsd !mmccam > dev/mmc/mmc_fdt_helpers.c optional ext_resources mmc fdt | = ext_resources mmccam fdt > +dev/mmc/mmc_helpers.c optional ext_resources mmc | = ext_resources mmccam > dev/mmc/mmc_pwrseq.c optional ext_resources mmc fdt | = ext_resources mmccam fdt > dev/mmc/mmc_pwrseq_if.m optional ext_resources mmc fdt | = ext_resources mmccam fdt > dev/mmcnull/mmcnull.c optional mmcnull > diff --git a/sys/dev/mmc/host/dwmmc_var.h = b/sys/dev/mmc/host/dwmmc_var.h > index ef7c91fa628e..a3f20278ad2a 100644 > --- a/sys/dev/mmc/host/dwmmc_var.h > +++ b/sys/dev/mmc/host/dwmmc_var.h > @@ -56,7 +56,7 @@ struct dwmmc_softc { > device_t dev; > void *intr_cookie; > struct mmc_host host; > - struct mmc_fdt_helper mmc_helper; > + struct mmc_helper mmc_helper; > struct mtx sc_mtx; > #ifdef MMCCAM > union ccb * ccb; > diff --git a/sys/dev/mmc/mmc_fdt_helpers.c = b/sys/dev/mmc/mmc_fdt_helpers.c > index 291a4bc72ff2..249a430311fa 100644 > --- a/sys/dev/mmc/mmc_fdt_helpers.c > +++ b/sys/dev/mmc/mmc_fdt_helpers.c > @@ -45,105 +45,21 @@ __FBSDID("$FreeBSD$"); > #include > #endif >=20 > -#include "mmc_pwrseq_if.h" > - > -static inline void > -mmc_fdt_parse_sd_speed(phandle_t node, struct mmc_host *host) > -{ > - bool no_18v =3D false; > - > - /*=20 > - * Parse SD supported modes=20 > - * All UHS-I modes requires 1.8V signaling. > - */ > - if (OF_hasprop(node, "no-1-8-v")) > - no_18v =3D true; > - if (OF_hasprop(node, "cap-sd-highspeed")) > - host->caps |=3D MMC_CAP_HSPEED; > - if (OF_hasprop(node, "sd-uhs-sdr12") && no_18v =3D=3D false) > - host->caps |=3D MMC_CAP_UHS_SDR12 | = MMC_CAP_SIGNALING_180; > - if (OF_hasprop(node, "sd-uhs-sdr25") && no_18v =3D=3D false) > - host->caps |=3D MMC_CAP_UHS_SDR25 | = MMC_CAP_SIGNALING_180; > - if (OF_hasprop(node, "sd-uhs-sdr50") && no_18v =3D=3D false) > - host->caps |=3D MMC_CAP_UHS_SDR50 | = MMC_CAP_SIGNALING_180; > - if (OF_hasprop(node, "sd-uhs-sdr104") && no_18v =3D=3D false) > - host->caps |=3D MMC_CAP_UHS_SDR104 | = MMC_CAP_SIGNALING_180; > - if (OF_hasprop(node, "sd-uhs-ddr50") && no_18v =3D=3D false) > - host->caps |=3D MMC_CAP_UHS_DDR50 | = MMC_CAP_SIGNALING_180; > -} > +#include >=20 > -static inline void > -mmc_fdt_parse_mmc_speed(phandle_t node, struct mmc_host *host) > -{ > - > - /* Parse eMMC supported modes */ > - if (OF_hasprop(node, "cap-mmc-highspeed")) > - host->caps |=3D MMC_CAP_HSPEED; > - if (OF_hasprop(node, "mmc-ddr-1_2v")) > - host->caps |=3D MMC_CAP_MMC_DDR52_120 | = MMC_CAP_SIGNALING_120; > - if (OF_hasprop(node, "mmc-ddr-1_8v")) > - host->caps |=3D MMC_CAP_MMC_DDR52_180 | = MMC_CAP_SIGNALING_180; > - if (OF_hasprop(node, "mmc-ddr-3_3v")) > - host->caps |=3D MMC_CAP_SIGNALING_330; > - if (OF_hasprop(node, "mmc-hs200-1_2v")) > - host->caps |=3D MMC_CAP_MMC_HS200_120 | = MMC_CAP_SIGNALING_120; > - if (OF_hasprop(node, "mmc-hs200-1_8v")) > - host->caps |=3D MMC_CAP_MMC_HS200_180 | = MMC_CAP_SIGNALING_180; > - if (OF_hasprop(node, "mmc-hs400-1_2v")) > - host->caps |=3D MMC_CAP_MMC_HS400_120 | = MMC_CAP_SIGNALING_120; > - if (OF_hasprop(node, "mmc-hs400-1_8v")) > - host->caps |=3D MMC_CAP_MMC_HS400_180 | = MMC_CAP_SIGNALING_180; > - if (OF_hasprop(node, "mmc-hs400-enhanced-strobe")) > - host->caps |=3D MMC_CAP_MMC_ENH_STROBE; > -} > +#include "mmc_pwrseq_if.h" >=20 > int > -mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper = *helper, > +mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_helper = *helper, > struct mmc_host *host) > { > - uint32_t bus_width; > + struct mmc_helper mmc_helper; > phandle_t pwrseq_xref; >=20 > - if (node <=3D 0) > - node =3D ofw_bus_get_node(dev); > - if (node <=3D 0) > - return (ENXIO); > - > - if (OF_getencprop(node, "bus-width", &bus_width, = sizeof(uint32_t)) <=3D 0) > - bus_width =3D 1; > - > - if (bus_width >=3D 4) > - host->caps |=3D MMC_CAP_4_BIT_DATA; > - if (bus_width >=3D 8) > - host->caps |=3D MMC_CAP_8_BIT_DATA; > + memset(&mmc_helper, 0, sizeof(mmc_helper)); > + mmc_parse(dev, &mmc_helper, host); >=20 > - /*=20 > - * max-frequency is optional, drivers should tweak this value > - * if it's not present based on the clock that the mmc = controller > - * operates on > - */ > - OF_getencprop(node, "max-frequency", &host->f_max, = sizeof(uint32_t)); > - > - if (OF_hasprop(node, "broken-cd")) > - helper->props |=3D MMC_PROP_BROKEN_CD; > - if (OF_hasprop(node, "non-removable")) > - helper->props |=3D MMC_PROP_NON_REMOVABLE; > - if (OF_hasprop(node, "wp-inverted")) > - helper->props |=3D MMC_PROP_WP_INVERTED; > - if (OF_hasprop(node, "cd-inverted")) > - helper->props |=3D MMC_PROP_CD_INVERTED; > - if (OF_hasprop(node, "no-sdio")) > - helper->props |=3D MMC_PROP_NO_SDIO; > - if (OF_hasprop(node, "no-sd")) > - helper->props |=3D MMC_PROP_NO_SD; > - if (OF_hasprop(node, "no-mmc")) > - helper->props |=3D MMC_PROP_NO_MMC; > - > - if (!(helper->props & MMC_PROP_NO_SD)) > - mmc_fdt_parse_sd_speed(node, host); > - > - if (!(helper->props & MMC_PROP_NO_MMC)) > - mmc_fdt_parse_mmc_speed(node, host); > + helper->props =3D mmc_helper.props; >=20 > #ifdef EXT_RESOURCES > /* > @@ -200,7 +116,7 @@ mmc_fdt_parse(device_t dev, phandle_t node, struct = mmc_fdt_helper *helper, > static void > cd_intr(void *arg) > { > - struct mmc_fdt_helper *helper =3D arg; > + struct mmc_helper *helper =3D arg; >=20 > taskqueue_enqueue_timeout(taskqueue_swi_giant, > &helper->cd_delayed_task, -(hz / 2)); > @@ -209,7 +125,7 @@ cd_intr(void *arg) > static void > cd_card_task(void *arg, int pending __unused) > { > - struct mmc_fdt_helper *helper =3D arg; > + struct mmc_helper *helper =3D arg; > bool cd_present; >=20 > cd_present =3D mmc_fdt_gpio_get_present(helper); > @@ -228,7 +144,7 @@ cd_card_task(void *arg, int pending __unused) > * Card detect setup. > */ > static void > -cd_setup(struct mmc_fdt_helper *helper, phandle_t node) > +cd_setup(struct mmc_helper *helper, phandle_t node) > { > int pincaps; > device_t dev; > @@ -330,7 +246,7 @@ without_interrupts: > * Write protect setup. > */ > static void > -wp_setup(struct mmc_fdt_helper *helper, phandle_t node) > +wp_setup(struct mmc_helper *helper, phandle_t node) > { > device_t dev; >=20 > @@ -352,7 +268,7 @@ wp_setup(struct mmc_fdt_helper *helper, phandle_t = node) > } >=20 > int > -mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct = mmc_fdt_helper *helper, > +mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_helper = *helper, > mmc_fdt_cd_handler handler) > { >=20 > @@ -377,7 +293,7 @@ mmc_fdt_gpio_setup(device_t dev, phandle_t node, = struct mmc_fdt_helper *helper, > } >=20 > void > -mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper) > +mmc_fdt_gpio_teardown(struct mmc_helper *helper) > { >=20 > if (helper =3D=3D NULL) > @@ -396,7 +312,7 @@ mmc_fdt_gpio_teardown(struct mmc_fdt_helper = *helper) > } >=20 > bool > -mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper) > +mmc_fdt_gpio_get_present(struct mmc_helper *helper) > { > bool pinstate; >=20 > @@ -411,7 +327,7 @@ mmc_fdt_gpio_get_present(struct mmc_fdt_helper = *helper) > } >=20 > bool > -mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper) > +mmc_fdt_gpio_get_readonly(struct mmc_helper *helper) > { > bool pinstate; >=20 > @@ -427,7 +343,7 @@ mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper = *helper) > } >=20 > void > -mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode = power_mode) > +mmc_fdt_set_power(struct mmc_helper *helper, enum mmc_power_mode = power_mode) > { > int reg_status; > int rv; > diff --git a/sys/dev/mmc/mmc_fdt_helpers.h = b/sys/dev/mmc/mmc_fdt_helpers.h > index e6d6f3fbfd84..f07ca1684440 100644 > --- a/sys/dev/mmc/mmc_fdt_helpers.h > +++ b/sys/dev/mmc/mmc_fdt_helpers.h > @@ -37,43 +37,17 @@ > #include > #endif >=20 > -struct mmc_fdt_helper { > - device_t dev; > - gpio_pin_t wp_pin; > - gpio_pin_t cd_pin; > - void * cd_ihandler; > - struct resource * cd_ires; > - int cd_irid; > - void (*cd_handler)(device_t, bool); > - struct timeout_task cd_delayed_task; > - bool cd_disabled; > - bool wp_disabled; > - bool cd_present; > - uint32_t props; > -#define MMC_PROP_BROKEN_CD (1 << 0) > -#define MMC_PROP_NON_REMOVABLE (1 << 1) > -#define MMC_PROP_WP_INVERTED (1 << 2) > -#define MMC_PROP_CD_INVERTED (1 << 3) > -#define MMC_PROP_DISABLE_WP (1 << 4) > -#define MMC_PROP_NO_SDIO (1 << 5) > -#define MMC_PROP_NO_SD (1 << 6) > -#define MMC_PROP_NO_MMC (1 << 7) > +#include >=20 > -#ifdef EXT_RESOURCES > - regulator_t vmmc_supply; > - regulator_t vqmmc_supply; > -#endif > - > - device_t mmc_pwrseq; > -}; > +#define mmc_fdt_helper mmc_helper /* For backwards compatibility */ >=20 > typedef void (*mmc_fdt_cd_handler)(device_t dev, bool present); >=20 > -int mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper = *helper, struct mmc_host *host); > -int mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct = mmc_fdt_helper *helper, mmc_fdt_cd_handler handler); > -void mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper); > -bool mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper); > -bool mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper); > -void mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum = mmc_power_mode power_mode); > +int mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_helper = *helper, struct mmc_host *host); > +int mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct = mmc_helper *helper, mmc_fdt_cd_handler handler); > +void mmc_fdt_gpio_teardown(struct mmc_helper *helper); > +bool mmc_fdt_gpio_get_present(struct mmc_helper *helper); > +bool mmc_fdt_gpio_get_readonly(struct mmc_helper *helper); > +void mmc_fdt_set_power(struct mmc_helper *helper, enum mmc_power_mode = power_mode); >=20 > #endif > diff --git a/sys/dev/mmc/mmc_helpers.c b/sys/dev/mmc/mmc_helpers.c > new file mode 100644 > index 000000000000..0e1e16666367 > --- /dev/null > +++ b/sys/dev/mmc/mmc_helpers.c > @@ -0,0 +1,134 @@ > +/* > + * Copyright 2019 Emmanuel Vadot > + * Copyright (c) 2017 Ian Lepore All rights = reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions = are > + * met: > + * > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above = copyright > + * notice, this list of conditions and the following disclaimer = in the > + * documentation and/or other materials provided with the = distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' = AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, = THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR = CONTRIBUTORS BE > + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, = OR > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT = OF > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR > + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF = LIABILITY, > + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING = NEGLIGENCE OR > + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, = EVEN IF > + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +static inline void > +mmc_parse_sd_speed(device_t dev, struct mmc_host *host) > +{ > + bool no_18v =3D false; > + > + /* > + * Parse SD supported modes > + * All UHS-I modes requires 1.8V signaling. > + */ > + if (device_has_property(dev, "no-1-8-v")) > + no_18v =3D true; > + if (device_has_property(dev, "cap-sd-highspeed")) > + host->caps |=3D MMC_CAP_HSPEED; > + if (device_has_property(dev, "sd-uhs-sdr12") && !no_18v) > + host->caps |=3D MMC_CAP_UHS_SDR12 | = MMC_CAP_SIGNALING_180; > + if (device_has_property(dev, "sd-uhs-sdr25") && !no_18v) > + host->caps |=3D MMC_CAP_UHS_SDR25 | = MMC_CAP_SIGNALING_180; > + if (device_has_property(dev, "sd-uhs-sdr50") && !no_18v) > + host->caps |=3D MMC_CAP_UHS_SDR50 | = MMC_CAP_SIGNALING_180; > + if (device_has_property(dev, "sd-uhs-sdr104") && !no_18v) > + host->caps |=3D MMC_CAP_UHS_SDR104 | = MMC_CAP_SIGNALING_180; > + if (device_has_property(dev, "sd-uhs-ddr50") && !no_18v) > + host->caps |=3D MMC_CAP_UHS_DDR50 | = MMC_CAP_SIGNALING_180; > +} > + > +static inline void > +mmc_parse_mmc_speed(device_t dev, struct mmc_host *host) > +{ > + /* Parse eMMC supported modes */ > + if (device_has_property(dev, "cap-mmc-highspeed")) > + host->caps |=3D MMC_CAP_HSPEED; > + if (device_has_property(dev, "mmc-ddr-1_2v")) > + host->caps |=3D MMC_CAP_MMC_DDR52_120 | = MMC_CAP_SIGNALING_120; > + if (device_has_property(dev, "mmc-ddr-1_8v")) > + host->caps |=3D MMC_CAP_MMC_DDR52_180 | = MMC_CAP_SIGNALING_180; > + if (device_has_property(dev, "mmc-ddr-3_3v")) > + host->caps |=3D MMC_CAP_SIGNALING_330; > + if (device_has_property(dev, "mmc-hs200-1_2v")) > + host->caps |=3D MMC_CAP_MMC_HS200_120 | = MMC_CAP_SIGNALING_120; > + if (device_has_property(dev, "mmc-hs200-1_8v")) > + host->caps |=3D MMC_CAP_MMC_HS200_180 | = MMC_CAP_SIGNALING_180; > + if (device_has_property(dev, "mmc-hs400-1_2v")) > + host->caps |=3D MMC_CAP_MMC_HS400_120 | = MMC_CAP_SIGNALING_120; > + if (device_has_property(dev, "mmc-hs400-1_8v")) > + host->caps |=3D MMC_CAP_MMC_HS400_180 | = MMC_CAP_SIGNALING_180; > + if (device_has_property(dev, "mmc-hs400-enhanced-strobe")) > + host->caps |=3D MMC_CAP_MMC_ENH_STROBE; > +} > + > +int > +mmc_parse(device_t dev, struct mmc_helper *helper, struct mmc_host = *host) > +{ > + uint64_t bus_width, max_freq; > + > + bus_width =3D 0; > + if (device_get_property(dev, "bus-width", &bus_width, = sizeof(uint64_t)) <=3D 0) > + bus_width =3D 1; > + > + if (bus_width >=3D 4) > + host->caps |=3D MMC_CAP_4_BIT_DATA; > + if (bus_width >=3D 8) > + host->caps |=3D MMC_CAP_8_BIT_DATA; > + > + /* > + * max-frequency is optional, drivers should tweak this value > + * if it's not present based on the clock that the mmc = controller > + * operates on > + */ > + max_freq =3D 0; > + device_get_property(dev, "max-frequency", &max_freq, = sizeof(uint64_t)); > + host->f_max =3D max_freq; Previously OF_getencprop was called with &host->f_max so it would only be written to if it existed. Now it is instead written to with the value of 0 if the property doesn=E2=80=99t exist. Both aw_mmc and dwmmc = set f_max to a default value *before* calling mmc_fdt_parse so that is now clobbered. This commit breaks booting on the Stratix 10 which uses dwmmc (boot hangs at the point where da0 would normally attach), and reverting it succeeds. I don=E2=80=99t know if f_max being clobbered is = the cause of that (I=E2=80=99ll try tomorrow), but it seems likely, and is certainly a bug in this commit. Jess From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:06:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C69E6A97B5; Tue, 28 Sep 2021 18:06: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 4HJnWS6nsKz4ZNn; Tue, 28 Sep 2021 18:06:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C99C410AF; Tue, 28 Sep 2021 18:06: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 18SI6SZZ029851; Tue, 28 Sep 2021 18:06:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SI6S8m029850; Tue, 28 Sep 2021 18:06:28 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:06:28 GMT Message-Id: <202109281806.18SI6S8m029850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 819961c5808b - main - Temporarily skip sys.geom.class.multipath.failloop.failloop in CI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 819961c5808b053c626648e202dec42a19ebe7a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:06:29 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=819961c5808b053c626648e202dec42a19ebe7a6 commit 819961c5808b053c626648e202dec42a19ebe7a6 Author: Li-Wen Hsu AuthorDate: 2021-09-28 18:02:27 +0000 Commit: Li-Wen Hsu CommitDate: 2021-09-28 18:02:27 +0000 Temporarily skip sys.geom.class.multipath.failloop.failloop in CI This test case uses `dtrace -c` but it has some issues at the moment While here, add a checker for dtrace executes successfully or not to provide a more informative error message. PR: 258763 Sponsored by: The FreeBSD Foundation --- tests/sys/geom/class/multipath/failloop.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/sys/geom/class/multipath/failloop.sh b/tests/sys/geom/class/multipath/failloop.sh index f9a1417ae37f..b089f0f53d11 100755 --- a/tests/sys/geom/class/multipath/failloop.sh +++ b/tests/sys/geom/class/multipath/failloop.sh @@ -36,6 +36,10 @@ failloop_head() } failloop_body() { + if [ "$(atf_config_get ci false)" = "true" ]; then + atf_skip "https://bugs.freebsd.org/258763" + fi + sysctl -n kern.geom.notaste > kern.geom.notaste.txt load_gnop load_gmultipath @@ -59,6 +63,9 @@ failloop_body() # The dd command should've failed ... atf_check_equal 1 $dd_status # and triggered 1 or 2 path restores + if [ ! -f restore_count ]; then + atf_fail "dtrace didn't execute succfully" + fi if [ `cat restore_count` -gt 2 ]; then atf_fail "gmultipath restored paths too many times" fi From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:22:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1BD56A9D88; Tue, 28 Sep 2021 18:22: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 4HJntS6FfCz4d1J; Tue, 28 Sep 2021 18:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B79411614; Tue, 28 Sep 2021 18:22: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 18SIMuNI055765; Tue, 28 Sep 2021 18:22:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SIMucq055764; Tue, 28 Sep 2021 18:22:56 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:22:56 GMT Message-Id: <202109281822.18SIMucq055764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ian Lepore Subject: git: 1acf73d54412 - main - qoriq_therm.c: avoid a segfault on the error exit path. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1acf73d5441219d292e225bf0afbd81b490c4b91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:22:57 -0000 The branch main has been updated by ian: URL: https://cgit.FreeBSD.org/src/commit/?id=1acf73d5441219d292e225bf0afbd81b490c4b91 commit 1acf73d5441219d292e225bf0afbd81b490c4b91 Author: Ian Lepore AuthorDate: 2021-09-28 18:19:44 +0000 Commit: Ian Lepore CommitDate: 2021-09-28 18:19:44 +0000 qoriq_therm.c: avoid a segfault on the error exit path. If anything goes wrong during attach() it is handled with a 'goto fail' which calls sysctl_ctx_free(). But the sysctl context doesn't get initialized until very late in attach(), so almost any error just results in a segfault. Move the sysctl_ctx_init() call to the beginning of the attach() function, so that it is done before any errors can happen that will lead to freeing the context. --- sys/arm64/qoriq/qoriq_therm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/arm64/qoriq/qoriq_therm.c b/sys/arm64/qoriq/qoriq_therm.c index 33237fc94c07..c880e68025bf 100644 --- a/sys/arm64/qoriq/qoriq_therm.c +++ b/sys/arm64/qoriq/qoriq_therm.c @@ -190,7 +190,6 @@ qoriq_therm_init_sysctl(struct qoriq_therm_softc *sc) int i; struct sysctl_oid *oid, *tmp; - sysctl_ctx_init(&qoriq_therm_sysctl_ctx); /* create node for hw.temp */ oid = SYSCTL_ADD_NODE(&qoriq_therm_sysctl_ctx, SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO, "temperature", @@ -269,6 +268,8 @@ qoriq_therm_attach(device_t dev) node = ofw_bus_get_node(sc->dev); sc->little_endian = OF_hasprop(node, "little-endian"); + sysctl_ctx_init(&qoriq_therm_sysctl_ctx); + rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:24:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DC4B6A9D73; Tue, 28 Sep 2021 18:24: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 4HJnvp2flgz4dGD; Tue, 28 Sep 2021 18:24:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30A64FDC; Tue, 28 Sep 2021 18:24: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 18SIO6hQ055974; Tue, 28 Sep 2021 18:24:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SIO61S055973; Tue, 28 Sep 2021 18:24:06 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:24:06 GMT Message-Id: <202109281824.18SIO61S055973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: c6213beff4f5 - main - Add flag BIO_SWAP to mark IOs that are associated with swap. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6213beff4f51d6c9cc4e41682538d203249359e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:24:06 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c6213beff4f51d6c9cc4e41682538d203249359e commit c6213beff4f51d6c9cc4e41682538d203249359e Author: Gleb Smirnoff AuthorDate: 2021-09-28 18:11:50 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-28 18:23:51 +0000 Add flag BIO_SWAP to mark IOs that are associated with swap. Submitted by: jtl Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D24400 --- sys/geom/geom_io.c | 8 ++++---- sys/sys/bio.h | 3 ++- sys/vm/swap_pager.c | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 31213f0f2b22..c4e9be02bf44 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -199,12 +199,12 @@ g_clone_bio(struct bio *bp) /* * BIO_ORDERED flag may be used by disk drivers to enforce * ordering restrictions, so this flag needs to be cloned. - * BIO_UNMAPPED and BIO_VLIST should be inherited, to properly - * indicate which way the buffer is passed. + * BIO_UNMAPPED, BIO_VLIST, and BIO_SWAP should be inherited, + * to properly indicate which way the buffer is passed. * Other bio flags are not suitable for cloning. */ bp2->bio_flags = bp->bio_flags & - (BIO_ORDERED | BIO_UNMAPPED | BIO_VLIST); + (BIO_ORDERED | BIO_UNMAPPED | BIO_VLIST | BIO_SWAP); bp2->bio_length = bp->bio_length; bp2->bio_offset = bp->bio_offset; bp2->bio_data = bp->bio_data; @@ -238,7 +238,7 @@ g_duplicate_bio(struct bio *bp) struct bio *bp2; bp2 = uma_zalloc(biozone, M_WAITOK | M_ZERO); - bp2->bio_flags = bp->bio_flags & (BIO_UNMAPPED | BIO_VLIST); + bp2->bio_flags = bp->bio_flags & (BIO_UNMAPPED | BIO_VLIST | BIO_SWAP); bp2->bio_parent = bp; bp2->bio_cmd = bp->bio_cmd; bp2->bio_length = bp->bio_length; diff --git a/sys/sys/bio.h b/sys/sys/bio.h index 5fdf0ecbb917..fba1b9dce68f 100644 --- a/sys/sys/bio.h +++ b/sys/sys/bio.h @@ -67,8 +67,9 @@ #define BIO_UNMAPPED 0x10 #define BIO_TRANSIENT_MAPPING 0x20 #define BIO_VLIST 0x40 +#define BIO_SWAP 0x200 /* Swap-related I/O */ -#define PRINT_BIO_FLAGS "\20\7vlist\6transient_mapping\5unmapped" \ +#define PRINT_BIO_FLAGS "\20\12swap\7vlist\6transient_mapping\5unmapped" \ "\4ordered\3onqueue\2done\1error" #define BIO_SPEEDUP_WRITE 0x4000 /* Resource shortage at upper layers */ diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 6d64ff883966..08a5ead438ba 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2893,6 +2893,7 @@ swapgeom_strategy(struct buf *bp, struct swdevt *sp) bio->bio_offset = (bp->b_blkno - sp->sw_first) * PAGE_SIZE; bio->bio_length = bp->b_bcount; bio->bio_done = swapgeom_done; + bio->bio_flags |= BIO_SWAP; if (!buf_mapped(bp)) { bio->bio_ma = bp->b_pages; bio->bio_data = unmapped_buf; From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:24:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 860C06A99DC; Tue, 28 Sep 2021 18:24: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 4HJnvq3Fynz4dXJ; Tue, 28 Sep 2021 18:24:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 513CA1615; Tue, 28 Sep 2021 18:24: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 18SIO79U055998; Tue, 28 Sep 2021 18:24:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SIO7mY055997; Tue, 28 Sep 2021 18:24:07 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:24:07 GMT Message-Id: <202109281824.18SIO7mY055997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 183f8e1e575b - main - Externalize nsw_cluster_max and initialize it early. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 183f8e1e575b526515e70400a22af243cd1a4a78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:24:07 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=183f8e1e575b526515e70400a22af243cd1a4a78 commit 183f8e1e575b526515e70400a22af243cd1a4a78 Author: Gleb Smirnoff AuthorDate: 2021-09-28 18:13:33 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-28 18:23:52 +0000 Externalize nsw_cluster_max and initialize it early. GEOM_ELI needs to know the value, cause it will soon have special memory handling for IO operations associated with swap. Move initialization to swap_pager_init(), which is executed at SI_SUB_VM, unlike swap_pager_swap_init(), which would be executed only when a swap is configured. GEOM_ELI might need the value at SI_SUB_DRIVERS, when disks are tasted by GEOM. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D24400 --- sys/vm/swap_pager.c | 20 +++++++++++++------- sys/vm/swap_pager.h | 1 + 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 08a5ead438ba..9bc506c9b6b8 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -383,7 +383,7 @@ static int swap_pager_almost_full = 1; /* swap space exhaustion (w/hysteresis)*/ static struct mtx swbuf_mtx; /* to sync nsw_wcount_async */ static int nsw_wcount_async; /* limit async write buffers */ static int nsw_wcount_async_max;/* assigned maximum */ -static int nsw_cluster_max; /* maximum VOP I/O allowed */ +int nsw_cluster_max; /* maximum VOP I/O allowed */ static int sysctl_swap_async_max(SYSCTL_HANDLER_ARGS); SYSCTL_PROC(_vm, OID_AUTO, swap_async_max, CTLTYPE_INT | CTLFLAG_RW | @@ -572,6 +572,16 @@ swap_pager_init(void) mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF); sx_init(&sw_alloc_sx, "swspsx"); sx_init(&swdev_syscall_lock, "swsysc"); + + /* + * The nsw_cluster_max is constrained by the bp->b_pages[] + * array, which has maxphys / PAGE_SIZE entries, and our locally + * defined MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are + * constrained by the swap device interleave stripe size. + * + * Initialized early so that GEOM_ELI can see it. + */ + nsw_cluster_max = min(maxphys / PAGE_SIZE, MAX_PAGEOUT_CLUSTER); } /* @@ -591,11 +601,6 @@ swap_pager_swap_init(void) * initialize workable values (0 will work for hysteresis * but it isn't very efficient). * - * The nsw_cluster_max is constrained by the bp->b_pages[] - * array, which has maxphys / PAGE_SIZE entries, and our locally - * defined MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are - * constrained by the swap device interleave stripe size. - * * Currently we hardwire nsw_wcount_async to 4. This limit is * designed to prevent other I/O from having high latencies due to * our pageout I/O. The value 4 works well for one or two active swap @@ -606,8 +611,9 @@ swap_pager_swap_init(void) * at least 2 per swap devices, and 4 is a pretty good value if you * have one NFS swap device due to the command/ack latency over NFS. * So it all works out pretty well. + * + * nsw_cluster_max is initialized in swap_pager_init(). */ - nsw_cluster_max = min(maxphys / PAGE_SIZE, MAX_PAGEOUT_CLUSTER); nsw_wcount_async = 4; nsw_wcount_async_max = nsw_wcount_async; diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 6761d4f99ee4..20b9bc95b1b2 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -71,6 +71,7 @@ struct swdevt { #ifdef _KERNEL extern int swap_pager_avail; +extern int nsw_cluster_max; struct xswdev; int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:24:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAEC36A9F04; Tue, 28 Sep 2021 18:24: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 4HJnvr45Fyz4dM8; Tue, 28 Sep 2021 18:24:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A20C1598; Tue, 28 Sep 2021 18:24: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 18SIO88s056022; Tue, 28 Sep 2021 18:24:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SIO8Ss056021; Tue, 28 Sep 2021 18:24:08 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:24:08 GMT Message-Id: <202109281824.18SIO8Ss056021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 2dbc9a388eeb - main - Fix memory deadlock when GELI partition is used for swap. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2dbc9a388eeb73a6b17eb6fd1349a2a7e95123cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:24:09 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=2dbc9a388eeb73a6b17eb6fd1349a2a7e95123cc commit 2dbc9a388eeb73a6b17eb6fd1349a2a7e95123cc Author: Gleb Smirnoff AuthorDate: 2021-09-28 18:19:29 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-28 18:23:52 +0000 Fix memory deadlock when GELI partition is used for swap. When we get low on memory, the VM system tries to free some by swapping pages. However, if we are so low on free pages that GELI allocations block, then the swapout operation cannot complete. This keeps the VM system from being able to free enough memory so the allocation can complete. To alleviate this, keep a UMA pool at the GELI layer which is used for data buffer allocation in the fast path, and reserve some of that memory for swap operations. If an IO operation is a swap, then use the reserved memory. If the allocation still fails, return ENOMEM instead of blocking. For non-swap allocations, change the default to using M_NOWAIT. In general, this *should* be better, since it gives upper layers a signal of the memory pressure and a chance to manage their failure strategy appropriately. However, a user can set the kern.geom.eli.blocking_malloc sysctl/tunable to restore the previous M_WAITOK strategy. Submitted by: jtl Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D24400 --- sys/geom/eli/g_eli.c | 201 ++++++++++++++++++++++++++++++++++++++--- sys/geom/eli/g_eli.h | 13 ++- sys/geom/eli/g_eli_integrity.c | 37 +++++--- sys/geom/eli/g_eli_privacy.c | 25 +++-- 4 files changed, 239 insertions(+), 37 deletions(-) diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index 24b61d9f6d8e..773b9c829acc 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include @@ -90,6 +92,48 @@ SYSCTL_UINT(_kern_geom_eli, OID_AUTO, threads, CTLFLAG_RWTUN, &g_eli_threads, 0, u_int g_eli_batch = 0; SYSCTL_UINT(_kern_geom_eli, OID_AUTO, batch, CTLFLAG_RWTUN, &g_eli_batch, 0, "Use crypto operations batching"); +static u_int g_eli_minbufs = 16; +static int sysctl_g_eli_minbufs(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_kern_geom_eli, OID_AUTO, minbufs, CTLTYPE_UINT | CTLFLAG_RW | + CTLFLAG_MPSAFE, NULL, 0, sysctl_g_eli_minbufs, "IU", + "Number of GELI bufs reserved for swap transactions"); +static struct sx g_eli_umalock; /* Controls changes to UMA zone. */ +SX_SYSINIT(g_eli_umalock, &g_eli_umalock, "GELI UMA"); +static uma_zone_t g_eli_uma = NULL; +static int g_eli_alloc_sz; +static volatile int g_eli_umaoutstanding; +static volatile int g_eli_devs; +static bool g_eli_blocking_malloc = false; +SYSCTL_BOOL(_kern_geom_eli, OID_AUTO, blocking_malloc, CTLFLAG_RWTUN, + &g_eli_blocking_malloc, 0, "Use blocking malloc calls for GELI buffers"); + +/* + * Control the number of reserved entries in the GELI zone. + * If the GELI zone has already been allocated, update the zone. Otherwise, + * simply update the variable for use the next time the zone is created. + */ +static int +sysctl_g_eli_minbufs(SYSCTL_HANDLER_ARGS) +{ + int error; + u_int new; + + new = g_eli_minbufs; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + sx_xlock(&g_eli_umalock); + if (g_eli_uma != NULL) { + if (new != g_eli_minbufs) + uma_zone_reserve(g_eli_uma, new); + if (new > g_eli_minbufs) + uma_prealloc(g_eli_uma, new - g_eli_minbufs); + } + if (new != g_eli_minbufs) + g_eli_minbufs = new; + sx_xunlock(&g_eli_umalock); + return (0); +} /* * Passphrase cached during boot, in order to be more user-friendly if @@ -201,10 +245,11 @@ g_eli_crypto_rerun(struct cryptop *crp) bp = (struct bio *)crp->crp_opaque; sc = bp->bio_to->geom->softc; LIST_FOREACH(wr, &sc->sc_workers, w_next) { - if (wr->w_number == bp->bio_pflags) + if (wr->w_number == G_ELI_WORKER(bp->bio_pflags)) break; } - KASSERT(wr != NULL, ("Invalid worker (%u).", bp->bio_pflags)); + KASSERT(wr != NULL, ("Invalid worker (%u).", + G_ELI_WORKER(bp->bio_pflags))); G_ELI_DEBUG(1, "Rerunning crypto %s request (sid: %p -> %p).", bp->bio_cmd == BIO_READ ? "READ" : "WRITE", wr->w_sid, crp->crp_session); @@ -255,10 +300,7 @@ g_eli_read_done(struct bio *bp) G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__, pbp->bio_error); pbp->bio_completed = 0; - if (pbp->bio_driver2 != NULL) { - free(pbp->bio_driver2, M_ELI); - pbp->bio_driver2 = NULL; - } + g_eli_free_data(pbp); g_io_deliver(pbp, pbp->bio_error); if (sc != NULL) atomic_subtract_int(&sc->sc_inflight, 1); @@ -292,8 +334,8 @@ g_eli_write_done(struct bio *bp) pbp->bio_inbed++; if (pbp->bio_inbed < pbp->bio_children) return; - free(pbp->bio_driver2, M_ELI); - pbp->bio_driver2 = NULL; + sc = pbp->bio_to->geom->softc; + g_eli_free_data(pbp); if (pbp->bio_error != 0) { G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__, pbp->bio_error); @@ -304,7 +346,6 @@ g_eli_write_done(struct bio *bp) /* * Write is finished, send it up. */ - sc = pbp->bio_to->geom->softc; g_io_deliver(pbp, pbp->bio_error); if (sc != NULL) atomic_subtract_int(&sc->sc_inflight, 1); @@ -451,7 +492,8 @@ g_eli_start(struct bio *bp) return; } bp->bio_driver1 = cbp; - bp->bio_pflags = G_ELI_NEW_BIO; + bp->bio_pflags = 0; + G_ELI_SET_NEW_BIO(bp->bio_pflags); switch (bp->bio_cmd) { case BIO_READ: if (!(sc->sc_flags & G_ELI_FLAG_AUTH)) { @@ -576,7 +618,7 @@ g_eli_cancel(struct g_eli_softc *sc) mtx_assert(&sc->sc_queue_mtx, MA_OWNED); while ((bp = bioq_takefirst(&sc->sc_queue)) != NULL) { - KASSERT(bp->bio_pflags == G_ELI_NEW_BIO, + KASSERT(G_ELI_IS_NEW_BIO(bp->bio_pflags), ("Not new bio when canceling (bp=%p).", bp)); g_io_deliver(bp, ENXIO); } @@ -595,7 +637,7 @@ g_eli_takefirst(struct g_eli_softc *sc) * Device suspended, so we skip new I/O requests. */ TAILQ_FOREACH(bp, &sc->sc_queue.queue, bio_queue) { - if (bp->bio_pflags != G_ELI_NEW_BIO) + if (!G_ELI_IS_NEW_BIO(bp->bio_pflags)) break; } if (bp != NULL) @@ -688,11 +730,11 @@ again: msleep(sc, &sc->sc_queue_mtx, PDROP, "geli:w", 0); continue; } - if (bp->bio_pflags == G_ELI_NEW_BIO) + if (G_ELI_IS_NEW_BIO(bp->bio_pflags)) atomic_add_int(&sc->sc_inflight, 1); mtx_unlock(&sc->sc_queue_mtx); - if (bp->bio_pflags == G_ELI_NEW_BIO) { - bp->bio_pflags = 0; + if (G_ELI_IS_NEW_BIO(bp->bio_pflags)) { + G_ELI_SETWORKER(bp->bio_pflags, 0); if (sc->sc_flags & G_ELI_FLAG_AUTH) { if (bp->bio_cmd == BIO_READ) g_eli_auth_read(sc, bp); @@ -835,6 +877,132 @@ g_eli_cpu_is_disabled(int cpu) #endif } +static void +g_eli_init_uma(void) +{ + + atomic_add_int(&g_eli_devs, 1); + sx_xlock(&g_eli_umalock); + if (g_eli_uma == NULL) { + /* + * Calculate the maximum-sized swap buffer we are + * likely to see. + */ + g_eli_alloc_sz = roundup2((PAGE_SIZE + sizeof(int) + + G_ELI_AUTH_SECKEYLEN) * nsw_cluster_max + + sizeof(uintptr_t), PAGE_SIZE); + + /* + * Create the zone, setting UMA_ZONE_NOFREE so we won't + * drain the zone in a memory shortage. + */ + g_eli_uma = uma_zcreate("GELI buffers", g_eli_alloc_sz, + NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + + /* Reserve and pre-allocate pages, as appropriate. */ + uma_zone_reserve(g_eli_uma, g_eli_minbufs); + uma_prealloc(g_eli_uma, g_eli_minbufs); + } + sx_xunlock(&g_eli_umalock); +} + +/* + * Try to destroy the UMA pool. This will do nothing if there are existing + * GELI devices or existing UMA allocations. + */ +static void +g_eli_destroy_uma(void) +{ + uma_zone_t oldzone; + + sx_xlock(&g_eli_umalock); + /* Ensure we really should be destroying this. */ + if (atomic_load_int(&g_eli_devs) == 0 && + atomic_load_int(&g_eli_umaoutstanding) == 0) { + oldzone = g_eli_uma; + g_eli_uma = NULL; + } else + oldzone = NULL; + sx_xunlock(&g_eli_umalock); + + if (oldzone != NULL) + uma_zdestroy(oldzone); +} + +static void +g_eli_fini_uma(void) +{ + + /* + * If this is the last outstanding GELI device, try to + * destroy the UMA pool. + */ + if (atomic_fetchadd_int(&g_eli_devs, -1) == 1) + g_eli_destroy_uma(); +} + +/* + * Allocate a data buffer. If the size fits within our swap-sized buffers, + * try to allocate a swap-sized buffer from the UMA pool. Otherwise, fall + * back to using malloc. + * + * Swap-related requests are special: they can only use the UMA pool, they + * use M_USE_RESERVE to let them dip farther into system resources, and + * they always use M_NOWAIT to prevent swap operations from deadlocking. + */ +bool +g_eli_alloc_data(struct bio *bp, int sz) +{ + + KASSERT(sz <= g_eli_alloc_sz || (bp->bio_flags & BIO_SWAP) == 0, + ("BIO_SWAP request for %d bytes exceeds the precalculated buffer" + " size (%d)", sz, g_eli_alloc_sz)); + if (sz <= g_eli_alloc_sz) { + bp->bio_driver2 = uma_zalloc(g_eli_uma, M_NOWAIT | + ((bp->bio_flags & BIO_SWAP) != 0 ? M_USE_RESERVE : 0)); + if (bp->bio_driver2 != NULL) { + bp->bio_pflags |= G_ELI_UMA_ALLOC; + atomic_add_int(&g_eli_umaoutstanding, 1); + } + if (bp->bio_driver2 != NULL || (bp->bio_flags & BIO_SWAP) != 0) + return (bp->bio_driver2 != NULL); + } + bp->bio_pflags &= ~(G_ELI_UMA_ALLOC); + bp->bio_driver2 = malloc(sz, M_ELI, g_eli_blocking_malloc ? M_WAITOK : + M_NOWAIT); + return (bp->bio_driver2 != NULL); +} + +/* + * Free a buffer from bp->bio_driver2 which was allocated with + * g_eli_alloc_data(). This function makes sure that the memory is freed + * to the correct place. + * + * Additionally, if this function frees the last outstanding UMA request + * and there are no open GELI devices, this will destroy the UMA pool. + */ +void +g_eli_free_data(struct bio *bp) +{ + + /* + * Mimic the free(9) behavior of allowing a NULL pointer to be + * freed. + */ + if (bp->bio_driver2 == NULL) + return; + + if ((bp->bio_pflags & G_ELI_UMA_ALLOC) != 0) { + uma_zfree(g_eli_uma, bp->bio_driver2); + if (atomic_fetchadd_int(&g_eli_umaoutstanding, -1) == 1 && + atomic_load_int(&g_eli_devs) == 0) + g_eli_destroy_uma(); + } else + free(bp->bio_driver2, M_ELI); + bp->bio_driver2 = NULL; +} + struct g_geom * g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp, const struct g_eli_metadata *md, const u_char *mkey, int nkey) @@ -927,6 +1095,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp, if (threads == 0) threads = mp_ncpus; sc->sc_cpubind = (mp_ncpus > 1 && threads == mp_ncpus); + g_eli_init_uma(); for (i = 0; i < threads; i++) { if (g_eli_cpu_is_disabled(i)) { G_ELI_DEBUG(1, "%s: CPU %u disabled, skipping.", @@ -1018,6 +1187,7 @@ failed: g_destroy_consumer(cp); g_destroy_geom(gp); g_eli_key_destroy(sc); + g_eli_fini_uma(); zfree(sc, M_ELI); return (NULL); } @@ -1061,6 +1231,7 @@ g_eli_destroy(struct g_eli_softc *sc, boolean_t force) mtx_destroy(&sc->sc_queue_mtx); gp->softc = NULL; g_eli_key_destroy(sc); + g_eli_fini_uma(); zfree(sc, M_ELI); G_ELI_DEBUG(0, "Device %s destroyed.", gp->name); diff --git a/sys/geom/eli/g_eli.h b/sys/geom/eli/g_eli.h index d07afe0c8a61..9cd9f1a7f3e6 100644 --- a/sys/geom/eli/g_eli.h +++ b/sys/geom/eli/g_eli.h @@ -123,7 +123,15 @@ /* Provider uses IV-Key for encryption key generation. */ #define G_ELI_FLAG_ENC_IVKEY 0x00400000 -#define G_ELI_NEW_BIO 255 +/* BIO pflag values. */ +#define G_ELI_WORKER(pflags) ((pflags) & 0xff) +#define G_ELI_MAX_WORKERS 255 +#define G_ELI_NEW_BIO G_ELI_MAX_WORKERS +#define G_ELI_SETWORKER(pflags, w) \ + (pflags) = ((pflags) & 0xff00) | ((w) & 0xff) +#define G_ELI_SET_NEW_BIO(pflags) G_ELI_SETWORKER((pflags), G_ELI_NEW_BIO) +#define G_ELI_IS_NEW_BIO(pflags) (G_ELI_WORKER(pflags) == G_ELI_NEW_BIO) +#define G_ELI_UMA_ALLOC 0x100 /* bio_driver2 alloc came from UMA */ #define SHA512_MDLEN 64 #define G_ELI_AUTH_SECKEYLEN SHA256_DIGEST_LENGTH @@ -692,6 +700,9 @@ void g_eli_read_done(struct bio *bp); void g_eli_write_done(struct bio *bp); int g_eli_crypto_rerun(struct cryptop *crp); +bool g_eli_alloc_data(struct bio *bp, int sz); +void g_eli_free_data(struct bio *bp); + void g_eli_crypto_read(struct g_eli_softc *sc, struct bio *bp, boolean_t fromworker); void g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp); diff --git a/sys/geom/eli/g_eli_integrity.c b/sys/geom/eli/g_eli_integrity.c index e97924b8df08..17a0912797c1 100644 --- a/sys/geom/eli/g_eli_integrity.c +++ b/sys/geom/eli/g_eli_integrity.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -104,8 +103,6 @@ __FBSDID("$FreeBSD$"); * g_eli_start -> g_eli_auth_run -> g_eli_auth_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ -MALLOC_DECLARE(M_ELI); - /* * Here we generate key for HMAC. Every sector has its own HMAC key, so it is * not possible to copy sectors. @@ -268,8 +265,7 @@ g_eli_auth_read_done(struct cryptop *crp) sc->sc_name, (intmax_t)corsize, (intmax_t)coroff); } } - free(bp->bio_driver2, M_ELI); - bp->bio_driver2 = NULL; + g_eli_free_data(bp); if (bp->bio_error != 0) { if (bp->bio_error != EINTEGRITY) { G_ELI_LOGREQ(0, bp, @@ -326,8 +322,7 @@ g_eli_auth_write_done(struct cryptop *crp) if (bp->bio_error != 0) { G_ELI_LOGREQ(0, bp, "Crypto WRITE request failed (error=%d).", bp->bio_error); - free(bp->bio_driver2, M_ELI); - bp->bio_driver2 = NULL; + g_eli_free_data(bp); cbp = bp->bio_driver1; bp->bio_driver1 = NULL; g_destroy_bio(cbp); @@ -386,7 +381,7 @@ g_eli_auth_read(struct g_eli_softc *sc, struct bio *bp) size_t size; off_t nsec; - bp->bio_pflags = 0; + G_ELI_SETWORKER(bp->bio_pflags, 0); cp = LIST_FIRST(&sc->sc_geom->consumer); cbp = bp->bio_driver1; @@ -404,7 +399,14 @@ g_eli_auth_read(struct g_eli_softc *sc, struct bio *bp) size += sizeof(int) * nsec; size += G_ELI_AUTH_SECKEYLEN * nsec; cbp->bio_offset = (bp->bio_offset / bp->bio_to->sectorsize) * sc->sc_bytes_per_sector; - bp->bio_driver2 = malloc(size, M_ELI, M_WAITOK); + if (!g_eli_alloc_data(bp, size)) { + G_ELI_LOGREQ(0, bp, "Crypto auth read request failed (ENOMEM)"); + g_destroy_bio(cbp); + bp->bio_error = ENOMEM; + g_io_deliver(bp, bp->bio_error); + atomic_subtract_int(&sc->sc_inflight, 1); + return; + } cbp->bio_data = bp->bio_driver2; /* Clear the error array. */ @@ -459,7 +461,7 @@ g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp) G_ELI_LOGREQ(3, bp, "%s", __func__); - bp->bio_pflags = wr->w_number; + G_ELI_SETWORKER(bp->bio_pflags, wr->w_number); sc = wr->w_softc; /* Sectorsize of decrypted provider eg. 4096. */ decr_secsize = bp->bio_to->sectorsize; @@ -487,8 +489,19 @@ g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp) size = encr_secsize * nsec; size += G_ELI_AUTH_SECKEYLEN * nsec; size += sizeof(uintptr_t); /* Space for alignment. */ - data = malloc(size, M_ELI, M_WAITOK); - bp->bio_driver2 = data; + if (!g_eli_alloc_data(bp, size)) { + G_ELI_LOGREQ(0, bp, "Crypto request failed (ENOMEM)"); + if (bp->bio_driver1 != NULL) { + g_destroy_bio(bp->bio_driver1); + bp->bio_driver1 = NULL; + } + bp->bio_error = ENOMEM; + g_io_deliver(bp, bp->bio_error); + if (sc != NULL) + atomic_subtract_int(&sc->sc_inflight, 1); + return; + } + data = bp->bio_driver2; p = data + encr_secsize * nsec; } bp->bio_inbed = 0; diff --git a/sys/geom/eli/g_eli_privacy.c b/sys/geom/eli/g_eli_privacy.c index f4e0416cc828..20a9f09452c5 100644 --- a/sys/geom/eli/g_eli_privacy.c +++ b/sys/geom/eli/g_eli_privacy.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -60,8 +59,6 @@ __FBSDID("$FreeBSD$"); * g_eli_start -> g_eli_crypto_run -> g_eli_crypto_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ -MALLOC_DECLARE(M_ELI); - /* * Copy data from a (potentially unmapped) bio to a kernelspace buffer. * @@ -180,8 +177,7 @@ g_eli_crypto_write_done(struct cryptop *crp) if (bp->bio_error != 0) { G_ELI_LOGREQ(0, bp, "Crypto WRITE request failed (error=%d).", bp->bio_error); - free(bp->bio_driver2, M_ELI); - bp->bio_driver2 = NULL; + g_eli_free_data(bp); g_destroy_bio(cbp); g_io_deliver(bp, bp->bio_error); atomic_subtract_int(&sc->sc_inflight, 1); @@ -235,7 +231,7 @@ g_eli_crypto_read(struct g_eli_softc *sc, struct bio *bp, boolean_t fromworker) atomic_add_int(&sc->sc_inflight, 1); mtx_unlock(&sc->sc_queue_mtx); } - bp->bio_pflags = 0; + G_ELI_SETWORKER(bp->bio_pflags, 0); bp->bio_driver2 = NULL; cbp = bp->bio_driver1; cbp->bio_done = g_eli_read_done; @@ -272,7 +268,7 @@ g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp) G_ELI_LOGREQ(3, bp, "%s", __func__); - bp->bio_pflags = wr->w_number; + G_ELI_SETWORKER(bp->bio_pflags, wr->w_number); sc = wr->w_softc; secsize = LIST_FIRST(&sc->sc_geom->provider)->sectorsize; nsec = bp->bio_length / secsize; @@ -285,8 +281,19 @@ g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp) * so we need to allocate more memory for encrypted data. */ if (bp->bio_cmd == BIO_WRITE) { - data = malloc(bp->bio_length, M_ELI, M_WAITOK); - bp->bio_driver2 = data; + if (!g_eli_alloc_data(bp, bp->bio_length)) { + G_ELI_LOGREQ(0, bp, "Crypto request failed (ENOMEM)."); + if (bp->bio_driver1 != NULL) { + g_destroy_bio(bp->bio_driver1); + bp->bio_driver1 = NULL; + } + bp->bio_error = ENOMEM; + g_io_deliver(bp, bp->bio_error); + if (sc != NULL) + atomic_subtract_int(&sc->sc_inflight, 1); + return; + } + data = bp->bio_driver2; /* * This copy could be eliminated by using crypto's output * buffer, instead of using a single overwriting buffer. From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:26:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29CB76A9FBD for ; Tue, 28 Sep 2021 18:26:43 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2q.ore.mailhop.org (outbound2q.ore.mailhop.org [54.187.71.48]) (using TLSv1.3 with cipher TLS_AES_256_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 4HJnyp6Bvcz4dZB for ; Tue, 28 Sep 2021 18:26:42 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1632853597; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=A5DON/AdjioqS1MaqwORD23RSVMNlhWGIFEqosy9o63ATj0LH3MI6fJq2gRss2cP/LM8S8fLIbCDu EX7wOzxtiiBGhuxGZCFlYVKca4jZ1GCGjC/bBWvXIY2kEIZKl7+7b1IcgSYYCROt7fYd8aikFLOXip V3PKhvCbWAUQ2rQ90yMfi0/e6llIq9i8ZHJqFuTwJhny3ylcOBFbzTPLIFmWQTmffT9g1eS8kT9K/p NgQMKITzTKS32fG8sFbPzWxlu+y43cCdv31jz7gSdUQGCxYdegp9XOuvXmx2qMwMhFtd0yxfNvd9wt D9AlUvU37eRpuwovULQxbDwbeu3+2JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=RFCP72QPozr/dk+wlrf2/WkNKGVuksuiTywTg90G/iE=; b=OaLTM8KKqtIJiEbb71NIP2hiHsgvzgzxFWAyZg5WLTs+8BdjqhnScINxls9qkceGyBvMj1yf0eKx0 55CvZ1C20IzJAqgGGQmEWeJ1MPQS/sWiF76K6GgD5LhMaF3FLj9K7eLgWFraqbmZK6WAytTOGd3I3z JpaBUIsZg2bSOloiw74D30A/iQple14y/yrsS6YFGx37SawOii+u/InEsX2VGB442ENteIa5DsObRZ AfkWQAuttnZTgySLTY0F3C6oaDp85JquYeUE4717vubmfKfJnhxOYjM0uWAnt4eI7FAlCOrs2BEAkp NMzYokjGlTrk25ef7O+qlU4JXKLeSMg== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=24.8.225.114; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=RFCP72QPozr/dk+wlrf2/WkNKGVuksuiTywTg90G/iE=; b=HuTgb5e9TIk9zzxnnlYd1yxQpWui55osWufCUM/ky8iCdnqxy0Fkl5FUjVkK1TLoiJeHE2XaLCUij 23SCjpHviXd2Ag40Xap8r14b/8j6i2lrNLv6wN24QJTUxtLEDzY4hPVExQVar/SA9KteRPsOfLVJoA d8InKtMwWsLPb6BrSFHXLT4+AJNkHUkClVEnyCaUfKP/rmUtkUvktVg/NmYmyiKynQejdKOpQPykGn zEztJn/2MSfPTOQINK1WiHSOpLBJylI6LtK+sj87Qvb6cz8QJgUmPC8Od+H6pJDCzsotM75uDwZpQr oI17X+ljTA5SPkvKgZZVu23pn9gwNyA== X-Originating-IP: 24.8.225.114 X-MHO-RoutePath: aGlwcGll X-MHO-User: 9ca60ecf-2089-11ec-a67c-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-24-8-225-114.hsd1.co.comcast.net [24.8.225.114]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 9ca60ecf-2089-11ec-a67c-89389772cfc7; Tue, 28 Sep 2021 18:26:35 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 18SIQYkF082693; Tue, 28 Sep 2021 12:26:34 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: <60e58628fbc1a5d141b360aa1d3651532024ba82.camel@freebsd.org> Subject: Re: git: c6213beff4f5 - main - Add flag BIO_SWAP to mark IOs that are associated with swap. From: Ian Lepore To: Gleb Smirnoff , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Date: Tue, 28 Sep 2021 12:26:34 -0600 In-Reply-To: <202109281824.18SIO61S055973@gitrepo.freebsd.org> References: <202109281824.18SIO61S055973@gitrepo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HJnyp6Bvcz4dZB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:26:43 -0000 On Tue, 2021-09-28 at 18:24 +0000, Gleb Smirnoff wrote: > The branch main has been updated by glebius: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=c6213beff4f51d6c9cc4e41682538d203249359e > > commit c6213beff4f51d6c9cc4e41682538d203249359e > Author:     Gleb Smirnoff > AuthorDate: 2021-09-28 18:11:50 +0000 > Commit:     Gleb Smirnoff > CommitDate: 2021-09-28 18:23:51 +0000 > >     Add flag BIO_SWAP to mark IOs that are associated with swap. >     Why? It's not clear from the diff why the new flag was added. -- Ian From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:28:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C31F6A9DF9; Tue, 28 Sep 2021 18:28: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 4HJp0h3YCVz4dWh; Tue, 28 Sep 2021 18:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 599ED1681; Tue, 28 Sep 2021 18:28: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 18SISKw5056426; Tue, 28 Sep 2021 18:28:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SISKLj056425; Tue, 28 Sep 2021 18:28:20 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:28:20 GMT Message-Id: <202109281828.18SISKLj056425@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 38dac71d0a95 - main - Fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38dac71d0a95ab2cf2cdfa1232cc556008b7ac94 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:28:20 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=38dac71d0a95ab2cf2cdfa1232cc556008b7ac94 commit 38dac71d0a95ab2cf2cdfa1232cc556008b7ac94 Author: Li-Wen Hsu AuthorDate: 2021-09-28 18:28:01 +0000 Commit: Li-Wen Hsu CommitDate: 2021-09-28 18:28:01 +0000 Fix typo Reported by: swills Sponsored by: The FreeBSD Foundation --- tests/sys/geom/class/multipath/failloop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/geom/class/multipath/failloop.sh b/tests/sys/geom/class/multipath/failloop.sh index b089f0f53d11..632458e1f0b1 100755 --- a/tests/sys/geom/class/multipath/failloop.sh +++ b/tests/sys/geom/class/multipath/failloop.sh @@ -64,7 +64,7 @@ failloop_body() atf_check_equal 1 $dd_status # and triggered 1 or 2 path restores if [ ! -f restore_count ]; then - atf_fail "dtrace didn't execute succfully" + atf_fail "dtrace didn't execute successfully" fi if [ `cat restore_count` -gt 2 ]; then atf_fail "gmultipath restored paths too many times" From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:31:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52DDA6AA213; Tue, 28 Sep 2021 18:31: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 4HJp471whvz4dwG; Tue, 28 Sep 2021 18:31:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21FE2FEF; Tue, 28 Sep 2021 18:31: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 18SIVJgt065689; Tue, 28 Sep 2021 18:31:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SIVJTr065688; Tue, 28 Sep 2021 18:31:19 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:31:19 GMT Message-Id: <202109281831.18SIVJTr065688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: fa947a3687b9 - main - sctp: cleanup and adding KASSERT()s, no functional change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa947a3687b98b387de55a33154fce7d6e3dffa3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:31:19 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=fa947a3687b98b387de55a33154fce7d6e3dffa3 commit fa947a3687b98b387de55a33154fce7d6e3dffa3 Author: Michael Tuexen AuthorDate: 2021-09-28 18:29:43 +0000 Commit: Michael Tuexen CommitDate: 2021-09-28 18:31:12 +0000 sctp: cleanup and adding KASSERT()s, no functional change MFC after: 1 week --- sys/netinet/sctp_ss_functions.c | 55 ++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index ff108eb0eb33..fe4b96cf00ab 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -63,9 +63,9 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc) * an existing association has been changed. We need to add all * stream queues to the wheel. */ - for (i = 0; i < stcb->asoc.streamoutcnt; i++) { - stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, - &stcb->asoc.strmout[i], + for (i = 0; i < asoc->streamoutcnt; i++) { + stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, + &asoc->strmout[i], NULL); } return; @@ -81,6 +81,7 @@ sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq; strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + KASSERT(strq->ss_params.scheduled, ("strq %p not scheduled", (void *)strq)); TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); strq->ss_params.scheduled = false; } @@ -162,6 +163,9 @@ sctp_ss_default_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, struct sctp_stream_out *strq, *strqt; if (asoc->ss_data.locked_on_sending) { + KASSERT(asoc->ss_data.locked_on_sending->ss_params.scheduled, + ("strq %p not scheduled", + (void *)asoc->ss_data.locked_on_sending)); return (asoc->ss_data.locked_on_sending); } strqt = asoc->ss_data.last_out_stream; @@ -170,11 +174,15 @@ default_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { + KASSERT(strqt->ss_params.scheduled, + ("strq %p not scheduled", (void *)strqt)); strq = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); if (strq == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } } + KASSERT(strq == NULL || strq->ss_params.scheduled, + ("strq %p not scheduled", (void *)strq)); /* * If CMT is off, we must validate that the stream in question has @@ -210,16 +218,18 @@ sctp_ss_default_scheduled(struct sctp_tcb *stcb, { struct sctp_stream_queue_pending *sp; + KASSERT(strq != NULL, ("strq is NULL")); + KASSERT(strq->ss_params.scheduled, ("strq %p is not scheduled", (void *)strq)); asoc->ss_data.last_out_stream = strq; - if (stcb->asoc.idata_supported == 0) { + if (asoc->idata_supported == 0) { sp = TAILQ_FIRST(&strq->outqueue); if ((sp != NULL) && (sp->some_taken == 1)) { - stcb->asoc.ss_data.locked_on_sending = strq; + asoc->ss_data.locked_on_sending = strq; } else { - stcb->asoc.ss_data.locked_on_sending = NULL; + asoc->ss_data.locked_on_sending = NULL; } } else { - stcb->asoc.ss_data.locked_on_sending = NULL; + asoc->ss_data.locked_on_sending = NULL; } return; } @@ -324,11 +334,15 @@ rrp_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { + KASSERT(strqt->ss_params.scheduled, + ("strq %p not scheduled", (void *)strqt)); strq = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); if (strq == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } } + KASSERT(strq == NULL || strq->ss_params.scheduled, + ("strq %p not scheduled", (void *)strq)); /* * If CMT is off, we must validate that the stream in question has @@ -370,6 +384,7 @@ sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq; strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + KASSERT(strq->ss_params.scheduled, ("strq %p not scheduled", (void *)strq)); if (clear_values) { strq->ss_params.ss.prio.priority = 0; } @@ -464,6 +479,9 @@ sctp_ss_prio_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, struct sctp_stream_out *strq, *strqt, *strqn; if (asoc->ss_data.locked_on_sending) { + KASSERT(asoc->ss_data.locked_on_sending->ss_params.scheduled, + ("strq %p not scheduled", + (void *)asoc->ss_data.locked_on_sending)); return (asoc->ss_data.locked_on_sending); } strqt = asoc->ss_data.last_out_stream; @@ -472,6 +490,8 @@ prio_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { + KASSERT(strqt->ss_params.scheduled, + ("strq %p not scheduled", (void *)strqt)); strqn = TAILQ_NEXT(strqt, ss_params.ss.prio.next_spoke); if (strqn != NULL && strqn->ss_params.ss.prio.priority == strqt->ss_params.ss.prio.priority) { @@ -480,6 +500,8 @@ prio_again: strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } } + KASSERT(strq == NULL || strq->ss_params.scheduled, + ("strq %p not scheduled", (void *)strq)); /* * If CMT is off, we must validate that the stream in question has @@ -544,6 +566,7 @@ sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq; strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); + KASSERT(strq->ss_params.scheduled, ("strq %p not scheduled", (void *)strq)); if (clear_values) { strq->ss_params.ss.fb.rounds = -1; } @@ -625,6 +648,9 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, struct sctp_stream_out *strq = NULL, *strqt; if (asoc->ss_data.locked_on_sending) { + KASSERT(asoc->ss_data.locked_on_sending->ss_params.scheduled, + ("strq %p not scheduled", + (void *)asoc->ss_data.locked_on_sending)); return (asoc->ss_data.locked_on_sending); } if (asoc->ss_data.last_out_stream == NULL || @@ -664,15 +690,15 @@ sctp_ss_fb_scheduled(struct sctp_tcb *stcb, struct sctp_nets *net SCTP_UNUSED, struct sctp_stream_out *strqt; int subtract; - if (stcb->asoc.idata_supported == 0) { + if (asoc->idata_supported == 0) { sp = TAILQ_FIRST(&strq->outqueue); if ((sp != NULL) && (sp->some_taken == 1)) { - stcb->asoc.ss_data.locked_on_sending = strq; + asoc->ss_data.locked_on_sending = strq; } else { - stcb->asoc.ss_data.locked_on_sending = NULL; + asoc->ss_data.locked_on_sending = NULL; } } else { - stcb->asoc.ss_data.locked_on_sending = NULL; + asoc->ss_data.locked_on_sending = NULL; } subtract = strq->ss_params.ss.fb.rounds; TAILQ_FOREACH(strqt, &asoc->ss_data.out.wheel, ss_params.ss.fb.next_spoke) { @@ -715,8 +741,8 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc) */ while (add_more) { add_more = 0; - for (i = 0; i < stcb->asoc.streamoutcnt; i++) { - sp = TAILQ_FIRST(&stcb->asoc.strmout[i].outqueue); + for (i = 0; i < asoc->streamoutcnt; i++) { + sp = TAILQ_FIRST(&asoc->strmout[i].outqueue); x = 0; /* Find n. message in current stream queue */ while (sp != NULL && x < n) { @@ -724,7 +750,7 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc) x++; } if (sp != NULL) { - sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp); + sctp_ss_fcfs_add(stcb, asoc, &asoc->strmout[i], sp); add_more = 1; } } @@ -743,6 +769,7 @@ sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { sp = TAILQ_FIRST(&asoc->ss_data.out.list); + KASSERT(sp->scheduled, ("sp %p not scheduled", (void *)sp)); TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); sp->scheduled = false; } From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:38:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC4756AA2E1; Tue, 28 Sep 2021 18:38:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJpDf6PNwz4fHR; Tue, 28 Sep 2021 18:38:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB8F3163E; Tue, 28 Sep 2021 18:38: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 18SIcgEv070316; Tue, 28 Sep 2021 18:38:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SIcgnf070315; Tue, 28 Sep 2021 18:38:42 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:38:42 GMT Message-Id: <202109281838.18SIcgnf070315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: b9b5a4dd590e - main - gmultipath failloop test: Put the dtrace sanity checker in right place MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9b5a4dd590e1b30d92dc73b3d1f22d3303e7e41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:38:43 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=b9b5a4dd590e1b30d92dc73b3d1f22d3303e7e41 commit b9b5a4dd590e1b30d92dc73b3d1f22d3303e7e41 Author: Li-Wen Hsu AuthorDate: 2021-09-28 18:38:34 +0000 Commit: Li-Wen Hsu CommitDate: 2021-09-28 18:38:34 +0000 gmultipath failloop test: Put the dtrace sanity checker in right place Check if dtrace excution is successful or not right after execution. Sponsored by: The FreeBSD Foundation --- tests/sys/geom/class/multipath/failloop.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/geom/class/multipath/failloop.sh b/tests/sys/geom/class/multipath/failloop.sh index 632458e1f0b1..48006d6b10da 100755 --- a/tests/sys/geom/class/multipath/failloop.sh +++ b/tests/sys/geom/class/multipath/failloop.sh @@ -60,12 +60,12 @@ failloop_body() -i 'geom:multipath:config:restore {@restore = count()}' \ -c "dd if=/dev/zero of=/dev/multipath/"$name" bs=4096 count=1" \ 2>&1 | awk '/exited with status/ {print $NF}'` - # The dd command should've failed ... - atf_check_equal 1 $dd_status - # and triggered 1 or 2 path restores if [ ! -f restore_count ]; then atf_fail "dtrace didn't execute successfully" fi + # The dd command should've failed ... + atf_check_equal 1 $dd_status + # and triggered 1 or 2 path restores if [ `cat restore_count` -gt 2 ]; then atf_fail "gmultipath restored paths too many times" fi From owner-dev-commits-src-all@freebsd.org Tue Sep 28 18:38:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E58776A9EFC; Tue, 28 Sep 2021 18:38:52 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJpDr4kXQz4f1f; Tue, 28 Sep 2021 18:38:52 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 18SIcjt3024741 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 28 Sep 2021 11:38:45 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 18SIciwB024740; Tue, 28 Sep 2021 11:38:44 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 28 Sep 2021 11:38:44 -0700 From: Gleb Smirnoff To: Ian Lepore Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: c6213beff4f5 - main - Add flag BIO_SWAP to mark IOs that are associated with swap. Message-ID: References: <202109281824.18SIO61S055973@gitrepo.freebsd.org> <60e58628fbc1a5d141b360aa1d3651532024ba82.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <60e58628fbc1a5d141b360aa1d3651532024ba82.camel@freebsd.org> X-Rspamd-Queue-Id: 4HJpDr4kXQz4f1f X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:38:53 -0000 Ian, On Tue, Sep 28, 2021 at 12:26:34PM -0600, Ian Lepore wrote: I> > URL: I> > https://cgit.FreeBSD.org/src/commit/?id=c6213beff4f51d6c9cc4e41682538d203249359e I> > I> > commit c6213beff4f51d6c9cc4e41682538d203249359e I> > Author:     Gleb Smirnoff I> > AuthorDate: 2021-09-28 18:11:50 +0000 I> > Commit:     Gleb Smirnoff I> > CommitDate: 2021-09-28 18:23:51 +0000 I> > I> >     Add flag BIO_SWAP to mark IOs that are associated with swap. I> >     I> I> Why? It's not clear from the diff why the new flag was added. Next couple commits that were pushed same second use it. -- Gleb Smirnoff From owner-dev-commits-src-all@freebsd.org Tue Sep 28 19:11:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D0796AABB2; Tue, 28 Sep 2021 19:11: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 4HJpyW1g8Dz4jZn; Tue, 28 Sep 2021 19:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 193C71D98; Tue, 28 Sep 2021 19:11: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 18SJBVbT019389; Tue, 28 Sep 2021 19:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SJBV3r019388; Tue, 28 Sep 2021 19:11:31 GMT (envelope-from git) Date: Tue, 28 Sep 2021 19:11:31 GMT Message-Id: <202109281911.18SJBV3r019388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: c83ae596f3c2 - main - mgb: Staticize devclass and iflib structs (as is typical) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c83ae596f3c2ce8c4ef2bacfb63100aaf8d48bb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 19:11:31 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c83ae596f3c2ce8c4ef2bacfb63100aaf8d48bb7 commit c83ae596f3c2ce8c4ef2bacfb63100aaf8d48bb7 Author: Ed Maste AuthorDate: 2021-09-28 18:12:58 +0000 Commit: Ed Maste CommitDate: 2021-09-28 19:11:01 +0000 mgb: Staticize devclass and iflib structs (as is typical) MFC after: 1 week Fixes: 8890ab7758b8 ("Introduce if_mgb driver...") Sponsored by: The FreeBSD Foundation --- sys/dev/mgb/if_mgb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index de4f78e0fd57..9515d0d5d788 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -206,7 +206,7 @@ static driver_t mgb_driver = { "mgb", mgb_methods, sizeof(struct mgb_softc) }; -devclass_t mgb_devclass; +static devclass_t mgb_devclass; DRIVER_MODULE(mgb, pci, mgb_driver, mgb_devclass, NULL, NULL); IFLIB_PNP_INFO(pci, mgb, mgb_vendor_info_array); MODULE_VERSION(mgb, 1); @@ -270,7 +270,7 @@ static driver_t mgb_iflib_driver = { "mgb", mgb_iflib_methods, sizeof(struct mgb_softc) }; -struct if_txrx mgb_txrx = { +static struct if_txrx mgb_txrx = { .ift_txd_encap = mgb_isc_txd_encap, .ift_txd_flush = mgb_isc_txd_flush, .ift_txd_credits_update = mgb_isc_txd_credits_update, @@ -282,7 +282,7 @@ struct if_txrx mgb_txrx = { .ift_legacy_intr = mgb_legacy_intr }; -struct if_shared_ctx mgb_sctx_init = { +static struct if_shared_ctx mgb_sctx_init = { .isc_magic = IFLIB_MAGIC, .isc_q_align = PAGE_SIZE, From owner-dev-commits-src-all@freebsd.org Tue Sep 28 19:31:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E9966AADBD; Tue, 28 Sep 2021 19:31: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 4HJqPq3YZfz4kfk; Tue, 28 Sep 2021 19:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A9D623EB; Tue, 28 Sep 2021 19:31: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 18SJVhaS047436; Tue, 28 Sep 2021 19:31:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SJVhel047435; Tue, 28 Sep 2021 19:31:43 GMT (envelope-from git) Date: Tue, 28 Sep 2021 19:31:43 GMT Message-Id: <202109281931.18SJVhel047435@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ian Lepore Subject: git: dc91a9715f8f - main - Fix busdma resource leak on usb device detach. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc91a9715f8fda4b3633388830a28a99f73cbe59 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 19:31:43 -0000 The branch main has been updated by ian: URL: https://cgit.FreeBSD.org/src/commit/?id=dc91a9715f8fda4b3633388830a28a99f73cbe59 commit dc91a9715f8fda4b3633388830a28a99f73cbe59 Author: Ian Lepore AuthorDate: 2021-09-28 19:29:10 +0000 Commit: Ian Lepore CommitDate: 2021-09-28 19:29:10 +0000 Fix busdma resource leak on usb device detach. When a usb device is detached, usb_pc_dmamap_destroy() called bus_dmamap_destroy() while the map was still loaded. That's harmless on x86 architectures, but on all other platforms it causes bus_dmamap_destroy() to return EBUSY and leak away any memory resources (including bounce buffers) associated with the mapping, as well as any allocated map structure itself. This change introduces a new is_loaded flag to the usb_page_cache struct to track whether a map is loaded or not. If the map is loaded, bus_dmamap_unload() is called before bus_dmamap_destroy() to avoid leaking away resources. MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D32208 --- sys/dev/usb/usb_busdma.c | 16 +++++++++++++--- sys/dev/usb/usb_busdma.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/usb_busdma.c b/sys/dev/usb/usb_busdma.c index 4806903fa83a..62e22805b39c 100644 --- a/sys/dev/usb/usb_busdma.c +++ b/sys/dev/usb/usb_busdma.c @@ -600,6 +600,7 @@ usb_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg, bus_dmamem_free(utag->tag, ptr, map); goto error; } + pc->isloaded = 1; memset(ptr, 0, size); usb_pc_cpu_flush(pc); @@ -612,6 +613,7 @@ error: pc->page_start = NULL; pc->page_offset_buf = 0; pc->page_offset_end = 0; + pc->isloaded = 0; pc->map = NULL; pc->tag = NULL; return (1); @@ -626,11 +628,13 @@ void usb_pc_free_mem(struct usb_page_cache *pc) { if (pc && pc->buffer) { - bus_dmamap_unload(pc->tag, pc->map); + if (pc->isloaded) + bus_dmamap_unload(pc->tag, pc->map); bus_dmamem_free(pc->tag, pc->buffer, pc->map); pc->buffer = NULL; + pc->isloaded = 0; } } @@ -662,7 +666,8 @@ usb_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync) * We have to unload the previous loaded DMA * pages before trying to load a new one! */ - bus_dmamap_unload(pc->tag, pc->map); + if (pc->isloaded) + bus_dmamap_unload(pc->tag, pc->map); /* * Try to load memory into DMA. @@ -675,6 +680,7 @@ usb_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync) err = 0; } if (err || uptag->dma_error) { + pc->isloaded = 0; return (1); } } else { @@ -682,7 +688,8 @@ usb_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync) * We have to unload the previous loaded DMA * pages before trying to load a new one! */ - bus_dmamap_unload(pc->tag, pc->map); + if (pc->isloaded) + bus_dmamap_unload(pc->tag, pc->map); /* * Try to load memory into DMA. The callback @@ -693,6 +700,7 @@ usb_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync) &usb_pc_load_mem_cb, pc, BUS_DMA_WAITOK)) { } } + pc->isloaded = 1; } else { if (!sync) { /* @@ -785,6 +793,8 @@ void usb_pc_dmamap_destroy(struct usb_page_cache *pc) { if (pc && pc->tag) { + if (pc->isloaded) + bus_dmamap_unload(pc->tag, pc->map); bus_dmamap_destroy(pc->tag, pc->map); pc->tag = NULL; pc->map = NULL; diff --git a/sys/dev/usb/usb_busdma.h b/sys/dev/usb/usb_busdma.h index ca0631e2ce53..2f60b30963d2 100644 --- a/sys/dev/usb/usb_busdma.h +++ b/sys/dev/usb/usb_busdma.h @@ -101,6 +101,7 @@ struct usb_page_cache { * from the memory. Else write. */ uint8_t ismultiseg:1; /* set if we can have multiple * segments */ + uint8_t isloaded:1; /* Set if map is currently loaded. */ #endif }; From owner-dev-commits-src-all@freebsd.org Tue Sep 28 19:33:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4B816AB002; Tue, 28 Sep 2021 19:33: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 4HJqRd5fxnz4kx0; Tue, 28 Sep 2021 19:33:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A158A2485; Tue, 28 Sep 2021 19:33:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18SJXHlv049288; Tue, 28 Sep 2021 19:33:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SJXHgb049287; Tue, 28 Sep 2021 19:33:17 GMT (envelope-from git) Date: Tue, 28 Sep 2021 19:33:17 GMT Message-Id: <202109281933.18SJXHgb049287@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 0b159faaca08 - main - Temporarily skip flaky tset cases under sys.aio.aio_test in CI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b159faaca08e6cc89abcd29b4b1360f97e18245 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 19:33:17 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=0b159faaca08e6cc89abcd29b4b1360f97e18245 commit 0b159faaca08e6cc89abcd29b4b1360f97e18245 Author: Li-Wen Hsu AuthorDate: 2021-09-28 19:32:47 +0000 Commit: Li-Wen Hsu CommitDate: 2021-09-28 19:32:47 +0000 Temporarily skip flaky tset cases under sys.aio.aio_test in CI - sys.aio.aio_test.vectored_unaligned - sys.aio.aio_test.vectored_zvol_poll PR: 258766 Sponsored by: The FreeBSD Foundation --- tests/sys/aio/aio_test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index c3cf1d372e23..44bf85a10241 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -1813,6 +1813,9 @@ ATF_TC_BODY(vectored_unaligned, tc) ssize_t len, total_len; int fd; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/258766"); + ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); @@ -1902,6 +1905,8 @@ ATF_TC_HEAD(vectored_zvol_poll, tc) } ATF_TC_BODY(vectored_zvol_poll, tc) { + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/258766"); aio_zvol_test(poll, NULL, true); } ATF_TC_CLEANUP(vectored_zvol_poll, tc) From owner-dev-commits-src-all@freebsd.org Tue Sep 28 20:18:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 215FF6AAF78; Tue, 28 Sep 2021 20:18:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJrRH0CbQz4pjf; Tue, 28 Sep 2021 20:18:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB2082C30; Tue, 28 Sep 2021 20:18: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 18SKI26M003169; Tue, 28 Sep 2021 20:18:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SKI2un003168; Tue, 28 Sep 2021 20:18:02 GMT (envelope-from git) Date: Tue, 28 Sep 2021 20:18:02 GMT Message-Id: <202109282018.18SKI2un003168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 820da5820e60 - main - mgb: Apply some style(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 820da5820e60f538d3598d8cb226f51a01bdf01c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 20:18:03 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=820da5820e60f538d3598d8cb226f51a01bdf01c commit 820da5820e60f538d3598d8cb226f51a01bdf01c Author: Ed Maste AuthorDate: 2021-09-28 20:08:14 +0000 Commit: Ed Maste CommitDate: 2021-09-28 20:17:16 +0000 mgb: Apply some style(9) Add parens around return values, rewrap lines MFC after: 1 week Fixes: 8890ab7758b8 ("Introduce if_mgb driver...") Sponsored by: The FreeBSD Foundation --- sys/dev/mgb/if_mgb.c | 81 ++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index 9515d0d5d788..d4dda0bf65fd 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -397,8 +397,7 @@ mgb_attach_pre(if_ctx_t ctx) goto fail; } - switch (pci_get_device(sc->dev)) - { + switch (pci_get_device(sc->dev)) { case MGB_LAN7430_DEVICE_ID: phyaddr = 1; break; @@ -556,7 +555,7 @@ mgb_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int ntxqs, rdata->head_wb = (uint32_t *) vaddrs[q * ntxqs + 1]; rdata->head_wb_bus_addr = paddrs[q * ntxqs + 1]; } - return 0; + return (0); } static int @@ -580,7 +579,7 @@ mgb_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs, rdata->head_wb = (uint32_t *) vaddrs[q * nrxqs + 1]; rdata->head_wb_bus_addr = paddrs[q * nrxqs + 1]; } - return 0; + return (0); } static void @@ -787,19 +786,16 @@ mgb_admin_intr(void *xsc) */ /* TODO: shouldn't continue if suspended */ - if ((intr_sts & MGB_INTR_STS_ANY) == 0) - { + if ((intr_sts & MGB_INTR_STS_ANY) == 0) { device_printf(sc->dev, "non-mgb interrupt triggered.\n"); return (FILTER_SCHEDULE_THREAD); } - if ((intr_sts & MGB_INTR_STS_TEST) != 0) - { + if ((intr_sts & MGB_INTR_STS_TEST) != 0) { sc->isr_test_flag = true; CSR_WRITE_REG(sc, MGB_INTR_STS, MGB_INTR_STS_TEST); return (FILTER_HANDLED); } - if ((intr_sts & MGB_INTR_STS_RX_ANY) != 0) - { + if ((intr_sts & MGB_INTR_STS_RX_ANY) != 0) { for (qidx = 0; qidx < scctx->isc_nrxqsets; qidx++) { if ((intr_sts & MGB_INTR_STS_RX(qidx))){ iflib_rx_intr_deferred(sc->ctx, qidx); @@ -808,8 +804,7 @@ mgb_admin_intr(void *xsc) return (FILTER_HANDLED); } /* XXX: TX interrupts should not occur */ - if ((intr_sts & MGB_INTR_STS_TX_ANY) != 0) - { + if ((intr_sts & MGB_INTR_STS_TX_ANY) != 0) { for (qidx = 0; qidx < scctx->isc_ntxqsets; qidx++) { if ((intr_sts & MGB_INTR_STS_RX(qidx))) { /* clear the interrupt sts and run handler */ @@ -960,7 +955,7 @@ mgb_intr_test(struct mgb_softc *sc) MGB_INTR_STS_ANY | MGB_INTR_STS_TEST); CSR_WRITE_REG(sc, MGB_INTR_SET, MGB_INTR_STS_TEST); if (sc->isr_test_flag) - return true; + return (true); for (i = 0; i < MGB_TIMEOUT; i++) { DELAY(10); if (sc->isr_test_flag) @@ -968,7 +963,7 @@ mgb_intr_test(struct mgb_softc *sc) } CSR_WRITE_REG(sc, MGB_INTR_ENBL_CLR, MGB_INTR_STS_TEST); CSR_WRITE_REG(sc, MGB_INTR_STS, MGB_INTR_STS_TEST); - return sc->isr_test_flag; + return (sc->isr_test_flag); } static int @@ -1055,7 +1050,7 @@ mgb_isc_txd_credits_update(void *xsc, uint16_t txqid, bool clear) while (*(rdata->head_wb) != rdata->last_head) { if (!clear) - return 1; + return (1); txd = &rdata->ring[rdata->last_head]; memset(txd, 0, sizeof(struct mgb_ring_desc)); @@ -1080,8 +1075,7 @@ mgb_isc_rxd_available(void *xsc, uint16_t rxqid, qidx_t idx, qidx_t budget) rdata = &sc->rx_ring_data; scctx = iflib_get_softc_ctx(sc->ctx); - for (; idx != *(rdata->head_wb); - idx = MGB_NEXT_RING_IDX(idx)) { + for (; idx != *(rdata->head_wb); idx = MGB_NEXT_RING_IDX(idx)) { avail++; /* XXX: Could verify desc is device owned here */ if (avail == budget) @@ -1116,21 +1110,21 @@ mgb_isc_rxd_pkt_get(void *xsc, if_rxd_info_t ri) device_printf(sc->dev, "Tried to read descriptor ... " "found that it's owned by the driver\n"); - return EINVAL; + return (EINVAL); } if ((rxd.ctl & MGB_RX_DESC_CTL_FS) == 0) { device_printf(sc->dev, "Tried to read descriptor ... " "found that FS is not set.\n"); device_printf(sc->dev, "Tried to read descriptor ... that it FS is not set.\n"); - return EINVAL; + return (EINVAL); } /* XXX: Multi-packet support */ if ((rxd.ctl & MGB_RX_DESC_CTL_LS) == 0) { device_printf(sc->dev, "Tried to read descriptor ... " "found that LS is not set. (Multi-buffer packets not yet supported)\n"); - return EINVAL; + return (EINVAL); } ri->iri_frags[0].irf_flid = 0; ri->iri_frags[0].irf_idx = rdata->last_head; @@ -1212,10 +1206,10 @@ mgb_test_bar(struct mgb_softc *sc) rev = id_rev & 0xFFFF; if (dev_id == MGB_LAN7430_DEVICE_ID || dev_id == MGB_LAN7431_DEVICE_ID) { - return 0; + return (0); } else { device_printf(sc->dev, "ID check failed.\n"); - return ENXIO; + return (ENXIO); } } @@ -1229,7 +1223,7 @@ mgb_alloc_regs(struct mgb_softc *sc) sc->regs = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->regs == NULL) - return ENXIO; + return (ENXIO); return (0); } @@ -1244,7 +1238,7 @@ mgb_release_regs(struct mgb_softc *sc) rman_get_rid(sc->regs), sc->regs); sc->regs = NULL; pci_disable_busmaster(sc->dev); - return error; + return (error); } static int @@ -1264,7 +1258,7 @@ mgb_dma_init(struct mgb_softc *sc) goto fail; fail: - return error; + return (error); } static int @@ -1394,7 +1388,7 @@ mgb_dma_tx_ring_init(struct mgb_softc *sc, int channel) DMAC_START))) device_printf(sc->dev, "Failed to start TX DMAC.\n"); fail: - return error; + return (error); } static int @@ -1418,7 +1412,7 @@ mgb_dmac_control(struct mgb_softc *sc, int start, int channel, */ error = mgb_dmac_control(sc, start, channel, DMAC_STOP); if (error != 0) - return error; + return (error); CSR_WRITE_REG(sc, MGB_DMAC_CMD, MGB_DMAC_CMD_START(start, channel)); break; @@ -1431,7 +1425,7 @@ mgb_dmac_control(struct mgb_softc *sc, int start, int channel, MGB_DMAC_CMD_START(start, channel)); break; } - return error; + return (error); } static int @@ -1442,13 +1436,13 @@ mgb_fct_control(struct mgb_softc *sc, int reg, int channel, switch (cmd) { case FCT_RESET: CSR_WRITE_REG(sc, reg, MGB_FCT_RESET(channel)); - return mgb_wait_for_bits(sc, reg, 0, MGB_FCT_RESET(channel)); + return (mgb_wait_for_bits(sc, reg, 0, MGB_FCT_RESET(channel))); case FCT_ENABLE: CSR_WRITE_REG(sc, reg, MGB_FCT_ENBL(channel)); return (0); case FCT_DISABLE: CSR_WRITE_REG(sc, reg, MGB_FCT_DSBL(channel)); - return mgb_wait_for_bits(sc, reg, 0, MGB_FCT_ENBL(channel)); + return (mgb_wait_for_bits(sc, reg, 0, MGB_FCT_ENBL(channel))); } } @@ -1487,7 +1481,7 @@ mgb_hw_init(struct mgb_softc *sc) goto fail; fail: - return error; + return (error); } static int @@ -1510,7 +1504,7 @@ mgb_mac_init(struct mgb_softc *sc) CSR_UPDATE_REG(sc, MGB_MAC_TX, MGB_MAC_ENBL); CSR_UPDATE_REG(sc, MGB_MAC_RX, MGB_MAC_ENBL); - return MGB_STS_OK; + return (MGB_STS_OK); } static int @@ -1520,7 +1514,7 @@ mgb_phy_reset(struct mgb_softc *sc) CSR_UPDATE_BYTE(sc, MGB_PMT_CTL, MGB_PHY_RESET); if (mgb_wait_for_bits(sc, MGB_PMT_CTL, 0, MGB_PHY_RESET) == MGB_STS_TIMEOUT) - return MGB_STS_TIMEOUT; + return (MGB_STS_TIMEOUT); return (mgb_wait_for_bits(sc, MGB_PMT_CTL, MGB_PHY_READY, 0)); } @@ -1545,12 +1539,11 @@ mgb_wait_for_bits(struct mgb_softc *sc, int reg, int set_bits, int clear_bits) */ DELAY(100); val = CSR_READ_REG(sc, reg); - if ((val & set_bits) == set_bits && - (val & clear_bits) == 0) - return MGB_STS_OK; + if ((val & set_bits) == set_bits && (val & clear_bits) == 0) + return (MGB_STS_OK); } while (i++ < MGB_TIMEOUT); - return MGB_STS_TIMEOUT; + return (MGB_STS_TIMEOUT); } static void @@ -1571,14 +1564,14 @@ mgb_miibus_readreg(device_t dev, int phy, int reg) if (mgb_wait_for_bits(sc, MGB_MII_ACCESS, 0, MGB_MII_BUSY) == MGB_STS_TIMEOUT) - return EIO; + return (EIO); mii_access = (phy & MGB_MII_PHY_ADDR_MASK) << MGB_MII_PHY_ADDR_SHIFT; mii_access |= (reg & MGB_MII_REG_ADDR_MASK) << MGB_MII_REG_ADDR_SHIFT; mii_access |= MGB_MII_BUSY | MGB_MII_READ; CSR_WRITE_REG(sc, MGB_MII_ACCESS, mii_access); if (mgb_wait_for_bits(sc, MGB_MII_ACCESS, 0, MGB_MII_BUSY) == MGB_STS_TIMEOUT) - return EIO; + return (EIO); return (CSR_READ_2_BYTES(sc, MGB_MII_DATA)); } @@ -1590,9 +1583,9 @@ mgb_miibus_writereg(device_t dev, int phy, int reg, int data) sc = iflib_get_softc(device_get_softc(dev)); - if (mgb_wait_for_bits(sc, MGB_MII_ACCESS, - 0, MGB_MII_BUSY) == MGB_STS_TIMEOUT) - return EIO; + if (mgb_wait_for_bits(sc, MGB_MII_ACCESS, 0, MGB_MII_BUSY) == + MGB_STS_TIMEOUT) + return (EIO); mii_access = (phy & MGB_MII_PHY_ADDR_MASK) << MGB_MII_PHY_ADDR_SHIFT; mii_access |= (reg & MGB_MII_REG_ADDR_MASK) << MGB_MII_REG_ADDR_SHIFT; mii_access |= MGB_MII_BUSY | MGB_MII_WRITE; @@ -1600,8 +1593,8 @@ mgb_miibus_writereg(device_t dev, int phy, int reg, int data) CSR_WRITE_REG(sc, MGB_MII_ACCESS, mii_access); if (mgb_wait_for_bits(sc, MGB_MII_ACCESS, 0, MGB_MII_BUSY) == MGB_STS_TIMEOUT) - return EIO; - return 0; + return (EIO); + return (0); } /* XXX: May need to lock these up */ From owner-dev-commits-src-all@freebsd.org Tue Sep 28 20:31:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E12F06AB949; Tue, 28 Sep 2021 20:31: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 4HJrkZ5n0cz4qV0; Tue, 28 Sep 2021 20:31:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A83FF3156; Tue, 28 Sep 2021 20:31: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 18SKVIRA026387; Tue, 28 Sep 2021 20:31:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SKVIME026369; Tue, 28 Sep 2021 20:31:18 GMT (envelope-from git) Date: Tue, 28 Sep 2021 20:31:18 GMT Message-Id: <202109282031.18SKVIME026369@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 667ea7385d9c - main - mgb: Update man page wrt state of the driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 667ea7385d9ce45c376260e9c2c893c51514e25e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 20:31:19 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=667ea7385d9ce45c376260e9c2c893c51514e25e commit 667ea7385d9ce45c376260e9c2c893c51514e25e Author: Ed Maste AuthorDate: 2021-09-28 20:27:28 +0000 Commit: Ed Maste CommitDate: 2021-09-28 20:28:37 +0000 mgb: Update man page wrt state of the driver Be explicit that the driver has caveats and limitations, and remove the note about not being connected to the build: I plan to connect it soon. (Also the note serves no real purpose in a man page that is not installed.) MFC after: 1 week Sponsored by: The FreeBSD Foundation --- share/man/man4/mgb.4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/man/man4/mgb.4 b/share/man/man4/mgb.4 index f491595b257e..6b3cafa5c63d 100644 --- a/share/man/man4/mgb.4 +++ b/share/man/man4/mgb.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 2, 2019 +.Dd September 28, 2021 .Dt MGB 4 .Os .Sh NAME @@ -38,7 +38,8 @@ if_mgb_load="YES" .Sh DESCRIPTION The .Nm -driver is experimental, and is not yet connected to the build. +driver is experimental, and has a number of caveats and limitations. +It is currently available only as a kernel module. .Pp The .Nm From owner-dev-commits-src-all@freebsd.org Tue Sep 28 22:24:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 193D36ACDC4; Tue, 28 Sep 2021 22:24: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 4HJvDx09CJz3Fqx; Tue, 28 Sep 2021 22:24:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9AC4484B; Tue, 28 Sep 2021 22:24: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 18SMOGGo076698; Tue, 28 Sep 2021 22:24:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SMOG82076697; Tue, 28 Sep 2021 22:24:16 GMT (envelope-from git) Date: Tue, 28 Sep 2021 22:24:16 GMT Message-Id: <202109282224.18SMOG82076697@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 7457840230c5 - main - loader: Set twiddle globaldiv to 16 by default 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/main X-Git-Reftype: branch X-Git-Commit: 7457840230c5a470ee5df8abed6ab59c4d008a45 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 22:24:17 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=7457840230c5a470ee5df8abed6ab59c4d008a45 commit 7457840230c5a470ee5df8abed6ab59c4d008a45 Author: Colin Percival AuthorDate: 2021-09-28 18:39:59 +0000 Commit: Colin Percival CommitDate: 2021-09-28 22:24:02 +0000 loader: Set twiddle globaldiv to 16 by default Booting FreeBSD on an EC2 c5.xlarge instance, the loader "twiddles" 810 times over the course of 510 ms, a rate of 1.59 kHz. Even accepting that many systems are slower than this particular VM and will take longer to boot (especially if using spinning-rust disks), this seems like an unhelpfully large amount of twiddling when compared to the ~60 Hz frame rate of many displays; printing the twiddles also consumes roughly 10% of the boot time on the aforementioned VM. Setting the default globaldiv to 16 dramatically reduces the time spent printing twiddles to the console while still twiddling at roughly 100 Hz; this should be ample even for systems which take longer to boot and consequently twiddle slower. Note that this can adjusted via the twiddle_divisor variable in loader.conf, but that file is not processed until nearly halfway through the loader's runtime. Reviewed by: allanjude, jrtc27, kevans MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva Differential Revision: --- stand/common/console.c | 2 +- stand/defaults/loader.conf | 3 ++- stand/libsa/twiddle.c | 2 +- stand/man/loader.8 | 3 ++- stand/man/loader_simp.8 | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/stand/common/console.c b/stand/common/console.c index 7886f9386c14..ff864276f96c 100644 --- a/stand/common/console.c +++ b/stand/common/console.c @@ -56,7 +56,7 @@ cons_probe(void) TSENTER(); /* We want a callback to install the new value when this var changes. */ - env_setenv("twiddle_divisor", EV_VOLATILE, "1", twiddle_set, + env_setenv("twiddle_divisor", EV_VOLATILE, "16", twiddle_set, env_nounset); /* Do all console probes */ diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf index 7bca621e6703..6feb909d708a 100644 --- a/stand/defaults/loader.conf +++ b/stand/defaults/loader.conf @@ -111,7 +111,8 @@ module_blacklist="drm drm2 radeonkms i915kms amdgpu" # Loader module blacklist #tftp.blksize="1428" # Set the RFC 2348 TFTP block size. # If the TFTP server does not support RFC 2348, # the block size is set to 512. Valid: (8,9007) -#twiddle_divisor="1" # >1 means slow down the progress indicator. +#twiddle_divisor="16" # >16 slows down the progress indicator; + # <16 speeds up the progress indicator. ### Kernel settings ######################################## # The following boot_ variables are enabled by setting them to any value. diff --git a/stand/libsa/twiddle.c b/stand/libsa/twiddle.c index 7565295fa1a3..60022e4c8167 100644 --- a/stand/libsa/twiddle.c +++ b/stand/libsa/twiddle.c @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); /* Extra functions from NetBSD standalone printf.c */ -static u_int globaldiv; +static u_int globaldiv = 16; void twiddle(u_int callerdiv) diff --git a/stand/man/loader.8 b/stand/man/loader.8 index e658b41f8338..c606068941a7 100644 --- a/stand/man/loader.8 +++ b/stand/man/loader.8 @@ -644,7 +644,8 @@ Throttles the output of the I/O progress indicator displayed while loading the kernel and modules. This is useful on slow serial consoles where the time spent waiting for these characters to be written can add up to many seconds. -The default is 1 (full speed); a value of 2 spins half as fast, and so on. +The default is 16; a value of 32 spins half as fast, +while a value of 8 spins twice as fast. .It Va vm.kmem_size Sets the size of kernel memory (bytes). This overrides the value determined when the kernel was compiled. diff --git a/stand/man/loader_simp.8 b/stand/man/loader_simp.8 index 689996f244fd..ba0ba76e8f88 100644 --- a/stand/man/loader_simp.8 +++ b/stand/man/loader_simp.8 @@ -624,7 +624,8 @@ Throttles the output of the I/O progress indicator displayed while loading the kernel and modules. This is useful on slow serial consoles where the time spent waiting for these characters to be written can add up to many seconds. -The default is 1 (full speed); a value of 2 spins half as fast, and so on. +The default is 16; a value of 32 spins half as fast, +while a value of 8 spins twice as fast. .It Va vm.kmem_size Sets the size of kernel memory (bytes). This overrides the value determined when the kernel was compiled. From owner-dev-commits-src-all@freebsd.org Wed Sep 29 00:10:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A50C6AE528; Wed, 29 Sep 2021 00:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJxc12n1dz3Njq; Wed, 29 Sep 2021 00:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40AE35FFB; Wed, 29 Sep 2021 00:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18T0AvVR018405; Wed, 29 Sep 2021 00:10:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T0AvGx018404; Wed, 29 Sep 2021 00:10:57 GMT (envelope-from git) Date: Wed, 29 Sep 2021 00:10:57 GMT Message-Id: <202109290010.18T0AvGx018404@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 28ea9470782d - main - sctp: provide a specific stream scheduler function for FCFS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28ea9470782d4d01004b801c3ec7d74761fcf611 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 00:10:57 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=28ea9470782d4d01004b801c3ec7d74761fcf611 commit 28ea9470782d4d01004b801c3ec7d74761fcf611 Author: Michael Tuexen AuthorDate: 2021-09-29 00:08:37 +0000 Commit: Michael Tuexen CommitDate: 2021-09-29 00:08:37 +0000 sctp: provide a specific stream scheduler function for FCFS A KASSERT in the genric routine does not apply and triggers incorrectly. Reported by: syzbot+8435af157238c6a11430@syzkaller.appspotmail.com MFC after: 1 week --- sys/netinet/sctp_ss_functions.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index fe4b96cf00ab..5293c0fee742 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -863,6 +863,30 @@ default_again: return (strq); } +static void +sctp_ss_fcfs_scheduled(struct sctp_tcb *stcb, + struct sctp_nets *net SCTP_UNUSED, + struct sctp_association *asoc, + struct sctp_stream_out *strq, + int moved_how_much SCTP_UNUSED) +{ + struct sctp_stream_queue_pending *sp; + + KASSERT(strq != NULL, ("strq is NULL")); + asoc->ss_data.last_out_stream = strq; + if (asoc->idata_supported == 0) { + sp = TAILQ_FIRST(&strq->outqueue); + if ((sp != NULL) && (sp->some_taken == 1)) { + asoc->ss_data.locked_on_sending = strq; + } else { + asoc->ss_data.locked_on_sending = NULL; + } + } else { + asoc->ss_data.locked_on_sending = NULL; + } + return; +} + const struct sctp_ss_functions sctp_ss_functions[] = { /* SCTP_SS_DEFAULT */ { @@ -948,7 +972,7 @@ const struct sctp_ss_functions sctp_ss_functions[] = { .sctp_ss_is_empty = sctp_ss_fcfs_is_empty, .sctp_ss_remove_from_stream = sctp_ss_fcfs_remove, .sctp_ss_select_stream = sctp_ss_fcfs_select, - .sctp_ss_scheduled = sctp_ss_default_scheduled, + .sctp_ss_scheduled = sctp_ss_fcfs_scheduled, .sctp_ss_packet_done = sctp_ss_default_packet_done, .sctp_ss_get_value = sctp_ss_default_get_value, .sctp_ss_set_value = sctp_ss_default_set_value, From owner-dev-commits-src-all@freebsd.org Wed Sep 29 00:43:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDF1F6AF447; Wed, 29 Sep 2021 00:43: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 4HJyKN5197z3QyC; Wed, 29 Sep 2021 00:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BDF36453; Wed, 29 Sep 2021 00:43: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 18T0hKaD062249; Wed, 29 Sep 2021 00:43:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T0hKNm062248; Wed, 29 Sep 2021 00:43:20 GMT (envelope-from git) Date: Wed, 29 Sep 2021 00:43:20 GMT Message-Id: <202109290043.18T0hKNm062248@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: df866676411e - stable/13 - ipmi(4): Limit maximum watchdog pre-timeout interval. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: df866676411e22c9de4b0ebb73fda41906a015c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 00:43:20 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=df866676411e22c9de4b0ebb73fda41906a015c4 commit df866676411e22c9de4b0ebb73fda41906a015c4 Author: Alexander Motin AuthorDate: 2021-09-15 01:06:39 +0000 Commit: Alexander Motin CommitDate: 2021-09-29 00:43:18 +0000 ipmi(4): Limit maximum watchdog pre-timeout interval. Previous code by default setting pre-timeout interval to 120 seconds made impossible to set timeout interval below that, resulting in error 0xcc (Invalid data field in Request) at least on Supermicro boards. To fix that limit maximum pre-timeout interval to ~1/4 of the timeout interval, that sounds like a reasonable default: not too short to fire too late, but also not too long to give many false reports. MFC after: 2 weeks (cherry picked from commit 6c2d4404161aa2bac1c7992afbf5a763f1a6f66e) --- sys/dev/ipmi/ipmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index 77baf652b4bc..a8f3e7f1be10 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -668,7 +668,8 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec) req->ir_request[0] = IPMI_SET_WD_TIMER_DONT_STOP | IPMI_SET_WD_TIMER_SMS_OS; req->ir_request[1] = (wd_timer_actions & 0xff); - req->ir_request[2] = (wd_pretimeout_countdown & 0xff); + req->ir_request[2] = min(0xff, + min(wd_pretimeout_countdown, (sec + 2) / 4)); req->ir_request[3] = 0; /* Timer use */ req->ir_request[4] = (sec * 10) & 0xff; req->ir_request[5] = (sec * 10) >> 8; From owner-dev-commits-src-all@freebsd.org Wed Sep 29 00:44:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 657F96AF494; Wed, 29 Sep 2021 00:44: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 4HJyLD2QqKz3Qyd; Wed, 29 Sep 2021 00:44:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 331F96B0D; Wed, 29 Sep 2021 00:44: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 18T0i4qt062427; Wed, 29 Sep 2021 00:44:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T0i4ie062426; Wed, 29 Sep 2021 00:44:04 GMT (envelope-from git) Date: Wed, 29 Sep 2021 00:44:04 GMT Message-Id: <202109290044.18T0i4ie062426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 5f6b026eee32 - stable/12 - ipmi(4): Limit maximum watchdog pre-timeout interval. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5f6b026eee3201025a02cf81ca41c225d56b99d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 00:44:04 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=5f6b026eee3201025a02cf81ca41c225d56b99d2 commit 5f6b026eee3201025a02cf81ca41c225d56b99d2 Author: Alexander Motin AuthorDate: 2021-09-15 01:06:39 +0000 Commit: Alexander Motin CommitDate: 2021-09-29 00:44:02 +0000 ipmi(4): Limit maximum watchdog pre-timeout interval. Previous code by default setting pre-timeout interval to 120 seconds made impossible to set timeout interval below that, resulting in error 0xcc (Invalid data field in Request) at least on Supermicro boards. To fix that limit maximum pre-timeout interval to ~1/4 of the timeout interval, that sounds like a reasonable default: not too short to fire too late, but also not too long to give many false reports. MFC after: 2 weeks (cherry picked from commit 6c2d4404161aa2bac1c7992afbf5a763f1a6f66e) --- sys/dev/ipmi/ipmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index d48a7d10c289..e95abc3b3127 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -662,7 +662,8 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec) req->ir_request[0] = IPMI_SET_WD_TIMER_DONT_STOP | IPMI_SET_WD_TIMER_SMS_OS; req->ir_request[1] = (wd_timer_actions & 0xff); - req->ir_request[2] = (wd_pretimeout_countdown & 0xff); + req->ir_request[2] = min(0xff, + min(wd_pretimeout_countdown, (sec + 2) / 4)); req->ir_request[3] = 0; /* Timer use */ req->ir_request[4] = (sec * 10) & 0xff; req->ir_request[5] = (sec * 10) >> 8; From owner-dev-commits-src-all@freebsd.org Wed Sep 29 00:44:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B0616AF4AD; Wed, 29 Sep 2021 00:44: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 4HJyLl26Z7z3Qyx; Wed, 29 Sep 2021 00:44:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28C776545; Wed, 29 Sep 2021 00:44: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 18T0iV3u062580; Wed, 29 Sep 2021 00:44:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T0iVwx062579; Wed, 29 Sep 2021 00:44:31 GMT (envelope-from git) Date: Wed, 29 Sep 2021 00:44:31 GMT Message-Id: <202109290044.18T0iVwx062579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 0bd7300e598b - stable/13 - Fix false device_set_unit() error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0bd7300e598bb8ea8c97c397809a6c3a019c4e71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 00:44:31 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=0bd7300e598bb8ea8c97c397809a6c3a019c4e71 commit 0bd7300e598bb8ea8c97c397809a6c3a019c4e71 Author: Alexander Motin AuthorDate: 2021-09-22 12:42:36 +0000 Commit: Alexander Motin CommitDate: 2021-09-29 00:44:29 +0000 Fix false device_set_unit() error. It should silently succeed if the current unit number is the same as requested, not fail immediately. MFC after: 1 week (cherry picked from commit 884f38590c3cc0b1a2c00904c1f1f6c791376308) --- sys/kern/subr_bus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 5bd3a4f3d450..da78a9cb839f 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -3092,6 +3092,8 @@ device_set_unit(device_t dev, int unit) devclass_t dc; int err; + if (unit == dev->unit) + return (0); dc = device_get_devclass(dev); if (unit < dc->maxunit && dc->devices[unit]) return (EBUSY); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 00:44:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 424E36AF60B; Wed, 29 Sep 2021 00: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 4HJyLy5SMKz3Qrf; Wed, 29 Sep 2021 00:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 664E06A9C; Wed, 29 Sep 2021 00: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 18T0igMx062705; Wed, 29 Sep 2021 00: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 18T0igAP062704; Wed, 29 Sep 2021 00:44:42 GMT (envelope-from git) Date: Wed, 29 Sep 2021 00:44:42 GMT Message-Id: <202109290044.18T0igAP062704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 42061b62cc58 - stable/12 - Fix false device_set_unit() error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 42061b62cc58b42396d394c69bf958f9e05dc959 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 00:44:43 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=42061b62cc58b42396d394c69bf958f9e05dc959 commit 42061b62cc58b42396d394c69bf958f9e05dc959 Author: Alexander Motin AuthorDate: 2021-09-22 12:42:36 +0000 Commit: Alexander Motin CommitDate: 2021-09-29 00:44:40 +0000 Fix false device_set_unit() error. It should silently succeed if the current unit number is the same as requested, not fail immediately. MFC after: 1 week (cherry picked from commit 884f38590c3cc0b1a2c00904c1f1f6c791376308) --- sys/kern/subr_bus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 46c098237f48..92c9eb4dd6d5 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -3089,6 +3089,8 @@ device_set_unit(device_t dev, int unit) devclass_t dc; int err; + if (unit == dev->unit) + return (0); dc = device_get_devclass(dev); if (unit < dc->maxunit && dc->devices[unit]) return (EBUSY); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 01:18:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B26166AF8E5; Wed, 29 Sep 2021 01:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJz6T4g77z3jjP; Wed, 29 Sep 2021 01:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 801897146; Wed, 29 Sep 2021 01:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18T1Iva2003473; Wed, 29 Sep 2021 01:18:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T1IvqG003472; Wed, 29 Sep 2021 01:18:57 GMT (envelope-from git) Date: Wed, 29 Sep 2021 01:18:57 GMT Message-Id: <202109290118.18T1IvqG003472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 543df609072f - main - mgb: Connect if_mgb module to the build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 543df609072fe49079c36d6bee510e1645edde3a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 01:18:57 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=543df609072fe49079c36d6bee510e1645edde3a commit 543df609072fe49079c36d6bee510e1645edde3a Author: Ed Maste AuthorDate: 2021-09-28 16:58:40 +0000 Commit: Ed Maste CommitDate: 2021-09-29 01:16:40 +0000 mgb: Connect if_mgb module to the build It supports the following Microchip devices: LAN7430 PCIe Gigabit Ethernet controller with PHY LAN7431 PCIe Gigabit Ethernet controller with RGMII interface The driver has a number of caveats and limitations, but is functional. Relnotes: Yes Sponsored by: The FreeBSD Foundation --- share/man/man4/Makefile | 2 ++ sys/modules/Makefile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index d83f4d03d9db..4dad9b11ec22 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -297,6 +297,7 @@ MAN= aac.4 \ mem.4 \ meteor.4 \ mfi.4 \ + ${_mgb.4} \ miibus.4 \ mld.4 \ mlx.4 \ @@ -816,6 +817,7 @@ _igc.4= igc.4 _imcsmb.4= imcsmb.4 _io.4= io.4 _itwd.4= itwd.4 +_mgb.4= mgb.4 _nda.4= nda.4 _nfe.4= nfe.4 _nfsmb.4= nfsmb.4 diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 2c0c9b48941d..00f5bb281872 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -232,6 +232,7 @@ SUBDIR= \ ${_mana} \ md \ mdio \ + ${_mgb} \ mem \ mfi \ mii \ @@ -652,6 +653,7 @@ _ixv= ixv _lio= lio .endif _mana= mana +_mgb= mgb _nctgpio= nctgpio _ntb= ntb _ocs_fc= ocs_fc From owner-dev-commits-src-all@freebsd.org Wed Sep 29 03:24:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B972F669E64; Wed, 29 Sep 2021 03: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 4HK1vB4Yn3z3qs2; Wed, 29 Sep 2021 03:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72E1F108CD; Wed, 29 Sep 2021 03:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18T3OMpW075529; Wed, 29 Sep 2021 03:24:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T3OMpt075528; Wed, 29 Sep 2021 03:24:22 GMT (envelope-from git) Date: Wed, 29 Sep 2021 03:24:22 GMT Message-Id: <202109290324.18T3OMpt075528@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: fa81f3731d1a - main - nvme: start qpair in state RECOVERY_WAITING 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/main X-Git-Reftype: branch X-Git-Commit: fa81f3731d1a2984a28ae44e60d12a0659b8fd2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 03:24:22 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fa81f3731d1a2984a28ae44e60d12a0659b8fd2f commit fa81f3731d1a2984a28ae44e60d12a0659b8fd2f Author: Warner Losh AuthorDate: 2021-09-29 03:09:45 +0000 Commit: Warner Losh CommitDate: 2021-09-29 03:16:19 +0000 nvme: start qpair in state RECOVERY_WAITING An interrupt happens on the admin queue right away after the reset, so as soon as we enable interrupts, we'll get a call to our interrupt handler. It is safe to ignore this interrupt if we're not yet initialized, or to process it if we are. If we are initialized, we'll see there's no completion records and return. If we're not, we'll process no completion records and return. Either way, nothing is processed and nothing is lost. Until we've completely setup the qpair, we need to avoid processing completion records. Start the qpair in the waiting recovery state so we return immediately when we try to process completions. The code already sets it to 'NONE' when we're initialization is complete. It's safe to defer completion processing here because we don't send any commands before the initialization of the software state of the qpair is complete. And even if we were to somehow send a command prior to that completing, the completion record for that command would be processed when we send commands to the admin qpair after we've setup the software state. There's no good central point to add an assert for this last condition. This fixes an KASSERT "received completion for unknown cmd" panic on boot. Fixes: 502dc84a8b6703e7c0626739179a3cdffdd22d81 Sponsored by: Netflix Reviewed by: mav, cperciva, gallatin Differential Revision: https://reviews.freebsd.org/D32210 --- sys/dev/nvme/nvme_qpair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 7a17a057f319..6ee5fa9d4c30 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -740,7 +740,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, callout_init(&qpair->timer, 1); qpair->timer_armed = false; - qpair->recovery_state = RECOVERY_NONE; + qpair->recovery_state = RECOVERY_WAITING; /* * Calcuate the stride of the doorbell register. Many emulators set this From owner-dev-commits-src-all@freebsd.org Wed Sep 29 03:24:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D27AA669B59; Wed, 29 Sep 2021 03: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 4HK1vC4z45z3qs6; Wed, 29 Sep 2021 03:24:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BCBB10CCE; Wed, 29 Sep 2021 03: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 18T3ON8k075560; Wed, 29 Sep 2021 03: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 18T3ONUd075559; Wed, 29 Sep 2021 03:24:23 GMT (envelope-from git) Date: Wed, 29 Sep 2021 03:24:23 GMT Message-Id: <202109290324.18T3ONUd075559@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7d5eebe0f4a0 - main - nvme: Add sanity check for phase on startup. 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/main X-Git-Reftype: branch X-Git-Commit: 7d5eebe0f4a0f2aa5c8c7dfdd1a9ce1513849da8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 03:24:24 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7d5eebe0f4a0f2aa5c8c7dfdd1a9ce1513849da8 commit 7d5eebe0f4a0f2aa5c8c7dfdd1a9ce1513849da8 Author: Warner Losh AuthorDate: 2021-09-29 03:11:17 +0000 Commit: Warner Losh CommitDate: 2021-09-29 03:18:00 +0000 nvme: Add sanity check for phase on startup. The proper phase for the qpiar right after reset in the first interrupt is 1. For it, make sure that we're not still in phase 0. This is an illegal state to be processing interrupts and indicates that we've failed to properly protect against a race between initializing our state and processing interrupts. Modify stat resetting code so it resets the number of interrpts to 1 instead of 0 so we don't trigger a false positive panic. Sponsored by: Netflix Reviewed by: cperciva, mav (prior version) Differential Revision: https://reviews.freebsd.org/D32211 --- sys/dev/nvme/nvme_qpair.c | 21 ++++++++++++++++++--- sys/dev/nvme/nvme_sysctl.c | 7 ++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 6ee5fa9d4c30..827054efd48e 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -536,16 +536,31 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) int done = 0; bool in_panic = dumping || SCHEDULER_STOPPED(); - qpair->num_intr_handler_calls++; - /* * qpair is not enabled, likely because a controller reset is is in * progress. Ignore the interrupt - any I/O that was associated with - * this interrupt will get retried when the reset is complete. + * this interrupt will get retried when the reset is complete. Any + * pending completions for when we're in startup will be completed + * as soon as initialization is complete and we start sending commands + * to the device. */ if (qpair->recovery_state != RECOVERY_NONE) return (false); + /* + * Sanity check initialization. After we reset the hardware, the phase + * is defined to be 1. So if we get here with zero prior calls and the + * phase is 0, it means that we've lost a race between the + * initialization and the ISR running. With the phase wrong, we'll + * process a bunch of completions that aren't really completions leading + * to a KASSERT below. + */ + KASSERT(!(qpair->num_intr_handler_calls == 0 && qpair->phase == 0), + ("%s: Phase wrong for first interrupt call.", + device_get_nameunit(qpair->ctrlr->dev))); + + qpair->num_intr_handler_calls++; + bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c index 9ec1f14511f5..58db38dc373d 100644 --- a/sys/dev/nvme/nvme_sysctl.c +++ b/sys/dev/nvme/nvme_sysctl.c @@ -155,8 +155,13 @@ static void nvme_qpair_reset_stats(struct nvme_qpair *qpair) { + /* + * Reset the values. Due to sanity checks in + * nvme_qpair_process_completions, we reset the number of interrupt + * calls to 1. + */ qpair->num_cmds = 0; - qpair->num_intr_handler_calls = 0; + qpair->num_intr_handler_calls = 1; qpair->num_retries = 0; qpair->num_failures = 0; } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 03:24:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CBB7669DCF; Wed, 29 Sep 2021 03: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 4HK1vF0Tmfz3qq6; Wed, 29 Sep 2021 03:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B690610CCF; Wed, 29 Sep 2021 03: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 18T3OOmS075584; Wed, 29 Sep 2021 03: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 18T3OOEm075583; Wed, 29 Sep 2021 03:24:24 GMT (envelope-from git) Date: Wed, 29 Sep 2021 03:24:24 GMT Message-Id: <202109290324.18T3OOEm075583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 587aa25525e5 - main - nvme: count number of ignored interrupts 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/main X-Git-Reftype: branch X-Git-Commit: 587aa25525e54ea775298c402acd7a647f9838fb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 03:24:25 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=587aa25525e54ea775298c402acd7a647f9838fb commit 587aa25525e54ea775298c402acd7a647f9838fb Author: Warner Losh AuthorDate: 2021-09-29 03:13:11 +0000 Commit: Warner Losh CommitDate: 2021-09-29 03:18:00 +0000 nvme: count number of ignored interrupts Count the number of times we're asked to process completions, but that we ignore because the state of the qpair isn't in RECOVERY_NONE. Sponsored by: Netflix Reviewed by: mav, chuck Differential Revision: https://reviews.freebsd.org/D32212 --- sys/dev/nvme/nvme_private.h | 1 + sys/dev/nvme/nvme_qpair.c | 5 ++++- sys/dev/nvme/nvme_sysctl.c | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 02cecaf03a97..b00130910a82 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -195,6 +195,7 @@ struct nvme_qpair { int64_t num_intr_handler_calls; int64_t num_retries; int64_t num_failures; + int64_t num_ignored; struct nvme_command *cmd; struct nvme_completion *cpl; diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 827054efd48e..788322092f88 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -544,8 +544,10 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) * as soon as initialization is complete and we start sending commands * to the device. */ - if (qpair->recovery_state != RECOVERY_NONE) + if (qpair->recovery_state != RECOVERY_NONE) { + qpair->num_ignored++; return (false); + } /* * Sanity check initialization. After we reset the hardware, the phase @@ -746,6 +748,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->num_intr_handler_calls = 0; qpair->num_retries = 0; qpair->num_failures = 0; + qpair->num_ignored = 0; qpair->cmd = (struct nvme_command *)queuemem; qpair->cpl = (struct nvme_completion *)(queuemem + cmdsz); prpmem = (uint8_t *)(queuemem + cmdsz + cplsz); diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c index 58db38dc373d..cfcc814f44d2 100644 --- a/sys/dev/nvme/nvme_sysctl.c +++ b/sys/dev/nvme/nvme_sysctl.c @@ -164,6 +164,7 @@ nvme_qpair_reset_stats(struct nvme_qpair *qpair) qpair->num_intr_handler_calls = 1; qpair->num_retries = 0; qpair->num_failures = 0; + qpair->num_ignored = 0; } static int @@ -226,6 +227,21 @@ nvme_sysctl_num_failures(SYSCTL_HANDLER_ARGS) return (sysctl_handle_64(oidp, &num_failures, 0, req)); } +static int +nvme_sysctl_num_ignored(SYSCTL_HANDLER_ARGS) +{ + struct nvme_controller *ctrlr = arg1; + int64_t num_ignored = 0; + int i; + + num_ignored = ctrlr->adminq.num_ignored; + + for (i = 0; i < ctrlr->num_io_queues; i++) + num_ignored += ctrlr->ioq[i].num_ignored; + + return (sysctl_handle_64(oidp, &num_ignored, 0, req)); +} + static int nvme_sysctl_reset_stats(SYSCTL_HANDLER_ARGS) { @@ -281,6 +297,9 @@ nvme_sysctl_initialize_queue(struct nvme_qpair *qpair, SYSCTL_ADD_QUAD(ctrlr_ctx, que_list, OID_AUTO, "num_failures", CTLFLAG_RD, &qpair->num_failures, "Number of commands ending in failure after all retries"); + SYSCTL_ADD_QUAD(ctrlr_ctx, que_list, OID_AUTO, "num_ignored", + CTLFLAG_RD, &qpair->num_ignored, + "Number of interrupts posted, but were administratively ignored"); SYSCTL_ADD_PROC(ctrlr_ctx, que_list, OID_AUTO, "dump_debug", CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, @@ -344,6 +363,11 @@ nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr) ctrlr, 0, nvme_sysctl_num_failures, "IU", "Number of commands ending in failure after all retries"); + SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO, + "num_ignored", CTLTYPE_S64 | CTLFLAG_RD | CTLFLAG_MPSAFE, + ctrlr, 0, nvme_sysctl_num_ignored, "IU", + "Number of interrupts ignored administratively"); + SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO, "reset_stats", CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, ctrlr, 0, nvme_sysctl_reset_stats, "IU", "Reset statistics to zero"); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 03:24:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 300D266A3B3; Wed, 29 Sep 2021 03:24: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 4HK1vF71qPz3qyG; Wed, 29 Sep 2021 03:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD923108CE; Wed, 29 Sep 2021 03: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 18T3OPCO075608; Wed, 29 Sep 2021 03: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 18T3OPwf075607; Wed, 29 Sep 2021 03:24:25 GMT (envelope-from git) Date: Wed, 29 Sep 2021 03:24:25 GMT Message-Id: <202109290324.18T3OPwf075607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 36a87d0c6fe9 - main - nvme: Sanity check completion id 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/main X-Git-Reftype: branch X-Git-Commit: 36a87d0c6fe9d65de23f177ef84000b205f87e39 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 03:24:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=36a87d0c6fe9d65de23f177ef84000b205f87e39 commit 36a87d0c6fe9d65de23f177ef84000b205f87e39 Author: Warner Losh AuthorDate: 2021-09-29 03:21:50 +0000 Commit: Warner Losh CommitDate: 2021-09-29 03:21:50 +0000 nvme: Sanity check completion id Make sure the completion ID is in the range of [0..num_trackers) since the values past the end of the act_tr array are never going to be valid trackers and will lead to pain and suffering if we try to dereference them to get the tracker or to set the tracker back to NULL as we complete the I/O. Sponsored by: Netflix Reviewed by: mav, chs, chuck Differential Revision: https://reviews.freebsd.org/D32088 --- sys/dev/nvme/nvme_qpair.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 788322092f88..8041731099df 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -624,7 +624,10 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) NVME_STATUS_GET_P(status) == NVME_STATUS_GET_P(cpl.status), ("Phase unexpectedly inconsistent")); - tr = qpair->act_tr[cpl.cid]; + if (cpl.cid < qpair->num_trackers) + tr = qpair->act_tr[cpl.cid]; + else + tr = NULL; if (tr != NULL) { nvme_qpair_complete_tracker(tr, &cpl, ERROR_PRINT_ALL); @@ -644,7 +647,8 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) * ignore this condition because it's not unexpected. */ nvme_printf(qpair->ctrlr, - "cpl does not map to outstanding cmd\n"); + "cpl (cid = %u) does not map to outstanding cmd\n", + cpl.cid); /* nvme_dump_completion expects device endianess */ nvme_dump_completion(&qpair->cpl[qpair->cq_head]); KASSERT(0, ("received completion for unknown cmd")); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 04:49:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 763A666AFE4; Wed, 29 Sep 2021 04:49: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 4HK3nX2hGgz4R1M; Wed, 29 Sep 2021 04:49:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BE7111FB1; Wed, 29 Sep 2021 04:49:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18T4nawU081850; Wed, 29 Sep 2021 04:49:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T4navA081849; Wed, 29 Sep 2021 04:49:36 GMT (envelope-from git) Date: Wed, 29 Sep 2021 04:49:36 GMT Message-Id: <202109290449.18T4navA081849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 634a009fa973 - stable/13 - contrib/tzdata: correct DST in Jordan and Samoa MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 634a009fa97371f517ce7be1079f7adb920af813 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 04:49:36 -0000 The branch stable/13 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=634a009fa97371f517ce7be1079f7adb920af813 commit 634a009fa97371f517ce7be1079f7adb920af813 Author: Philip Paeps AuthorDate: 2021-09-29 04:43:58 +0000 Commit: Philip Paeps CommitDate: 2021-09-29 04:44:34 +0000 contrib/tzdata: correct DST in Jordan and Samoa Direct commit to stable/13. The recent tzdata 2021b release includes several controversial changes under active debate on the tz mailing list. Pending consensus, and hopefully a 2021c release reflecting it, only merge the DST changes for Jordan and Samoa. This corrects present and future timestamps in those regions. --- contrib/tzdata/asia | 11 ++++++++++- contrib/tzdata/australasia | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index ed944130e99f..27d944946b56 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -2234,6 +2234,14 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u # From Paul Eggert (2013-12-11): # As Steffen suggested, consider the past 21-month experiment to be DST. +# From Steffen Thorsen (2021-09-24): +# The Jordanian Government announced yesterday that they will start DST +# in February instead of March: +# https://petra.gov.jo/Include/InnerPage.jsp?ID=37683&lang=en&name=en_news (English) +# https://petra.gov.jo/Include/InnerPage.jsp?ID=189969&lang=ar&name=news (Arabic) +# From the Arabic version, it seems to say it would be at midnight +# (assume 24:00) on the last Thursday in February, starting from 2022. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Jordan 1973 only - Jun 6 0:00 1:00 S Rule Jordan 1973 1975 - Oct 1 0:00 0 - @@ -2264,8 +2272,9 @@ Rule Jordan 2004 only - Oct 15 0:00s 0 - Rule Jordan 2005 only - Sep lastFri 0:00s 0 - Rule Jordan 2006 2011 - Oct lastFri 0:00s 0 - Rule Jordan 2013 only - Dec 20 0:00 0 - -Rule Jordan 2014 max - Mar lastThu 24:00 1:00 S +Rule Jordan 2014 2021 - Mar lastThu 24:00 1:00 S Rule Jordan 2014 max - Oct lastFri 0:00s 0 - +Rule Jordan 2022 max - Feb lastThu 24:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 2:00 Jordan EE%sT diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index cf8a0638f831..a2c5ee86eecf 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -742,13 +742,17 @@ Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands # From Paul Eggert (2014-07-08): # That web page currently lists transitions for 2012/3 and 2013/4. # Assume the pattern instituted in 2012 will continue indefinitely. +# +# From Geoffrey D. Bennett (2021-09-20): +# https://www.mcil.gov.ws/storage/2021/09/MCIL-Scan_20210920_120553.pdf +# DST has been cancelled for this year. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule WS 2010 only - Sep lastSun 0:00 1 - Rule WS 2011 only - Apr Sat>=1 4:00 0 - Rule WS 2011 only - Sep lastSat 3:00 1 - -Rule WS 2012 max - Apr Sun>=1 4:00 0 - -Rule WS 2012 max - Sep lastSun 3:00 1 - +Rule WS 2012 2021 - Apr Sun>=1 4:00 0 - +Rule WS 2012 2020 - Sep lastSun 3:00 1 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1892 Jul 5 -11:26:56 - LMT 1911 From owner-dev-commits-src-all@freebsd.org Wed Sep 29 04:49:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8147666B791; Wed, 29 Sep 2021 04:49: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 4HK3nw3Dh6z3wVG; Wed, 29 Sep 2021 04:49:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4EC2011F3C; Wed, 29 Sep 2021 04:49: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 18T4nujn081983; Wed, 29 Sep 2021 04:49:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T4nu6X081982; Wed, 29 Sep 2021 04:49:56 GMT (envelope-from git) Date: Wed, 29 Sep 2021 04:49:56 GMT Message-Id: <202109290449.18T4nu6X081982@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 75245fdb05f2 - stable/12 - contrib/tzdata: correct DST in Jordan and Samoa MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 75245fdb05f25b1211ec9d0a366052ffbe276259 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 04:49:56 -0000 The branch stable/12 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=75245fdb05f25b1211ec9d0a366052ffbe276259 commit 75245fdb05f25b1211ec9d0a366052ffbe276259 Author: Philip Paeps AuthorDate: 2021-09-29 04:43:58 +0000 Commit: Philip Paeps CommitDate: 2021-09-29 04:45:39 +0000 contrib/tzdata: correct DST in Jordan and Samoa Direct commit to stable/12. The recent tzdata 2021b release includes several controversial changes under active debate on the tz mailing list. Pending consensus, and hopefully a 2021c release reflecting it, only merge the DST changes for Jordan and Samoa. This corrects present and future timestamps in those regions. --- contrib/tzdata/asia | 11 ++++++++++- contrib/tzdata/australasia | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index ed944130e99f..27d944946b56 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -2234,6 +2234,14 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u # From Paul Eggert (2013-12-11): # As Steffen suggested, consider the past 21-month experiment to be DST. +# From Steffen Thorsen (2021-09-24): +# The Jordanian Government announced yesterday that they will start DST +# in February instead of March: +# https://petra.gov.jo/Include/InnerPage.jsp?ID=37683&lang=en&name=en_news (English) +# https://petra.gov.jo/Include/InnerPage.jsp?ID=189969&lang=ar&name=news (Arabic) +# From the Arabic version, it seems to say it would be at midnight +# (assume 24:00) on the last Thursday in February, starting from 2022. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Jordan 1973 only - Jun 6 0:00 1:00 S Rule Jordan 1973 1975 - Oct 1 0:00 0 - @@ -2264,8 +2272,9 @@ Rule Jordan 2004 only - Oct 15 0:00s 0 - Rule Jordan 2005 only - Sep lastFri 0:00s 0 - Rule Jordan 2006 2011 - Oct lastFri 0:00s 0 - Rule Jordan 2013 only - Dec 20 0:00 0 - -Rule Jordan 2014 max - Mar lastThu 24:00 1:00 S +Rule Jordan 2014 2021 - Mar lastThu 24:00 1:00 S Rule Jordan 2014 max - Oct lastFri 0:00s 0 - +Rule Jordan 2022 max - Feb lastThu 24:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 2:00 Jordan EE%sT diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index cf8a0638f831..a2c5ee86eecf 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -742,13 +742,17 @@ Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands # From Paul Eggert (2014-07-08): # That web page currently lists transitions for 2012/3 and 2013/4. # Assume the pattern instituted in 2012 will continue indefinitely. +# +# From Geoffrey D. Bennett (2021-09-20): +# https://www.mcil.gov.ws/storage/2021/09/MCIL-Scan_20210920_120553.pdf +# DST has been cancelled for this year. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule WS 2010 only - Sep lastSun 0:00 1 - Rule WS 2011 only - Apr Sat>=1 4:00 0 - Rule WS 2011 only - Sep lastSat 3:00 1 - -Rule WS 2012 max - Apr Sun>=1 4:00 0 - -Rule WS 2012 max - Sep lastSun 3:00 1 - +Rule WS 2012 2021 - Apr Sun>=1 4:00 0 - +Rule WS 2012 2020 - Sep lastSun 3:00 1 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1892 Jul 5 -11:26:56 - LMT 1911 From owner-dev-commits-src-all@freebsd.org Wed Sep 29 04:50:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5BD066B829; Wed, 29 Sep 2021 04:50: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 4HK3pD3kSbz4Qr2; Wed, 29 Sep 2021 04:50:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6134612084; Wed, 29 Sep 2021 04:50: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 18T4oCqn086002; Wed, 29 Sep 2021 04:50:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T4oCWt085991; Wed, 29 Sep 2021 04:50:12 GMT (envelope-from git) Date: Wed, 29 Sep 2021 04:50:12 GMT Message-Id: <202109290450.18T4oCWt085991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 21e88c53735d - stable/11 - contrib/tzdata: correct DST in Jordan and Samoa MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 21e88c53735de2ba1036d87156e5dda0b4f12991 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 04:50:12 -0000 The branch stable/11 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=21e88c53735de2ba1036d87156e5dda0b4f12991 commit 21e88c53735de2ba1036d87156e5dda0b4f12991 Author: Philip Paeps AuthorDate: 2021-09-29 04:43:58 +0000 Commit: Philip Paeps CommitDate: 2021-09-29 04:47:24 +0000 contrib/tzdata: correct DST in Jordan and Samoa Direct commit to stable/11. The recent tzdata 2021b release includes several controversial changes under active debate on the tz mailing list. Pending consensus, and hopefully a 2021c release reflecting it, only merge the DST changes for Jordan and Samoa. This corrects present and future timestamps in those regions. --- contrib/tzdata/asia | 11 ++++++++++- contrib/tzdata/australasia | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index ed944130e99f..27d944946b56 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -2234,6 +2234,14 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u # From Paul Eggert (2013-12-11): # As Steffen suggested, consider the past 21-month experiment to be DST. +# From Steffen Thorsen (2021-09-24): +# The Jordanian Government announced yesterday that they will start DST +# in February instead of March: +# https://petra.gov.jo/Include/InnerPage.jsp?ID=37683&lang=en&name=en_news (English) +# https://petra.gov.jo/Include/InnerPage.jsp?ID=189969&lang=ar&name=news (Arabic) +# From the Arabic version, it seems to say it would be at midnight +# (assume 24:00) on the last Thursday in February, starting from 2022. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Jordan 1973 only - Jun 6 0:00 1:00 S Rule Jordan 1973 1975 - Oct 1 0:00 0 - @@ -2264,8 +2272,9 @@ Rule Jordan 2004 only - Oct 15 0:00s 0 - Rule Jordan 2005 only - Sep lastFri 0:00s 0 - Rule Jordan 2006 2011 - Oct lastFri 0:00s 0 - Rule Jordan 2013 only - Dec 20 0:00 0 - -Rule Jordan 2014 max - Mar lastThu 24:00 1:00 S +Rule Jordan 2014 2021 - Mar lastThu 24:00 1:00 S Rule Jordan 2014 max - Oct lastFri 0:00s 0 - +Rule Jordan 2022 max - Feb lastThu 24:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 2:00 Jordan EE%sT diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index cf8a0638f831..a2c5ee86eecf 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -742,13 +742,17 @@ Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands # From Paul Eggert (2014-07-08): # That web page currently lists transitions for 2012/3 and 2013/4. # Assume the pattern instituted in 2012 will continue indefinitely. +# +# From Geoffrey D. Bennett (2021-09-20): +# https://www.mcil.gov.ws/storage/2021/09/MCIL-Scan_20210920_120553.pdf +# DST has been cancelled for this year. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule WS 2010 only - Sep lastSun 0:00 1 - Rule WS 2011 only - Apr Sat>=1 4:00 0 - Rule WS 2011 only - Sep lastSat 3:00 1 - -Rule WS 2012 max - Apr Sun>=1 4:00 0 - -Rule WS 2012 max - Sep lastSun 3:00 1 - +Rule WS 2012 2021 - Apr Sun>=1 4:00 0 - +Rule WS 2012 2020 - Sep lastSun 3:00 1 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1892 Jul 5 -11:26:56 - LMT 1911 From owner-dev-commits-src-all@freebsd.org Wed Sep 29 08:35:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCF6666F765; Wed, 29 Sep 2021 08:35: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 4HK8nm5cCnz4l1h; Wed, 29 Sep 2021 08:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A14FA14B61; Wed, 29 Sep 2021 08:35: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 18T8Z83k088200; Wed, 29 Sep 2021 08:35:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18T8Z8ns088199; Wed, 29 Sep 2021 08:35:08 GMT (envelope-from git) Date: Wed, 29 Sep 2021 08:35:08 GMT Message-Id: <202109290835.18T8Z8ns088199@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 5f07d7fe408b - main - mgb: Fix DEBUG (and LINT) build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f07d7fe408bbca5c2f6755c363128107916c08d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 08:35:08 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=5f07d7fe408bbca5c2f6755c363128107916c08d commit 5f07d7fe408bbca5c2f6755c363128107916c08d Author: Li-Wen Hsu AuthorDate: 2021-09-29 08:34:59 +0000 Commit: Li-Wen Hsu CommitDate: 2021-09-29 08:34:59 +0000 mgb: Fix DEBUG (and LINT) build Sponsored by: The FreeBSD Foundation --- sys/dev/mgb/if_mgb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index d4dda0bf65fd..bc944c92625c 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -693,7 +693,6 @@ mgb_dump_some_stats(struct mgb_softc *sc) i, sc->tx_ring_data.ring[i].addr.high, i, sc->tx_ring_data.ring[i].sts); device_printf(sc->dev, "==== DUMP_TX_DMA_RAM ====\n"); - int i; CSR_WRITE_REG(sc, 0x24, 0xF); // DP_SEL & TX_RAM_0 for (i = 0; i < 128; i++) { CSR_WRITE_REG(sc, 0x2C, i); // DP_ADDR From owner-dev-commits-src-all@freebsd.org Wed Sep 29 12:43:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62A52672DD5; Wed, 29 Sep 2021 12:43: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 4HKGJg241qz3Pjw; Wed, 29 Sep 2021 12:43:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2760E17DFC; Wed, 29 Sep 2021 12:43: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 18TChlTr021335; Wed, 29 Sep 2021 12:43:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TChlcO021334; Wed, 29 Sep 2021 12:43:47 GMT (envelope-from git) Date: Wed, 29 Sep 2021 12:43:47 GMT Message-Id: <202109291243.18TChlcO021334@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 25adbd0b8c3f - main - neta: cleanup warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25adbd0b8c3f282b8bdf252379eace8ce57bc927 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 12:43:47 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=25adbd0b8c3f282b8bdf252379eace8ce57bc927 commit 25adbd0b8c3f282b8bdf252379eace8ce57bc927 Author: Bjoern A. Zeeb AuthorDate: 2021-09-29 12:37:16 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-29 12:37:16 +0000 neta: cleanup warning mvneta_find_ethernet_prop_switch() is file-local static to if_mvneta_fdt.c. Normally we would not need a function declararion but in case MVNETA_DEBUG is set it becomes public. Move the function declaration from if_mvneta.c to if_mvneta_fdt.c to avoid a warning during each compile. --- sys/dev/neta/if_mvneta.c | 1 - sys/dev/neta/if_mvneta_fdt.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index fe86f4a5effe..1ddd95cced78 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -186,7 +186,6 @@ STATIC uint64_t mvneta_read_mib(struct mvneta_softc *, int); STATIC void mvneta_update_mib(struct mvneta_softc *); /* Switch */ -STATIC boolean_t mvneta_find_ethernet_prop_switch(phandle_t, phandle_t); STATIC boolean_t mvneta_has_switch(device_t); #define mvneta_sc_lock(sc) mtx_lock(&sc->mtx) diff --git a/sys/dev/neta/if_mvneta_fdt.c b/sys/dev/neta/if_mvneta_fdt.c index bedf4b253a45..85948adb69d4 100644 --- a/sys/dev/neta/if_mvneta_fdt.c +++ b/sys/dev/neta/if_mvneta_fdt.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); static int mvneta_fdt_probe(device_t); static int mvneta_fdt_attach(device_t); +STATIC boolean_t mvneta_find_ethernet_prop_switch(phandle_t, phandle_t); static device_method_t mvneta_fdt_methods[] = { /* Device interface */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 12:46:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34A0C673813; Wed, 29 Sep 2021 12:46: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 4HKGMr6fHyz3QNF; Wed, 29 Sep 2021 12:46:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C040117DFD; Wed, 29 Sep 2021 12:46:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18TCkWnk021648; Wed, 29 Sep 2021 12:46:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TCkWwb021647; Wed, 29 Sep 2021 12:46:32 GMT (envelope-from git) Date: Wed, 29 Sep 2021 12:46:32 GMT Message-Id: <202109291246.18TCkWwb021647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: c39eefe715b3 - main - LinuxKPI: implement dma_set_coherent_mask() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c39eefe715b3c835ce3d91a1c1932197c23c1f3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 12:46:33 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c39eefe715b3c835ce3d91a1c1932197c23c1f3c commit c39eefe715b3c835ce3d91a1c1932197c23c1f3c Author: Bjoern A. Zeeb AuthorDate: 2021-09-27 22:50:07 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-29 12:41:28 +0000 LinuxKPI: implement dma_set_coherent_mask() Coherent is lower 32bit only by default in Linux and our only default dma mask is 64bit currently which violates expectations unless dma_set_coherent_mask() was called explicitly with a different mask. Implement coherent by creating a second tag, and storing the tags in the objects and use the tag from the object wherever possible. This currently does not update the scatterlist or pool (both could be converted but S/G cannot be MFCed as easily). There is a 2nd change embedded in the updated logic of linux_dma_alloc_coherent() to always zero the allocation as otherwise some drivers get cranky on uninialised garbage. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32164 --- .../linuxkpi/common/include/linux/dma-mapping.h | 7 +- sys/compat/linuxkpi/common/src/linux_pci.c | 192 +++++++++++++-------- 2 files changed, 128 insertions(+), 71 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h index 554d4bd4e695..c86a24d1270a 100644 --- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h @@ -92,6 +92,7 @@ struct dma_map_ops { #define DMA_BIT_MASK(n) ((2ULL << ((n) - 1)) - 1ULL) int linux_dma_tag_init(struct device *, u64); +int linux_dma_tag_init_coherent(struct device *, u64); void *linux_dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag); dma_addr_t linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len); @@ -125,10 +126,10 @@ static inline int dma_set_coherent_mask(struct device *dev, u64 dma_mask) { - if (!dma_supported(dev, dma_mask)) + if (!dev->dma_priv || !dma_supported(dev, dma_mask)) return -EIO; - /* XXX Currently we don't support a separate coherent mask. */ - return 0; + + return (linux_dma_tag_init_coherent(dev, dma_mask)); } static inline int diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index ae45df9c6514..5e527fdf0f4b 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -110,13 +110,31 @@ static device_method_t pci_methods[] = { struct linux_dma_priv { uint64_t dma_mask; - struct mtx lock; bus_dma_tag_t dmat; + uint64_t dma_coherent_mask; + bus_dma_tag_t dmat_coherent; + struct mtx lock; struct pctrie ptree; }; #define DMA_PRIV_LOCK(priv) mtx_lock(&(priv)->lock) #define DMA_PRIV_UNLOCK(priv) mtx_unlock(&(priv)->lock) +static int +linux_pdev_dma_uninit(struct pci_dev *pdev) +{ + struct linux_dma_priv *priv; + + priv = pdev->dev.dma_priv; + if (priv->dmat) + bus_dma_tag_destroy(priv->dmat); + if (priv->dmat_coherent) + bus_dma_tag_destroy(priv->dmat_coherent); + mtx_destroy(&priv->lock); + pdev->dev.dma_priv = NULL; + free(priv, M_DEVBUF); + return (0); +} + static int linux_pdev_dma_init(struct pci_dev *pdev) { @@ -124,34 +142,26 @@ linux_pdev_dma_init(struct pci_dev *pdev) int error; priv = malloc(sizeof(*priv), M_DEVBUF, M_WAITOK | M_ZERO); - pdev->dev.dma_priv = priv; mtx_init(&priv->lock, "lkpi-priv-dma", NULL, MTX_DEF); - pctrie_init(&priv->ptree); - /* create a default DMA tag */ + pdev->dev.dma_priv = priv; + + /* Create a default DMA tags. */ error = linux_dma_tag_init(&pdev->dev, DMA_BIT_MASK(64)); - if (error) { - mtx_destroy(&priv->lock); - free(priv, M_DEVBUF); - pdev->dev.dma_priv = NULL; - } - return (error); -} + if (error != 0) + goto err; + /* Coherent is lower 32bit only by default in Linux. */ + error = linux_dma_tag_init_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (error != 0) + goto err; -static int -linux_pdev_dma_uninit(struct pci_dev *pdev) -{ - struct linux_dma_priv *priv; + return (error); - priv = pdev->dev.dma_priv; - if (priv->dmat) - bus_dma_tag_destroy(priv->dmat); - mtx_destroy(&priv->lock); - free(priv, M_DEVBUF); - pdev->dev.dma_priv = NULL; - return (0); +err: + linux_pdev_dma_uninit(pdev); + return (error); } int @@ -185,6 +195,37 @@ linux_dma_tag_init(struct device *dev, u64 dma_mask) return (-error); } +int +linux_dma_tag_init_coherent(struct device *dev, u64 dma_mask) +{ + struct linux_dma_priv *priv; + int error; + + priv = dev->dma_priv; + + if (priv->dmat_coherent) { + if (priv->dma_coherent_mask == dma_mask) + return (0); + + bus_dma_tag_destroy(priv->dmat_coherent); + } + + priv->dma_coherent_mask = dma_mask; + + error = bus_dma_tag_create(bus_get_dma_tag(dev->bsddev), + 1, 0, /* alignment, boundary */ + dma_mask, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filtfunc, filtfuncarg */ + BUS_SPACE_MAXSIZE, /* maxsize */ + 1, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsz */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &priv->dmat_coherent); + return (-error); +} + static struct pci_driver * linux_pci_find(device_t dev, const struct pci_device_id **idp) { @@ -704,6 +745,7 @@ struct linux_dma_obj { void *vaddr; uint64_t dma_addr; bus_dmamap_t dmamap; + bus_dma_tag_t dmat; }; static uma_zone_t linux_dma_trie_zone; @@ -749,44 +791,10 @@ linux_dma_trie_free(struct pctrie *ptree, void *node) PCTRIE_DEFINE(LINUX_DMA, linux_dma_obj, dma_addr, linux_dma_trie_alloc, linux_dma_trie_free); -void * -linux_dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) -{ - struct linux_dma_priv *priv; - vm_paddr_t high; - size_t align; - void *mem; - - if (dev == NULL || dev->dma_priv == NULL) { - *dma_handle = 0; - return (NULL); - } - priv = dev->dma_priv; - if (priv->dma_mask) - high = priv->dma_mask; - else if (flag & GFP_DMA32) - high = BUS_SPACE_MAXADDR_32BIT; - else - high = BUS_SPACE_MAXADDR; - align = PAGE_SIZE << get_order(size); - mem = (void *)kmem_alloc_contig(size, flag & GFP_NATIVE_MASK, 0, high, - align, 0, VM_MEMATTR_DEFAULT); - if (mem != NULL) { - *dma_handle = linux_dma_map_phys(dev, vtophys(mem), size); - if (*dma_handle == 0) { - kmem_free((vm_offset_t)mem, size); - mem = NULL; - } - } else { - *dma_handle = 0; - } - return (mem); -} - #if defined(__i386__) || defined(__amd64__) || defined(__aarch64__) -dma_addr_t -linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) +static dma_addr_t +linux_dma_map_phys_common(struct device *dev, vm_paddr_t phys, size_t len, + bus_dma_tag_t dmat) { struct linux_dma_priv *priv; struct linux_dma_obj *obj; @@ -801,25 +809,26 @@ linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) * bus_dma API. This avoids tracking collisions in the pctrie * with the additional benefit of reducing overhead. */ - if (bus_dma_id_mapped(priv->dmat, phys, len)) + if (bus_dma_id_mapped(dmat, phys, len)) return (phys); obj = uma_zalloc(linux_dma_obj_zone, M_NOWAIT); if (obj == NULL) { return (0); } + obj->dmat = dmat; DMA_PRIV_LOCK(priv); - if (bus_dmamap_create(priv->dmat, 0, &obj->dmamap) != 0) { + if (bus_dmamap_create(obj->dmat, 0, &obj->dmamap) != 0) { DMA_PRIV_UNLOCK(priv); uma_zfree(linux_dma_obj_zone, obj); return (0); } nseg = -1; - if (_bus_dmamap_load_phys(priv->dmat, obj->dmamap, phys, len, + if (_bus_dmamap_load_phys(obj->dmat, obj->dmamap, phys, len, BUS_DMA_NOWAIT, &seg, &nseg) != 0) { - bus_dmamap_destroy(priv->dmat, obj->dmamap); + bus_dmamap_destroy(obj->dmat, obj->dmamap); DMA_PRIV_UNLOCK(priv); uma_zfree(linux_dma_obj_zone, obj); return (0); @@ -830,8 +839,8 @@ linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) error = LINUX_DMA_PCTRIE_INSERT(&priv->ptree, obj); if (error != 0) { - bus_dmamap_unload(priv->dmat, obj->dmamap); - bus_dmamap_destroy(priv->dmat, obj->dmamap); + bus_dmamap_unload(obj->dmat, obj->dmamap); + bus_dmamap_destroy(obj->dmat, obj->dmamap); DMA_PRIV_UNLOCK(priv); uma_zfree(linux_dma_obj_zone, obj); return (0); @@ -841,12 +850,22 @@ linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) } #else dma_addr_t -linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) +linux_dma_map_phys_common(struct device *dev __unused, vm_paddr_t phys, + size_t len __unused, bus_dma_tag_t dmat __unused) { return (phys); } #endif +dma_addr_t +linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) +{ + struct linux_dma_priv *priv; + + priv = dev->dma_priv; + return (linux_dma_map_phys_common(dev, phys, len, priv->dmat)); +} + #if defined(__i386__) || defined(__amd64__) || defined(__aarch64__) void linux_dma_unmap(struct device *dev, dma_addr_t dma_addr, size_t len) @@ -866,8 +885,8 @@ linux_dma_unmap(struct device *dev, dma_addr_t dma_addr, size_t len) return; } LINUX_DMA_PCTRIE_REMOVE(&priv->ptree, dma_addr); - bus_dmamap_unload(priv->dmat, obj->dmamap); - bus_dmamap_destroy(priv->dmat, obj->dmamap); + bus_dmamap_unload(obj->dmat, obj->dmamap); + bus_dmamap_destroy(obj->dmat, obj->dmamap); DMA_PRIV_UNLOCK(priv); uma_zfree(linux_dma_obj_zone, obj); @@ -879,6 +898,43 @@ linux_dma_unmap(struct device *dev, dma_addr_t dma_addr, size_t len) } #endif +void * +linux_dma_alloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t flag) +{ + struct linux_dma_priv *priv; + vm_paddr_t high; + size_t align; + void *mem; + + if (dev == NULL || dev->dma_priv == NULL) { + *dma_handle = 0; + return (NULL); + } + priv = dev->dma_priv; + if (priv->dma_coherent_mask) + high = priv->dma_coherent_mask; + else + /* Coherent is lower 32bit only by default in Linux. */ + high = BUS_SPACE_MAXADDR_32BIT; + align = PAGE_SIZE << get_order(size); + /* Always zero the allocation. */ + flag |= M_ZERO; + mem = (void *)kmem_alloc_contig(size, flag & GFP_NATIVE_MASK, 0, high, + align, 0, VM_MEMATTR_DEFAULT); + if (mem != NULL) { + *dma_handle = linux_dma_map_phys_common(dev, vtophys(mem), size, + priv->dmat_coherent); + if (*dma_handle == 0) { + kmem_free((vm_offset_t)mem, size); + mem = NULL; + } + } else { + *dma_handle = 0; + } + return (mem); +} + int linux_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, enum dma_data_direction dir __unused, unsigned long attrs __unused) From owner-dev-commits-src-all@freebsd.org Wed Sep 29 12:59:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1433D673A84; Wed, 29 Sep 2021 12:59: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 4HKGg1056Qz3hbX; Wed, 29 Sep 2021 12:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6F2B18900; Wed, 29 Sep 2021 12:59: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 18TCxekL035492; Wed, 29 Sep 2021 12:59:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TCxeJP035491; Wed, 29 Sep 2021 12:59:40 GMT (envelope-from git) Date: Wed, 29 Sep 2021 12:59:40 GMT Message-Id: <202109291259.18TCxeJP035491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 4a331971d2f1 - main - mmc: Fix regression in 8a8166e5bcfb breaking Stratix 10 boot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a331971d2f1083f35b87197da0614fa3e0e53cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 12:59:41 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=4a331971d2f1083f35b87197da0614fa3e0e53cb commit 4a331971d2f1083f35b87197da0614fa3e0e53cb Author: Jessica Clarke AuthorDate: 2021-09-29 12:59:13 +0000 Commit: Jessica Clarke CommitDate: 2021-09-29 12:59:13 +0000 mmc: Fix regression in 8a8166e5bcfb breaking Stratix 10 boot The refactoring in 8a8166e5bcfb introduced a functional change that breaks booting on the Stratix 10, hanging when it should be attaching da0. Previously OF_getencprop was called with a pointer to host->f_max, so if it wasn't present then the existing value was left untouched, but after that commit it will instead clobber the value with 0. The dwmmc driver, as used on the Stratix 10, sets a default value before calling mmc_fdt_parse and so was broken by this functional change. It appears that aw_mmc also does the same thing, so was presumably also broken on some boards. Fixes: 8a8166e5bcfb ("mmc: switch mmc_helper to device_ api") Reviewed by: manu, mw Differential Revision: https://reviews.freebsd.org/D32209 --- sys/dev/mmc/mmc_helpers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/mmc/mmc_helpers.c b/sys/dev/mmc/mmc_helpers.c index 0e1e16666367..1a90f291fc47 100644 --- a/sys/dev/mmc/mmc_helpers.c +++ b/sys/dev/mmc/mmc_helpers.c @@ -105,9 +105,9 @@ mmc_parse(device_t dev, struct mmc_helper *helper, struct mmc_host *host) * if it's not present based on the clock that the mmc controller * operates on */ - max_freq = 0; - device_get_property(dev, "max-frequency", &max_freq, sizeof(uint64_t)); - host->f_max = max_freq; + if (device_get_property(dev, "max-frequency", &max_freq, + sizeof(uint64_t)) > 0) + host->f_max = max_freq; if (device_has_property(dev, "broken-cd")) helper->props |= MMC_PROP_BROKEN_CD; From owner-dev-commits-src-all@freebsd.org Wed Sep 29 13:42:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9C7467441A; Wed, 29 Sep 2021 13:42: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 4HKHcP4RV3z3lmY; Wed, 29 Sep 2021 13:42:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 748E61938D; Wed, 29 Sep 2021 13:42: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 18TDgTBu001105; Wed, 29 Sep 2021 13:42:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TDgTNS001104; Wed, 29 Sep 2021 13:42:29 GMT (envelope-from git) Date: Wed, 29 Sep 2021 13:42:29 GMT Message-Id: <202109291342.18TDgTNS001104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: bf8637181a2b - main - pf: implement adaptive mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf8637181a2bb81206ff8c685f1632d07b8feb13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 13:42:29 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bf8637181a2bb81206ff8c685f1632d07b8feb13 commit bf8637181a2bb81206ff8c685f1632d07b8feb13 Author: Kristof Provost AuthorDate: 2021-07-24 11:59:34 +0000 Commit: Kristof Provost CommitDate: 2021-09-29 13:11:54 +0000 pf: implement adaptive mode Use atomic counters to ensure that we correctly track the number of half open states and syncookie responses in-flight. This determines if we activate or deactivate syncookies in adaptive mode. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32134 --- sys/net/pfvar.h | 5 ++++- sys/netpfil/pf/pf.c | 15 +++++++++++++ sys/netpfil/pf/pf_syncookies.c | 51 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b2c177fba68c..90ef19c59172 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1382,7 +1382,8 @@ struct pf_pdesc { enum pf_syncookies_mode { PF_SYNCOOKIES_NEVER = 0, PF_SYNCOOKIES_ALWAYS = 1, - PF_SYNCOOKIES_MODE_MAX = PF_SYNCOOKIES_ALWAYS + PF_SYNCOOKIES_ADAPTIVE = 2, + PF_SYNCOOKIES_MODE_MAX = PF_SYNCOOKIES_ADAPTIVE }; #ifdef _KERNEL @@ -1402,6 +1403,8 @@ struct pf_kstatus { bool keep_counters; enum pf_syncookies_mode syncookies_mode; bool syncookies_active; + uint64_t syncookies_inflight[2]; + uint32_t states_halfopen; }; #endif diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index ac329a37f7bd..b67f688c3f3f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -500,6 +500,15 @@ pf_set_protostate(struct pf_kstate *s, int which, u_int8_t newstate) s->dst.state = newstate; if (which == PF_PEER_DST) return; + if (s->src.state == newstate) + return; + if (s->creatorid == V_pf_status.hostid && + s->key[PF_SK_STACK] != NULL && + s->key[PF_SK_STACK]->proto == IPPROTO_TCP && + !(TCPS_HAVEESTABLISHED(s->src.state) || + s->src.state == TCPS_CLOSED) && + (TCPS_HAVEESTABLISHED(newstate) || newstate == TCPS_CLOSED)) + atomic_add_32(&V_pf_status.states_halfopen, -1); s->src.state = newstate; } @@ -1931,6 +1940,11 @@ pf_unlink_state(struct pf_kstate *s, u_int flags) s->timeout = PFTM_UNLINKED; + /* Ensure we remove it from the list of halfopen states, if needed. */ + if (s->key[PF_SK_STACK] != NULL && + s->key[PF_SK_STACK]->proto == IPPROTO_TCP) + pf_set_protostate(s, PF_PEER_BOTH, TCPS_CLOSED); + PF_HASHROW_UNLOCK(ih); pf_detach_state(s); @@ -4035,6 +4049,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, pf_set_protostate(s, PF_PEER_SRC, TCPS_SYN_SENT); pf_set_protostate(s, PF_PEER_DST, TCPS_CLOSED); s->timeout = PFTM_TCP_FIRST_PACKET; + atomic_add_32(&V_pf_status.states_halfopen, 1); break; case IPPROTO_UDP: pf_set_protostate(s, PF_PEER_SRC, PFUDPS_SINGLE); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 4eabbb5e2744..11093b636777 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -106,6 +106,8 @@ struct pf_syncookie_status { struct callout keytimeout; uint8_t oddeven; uint8_t key[2][SIPHASH_KEY_LENGTH]; + uint32_t hiwat; /* absolute; # of states */ + uint32_t lowat; }; VNET_DEFINE_STATIC(struct pf_syncookie_status, pf_syncookie_status); #define V_pf_syncookie_status VNET(pf_syncookie_status) @@ -242,7 +244,24 @@ pf_synflood_check(struct pf_pdesc *pd) if (pd->pf_mtag && (pd->pf_mtag->tag & PF_TAG_SYNCOOKIE_RECREATED)) return (0); - return (V_pf_status.syncookies_mode); + if (V_pf_status.syncookies_mode != PF_SYNCOOKIES_ADAPTIVE) + return (V_pf_status.syncookies_mode); + + if (!V_pf_status.syncookies_active && + atomic_load_32(&V_pf_status.states_halfopen) > + V_pf_syncookie_status.hiwat) { + /* We'd want to 'pf_syncookie_newkey()' here, but that requires + * the rules write lock, which we can't get with the read lock + * held. */ + callout_reset(&V_pf_syncookie_status.keytimeout, 0, + pf_syncookie_rotate, curvnet); + V_pf_status.syncookies_active = true; + DPFPRINTF(LOG_WARNING, + ("synflood detected, enabling syncookies\n")); + // XXXTODO V_pf_status.lcounters[LCNT_SYNFLOODS]++; + } + + return (V_pf_status.syncookies_active); } void @@ -257,6 +276,9 @@ pf_syncookie_send(struct mbuf *m, int off, struct pf_pdesc *pd) iss, ntohl(pd->hdr.tcp.th_seq) + 1, TH_SYN|TH_ACK, 0, mss, 0, 1, 0); counter_u64_add(V_pf_status.lcounters[KLCNT_SYNCOOKIES_SENT], 1); + /* XXX Maybe only in adaptive mode? */ + atomic_add_64(&V_pf_status.syncookies_inflight[V_pf_syncookie_status.oddeven], + 1); } uint8_t @@ -272,11 +294,17 @@ pf_syncookie_validate(struct pf_pdesc *pd) ack = ntohl(pd->hdr.tcp.th_ack) - 1; cookie.cookie = (ack & 0xff) ^ (ack >> 24); + /* we don't know oddeven before setting the cookie (union) */ + if (atomic_load_64(&V_pf_status.syncookies_inflight[cookie.flags.oddeven]) + == 0) + return (0); + hash = pf_syncookie_mac(pd, cookie, seq); if ((ack & ~0xff) != (hash & ~0xff)) return (0); counter_u64_add(V_pf_status.lcounters[KLCNT_SYNCOOKIES_VALID], 1); + atomic_add_64(&V_pf_status.syncookies_inflight[cookie.flags.oddeven], -1); return (1); } @@ -290,13 +318,22 @@ pf_syncookie_rotate(void *arg) CURVNET_SET((struct vnet *)arg); /* do we want to disable syncookies? */ - if (V_pf_status.syncookies_active) { + if (V_pf_status.syncookies_active && + ((V_pf_status.syncookies_mode == PF_SYNCOOKIES_ADAPTIVE && + (atomic_load_32(&V_pf_status.states_halfopen) + + atomic_load_64(&V_pf_status.syncookies_inflight[0]) + + atomic_load_64(&V_pf_status.syncookies_inflight[1])) < + V_pf_syncookie_status.lowat) || + V_pf_status.syncookies_mode == PF_SYNCOOKIES_NEVER) + ) { V_pf_status.syncookies_active = false; - DPFPRINTF(PF_DEBUG_MISC, ("syncookies disabled")); + DPFPRINTF(PF_DEBUG_MISC, ("syncookies disabled\n")); } /* nothing in flight any more? delete keys and return */ - if (!V_pf_status.syncookies_active) { + if (!V_pf_status.syncookies_active && + atomic_load_64(&V_pf_status.syncookies_inflight[0]) == 0 && + atomic_load_64(&V_pf_status.syncookies_inflight[1]) == 0) { memset(V_pf_syncookie_status.key[0], 0, PF_SYNCOOKIE_SECRET_SIZE); memset(V_pf_syncookie_status.key[1], 0, @@ -305,8 +342,10 @@ pf_syncookie_rotate(void *arg) return; } + PF_RULES_WLOCK(); /* new key, including timeout */ pf_syncookie_newkey(); + PF_RULES_WUNLOCK(); CURVNET_RESTORE(); } @@ -316,11 +355,13 @@ pf_syncookie_newkey(void) { PF_RULES_WASSERT(); + MPASS(V_pf_syncookie_status.oddeven < 2); V_pf_syncookie_status.oddeven = (V_pf_syncookie_status.oddeven + 1) & 0x1; + atomic_store_64(&V_pf_status.syncookies_inflight[V_pf_syncookie_status.oddeven], 0); arc4random_buf(V_pf_syncookie_status.key[V_pf_syncookie_status.oddeven], PF_SYNCOOKIE_SECRET_SIZE); callout_reset(&V_pf_syncookie_status.keytimeout, - PF_SYNCOOKIE_SECRET_LIFETIME, pf_syncookie_rotate, curvnet); + PF_SYNCOOKIE_SECRET_LIFETIME * hz, pf_syncookie_rotate, curvnet); } /* From owner-dev-commits-src-all@freebsd.org Wed Sep 29 13:42:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24343674480; Wed, 29 Sep 2021 13:42: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 4HKHcQ63RRz3lvM; Wed, 29 Sep 2021 13:42:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FEA218DFE; Wed, 29 Sep 2021 13:42: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 18TDgURt001129; Wed, 29 Sep 2021 13:42:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TDgUDY001128; Wed, 29 Sep 2021 13:42:30 GMT (envelope-from git) Date: Wed, 29 Sep 2021 13:42:30 GMT Message-Id: <202109291342.18TDgUDY001128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 955460d41e99 - main - pf: hook up adaptive mode configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 955460d41e99031906841870e02063ffdf227f09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 13:42:31 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=955460d41e99031906841870e02063ffdf227f09 commit 955460d41e99031906841870e02063ffdf227f09 Author: Kristof Provost AuthorDate: 2021-07-24 12:23:59 +0000 Commit: Kristof Provost CommitDate: 2021-09-29 13:11:54 +0000 pf: hook up adaptive mode configuration The kernel side of pf syncookie adaptive mode configuration. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32135 --- sys/netpfil/pf/pf_syncookies.c | 56 ++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 11093b636777..32b2bec6c3d6 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -85,6 +85,7 @@ #include #include +#include #define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x @@ -147,7 +148,10 @@ pf_get_syncookies(struct pfioc_nv *nv) nvlist_add_bool(nvl, "enabled", V_pf_status.syncookies_mode != PF_SYNCOOKIES_NEVER); - nvlist_add_bool(nvl, "adaptive", false); + nvlist_add_bool(nvl, "adaptive", + V_pf_status.syncookies_mode == PF_SYNCOOKIES_ADAPTIVE); + nvlist_add_number(nvl, "highwater", V_pf_syncookie_status.hiwat); + nvlist_add_number(nvl, "lowwater", V_pf_syncookie_status.lowat); nvlpacked = nvlist_pack(nvl, &nv->len); if (nvlpacked == NULL) { @@ -174,6 +178,10 @@ pf_set_syncookies(struct pfioc_nv *nv) void *nvlpacked = NULL; int error; bool enabled, adaptive; + uint32_t hiwat, lowat; + uint8_t newmode; + +#define ERROUT(x) ERROUT_FUNCTION(errout, x) if (nv->len > pf_ioctl_maxcount) return (ENOMEM); @@ -183,38 +191,44 @@ pf_set_syncookies(struct pfioc_nv *nv) return (ENOMEM); error = copyin(nv->data, nvlpacked, nv->len); - if (error) { - free(nvlpacked, M_TEMP); - return (error); - } + if (error) + ERROUT(error); nvl = nvlist_unpack(nvlpacked, nv->len, 0); - if (nvl == NULL) { - free(nvlpacked, M_TEMP); - return (EBADMSG); - } + if (nvl == NULL) + ERROUT(EBADMSG); if (! nvlist_exists_bool(nvl, "enabled") - || ! nvlist_exists_bool(nvl, "adaptive")) { - nvlist_destroy(nvl); - free(nvlpacked, M_TEMP); - return (EBADMSG); - } + || ! nvlist_exists_bool(nvl, "adaptive")) + ERROUT(EBADMSG); enabled = nvlist_get_bool(nvl, "enabled"); adaptive = nvlist_get_bool(nvl, "adaptive"); + PFNV_CHK(pf_nvuint32_opt(nvl, "highwater", &hiwat, + V_pf_syncookie_status.hiwat)); + PFNV_CHK(pf_nvuint32_opt(nvl, "lowwater", &lowat, + V_pf_syncookie_status.lowat)); - if (adaptive) { - nvlist_destroy(nvl); - free(nvlpacked, M_TEMP); - return (ENOTSUP); - } + if (lowat >= hiwat) + ERROUT(EINVAL); + + newmode = PF_SYNCOOKIES_NEVER; + if (enabled) + newmode = adaptive ? PF_SYNCOOKIES_ADAPTIVE : PF_SYNCOOKIES_ALWAYS; PF_RULES_WLOCK(); - error = pf_syncookies_setmode(enabled ? - PF_SYNCOOKIES_ALWAYS : PF_SYNCOOKIES_NEVER); + error = pf_syncookies_setmode(newmode); + + V_pf_syncookie_status.lowat = lowat; + V_pf_syncookie_status.hiwat = hiwat; + PF_RULES_WUNLOCK(); +#undef ERROUT +errout: + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + return (error); } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 13:42:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82066673CB1; Wed, 29 Sep 2021 13:42: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 4HKHcT1rhJz3ls5; Wed, 29 Sep 2021 13:42:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF37F19404; Wed, 29 Sep 2021 13:42:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18TDgWCr001183; Wed, 29 Sep 2021 13:42:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TDgWke001182; Wed, 29 Sep 2021 13:42:32 GMT (envelope-from git) Date: Wed, 29 Sep 2021 13:42:32 GMT Message-Id: <202109291342.18TDgWke001182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 20f015f08d66 - main - pf.conf: document syncookies MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20f015f08d66d0d953e49245cb95c81c118b9ee9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 13:42:33 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=20f015f08d66d0d953e49245cb95c81c118b9ee9 commit 20f015f08d66d0d953e49245cb95c81c118b9ee9 Author: Kristof Provost AuthorDate: 2021-08-14 08:42:03 +0000 Commit: Kristof Provost CommitDate: 2021-09-29 13:41:49 +0000 pf.conf: document syncookies Reviewed by: bcr Obtained from: OpenBSD MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32137 --- share/man/man5/pf.conf.5 | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 1bc7f147e830..9f69db70d90b 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -28,7 +28,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 10, 2021 +.Dd September 25, 2021 .Dt PF.CONF 5 .Os .Sh NAME @@ -539,6 +539,34 @@ For example: .Bd -literal -offset indent set state-policy if-bound .Ed +.It Ar set syncookies never | always | adaptive +When +.Cm syncookies +are active, pf will answer each incoming TCP SYN with a syncookie SYNACK, +without allocating any resources. +Upon reception of the client's ACK in response to the syncookie +SYNACK, pf will evaluate the ruleset and create state if the ruleset +permits it, complete the three way handshake with the target host and +continue the connection with synproxy in place. +This allows pf to be resilient against large synflood attacks which would +run the state table against its limits otherwise. +Due to the blind answers to every incoming SYN syncookies share the caveats of +synproxy, namely seemingly accepting connections that will be dropped later on. +.Pp +.Bl -tag -width adaptive -compact +.It Cm never +pf will never send syncookie SYNACKs (the default). +.It Cm always +pf will always send syncookie SYNACKs. +.It Cm adaptive +pf will enable syncookie mode when a given percentage of the state table +is used up by half-open TCP connections, as in, those that saw the initial +SYN but didn't finish the three way handshake. +The thresholds for entering and leaving syncookie mode can be specified using +.Bd -literal -offset indent +set syncookies adaptive (start 25%, end 12%) +.Ed +.El .It Ar set state-defaults The .Ar state-defaults From owner-dev-commits-src-all@freebsd.org Wed Sep 29 13:42:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 860B767412C; Wed, 29 Sep 2021 13:42: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 4HKHcV0lWpz3m10; Wed, 29 Sep 2021 13:42:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB5FF19119; Wed, 29 Sep 2021 13:42: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 18TDgXBn001208; Wed, 29 Sep 2021 13:42:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TDgXAS001207; Wed, 29 Sep 2021 13:42:33 GMT (envelope-from git) Date: Wed, 29 Sep 2021 13:42:33 GMT Message-Id: <202109291342.18TDgXAS001207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: dc0636636bb1 - main - pf tests: Basic syncookie test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc0636636bb1937283d4f218732ac2357f4ec4f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 13:42:34 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc0636636bb1937283d4f218732ac2357f4ec4f1 commit dc0636636bb1937283d4f218732ac2357f4ec4f1 Author: Kristof Provost AuthorDate: 2021-07-10 11:20:44 +0000 Commit: Kristof Provost CommitDate: 2021-09-29 13:42:01 +0000 pf tests: Basic syncookie test MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32138 --- tests/sys/netpfil/pf/syncookie.sh | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh index 49acd9fab11d..8a4005d0fc6d 100644 --- a/tests/sys/netpfil/pf/syncookie.sh +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -29,6 +29,48 @@ common_dir=$(atf_get_srcdir)/../common +atf_test_case "basic" "cleanup" +basic_head() +{ + atf_set descr 'Basic syncookie test' + atf_set require.user root +} + +basic_body() +{ + pft_init + + epair=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + jexec alcatraz /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/echo_inetd.conf + + ifconfig ${epair}a 192.0.2.2/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "set syncookies always" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + reply=$(echo foo | nc -N -w 5 192.0.2.1 7) + if [ "${reply}" != "foo" ]; + then + atf_fail "Failed to connect to syncookie protected echo daemon" + fi +} + +basic_cleanup() +{ + rm -f inetd-alcatraz.pid + pft_cleanup +} + atf_test_case "forward" "cleanup" forward_head() { @@ -128,6 +170,7 @@ nostate_cleanup() atf_init_test_cases() { + atf_add_test_case "basic" atf_add_test_case "forward" atf_add_test_case "nostate" } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 13:42:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B5BD674481; Wed, 29 Sep 2021 13:42: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 4HKHcR6bsWz3m0w; Wed, 29 Sep 2021 13:42:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6D11191A8; Wed, 29 Sep 2021 13:42: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 18TDgVKI001153; Wed, 29 Sep 2021 13:42:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TDgVTH001152; Wed, 29 Sep 2021 13:42:31 GMT (envelope-from git) Date: Wed, 29 Sep 2021 13:42:31 GMT Message-Id: <202109291342.18TDgVTH001152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5062afff9de7 - main - pfctl: userspace adaptive syncookies configration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5062afff9de7e67da96e3f0dcb9d8bbd5a4e1c5b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 13:42:32 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5062afff9de7e67da96e3f0dcb9d8bbd5a4e1c5b commit 5062afff9de7e67da96e3f0dcb9d8bbd5a4e1c5b Author: Kristof Provost AuthorDate: 2021-08-13 11:42:59 +0000 Commit: Kristof Provost CommitDate: 2021-09-29 13:11:54 +0000 pfctl: userspace adaptive syncookies configration Hook up the userspace bits to configure syncookies in adaptive mode. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32136 --- lib/libpfctl/libpfctl.c | 55 ++++++++++++++++++++++++++++++++++++++++++----- lib/libpfctl/libpfctl.h | 6 +++++- sbin/pfctl/parse.y | 43 ++++++++++++++++++++++++++++++++++-- sbin/pfctl/pfctl.c | 51 ++++++++++++++++++++++++++++++++++++++++++- sbin/pfctl/pfctl_parser.c | 5 +++-- sbin/pfctl/pfctl_parser.h | 8 +++++++ sys/net/pfvar.h | 3 +++ 7 files changed, 160 insertions(+), 11 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 576b256155fb..aaf5998ed0d6 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -50,6 +50,12 @@ #include "libpfctl.h" +const char* PFCTL_SYNCOOKIES_MODE_NAMES[] = { + "never", + "always", + "adaptive" +}; + static int _pfctl_clear_states(int , const struct pfctl_kill *, unsigned int *, uint64_t); @@ -938,17 +944,40 @@ pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed) return (_pfctl_clear_states(dev, kill, killed, DIOCKILLSTATESNV)); } +static int +pfctl_get_limit(int dev, const int index, u_int *limit) +{ + struct pfioc_limit pl; + + bzero(&pl, sizeof(pl)); + pl.index = index; + + if (ioctl(dev, DIOCGETLIMIT, &pl) == -1) + return (errno); + + *limit = pl.limit; + + return (0); +} + int pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s) { struct pfioc_nv nv; nvlist_t *nvl; int ret; + u_int state_limit; + + ret = pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit); + if (ret != 0) + return (ret); nvl = nvlist_create(0); nvlist_add_bool(nvl, "enabled", s->mode != PFCTL_SYNCOOKIES_NEVER); - nvlist_add_bool(nvl, "adaptive", false); /* XXX TODO */ + nvlist_add_bool(nvl, "adaptive", s->mode == PFCTL_SYNCOOKIES_ADAPTIVE); + nvlist_add_number(nvl, "highwater", state_limit * s->highwater / 100); + nvlist_add_number(nvl, "lowwater", state_limit * s->lowwater / 100); nv.data = nvlist_pack(nvl, &nv.len); nv.size = nv.len; @@ -966,12 +995,18 @@ pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) { struct pfioc_nv nv; nvlist_t *nvl; - bool enabled, adaptive; + int ret; + u_int state_limit; + bool enabled, adaptive; + + ret = pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit); + if (ret != 0) + return (ret); bzero(s, sizeof(*s)); - nv.data = malloc(128); - nv.len = nv.size = 128; + nv.data = malloc(256); + nv.len = nv.size = 256; if (ioctl(dev, DIOCGETSYNCOOKIES, &nv)) { free(nv.data); @@ -987,7 +1022,17 @@ pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) enabled = nvlist_get_bool(nvl, "enabled"); adaptive = nvlist_get_bool(nvl, "adaptive"); - s->mode = enabled ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + if (enabled) { + if (adaptive) + s->mode = PFCTL_SYNCOOKIES_ADAPTIVE; + else + s->mode = PFCTL_SYNCOOKIES_ALWAYS; + } else { + s->mode = PFCTL_SYNCOOKIES_NEVER; + } + + s->highwater = nvlist_get_number(nvl, "highwater") * 100 / state_limit; + s->lowwater = nvlist_get_number(nvl, "lowwater") * 100 / state_limit; nvlist_destroy(nvl); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index f57497b4a88a..1f7259ee8d32 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -276,11 +276,15 @@ struct pfctl_states { enum pfctl_syncookies_mode { PFCTL_SYNCOOKIES_NEVER, - PFCTL_SYNCOOKIES_ALWAYS + PFCTL_SYNCOOKIES_ALWAYS, + PFCTL_SYNCOOKIES_ADAPTIVE }; +extern const char* PFCTL_SYNCOOKIES_MODE_NAMES[]; struct pfctl_syncookies { enum pfctl_syncookies_mode mode; + uint8_t highwater; /* Percent */ + uint8_t lowwater; /* Percent */ }; struct pfctl_status* pfctl_get_status(int dev); diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 6bcf5a0bc397..89d5f330da47 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -320,6 +320,7 @@ static struct codel_opts codel_opts; static struct node_hfsc_opts hfsc_opts; static struct node_fairq_opts fairq_opts; static struct node_state_opt *keep_state_defaults = NULL; +static struct pfctl_watermarks syncookie_opts; int disallow_table(struct node_host *, const char *); int disallow_urpf_failed(struct node_host *, const char *); @@ -445,6 +446,7 @@ typedef struct { struct node_hfsc_opts hfsc_opts; struct node_fairq_opts fairq_opts; struct codel_opts codel_opts; + struct pfctl_watermarks *watermarks; } v; int lineno; } YYSTYPE; @@ -531,6 +533,7 @@ int parseport(char *, struct range *r, int); %type pool_opts pool_opt pool_opts_l %type tagged %type rtable +%type syncookie_opts %% ruleset : /* empty */ @@ -729,14 +732,19 @@ option : SET OPTIMIZATION STRING { | SET KEEPCOUNTERS { pf->keep_counters = true; } - | SET SYNCOOKIES syncookie_val { - pf->syncookies = $3; + | SET SYNCOOKIES syncookie_val syncookie_opts { + if (pfctl_cfg_syncookies(pf, $3, $4)) { + yyerror("error setting syncookies"); + YYERROR; + } } ; syncookie_val : STRING { if (!strcmp($1, "never")) $$ = PFCTL_SYNCOOKIES_NEVER; + else if (!strcmp($1, "adaptive")) + $$ = PFCTL_SYNCOOKIES_ADAPTIVE; else if (!strcmp($1, "always")) $$ = PFCTL_SYNCOOKIES_ALWAYS; else { @@ -745,6 +753,37 @@ syncookie_val : STRING { } } ; +syncookie_opts : /* empty */ { $$ = NULL; } + | { + memset(&syncookie_opts, 0, sizeof(syncookie_opts)); + } '(' syncookie_opt_l ')' { $$ = &syncookie_opts; } + ; + +syncookie_opt_l : syncookie_opt_l comma syncookie_opt + | syncookie_opt + ; + +syncookie_opt : STRING STRING { + double val; + char *cp; + + val = strtod($2, &cp); + if (cp == NULL || strcmp(cp, "%")) + YYERROR; + if (val <= 0 || val > 100) { + yyerror("illegal percentage value"); + YYERROR; + } + if (!strcmp($1, "start")) { + syncookie_opts.hi = val; + } else if (!strcmp($1, "end")) { + syncookie_opts.lo = val; + } else { + yyerror("illegal syncookie option"); + YYERROR; + } + } + ; stringall : STRING { $$ = $1; } | ALL { diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 8f3698e398f6..d7bde0012e9b 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1812,6 +1812,10 @@ pfctl_init_options(struct pfctl *pf) pf->limit[PF_LIMIT_TABLE_ENTRIES] = PFR_KENTRY_HIWAT; pf->debug = PF_DEBUG_URGENT; + + pf->syncookies = false; + pf->syncookieswat[0] = PF_SYNCOOKIES_LOWATPCT; + pf->syncookieswat[1] = PF_SYNCOOKIES_HIWATPCT; } int @@ -2069,7 +2073,9 @@ pfctl_load_syncookies(struct pfctl *pf, u_int8_t val) bzero(&cookies, sizeof(cookies)); - cookies.mode = val ? PFCTL_SYNCOOKIES_ALWAYS : PFCTL_SYNCOOKIES_NEVER; + cookies.mode = val; + cookies.lowwater = pf->syncookieswat[0]; + cookies.highwater = pf->syncookieswat[1]; if (pfctl_set_syncookies(dev, &cookies)) { warnx("DIOCSETSYNCOOKIES"); @@ -2078,6 +2084,49 @@ pfctl_load_syncookies(struct pfctl *pf, u_int8_t val) return (0); } +int +pfctl_cfg_syncookies(struct pfctl *pf, uint8_t val, struct pfctl_watermarks *w) +{ + if (val != PF_SYNCOOKIES_ADAPTIVE && w != NULL) { + warnx("syncookies start/end only apply to adaptive"); + return (1); + } + if (val == PF_SYNCOOKIES_ADAPTIVE && w != NULL) { + if (!w->hi) + w->hi = PF_SYNCOOKIES_HIWATPCT; + if (!w->lo) + w->lo = w->hi / 2; + if (w->lo >= w->hi) { + warnx("start must be higher than end"); + return (1); + } + pf->syncookieswat[0] = w->lo; + pf->syncookieswat[1] = w->hi; + pf->syncookieswat_set = 1; + } + + if (pf->opts & PF_OPT_VERBOSE) { + if (val == PF_SYNCOOKIES_NEVER) + printf("set syncookies never\n"); + else if (val == PF_SYNCOOKIES_ALWAYS) + printf("set syncookies always\n"); + else if (val == PF_SYNCOOKIES_ADAPTIVE) { + if (pf->syncookieswat_set) + printf("set syncookies adaptive (start %u%%, " + "end %u%%)\n", pf->syncookieswat[1], + pf->syncookieswat[0]); + else + printf("set syncookies adaptive\n"); + } else { /* cannot happen */ + warnx("king bula ate all syncookies"); + return (1); + } + } + + pf->syncookies = val; + return (0); +} + int pfctl_set_debug(struct pfctl *pf, char *d) { diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 131ad22123e2..91a3a38ef016 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -618,9 +619,9 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } printf("Syncookies\n"); + assert(cookies->mode <= PFCTL_SYNCOOKIES_ADAPTIVE); printf(" %-25s %s\n", "mode", - cookies->mode == PFCTL_SYNCOOKIES_NEVER ? - "never" : "always"); + PFCTL_SYNCOOKIES_MODE_NAMES[cookies->mode]); } } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 12a66e1ae710..484830c61791 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -101,6 +101,8 @@ struct pfctl { char *ifname; bool keep_counters; u_int8_t syncookies; + u_int8_t syncookieswat[2]; /* lowat, highwat, in % */ + u_int8_t syncookieswat_set; u_int8_t timeout_set[PFTM_MAX]; u_int8_t limit_set[PF_LIMIT_MAX]; @@ -200,6 +202,11 @@ struct pfctl_altq { } meta; }; +struct pfctl_watermarks { + uint32_t hi; + uint32_t lo; +}; + #ifdef __FreeBSD__ /* * XXX @@ -270,6 +277,7 @@ int pfctl_set_logif(struct pfctl *, char *); int pfctl_set_hostid(struct pfctl *, u_int32_t); int pfctl_set_debug(struct pfctl *, char *); int pfctl_set_interface_flags(struct pfctl *, char *, int, int); +int pfctl_cfg_syncookies(struct pfctl *, uint8_t, struct pfctl_watermarks *); int parse_config(char *, struct pfctl *); int parse_flags(char *); diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 90ef19c59172..ba5a2d341172 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1386,6 +1386,9 @@ enum pf_syncookies_mode { PF_SYNCOOKIES_MODE_MAX = PF_SYNCOOKIES_ADAPTIVE }; +#define PF_SYNCOOKIES_HIWATPCT 25 +#define PF_SYNCOOKIES_LOWATPCT (PF_SYNCOOKIES_HIWATPCT / 2) + #ifdef _KERNEL struct pf_kstatus { counter_u64_t counters[PFRES_MAX]; /* reason for passing/dropping */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 13:42:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC4636742CF; Wed, 29 Sep 2021 13:42: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 4HKHcW3BqBz3lq3; Wed, 29 Sep 2021 13:42:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F89919405; Wed, 29 Sep 2021 13:42: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 18TDgZMd001232; Wed, 29 Sep 2021 13:42:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TDgZxO001231; Wed, 29 Sep 2021 13:42:35 GMT (envelope-from git) Date: Wed, 29 Sep 2021 13:42:35 GMT Message-Id: <202109291342.18TDgZxO001231@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 2f20d80692ce - main - pf tests: Basic adaptive mode syncookie test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f20d80692ceb584842a7642562fc9f610a5b661 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 13:42:36 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2f20d80692ceb584842a7642562fc9f610a5b661 commit 2f20d80692ceb584842a7642562fc9f610a5b661 Author: Kristof Provost AuthorDate: 2021-09-25 13:05:02 +0000 Commit: Kristof Provost CommitDate: 2021-09-29 13:42:01 +0000 pf tests: Basic adaptive mode syncookie test MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32139 --- tests/sys/netpfil/pf/syncookie.sh | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/sys/netpfil/pf/syncookie.sh b/tests/sys/netpfil/pf/syncookie.sh index 8a4005d0fc6d..d85beac1a4d1 100644 --- a/tests/sys/netpfil/pf/syncookie.sh +++ b/tests/sys/netpfil/pf/syncookie.sh @@ -168,9 +168,59 @@ nostate_cleanup() pft_cleanup } +atf_test_case "adaptive" "cleanup" +adaptive_head() +{ + atf_set descr 'Adaptive mode test' + atf_set require.user root + atf_set require.progs scapy +} + +adaptive_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "set limit states 100" \ + "set syncookies adaptive (start 10%%, end 5%%)" \ + "pass in" \ + "pass out" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + # Now syn flood to create many states + ${common_dir}/pft_synflood.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --count 100 + + # Adaptive mode should kick in and stop us from creating more than + # about 10 states + states=$(jexec alcatraz pfctl -ss | grep tcp | wc -l) + if [ "$states" -gt 20 ]; + then + echo "$states" + atf_fail "Found unexpected states" + fi +} + +adaptive_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" atf_add_test_case "forward" atf_add_test_case "nostate" + atf_add_test_case "adaptive" } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 13:50:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABD95674669; Wed, 29 Sep 2021 13:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKHp54PbXz3mXl; Wed, 29 Sep 2021 13:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 773571942B; Wed, 29 Sep 2021 13:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18TDoreN010170; Wed, 29 Sep 2021 13:50:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TDor9B010169; Wed, 29 Sep 2021 13:50:53 GMT (envelope-from git) Date: Wed, 29 Sep 2021 13:50:53 GMT Message-Id: <202109291350.18TDor9B010169@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 9589362bc980 - main - syslogd: Fix bug that caused -N to drop SecureMode if specified after -s 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/main X-Git-Reftype: branch X-Git-Commit: 9589362bc980290ff84fe61814e5716dea79e931 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 13:50:53 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9589362bc980290ff84fe61814e5716dea79e931 commit 9589362bc980290ff84fe61814e5716dea79e931 Author: jfranklin13 AuthorDate: 2021-09-28 14:49:15 +0000 Commit: Mark Johnston CommitDate: 2021-09-29 13:44:11 +0000 syslogd: Fix bug that caused -N to drop SecureMode if specified after -s MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/541 --- usr.sbin/syslogd/syslogd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index dc07d4781553..5c2555480d3f 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -677,7 +677,8 @@ main(int argc, char *argv[]) break; case 'N': NoBind = 1; - SecureMode = 1; + if (!SecureMode) + SecureMode = 1; break; case 'n': resolve = 0; From owner-dev-commits-src-all@freebsd.org Wed Sep 29 13:55:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07B2F674ABB; Wed, 29 Sep 2021 13:55: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 4HKHvN6brkz3n5H; Wed, 29 Sep 2021 13:55:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3C4719591; Wed, 29 Sep 2021 13:55: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 18TDtSf6014688; Wed, 29 Sep 2021 13:55:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TDtSE6014687; Wed, 29 Sep 2021 13:55:28 GMT (envelope-from git) Date: Wed, 29 Sep 2021 13:55:28 GMT Message-Id: <202109291355.18TDtSE6014687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1269873159c7 - main - LinuxKPI: fix build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1269873159c7fa0db3b9dbf8dadc54eec5dc0d58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 13:55:29 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1269873159c7fa0db3b9dbf8dadc54eec5dc0d58 commit 1269873159c7fa0db3b9dbf8dadc54eec5dc0d58 Author: Bjoern A. Zeeb AuthorDate: 2021-09-29 13:50:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-29 13:50:12 +0000 LinuxKPI: fix build Add a missing "static" for non-{i386,amd64,arm64} which was missed in c39eefe715b3c835ce3d91a1c1932197c23c1f3c. This should ifx the builds. Sponsored by: The FreeBSD Foundation MFC after: 7 days X-MFC with: c39eefe715b3c835ce3d91a1c1932197c23c1f3c --- 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 5e527fdf0f4b..73c9b67bbedb 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -849,7 +849,7 @@ linux_dma_map_phys_common(struct device *dev, vm_paddr_t phys, size_t len, return (obj->dma_addr); } #else -dma_addr_t +static dma_addr_t linux_dma_map_phys_common(struct device *dev __unused, vm_paddr_t phys, size_t len __unused, bus_dma_tag_t dmat __unused) { From owner-dev-commits-src-all@freebsd.org Wed Sep 29 14:02:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59479674E44; Wed, 29 Sep 2021 14:02: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 4HKJ3m22xJz3nwv; Wed, 29 Sep 2021 14:02:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26AE51988C; Wed, 29 Sep 2021 14:02: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 18TE2iIm029565; Wed, 29 Sep 2021 14:02:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TE2iaN029564; Wed, 29 Sep 2021 14:02:44 GMT (envelope-from git) Date: Wed, 29 Sep 2021 14:02:44 GMT Message-Id: <202109291402.18TE2iaN029564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 5aa9f8dae3d4 - main - mgb: Use MGB_DEBUG instead of DEBUG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5aa9f8dae3d40e1780a688ce01401e799b25e7c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 14:02:44 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5aa9f8dae3d40e1780a688ce01401e799b25e7c3 commit 5aa9f8dae3d40e1780a688ce01401e799b25e7c3 Author: Ed Maste AuthorDate: 2021-09-29 13:59:10 +0000 Commit: Ed Maste CommitDate: 2021-09-29 14:00:55 +0000 mgb: Use MGB_DEBUG instead of DEBUG The debug register dump routine is not hooked up and is really only useful to driver developers, so put it under an mgb-specific MGB_DEBUG rather than general DEBUG. MFC after: 1 week Fixes: 8890ab7758b8 ("Introduce if_mgb driver...") Sponsored by: The FreeBSD Foundation --- sys/dev/mgb/if_mgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index bc944c92625c..c62b666f098b 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -620,7 +620,7 @@ mgb_init(if_ctx_t ctx) error); } -#ifdef DEBUG +#ifdef MGB_DEBUG static void mgb_dump_some_stats(struct mgb_softc *sc) { From owner-dev-commits-src-all@freebsd.org Wed Sep 29 14:20:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 336AE6751A5; Wed, 29 Sep 2021 14:20: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 4HKJRn0fYrz3pgw; Wed, 29 Sep 2021 14:20:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAD9519923; Wed, 29 Sep 2021 14:20: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 18TEK4jX045657; Wed, 29 Sep 2021 14:20:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TEK4HD045653; Wed, 29 Sep 2021 14:20:04 GMT (envelope-from git) Date: Wed, 29 Sep 2021 14:20:04 GMT Message-Id: <202109291420.18TEK4HD045653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: d78e464d2330 - main - sdhci_xenon: split driver file into generic file and fdt parts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d78e464d23304084be17cb8db8981558f2829d6c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 14:20:05 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=d78e464d23304084be17cb8db8981558f2829d6c commit d78e464d23304084be17cb8db8981558f2829d6c Author: Bartlomiej Grzesik AuthorDate: 2021-07-15 12:29:15 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-29 14:19:28 +0000 sdhci_xenon: split driver file into generic file and fdt parts This patch splits driver code into two seperate files sdhci_xenon.c and sdhci_xenon_fdt.c. This will allow future implementation of ACPI discovery of sdhci on Xenon chips. Reviewed by: mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31599 --- sys/conf/files.arm64 | 3 +- sys/dev/sdhci/sdhci_xenon.c | 206 ++++++++++++---------------------------- sys/dev/sdhci/sdhci_xenon.h | 29 ++++++ sys/dev/sdhci/sdhci_xenon_fdt.c | 173 +++++++++++++++++++++++++++++++++ 4 files changed, 264 insertions(+), 147 deletions(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 2362c7817025..0d33e315db65 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -274,7 +274,8 @@ dev/psci/smccc.c standard dev/safexcel/safexcel.c optional safexcel fdt -dev/sdhci/sdhci_xenon.c optional sdhci_xenon sdhci fdt +dev/sdhci/sdhci_xenon.c optional sdhci_xenon sdhci +dev/sdhci/sdhci_xenon_fdt.c optional sdhci_xenon sdhci fdt dev/uart/uart_cpu_arm64.c optional uart dev/uart/uart_dev_mu.c optional uart uart_mu diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index d88514d8fd8f..6dc0974c4e4e 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -48,17 +48,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include #include -#include #include #include #include -#include #include #include "mmcbr_if.h" @@ -69,34 +64,6 @@ __FBSDID("$FreeBSD$"); #define MAX_SLOTS 6 -static struct ofw_compat_data compat_data[] = { - { "marvell,armada-3700-sdhci", 1 }, -#ifdef SOC_MARVELL_8K - { "marvell,armada-cp110-sdhci", 1 }, - { "marvell,armada-ap806-sdhci", 1 }, - { "marvell,armada-ap807-sdhci", 1 }, -#endif - { NULL, 0 } -}; - -struct sdhci_xenon_softc { - device_t dev; /* Controller device */ - int slot_id; /* Controller ID */ - phandle_t node; /* FDT node */ - struct resource *irq_res; /* IRQ resource */ - void *intrhand; /* Interrupt handle */ - struct sdhci_fdt_gpio *gpio; /* GPIO pins for CD detection. */ - - struct sdhci_slot *slot; /* SDHCI internal data */ - struct resource *mem_res; /* Memory resource */ - - uint8_t znr; /* PHY ZNR */ - uint8_t zpr; /* PHY ZPR */ - bool slow_mode; /* PHY slow mode */ - - struct mmc_helper mmc_helper; /* MMC helper for parsing FDT */ -}; - static uint8_t sdhci_xenon_read_1(device_t dev, struct sdhci_slot *slot __unused, bus_size_t off) @@ -182,16 +149,7 @@ sdhci_xenon_get_ro(device_t bus, device_t dev) { struct sdhci_xenon_softc *sc = device_get_softc(bus); - return (sdhci_generic_get_ro(bus, dev) ^ - (sc->mmc_helper.props & MMC_PROP_WP_INVERTED)); -} - -static bool -sdhci_xenon_get_card_present(device_t dev, struct sdhci_slot *slot) -{ - struct sdhci_xenon_softc *sc = device_get_softc(dev); - - return (sdhci_fdt_gpio_get_present(sc->gpio)); + return (sdhci_generic_get_ro(bus, dev) ^ sc->wp_inverted); } static void @@ -387,19 +345,19 @@ sdhci_xenon_update_ios(device_t brdev, device_t reqdev) if (bootverbose) device_printf(sc->dev, "Powering down sd/mmc\n"); - if (sc->mmc_helper.vmmc_supply) - regulator_disable(sc->mmc_helper.vmmc_supply); - if (sc->mmc_helper.vqmmc_supply) - regulator_disable(sc->mmc_helper.vqmmc_supply); + if (sc->vmmc_supply) + regulator_disable(sc->vmmc_supply); + if (sc->vqmmc_supply) + regulator_disable(sc->vqmmc_supply); break; case power_up: if (bootverbose) device_printf(sc->dev, "Powering up sd/mmc\n"); - if (sc->mmc_helper.vmmc_supply) - regulator_enable(sc->mmc_helper.vmmc_supply); - if (sc->mmc_helper.vqmmc_supply) - regulator_enable(sc->mmc_helper.vqmmc_supply); + if (sc->vmmc_supply) + regulator_enable(sc->vmmc_supply); + if (sc->vqmmc_supply) + regulator_enable(sc->vqmmc_supply); break; }; @@ -432,8 +390,8 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) sc = device_get_softc(brdev); - if (sc->mmc_helper.vqmmc_supply == NULL) - return EOPNOTSUPP; + if (sc->vqmmc_supply == NULL && !sc->skip_regulators) + return (EOPNOTSUPP); err = 0; @@ -445,15 +403,17 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) hostctrl2 &= ~SDHCI_CTRL2_S18_ENABLE; bus_write_2(sc->mem_res, SDHCI_HOST_CONTROL2, hostctrl2); - uvolt = 3300000; - err = regulator_set_voltage(sc->mmc_helper.vqmmc_supply, - uvolt, uvolt); - if (err != 0) { - device_printf(sc->dev, - "Cannot set vqmmc to %d<->%d\n", - uvolt, - uvolt); - return (err); + if (!sc->skip_regulators) { + uvolt = 3300000; + err = regulator_set_voltage(sc->vqmmc_supply, + uvolt, uvolt); + if (err != 0) { + device_printf(sc->dev, + "Cannot set vqmmc to %d<->%d\n", + uvolt, + uvolt); + return (err); + } } /* @@ -466,25 +426,27 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) hostctrl2 = bus_read_2(sc->mem_res, SDHCI_HOST_CONTROL2); if (!(hostctrl2 & SDHCI_CTRL2_S18_ENABLE)) return (0); - return EAGAIN; + return (EAGAIN); case vccq_180: if (!(slot->host.caps & MMC_CAP_SIGNALING_180)) { - return EINVAL; + return (EINVAL); } if (hostctrl2 & SDHCI_CTRL2_S18_ENABLE) return (0); hostctrl2 |= SDHCI_CTRL2_S18_ENABLE; bus_write_2(sc->mem_res, SDHCI_HOST_CONTROL2, hostctrl2); - uvolt = 1800000; - err = regulator_set_voltage(sc->mmc_helper.vqmmc_supply, - uvolt, uvolt); - if (err != 0) { - device_printf(sc->dev, - "Cannot set vqmmc to %d<->%d\n", - uvolt, - uvolt); - return (err); + if (!sc->skip_regulators) { + uvolt = 1800000; + err = regulator_set_voltage(sc->vqmmc_supply, + uvolt, uvolt); + if (err != 0) { + device_printf(sc->dev, + "Cannot set vqmmc to %d<->%d\n", + uvolt, + uvolt); + return (err); + } } /* @@ -497,62 +459,46 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) hostctrl2 = bus_read_2(sc->mem_res, SDHCI_HOST_CONTROL2); if (hostctrl2 & SDHCI_CTRL2_S18_ENABLE) return (0); - return EAGAIN; + return (EAGAIN); default: device_printf(brdev, "Attempt to set unsupported signaling voltage\n"); - return EINVAL; + return (EINVAL); } } static void -sdhci_xenon_fdt_parse(device_t dev, struct sdhci_slot *slot) +sdhci_xenon_parse_prop(device_t dev) { - struct sdhci_xenon_softc *sc = device_get_softc(dev); - pcell_t cid; + struct sdhci_xenon_softc *sc; + uint64_t val; - mmc_fdt_parse(dev, 0, &sc->mmc_helper, &slot->host); + sc = device_get_softc(dev); + val = 0; - /* Allow dts to patch quirks, slots, and max-frequency. */ - if ((OF_getencprop(sc->node, "quirks", &cid, sizeof(cid))) > 0) - slot->quirks = cid; - if (OF_hasprop(sc->node, "marvell,xenon-phy-slow-mode")) - sc->slow_mode = true; + if (device_get_property(dev, "quirks", &val, sizeof(val)) > 0) + sc->slot->quirks = val; sc->znr = XENON_ZNR_DEF_VALUE; - if ((OF_getencprop(sc->node, "marvell,xenon-phy-znr", &cid, - sizeof(cid))) > 0) - sc->znr = cid & XENON_ZNR_MASK; + if (device_get_property(dev, "marvell,xenon-phy-znr", + &val, sizeof(val)) > 0) + sc->znr = val & XENON_ZNR_MASK; sc->zpr = XENON_ZPR_DEF_VALUE; - if ((OF_getencprop(sc->node, "marvell,xenon-phy-zpr", &cid, - sizeof(cid))) > 0) - sc->zpr = cid & XENON_ZPR_MASK; -} - -static int -sdhci_xenon_probe(device_t dev) -{ - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) - return (ENXIO); - - device_set_desc(dev, "Armada Xenon SDHCI controller"); - - return (0); + if (device_get_property(dev, "marvell,xenon-phy-zpr", + &val, sizeof(val)) > 0) + sc->zpr = val & XENON_ZPR_MASK; + if (device_has_property(dev, "marvell,xenon-phy-slow-mode")) + sc->slow_mode = true; } -static int +int sdhci_xenon_attach(device_t dev) { struct sdhci_xenon_softc *sc = device_get_softc(dev); - struct sdhci_slot *slot; int err, rid; uint32_t reg; sc->dev = dev; sc->slot_id = 0; - sc->node = ofw_bus_get_node(dev); /* Allocate IRQ. */ rid = 0; @@ -574,27 +520,11 @@ sdhci_xenon_attach(device_t dev) return (ENOMEM); } - slot = malloc(sizeof(*slot), M_DEVBUF, M_ZERO | M_WAITOK); - - /* - * Set up any gpio pin handling described in the FDT data. This cannot - * fail; see comments in sdhci_fdt_gpio.h for details. - */ - sc->gpio = sdhci_fdt_gpio_setup(dev, slot); + sdhci_xenon_parse_prop(dev); - sdhci_xenon_fdt_parse(dev, slot); - - slot->max_clk = XENON_MMC_MAX_CLK; - if (slot->host.f_max > 0) - slot->max_clk = slot->host.f_max; - /* Check if the device is flagged as non-removable. */ - if (sc->mmc_helper.props & MMC_PROP_NON_REMOVABLE) { - slot->opt |= SDHCI_NON_REMOVABLE; - if (bootverbose) - device_printf(dev, "Non-removable media\n"); - } - - sc->slot = slot; + sc->slot->max_clk = XENON_MMC_MAX_CLK; + if (sc->slot->host.f_max > 0) + sc->slot->max_clk = sc->slot->host.f_max; if (sdhci_init_slot(dev, sc->slot, 0)) goto fail; @@ -658,14 +588,11 @@ fail: return (ENXIO); } -static int +int sdhci_xenon_detach(device_t dev) { struct sdhci_xenon_softc *sc = device_get_softc(dev); - if (sc->gpio != NULL) - sdhci_fdt_gpio_teardown(sc->gpio); - bus_generic_detach(dev); bus_teardown_intr(dev, sc->irq_res, sc->intrhand); bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq_res), @@ -680,11 +607,6 @@ sdhci_xenon_detach(device_t dev) } static device_method_t sdhci_xenon_methods[] = { - /* device_if */ - DEVMETHOD(device_probe, sdhci_xenon_probe), - DEVMETHOD(device_attach, sdhci_xenon_attach), - DEVMETHOD(device_detach, sdhci_xenon_detach), - /* Bus interface */ DEVMETHOD(bus_read_ivar, sdhci_generic_read_ivar), DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), @@ -708,21 +630,13 @@ static device_method_t sdhci_xenon_methods[] = { DEVMETHOD(sdhci_write_2, sdhci_xenon_write_2), DEVMETHOD(sdhci_write_4, sdhci_xenon_write_4), DEVMETHOD(sdhci_write_multi_4, sdhci_xenon_write_multi_4), - DEVMETHOD(sdhci_get_card_present, sdhci_xenon_get_card_present), DEVMETHOD(sdhci_set_uhs_timing, sdhci_xenon_set_uhs_timing), DEVMETHOD_END }; -static driver_t sdhci_xenon_driver = { - "sdhci_xenon", - sdhci_xenon_methods, - sizeof(struct sdhci_xenon_softc), -}; -static devclass_t sdhci_xenon_devclass; - -DRIVER_MODULE(sdhci_xenon, simplebus, sdhci_xenon_driver, sdhci_xenon_devclass, - NULL, NULL); +DEFINE_CLASS_0(sdhci_xenon, sdhci_xenon_driver, sdhci_xenon_methods, + sizeof(struct sdhci_xenon_softc)); SDHCI_DEPEND(sdhci_xenon); #ifndef MMCCAM diff --git a/sys/dev/sdhci/sdhci_xenon.h b/sys/dev/sdhci/sdhci_xenon.h index 07ed99339b8d..9d8449b90c82 100644 --- a/sys/dev/sdhci/sdhci_xenon.h +++ b/sys/dev/sdhci/sdhci_xenon.h @@ -101,4 +101,33 @@ #define XENON_EMMC_PHY_LOGIC_TIMING_ADJUST (XENON_EMMC_PHY_REG_BASE + 0x18) #define XENON_LOGIC_TIMING_VALUE 0x00AA8977 +DECLARE_CLASS(sdhci_xenon_driver); + +struct sdhci_xenon_softc { + device_t dev; /* Controller device */ + int slot_id; /* Controller ID */ + + struct resource *mem_res; /* Memory resource */ + struct resource *irq_res; /* IRQ resource */ + void *intrhand; /* Interrupt handle */ + + struct sdhci_slot *slot; /* SDHCI internal data */ + + uint8_t znr; /* PHY ZNR */ + uint8_t zpr; /* PHY ZPR */ + bool slow_mode; /* PHY slow mode */ + bool wp_inverted; + bool skip_regulators; /* Don't switch regulators */ + + regulator_t vmmc_supply; + regulator_t vqmmc_supply; + +#ifdef FDT + struct sdhci_fdt_gpio *gpio; /* GPIO pins for CD detection. */ +#endif +}; + +device_attach_t sdhci_xenon_attach; +device_detach_t sdhci_xenon_detach; + #endif /* _SDHCI_XENON_H_ */ diff --git a/sys/dev/sdhci/sdhci_xenon_fdt.c b/sys/dev/sdhci/sdhci_xenon_fdt.c new file mode 100644 index 000000000000..2d96105bd7e9 --- /dev/null +++ b/sys/dev/sdhci/sdhci_xenon_fdt.c @@ -0,0 +1,173 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Semihalf + * + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "mmcbr_if.h" +#include "sdhci_if.h" + +#include "opt_mmccam.h" +#include "opt_soc.h" + +static struct ofw_compat_data compat_data[] = { + { "marvell,armada-3700-sdhci", 1 }, +#ifdef SOC_MARVELL_8K + { "marvell,armada-cp110-sdhci", 1 }, + { "marvell,armada-ap806-sdhci", 1 }, + { "marvell,armada-ap807-sdhci", 1 }, +#endif + { NULL, 0 } +}; + +static bool +sdhci_xenon_fdt_get_card_present(device_t dev, struct sdhci_slot *slot) +{ + struct sdhci_xenon_softc *sc; + + sc = device_get_softc(dev); + + return (sdhci_fdt_gpio_get_present(sc->gpio)); +} + +static int +sdhci_xenon_fdt_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Armada Xenon SDHCI controller"); + + return (BUS_PROBE_SPECIFIC); +} + +static void +sdhci_xenon_fdt_parse(device_t dev, struct sdhci_slot *slot) +{ + struct sdhci_xenon_softc *sc; + struct mmc_helper mmc_helper; + + sc = device_get_softc(dev); + memset(&mmc_helper, 0, sizeof(mmc_helper)); + + /* MMC helper for parsing FDT */ + mmc_fdt_parse(dev, 0, &mmc_helper, &slot->host); + + sc->skip_regulators = false; + sc->vmmc_supply = mmc_helper.vmmc_supply; + sc->vqmmc_supply = mmc_helper.vqmmc_supply; + sc->wp_inverted = mmc_helper.props & MMC_PROP_WP_INVERTED; + + /* Check if the device is flagged as non-removable. */ + if (mmc_helper.props & MMC_PROP_NON_REMOVABLE) { + slot->opt |= SDHCI_NON_REMOVABLE; + if (bootverbose) + device_printf(dev, "Non-removable media\n"); + } +} + +static int +sdhci_xenon_fdt_attach(device_t dev) +{ + struct sdhci_xenon_softc *sc; + struct sdhci_slot *slot; + + sc = device_get_softc(dev); + slot = malloc(sizeof(*slot), M_DEVBUF, M_ZERO | M_WAITOK); + + sdhci_xenon_fdt_parse(dev, slot); + + /* + * Set up any gpio pin handling described in the FDT data. This cannot + * fail; see comments in sdhci_fdt_gpio.h for details. + */ + sc->gpio = sdhci_fdt_gpio_setup(dev, slot); + sc->slot = slot; + + return (sdhci_xenon_attach(dev)); +} + +static int +sdhci_xenon_fdt_detach(device_t dev) +{ + struct sdhci_xenon_softc *sc; + + sc = device_get_softc(dev); + if (sc->gpio != NULL) + sdhci_fdt_gpio_teardown(sc->gpio); + + return (sdhci_xenon_detach(dev)); +} + +static device_method_t sdhci_xenon_fdt_methods[] = { + /* device_if */ + DEVMETHOD(device_probe, sdhci_xenon_fdt_probe), + DEVMETHOD(device_attach, sdhci_xenon_fdt_attach), + DEVMETHOD(device_detach, sdhci_xenon_fdt_detach), + + DEVMETHOD(sdhci_get_card_present, sdhci_xenon_fdt_get_card_present), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(sdhci_xenon, sdhci_xenon_fdt_driver, sdhci_xenon_fdt_methods, + sizeof(struct sdhci_xenon_softc), sdhci_xenon_driver); + +static devclass_t sdhci_xenon_fdt_devclass; + +DRIVER_MODULE(sdhci_xenon, simplebus, sdhci_xenon_fdt_driver, + sdhci_xenon_fdt_devclass, NULL, NULL); + +#ifndef MMCCAM +MMC_DECLARE_BRIDGE(sdhci_xenon_fdt); +#endif From owner-dev-commits-src-all@freebsd.org Wed Sep 29 14:20:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F809675417; Wed, 29 Sep 2021 14:20: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 4HKJRp1B1fz3q5f; Wed, 29 Sep 2021 14:20:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09F1F19996; Wed, 29 Sep 2021 14:20: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 18TEK53g045864; Wed, 29 Sep 2021 14:20:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TEK5pl045861; Wed, 29 Sep 2021 14:20:05 GMT (envelope-from git) Date: Wed, 29 Sep 2021 14:20:05 GMT Message-Id: <202109291420.18TEK5pl045861@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: adbce5ff747b - main - sdhci_xenon: add ACPI support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: adbce5ff747b6372b6cda915d06fe52b4a67b4d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 14:20:06 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=adbce5ff747b6372b6cda915d06fe52b4a67b4d8 commit adbce5ff747b6372b6cda915d06fe52b4a67b4d8 Author: Bartlomiej Grzesik AuthorDate: 2021-07-21 14:36:11 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-29 14:19:28 +0000 sdhci_xenon: add ACPI support Add support for ACPI device probing for SDHCI controller found on Marvell chips. Reviewed by: mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31600 --- sys/conf/files.arm64 | 1 + sys/dev/sdhci/sdhci_xenon_acpi.c | 140 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 0d33e315db65..9dd071b97e37 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -275,6 +275,7 @@ dev/psci/smccc.c standard dev/safexcel/safexcel.c optional safexcel fdt dev/sdhci/sdhci_xenon.c optional sdhci_xenon sdhci +dev/sdhci/sdhci_xenon_acpi.c optional sdhci_xenon sdhci acpi dev/sdhci/sdhci_xenon_fdt.c optional sdhci_xenon sdhci fdt dev/uart/uart_cpu_arm64.c optional uart diff --git a/sys/dev/sdhci/sdhci_xenon_acpi.c b/sys/dev/sdhci/sdhci_xenon_acpi.c new file mode 100644 index 000000000000..1bd4c03c67e4 --- /dev/null +++ b/sys/dev/sdhci/sdhci_xenon_acpi.c @@ -0,0 +1,140 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Semihalf + * + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#ifdef EXT_RESOURCES +#include +#endif + +#include +#include + +#include "mmcbr_if.h" +#include "sdhci_if.h" + +#include "opt_mmccam.h" +#include "opt_soc.h" + +static char *sdhci_xenon_hids[] = { + "MRVL0002", + "MRVL0003", + "MRVL0004", + NULL +}; + +static int +sdhci_xenon_acpi_probe(device_t dev) +{ + device_t bus; + int err; + + bus = device_get_parent(dev); + + err = ACPI_ID_PROBE(bus, dev, sdhci_xenon_hids, NULL); + if (err <= 0) { + device_set_desc(dev, "Armada Xenon SDHCI controller"); + return (err); + } + + return (ENXIO); +} + +static int +sdhci_xenon_acpi_attach(device_t dev) +{ + struct sdhci_xenon_softc *sc; + struct sdhci_slot *slot; + struct mmc_helper mmc_helper; + + sc = device_get_softc(dev); + memset(&mmc_helper, 0, sizeof(mmc_helper)); + + slot = malloc(sizeof(*slot), M_DEVBUF, M_ZERO | M_WAITOK); + if (!slot) + return (ENOMEM); + + /* + * Don't use regularators. + * In ACPI mode the firmware takes care of them for us + */ + sc->skip_regulators = true; + sc->slot = slot; + + if (mmc_parse(dev, &mmc_helper, &slot->host) != 0) + return (ENXIO); + + if (mmc_helper.props & MMC_PROP_NON_REMOVABLE) { + slot->opt |= SDHCI_NON_REMOVABLE; + if (bootverbose) + device_printf(dev, "Non-removable media\n"); + } + + sc->wp_inverted = mmc_helper.props & MMC_PROP_WP_INVERTED; + + return (sdhci_xenon_attach(dev)); +} + +static device_method_t sdhci_xenon_acpi_methods[] = { + /* device_if */ + DEVMETHOD(device_probe, sdhci_xenon_acpi_probe), + DEVMETHOD(device_attach, sdhci_xenon_acpi_attach), + DEVMETHOD(device_detach, sdhci_xenon_detach), + + DEVMETHOD(sdhci_get_card_present, sdhci_generic_get_card_present), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(sdhci_xenon, sdhci_xenon_acpi_driver, sdhci_xenon_acpi_methods, + sizeof(struct sdhci_xenon_softc), sdhci_xenon_driver); + +static devclass_t sdhci_xenon_acpi_devclass; + +DRIVER_MODULE(sdhci_xenon, acpi, sdhci_xenon_acpi_driver, + sdhci_xenon_acpi_devclass, NULL, NULL); + +#ifndef MMCCAM +MMC_DECLARE_BRIDGE(sdhci_xenon_acpi); +#endif From owner-dev-commits-src-all@freebsd.org Wed Sep 29 14:40:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64181675124; Wed, 29 Sep 2021 14:40: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 4HKJty2NXzz3qwj; Wed, 29 Sep 2021 14:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3251719577; Wed, 29 Sep 2021 14:40: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 18TEeAuP073210; Wed, 29 Sep 2021 14:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TEeA0w073207; Wed, 29 Sep 2021 14:40:10 GMT (envelope-from git) Date: Wed, 29 Sep 2021 14:40:10 GMT Message-Id: <202109291440.18TEeA0w073207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 440c645b8f14 - main - sdhci: add a missing newline 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/main X-Git-Reftype: branch X-Git-Commit: 440c645b8f14cae1f80412397ad2850595ba1396 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 14:40:10 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=440c645b8f14cae1f80412397ad2850595ba1396 commit 440c645b8f14cae1f80412397ad2850595ba1396 Author: Mitchell Horne AuthorDate: 2021-09-29 00:10:26 +0000 Commit: Mitchell Horne CommitDate: 2021-09-29 14:38:56 +0000 sdhci: add a missing newline --- sys/dev/sdhci/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 09df5e972ab6..7806a08a1572 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -1758,7 +1758,7 @@ sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd) slot->power == 0 || slot->clock == 0) { slot_printf(slot, - "Cannot issue a command (power=%d clock=%d)", + "Cannot issue a command (power=%d clock=%d)\n", slot->power, slot->clock); cmd->error = MMC_ERR_FAILED; sdhci_req_done(slot); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 15:07:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D520676009; Wed, 29 Sep 2021 15:07: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 4HKKVl1kqQz3sSC; Wed, 29 Sep 2021 15:07:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1796D1A668; Wed, 29 Sep 2021 15:07: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 18TF7gHj009651; Wed, 29 Sep 2021 15:07:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TF7gts009650; Wed, 29 Sep 2021 15:07:42 GMT (envelope-from git) Date: Wed, 29 Sep 2021 15:07:42 GMT Message-Id: <202109291507.18TF7gts009650@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 09e4502d5ca4 - main - Revert "mgb: Use MGB_DEBUG instead of DEBUG" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 09e4502d5ca41430e9647088a69d41b11deb47d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 15:07:43 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=09e4502d5ca41430e9647088a69d41b11deb47d9 commit 09e4502d5ca41430e9647088a69d41b11deb47d9 Author: Ed Maste AuthorDate: 2021-09-29 15:04:23 +0000 Commit: Ed Maste CommitDate: 2021-09-29 15:07:11 +0000 Revert "mgb: Use MGB_DEBUG instead of DEBUG" This reverts commit 5aa9f8dae3d40e1780a688ce01401e799b25e7c3. We might as well get coverage of this code via LINT. Reported by: mhorne --- sys/dev/mgb/if_mgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index c62b666f098b..bc944c92625c 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -620,7 +620,7 @@ mgb_init(if_ctx_t ctx) error); } -#ifdef MGB_DEBUG +#ifdef DEBUG static void mgb_dump_some_stats(struct mgb_softc *sc) { From owner-dev-commits-src-all@freebsd.org Wed Sep 29 15:26:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECC6F676261; Wed, 29 Sep 2021 15:26: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 4HKKvz6ClQz3vM3; Wed, 29 Sep 2021 15:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B510B1A9B7; Wed, 29 Sep 2021 15:26: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 18TFQ7Fl036179; Wed, 29 Sep 2021 15:26:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TFQ7CY036178; Wed, 29 Sep 2021 15:26:07 GMT (envelope-from git) Date: Wed, 29 Sep 2021 15:26:07 GMT Message-Id: <202109291526.18TFQ7CY036178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9e1dc7bec331 - main - loader: create separate man pages for each of the loaders 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/main X-Git-Reftype: branch X-Git-Commit: 9e1dc7bec331b4d120d4b0687cfd54692e4fddcb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 15:26:08 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9e1dc7bec331b4d120d4b0687cfd54692e4fddcb commit 9e1dc7bec331b4d120d4b0687cfd54692e4fddcb Author: Warner Losh AuthorDate: 2021-09-29 15:21:17 +0000 Commit: Warner Losh CommitDate: 2021-09-29 15:24:47 +0000 loader: create separate man pages for each of the loaders Create a man page per loader. Loader(8) will have information common to all of them, while loader_${INTERP}(8) will have information relevant to that specific loader. Rewrite loader(8) to give an overview and point to the appropriate man page. Rewrite each of the loader_${INTER}(8) man pages to contain only the relevant information to that loader. Put all the common commands, environment variables, etc in loader_simp(8) and refernce that from the loader_lua or loader_4th man pages. The loader_lua(8) could use more details about the Lua integration. Additional organization may be benefitial. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31340 --- stand/man/Makefile | 2 + stand/man/loader.8 | 1083 ++--------------------------------------------- stand/man/loader_4th.8 | 585 +++++++++++++++++++++++++ stand/man/loader_lua.8 | 277 ++++++++++++ stand/man/loader_simp.8 | 28 +- 5 files changed, 911 insertions(+), 1064 deletions(-) diff --git a/stand/man/Makefile b/stand/man/Makefile index 5523908b6814..27370624ff62 100644 --- a/stand/man/Makefile +++ b/stand/man/Makefile @@ -5,6 +5,8 @@ M.${MK_EFI}+= boot1.efi.8 M.yes+= loader.8 M.${MK_EFI}+= loader.efi.8 +M.${MK_FORTH}+= loader_4th.8 +M.${MK_LOADER_LUA}+= loader_lua.8 M.yes+= loader_simp.8 MAN=${M.yes} diff --git a/stand/man/loader.8 b/stand/man/loader.8 index c606068941a7..b71ac71e16ce 100644 --- a/stand/man/loader.8 +++ b/stand/man/loader.8 @@ -1,5 +1,6 @@ .\" Copyright (c) 1999 Daniel C. Sobral .\" All rights reserved. +.\" Copyright (c) 2021 Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -24,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2021 +.Dd September 29, 2021 .Dt LOADER 8 .Os .Sh NAME @@ -36,13 +37,14 @@ The program called is the final stage of .Fx Ns 's kernel bootstrapping process. -On IA32 (i386) architectures, it is a -.Pa BTX -client. -It is linked statically to -.Xr libstand 3 -and usually located in the directory -.Pa /boot . +It is responsible for bringing the kernel, kernel modules and other files into +memory. +It creates a set of +.Xr sh 1 +like environment variables that are passed to the kernel. +It executes boot scripts written in one of several interpreters. +Together with the scripts, it controls the booting process and +interaction with the user. .Pp It provides a scripting language that can be used to automate tasks, do pre-configuration or assist in recovery @@ -53,10 +55,17 @@ The smaller one is a set of commands designed for direct use by the casual user, called "builtin commands" for historical reasons. The main drive behind these commands is user-friendliness. -The bigger component is an -.Tn ANS -Forth compatible Forth interpreter based on FICL, by +The larger component is the scripting language built into +the boot loader. +.Fx +provides three different interpreters: Forth, Lua and Simple. +The Forth loader is based on an ANS Forth compatible +Forth interpreter based on FICL, by .An John Sadler . +The Lua loader is includes a full Lua interpreter from +.Pa https://www.lua.org/ . +The Simple loader only interprets a list of builtin commands +without any control structure. .Pp During initialization, .Nm @@ -73,1039 +82,36 @@ and are set, and .Va LINES is set to 24. -Next, -.Tn FICL -is initialized, the builtin words are added to its vocabulary, and -.Pa /boot/loader.4th -is processed if it exists. -No disk switching is possible while that file is being read. -The inner interpreter -.Nm -will use with -.Tn FICL -is then set to -.Ic interpret , -which is -.Tn FICL Ns 's -default. -After that, -.Pa /boot/loader.rc -is processed if available. -These files are processed through the -.Ic include -command, which reads all of them into memory before processing them, -making disk changes possible. -.Pp -At this point, if an -.Ic autoboot -has not been tried, and if -.Va autoboot_delay -is not set to -.Dq Li NO -(not case sensitive), then an -.Ic autoboot -will be tried. -If the system gets past this point, -.Va prompt -will be set and -.Nm -will engage interactive mode. -Please note that historically even when -.Va autoboot_delay -is set to -.Dq Li 0 -user will be able to interrupt autoboot process by pressing some key -on the console while kernel and modules are being loaded. -In some -cases such behaviour may be undesirable, to prevent it set -.Va autoboot_delay -to -.Dq Li -1 , -in this case -.Nm -will engage interactive mode only if -.Ic autoboot -has failed. +Finally, an interpreter specific file will be executed. .Sh BUILTIN COMMANDS -In -.Nm , -builtin commands take parameters from the command line. -Presently, -the only way to call them from a script is by using -.Pa evaluate -on a string. -If an error condition occurs, an exception will be generated, -which can be intercepted using -.Tn ANS -Forth exception handling -words. -If not intercepted, an error message will be displayed and -the interpreter's state will be reset, emptying the stack and restoring -interpreting mode. -.Pp -The builtin commands available are: -.Pp -.Bl -tag -width Ds -compact -.It Ic autoboot Op Ar seconds Op Ar prompt -Proceeds to bootstrap the system after a number of seconds, if not -interrupted by the user. -Displays a countdown prompt -warning the user the system is about to be booted, -unless interrupted by a key press. -The kernel will be loaded first if necessary. -Defaults to 10 seconds. -.Pp -.It Ic bcachestat -Displays statistics about disk cache usage. -For debugging only. -.Pp -.It Ic boot -.It Ic boot Ar kernelname Op Cm ... -.It Ic boot Fl flag Cm ... -Immediately proceeds to bootstrap the system, loading the kernel -if necessary. -Any flags or arguments are passed to the kernel, but they -must precede the kernel name, if a kernel name is provided. -.Pp -.Em WARNING : -The behavior of this builtin is changed if -.Xr loader.4th 8 -is loaded. -.Pp -.It Ic echo Xo -.Op Fl n -.Op Aq message -.Xc -Displays text on the screen. -A new line will be printed unless -.Fl n -is specified. -.Pp -.It Ic heap -Displays memory usage statistics. -For debugging purposes only. -.Pp -.It Ic help Op topic Op subtopic -Shows help messages read from -.Pa /boot/loader.help . -The special topic -.Em index -will list the topics available. -.Pp -.It Ic include Ar file Op Ar -Process script files. -Each file, in turn, is completely read into memory, -and then each of its lines is passed to the command line interpreter. -If any error is returned by the interpreter, the include -command aborts immediately, without reading any other files, and -returns an error itself (see -.Sx ERRORS ) . -.Pp -.It Ic load Xo -.Op Fl t Ar type -.Ar file Cm ... -.Xc -Loads a kernel, kernel loadable module (kld), disk image, -or file of opaque contents tagged as being of the type -.Ar type . -Kernel and modules can be either in a.out or ELF format. -Any arguments passed after the name of the file to be loaded -will be passed as arguments to that file. -Use the -.Li md_image -type to make the kernel create a file-backed -.Xr md 4 -disk. -This is useful for booting from a temporary rootfs. -Currently, argument passing does not work for the kernel. -.Pp -.It Ic load_geli Xo -.Op Fl n Ar keyno -.Ar prov Ar file -.Xc -Loads a -.Xr geli 8 -encryption keyfile for the given provider name. -The key index can be specified via -.Ar keyno -or will default to zero. -.Pp -.It Ic ls Xo -.Op Fl l -.Op Ar path -.Xc -Displays a listing of files in the directory -.Ar path , -or the root directory if -.Ar path -is not specified. -If -.Fl l -is specified, file sizes will be shown too. -.Pp -.It Ic lsdev Op Fl v -Lists all of the devices from which it may be possible to load modules, -as well as ZFS pools. -If -.Fl v -is specified, more details are printed, including ZFS pool information -in a format that resembles -.Nm zpool Cm status -output. -.Pp -.It Ic lsmod Op Fl v -Displays loaded modules. -If -.Fl v -is specified, more details are shown. -.Pp -.It Ic lszfs Ar filesystem -A ZFS extended command that can be used to explore the ZFS filesystem -hierarchy in a pool. -Lists the immediate children of the -.Ar filesystem . -The filesystem hierarchy is rooted at a filesystem with the same name -as the pool. -.Pp -.It Ic more Ar file Op Ar -Display the files specified, with a pause at each -.Va LINES -displayed. -.Pp -.It Ic pnpscan Op Fl v -Scans for Plug-and-Play devices. -This is not functional at present. -.Pp -.It Ic read Xo -.Op Fl t Ar seconds -.Op Fl p Ar prompt -.Op Va variable -.Xc -Reads a line of input from the terminal, storing it in -.Va variable -if specified. -A timeout can be specified with -.Fl t , -though it will be canceled at the first key pressed. -A prompt may also be displayed through the -.Fl p -flag. -.Pp -.It Ic reboot -Immediately reboots the system. -.Pp -.It Ic set Ar variable -.It Ic set Ar variable Ns = Ns Ar value -Set loader's environment variables. -.Pp -.It Ic show Op Va variable -Displays the specified variable's value, or all variables and their -values if -.Va variable -is not specified. -.Pp -.It Ic unload -Remove all modules from memory. -.Pp -.It Ic unset Va variable -Removes -.Va variable -from the environment. -.Pp -.It Ic \&? -Lists available commands. -.El +The commands common to all interpreters are described in the +.Xr loader_simp 8 +.Dq BUILTIN COMMANDS +section. .Ss BUILTIN ENVIRONMENT VARIABLES -The -.Nm -has actually two different kinds of -.Sq environment -variables. -There are ANS Forth's -.Em environmental queries , -and a separate space of environment variables used by builtins, which -are not directly available to Forth words. -It is the latter type that this section covers. -.Pp -Environment variables can be set and unset through the -.Ic set -and -.Ic unset -builtins, and can have their values interactively examined through the -use of the -.Ic show -builtin. -Their values can also be accessed as described in -.Sx BUILTIN PARSER . -.Pp -Notice that these environment variables are not inherited by any shell -after the system has been booted. -.Pp -A few variables are set automatically by -.Nm . -Others can affect the behavior of either -.Nm -or the kernel at boot. -Some options may require a value, -while others define behavior just by being set. -Both types of builtin variables are described below. -.Bl -tag -width bootfile -.It Va autoboot_delay -Number of seconds -.Ic autoboot -will wait before booting. -Configuration options are described in -.Xr loader.conf 5 . -.It Va boot_askname -Instructs the kernel to prompt the user for the name of the root device -when the kernel is booted. -.It Va boot_cdrom -Instructs the kernel to try to mount the root file system from CD-ROM. -.It Va boot_ddb -Instructs the kernel to start in the DDB debugger, rather than -proceeding to initialize when booted. -.It Va boot_dfltroot -Instructs the kernel to mount the statically compiled-in root file system. -.It Va boot_gdb -Selects gdb-remote mode for the kernel debugger by default. -.It Va boot_multicons -Enables multiple console support in the kernel early on boot. -In a running system, console configuration can be manipulated -by the -.Xr conscontrol 8 -utility. -.It Va boot_mute -All kernel console output is suppressed when console is muted. -In a running system, the state of console muting can be manipulated by the -.Xr conscontrol 8 -utility. -.It Va boot_pause -During the device probe, pause after each line is printed. -.It Va boot_serial -Force the use of a serial console even when an internal console -is present. -.It Va boot_single -Prevents the kernel from initiating a multi-user startup; instead, -a single-user mode will be entered when the kernel has finished -device probing. -.It Va boot_verbose -Setting this variable causes extra debugging information to be printed -by the kernel during the boot phase. -.It Va bootfile -List of semicolon-separated search path for bootable kernels. -The default is -.Dq Li kernel . -.It Va comconsole_speed -Defines the speed of the serial console (i386 and amd64 only). -If the previous boot stage indicated that a serial console is in use -then this variable is initialized to the current speed of the console -serial port. -Otherwise it is set to 9600 unless this was overridden using the -.Va BOOT_COMCONSOLE_SPEED -variable when -.Nm -was compiled. -Changes to the -.Va comconsole_speed -variable take effect immediately. -.It Va comconsole_port -Defines the base i/o port used to access console UART -(i386 and amd64 only). -If the variable is not set, its assumed value is 0x3F8, which -corresponds to PC port COM1, unless overridden by -.Va BOOT_COMCONSOLE_PORT -variable during the compilation of -.Nm . -Setting the -.Va comconsole_port -variable automatically set -.Va hw.uart.console -environment variable to provide a hint to kernel for location of the console. -Loader console is changed immediately after variable -.Va comconsole_port -is set. -.It Va comconsole_pcidev -Defines the location of a PCI device of the 'simple communication' -class to be used as the serial console UART (i386 and amd64 only). -The syntax of the variable is -.Li 'bus:device:function[:bar]' , -where all members must be numeric, with possible -.Li 0x -prefix to indicate a hexadecimal value. -The -.Va bar -member is optional and assumed to be 0x10 if omitted. -The bar must decode i/o space. -Setting the variable -.Va comconsole_pcidev -automatically sets the variable -.Va comconsole_port -to the base of the selected bar, and hint -.Va hw.uart.console . -Loader console is changed immediately after variable -.Va comconsole_pcidev -is set. -.It Va console -Defines the current console or consoles. -Multiple consoles may be specified. -In that case, the first listed console will become the default console for -userland output (e.g.\& from -.Xr init 8 ) . -.It Va currdev -Selects the default device to loader the kernel from. -The syntax is: -.Dl Ic loader_device: -or -.Dl Ic zfs:dataset: -Examples: -.Dl Ic disk0p2: -.Dl Ic zfs:zroot/ROOT/default: -.It Va dumpdev -Sets the device for kernel dumps. -This can be used to ensure that a device is configured before the corresponding -.Va dumpdev -directive from -.Xr rc.conf 5 -has been processed, allowing kernel panics that happen during the early stages -of boot to be captured. -.It Va init_chroot -See -.Xr init 8 . -.It Va init_exec -See -.Xr init 8 . -.It Va init_path -Sets the list of binaries which the kernel will try to run as the initial -process. -The first matching binary is used. -The default list is -.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init . -.It Va init_script -See -.Xr init 8 . -.It Va init_shell -See -.Xr init 8 . -.It Va interpret -Has the value -.Dq Li OK -if the Forth's current state is interpreting. -.It Va LINES -Define the number of lines on the screen, to be used by the pager. -.It Va module_path -Sets the list of directories which will be searched for modules -named in a load command or implicitly required by a dependency. -The default value for this variable is -.Dq Li /boot/kernel;/boot/modules . -.It Va num_ide_disks -Sets the number of IDE disks as a workaround for some problems in -finding the root disk at boot. -This has been deprecated in favor of -.Va root_disk_unit . -.It Va prompt -Value of -.Nm Ns 's -prompt. -Defaults to -.Dq Li "${interpret}" . -If variable -.Va prompt -is unset, the default prompt is -.Ql > . -.It Va root_disk_unit -If the code which detects the disk unit number for the root disk is -confused, e.g.\& by a mix of SCSI and IDE disks, or IDE disks with -gaps in the sequence (e.g.\& no primary slave), the unit number can -be forced by setting this variable. -.It Va rootdev -By default the value of -.Va currdev -is used to set the root file system -when the kernel is booted. -This can be overridden by setting -.Va rootdev -explicitly. -.El -.Pp -Other variables are used to override kernel tunable parameters. -The following tunables are available: -.Bl -tag -width Va -.It Va efi.rt.disabled -Disable UEFI runtime services in the kernel, if applicable. -Runtime services are only available and used if the kernel is booted in a UEFI -environment. -.It Va hw.physmem -Limit the amount of physical memory the system will use. -By default the size is in bytes, but the -.Cm k , K , m , M , g -and -.Cm G -suffixes -are also accepted and indicate kilobytes, megabytes and gigabytes -respectively. -An invalid suffix will result in the variable being ignored by the -kernel. -.It Va hw.pci.host_start_mem , hw.acpi.host_start_mem -When not otherwise constrained, this limits the memory start -address. -The default is 0x80000000 and should be set to at least size of the -memory and not conflict with other resources. -Typically, only systems without PCI bridges need to set this variable -since PCI bridges typically constrain the memory starting address -(and the variable is only used when bridges do not constrain this -address). -.It Va hw.pci.enable_io_modes -Enable PCI resources which are left off by some BIOSes or are not -enabled correctly by the device driver. -Tunable value set to ON (1) by default, but this may cause problems -with some peripherals. -.It Va kern.maxusers -Set the size of a number of statically allocated system tables; see -.Xr tuning 7 -for a description of how to select an appropriate value for this -tunable. -When set, this tunable replaces the value declared in the kernel -compile-time configuration file. -.It Va kern.ipc.nmbclusters -Set the number of mbuf clusters to be allocated. -The value cannot be set below the default -determined when the kernel was compiled. -.It Va kern.ipc.nsfbufs -Set the number of -.Xr sendfile 2 -buffers to be allocated. -Overrides -.Dv NSFBUFS . -Not all architectures use such buffers; see -.Xr sendfile 2 -for details. -.It Va kern.maxswzone -Limits the amount of KVM to be used to hold swap -metadata, which directly governs the -maximum amount of swap the system can support, -at the rate of approximately 200 MB of swap space -per 1 MB of metadata. -This value is specified in bytes of KVA space. -If no value is provided, the system allocates -enough memory to handle an amount of swap -that corresponds to eight times the amount of -physical memory present in the system. -.Pp -Note that swap metadata can be fragmented, -which means that the system can run out of -space before it reaches the theoretical limit. -Therefore, care should be taken to not configure -more swap than approximately half of the -theoretical maximum. -.Pp -Running out of space for swap metadata can leave -the system in an unrecoverable state. -Therefore, you should only change -this parameter if you need to greatly extend the -KVM reservation for other resources such as the -buffer cache or -.Va kern.ipc.nmbclusters . -Modifies kernel option -.Dv VM_SWZONE_SIZE_MAX . -.It Va kern.maxbcache -Limits the amount of KVM reserved for use by the -buffer cache, specified in bytes. -The default maximum is 200MB on i386, -and 400MB on amd64. -This parameter is used to -prevent the buffer cache from eating too much -KVM in large-memory machine configurations. -Only mess around with this parameter if you need to -greatly extend the KVM reservation for other resources -such as the swap zone or -.Va kern.ipc.nmbclusters . -Note that -the NBUF parameter will override this limit. -Modifies -.Dv VM_BCACHE_SIZE_MAX . -.It Va kern.msgbufsize -Sets the size of the kernel message buffer. -The default limit of 96KB is usually sufficient unless -large amounts of trace data need to be collected -between opportunities to examine the buffer or -dump it to a file. -Overrides kernel option -.Dv MSGBUF_SIZE . -.It Va machdep.disable_mtrrs -Disable the use of i686 MTRRs (x86 only). -.It Va net.inet.tcp.tcbhashsize -Overrides the compile-time set value of -.Dv TCBHASHSIZE -or the preset default of 512. -Must be a power of 2. -.It Va twiddle_divisor -Throttles the output of the -.Sq twiddle -I/O progress indicator displayed while loading the kernel and modules. -This is useful on slow serial consoles where the time spent waiting for -these characters to be written can add up to many seconds. -The default is 16; a value of 32 spins half as fast, -while a value of 8 spins twice as fast. -.It Va vm.kmem_size -Sets the size of kernel memory (bytes). -This overrides the value determined when the kernel was compiled. -Modifies -.Dv VM_KMEM_SIZE . -.It Va vm.kmem_size_min -.It Va vm.kmem_size_max -Sets the minimum and maximum (respectively) amount of kernel memory -that will be automatically allocated by the kernel. -These override the values determined when the kernel was compiled. -Modifies -.Dv VM_KMEM_SIZE_MIN -and -.Dv VM_KMEM_SIZE_MAX . -.El -.Ss ZFS FEATURES -.Nm -supports the following format for specifying ZFS filesystems which -can be used wherever -.Xr loader 8 -refers to a device specification: -.Pp -.Ar zfs:pool/filesystem: -.Pp -where -.Pa pool/filesystem -is a ZFS filesystem name as described in -.Xr zfs 8 . -.Pp -If -.Pa /etc/fstab -does not have an entry for the root filesystem and -.Va vfs.root.mountfrom -is not set, but -.Va currdev -refers to a ZFS filesystem, then -.Nm -will instruct kernel to use that filesystem as the root filesystem. -.Ss BUILTIN PARSER -When a builtin command is executed, the rest of the line is taken -by it as arguments, and it is processed by a special parser which -is not used for regular Forth commands. -.Pp -This special parser applies the following rules to the parsed text: -.Bl -enum -.It -All backslash characters are preprocessed. -.Bl -bullet -.It -\eb , \ef , \er , \en and \et are processed as in C. -.It -\es is converted to a space. -.It -\ev is converted to -.Tn ASCII -11. -.It -\ez is just skipped. -Useful for things like -.Dq \e0xf\ez\e0xf . -.It -\e0xN and \e0xNN are replaced by the hex N or NN. -.It -\eNNN is replaced by the octal NNN -.Tn ASCII -character. -.It -\e" , \e' and \e$ will escape these characters, preventing them from -receiving special treatment in Step 2, described below. -.It -\e\e will be replaced with a single \e . -.It -In any other occurrence, backslash will just be removed. -.El -.It -Every string between non-escaped quotes or double-quotes will be treated -as a single word for the purposes of the remaining steps. -.It -Replace any -.Li $VARIABLE -or -.Li ${VARIABLE} -with the value of the environment variable -.Va VARIABLE . -.It -Space-delimited arguments are passed to the called builtin command. -Spaces can also be escaped through the use of \e\e . -.El -.Pp -An exception to this parsing rule exists, and is described in -.Sx BUILTINS AND FORTH . -.Ss BUILTINS AND FORTH -All builtin words are state-smart, immediate words. -If interpreted, they behave exactly as described previously. -If they are compiled, though, -they extract their arguments from the stack instead of the command line. -.Pp -If compiled, the builtin words expect to find, at execution time, the -following parameters on the stack: -.D1 Ar addrN lenN ... addr2 len2 addr1 len1 N -where -.Ar addrX lenX -are strings which will compose the command line that will be parsed -into the builtin's arguments. -Internally, these strings are concatenated in from 1 to N, -with a space put between each one. -.Pp -If no arguments are passed, a 0 -.Em must -be passed, even if the builtin accepts no arguments. -.Pp -While this behavior has benefits, it has its trade-offs. -If the execution token of a builtin is acquired (through -.Ic ' -or -.Ic ['] ) , -and then passed to -.Ic catch -or -.Ic execute , -the builtin behavior will depend on the system state -.Bf Em -at the time -.Ic catch -or -.Ic execute -is processed! -.Ef -This is particularly annoying for programs that want or need to -handle exceptions. -In this case, the use of a proxy is recommended. -For example: -.Dl : (boot) boot ; -.Sh FICL -.Tn FICL -is a Forth interpreter written in C, in the form of a forth -virtual machine library that can be called by C functions and vice -versa. -.Pp -In -.Nm , -each line read interactively is then fed to -.Tn FICL , -which may call -.Nm -back to execute the builtin words. -The builtin -.Ic include -will also feed -.Tn FICL , -one line at a time. -.Pp -The words available to -.Tn FICL -can be classified into four groups. -The -.Tn ANS -Forth standard words, extra -.Tn FICL -words, extra -.Fx -words, and the builtin commands; -the latter were already described. -The -.Tn ANS -Forth standard words are listed in the -.Sx STANDARDS +The environment variables common to all interpreters are described in the +.Xr loader_simp 8 +.Dq BUILTIN ENVIRONMENT VARIABLES section. -The words falling in the two other groups are described in the -following subsections. -.Ss FICL EXTRA WORDS -.Bl -tag -width wid-set-super -.It Ic .env -.It Ic .ver -.It Ic -roll -.It Ic 2constant -.It Ic >name -.It Ic body> -.It Ic compare -This is the STRING word set's -.Ic compare . -.It Ic compile-only -.It Ic endif -.It Ic forget-wid -.It Ic parse-word -.It Ic sliteral -This is the STRING word set's -.Ic sliteral . -.It Ic wid-set-super -.It Ic w@ -.It Ic w! -.It Ic x. -.It Ic empty -.It Ic cell- -.It Ic -rot -.El -.Ss FREEBSD EXTRA WORDS -.Bl -tag -width XXXXXXXX -.It Ic \&$ Pq -- -Evaluates the remainder of the input buffer, after having printed it first. -.It Ic \&% Pq -- -Evaluates the remainder of the input buffer under a -.Ic catch -exception guard. -.It Ic .# -Works like -.Ic "." -but without outputting a trailing space. -.It Ic fclose Pq Ar fd -- -Closes a file. -.It Ic fkey Pq Ar fd -- char -Reads a single character from a file. -.It Ic fload Pq Ar fd -- -Processes a file -.Em fd . -.It Ic fopen Pq Ar addr len mode Li -- Ar fd -Opens a file. -Returns a file descriptor, or \-1 in case of failure. -The -.Ar mode -parameter selects whether the file is to be opened for read access, write -access, or both. -The constants -.Dv O_RDONLY , O_WRONLY , -and -.Dv O_RDWR -are defined in -.Pa /boot/support.4th , -indicating read only, write only, and read-write access, respectively. -.It Xo -.Ic fread -.Pq Ar fd addr len -- len' -.Xc -Tries to read -.Em len -bytes from file -.Em fd -into buffer -.Em addr . -Returns the actual number of bytes read, or -1 in case of error or end of -file. -.It Ic heap? Pq -- Ar cells -Return the space remaining in the dictionary heap, in cells. -This is not related to the heap used by dynamic memory allocation words. -.It Ic inb Pq Ar port -- char -Reads a byte from a port. -.It Ic key Pq -- Ar char -Reads a single character from the console. -.It Ic key? Pq -- Ar flag -Returns -.Ic true -if there is a character available to be read from the console. -.It Ic ms Pq Ar u -- -Waits -.Em u -microseconds. -.It Ic outb Pq Ar port char -- -Writes a byte to a port. -.It Ic seconds Pq -- Ar u -Returns the number of seconds since midnight. -.It Ic tib> Pq -- Ar addr len -Returns the remainder of the input buffer as a string on the stack. -.It Ic trace! Pq Ar flag -- -Activates or deactivates tracing. -Does not work with -.Ic catch . -.El -.Ss FREEBSD DEFINED ENVIRONMENTAL QUERIES -.Bl -tag -width Ds -.It arch-i386 -.Ic TRUE -if the architecture is IA32. -.It FreeBSD_version -.Fx -version at compile time. -.It loader_version -.Nm -version. -.El -.Sh SECURITY -Access to the -.Nm -command line provides several ways of compromising system security, -including, but not limited to: -.Pp -.Bl -bullet -.It -Booting from removable storage, by setting the -.Va currdev -or -.Va loaddev -variables -.It -Executing binary of choice, by setting the *** 1134 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 29 15:43:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5021767659B; Wed, 29 Sep 2021 15:43:03 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4HKLHT6FXsz3wK9; Wed, 29 Sep 2021 15:43:01 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtpclient.apple (cpc91232-cmbg18-2-0-cust554.5-4.cable.virginm.net [82.2.126.43]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 90B6F4E630; Wed, 29 Sep 2021 15:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz; s=mail; t=1632930144; bh=qL4oHJUVnt3YWcsblqA/C1sJy2AKwgVCIBCq1t9RIlQ=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=XGCkZLAD5PMOsdCVJKzdRudOOzu0PeV2cHWecqUV0lb+eX9/vTGgPoDq6Vcs6P4a6 iwTo/Zn/9I7gU19sjaXgiQP+mfemwl3+kJnY0Qwsbu7WOf04IiS1x+3qs/rQIvqWi3 CIPLAel1T2IXAwcxUPpxJPhoQrfMg1D9+sTVtJhn/E8ilKORGUFz1CT+2FjbdsWUDG 4MK9s/nWJXBRYMf4MSug95HmynNWbVvBxsLKP3fWqjo/42pKmRmboHnZ/GxiWEhzle EgAcaL95Nvn2EYHzGUNW0yq44XeCrNPvnmjGl7C0S1GfFNZ0DlWvokqV4PPCCeD+jx UhwHmDV/fzG0luFM/SOvF7WFUDNBocpOjOQAvPDNOibv3FUBZtk9iREp4WGiYpyYC6 g7VhFPMzwi9RVLAmDaG/errQoUutmblL+zCJGppvg3Vih2+DpIppue5oFZ40GIGvrn 1HEfV7ikkegPAzknQeKBqO9e+lwBNPFsCf1oRHfT01QHABJ50C4+Bw/lkCILhMTlyw 6yN98m3bZR+uo9L5fZ0JsYWudBVJf2bGnbIKScx98icEv/1tpf1EHV8MUWuZSzac2D NRHwm+65G90R3M4Jd9KZwfrhxwfZORBrbwgZWrSh/V6M5iii8/9rQkS13dPZu4a1Vc n3eprBgLFYsitBvjJ2l0Nkl4= Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: f3aa0098a82e - main - Use mtx_lock_spin in the gic driver From: Andrew Turner In-Reply-To: Date: Wed, 29 Sep 2021 16:42:24 +0100 Cc: Andrew Turner , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <66731C91-BAE9-4D5D-B7DE-F1D7AA94395D@fubar.geek.nz> References: <202109281243.18SChldh001988@gitrepo.freebsd.org> To: Marcin Wojtas X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HKLHT6FXsz3wK9 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=fubar.geek.nz header.s=mail header.b=XGCkZLAD; dmarc=pass (policy=none) header.from=fubar.geek.nz; spf=pass (mx1.freebsd.org: domain of andrew@fubar.geek.nz designates 139.59.165.16 as permitted sender) smtp.mailfrom=andrew@fubar.geek.nz X-Spamd-Result: default: False [-3.40 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[fubar.geek.nz:s=mail]; FREEFALL_USER(0.00)[andrew]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[fubar.geek.nz:+]; DMARC_POLICY_ALLOW(-0.50)[fubar.geek.nz,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:14061, ipnet:139.59.160.0/20, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 15:43:03 -0000 > On 28 Sep 2021, at 16:36, Marcin Wojtas wrote: >=20 > Hi Andrew, >=20 > wt., 28 wrz 2021 o 14:43 Andrew Turner = napisa=C5=82(a): >>=20 >> The branch main has been updated by andrew: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df3aa0098a82ebf7712aa13716d794aa7= e4ac59cd >>=20 >> commit f3aa0098a82ebf7712aa13716d794aa7e4ac59cd >> Author: Andrew Turner >> AuthorDate: 2021-09-28 11:36:42 +0000 >> Commit: Andrew Turner >> CommitDate: 2021-09-28 11:42:06 +0000 >>=20 >> Use mtx_lock_spin in the gic driver >>=20 >> The mutex was changed to a spin lock when the MSI/MSI-X handling = was >> moved from the gicv2m to the gic driver. Update the calls to lock >> and unlock the mutex to the spin variant. >>=20 >> Submitted by: jrtc27 ("Change all the mtx_(un)lock(&sc->mutex) = to be the _spin versions.") >> Reported by: mw, antranigv@freebsd.am >> Sponsored by: The FreeBSD Foundation >> --- >> sys/arm/arm/gic.c | 20 ++++++++++---------- >> 1 file changed, 10 insertions(+), 10 deletions(-) >>=20 >> diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c >> index d7edd7885404..89db4e324600 100644 >> --- a/sys/arm/arm/gic.c >> +++ b/sys/arm/arm/gic.c >> @@ -1056,7 +1056,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, = int count, int maxcount, >>=20 >> sc =3D device_get_softc(dev); >>=20 >> - mtx_lock(&sc->mutex); >> + mtx_lock_spin(&sc->mutex); >>=20 >> found =3D false; >> for (irq =3D sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { >> @@ -1091,7 +1091,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, = int count, int maxcount, >>=20 >> /* Not enough interrupts were found */ >> if (!found || irq =3D=3D sc->sc_spi_end) { >> - mtx_unlock(&sc->mutex); >> + mtx_unlock_spin(&sc->mutex); >> return (ENXIO); >> } >>=20 >> @@ -1099,7 +1099,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, = int count, int maxcount, >> /* Mark the interrupt as used */ >> sc->gic_irqs[irq + i].gi_flags |=3D GI_FLAG_MSI_USED; >> } >> - mtx_unlock(&sc->mutex); >> + mtx_unlock_spin(&sc->mutex); >>=20 >> for (i =3D 0; i < count; i++) >> srcs[i] =3D (struct intr_irqsrc *)&sc->gic_irqs[irq + = i]; >> @@ -1118,7 +1118,7 @@ arm_gic_release_msi(device_t dev, device_t = child, int count, >>=20 >> sc =3D device_get_softc(dev); >>=20 >> - mtx_lock(&sc->mutex); >> + mtx_lock_spin(&sc->mutex); >> for (i =3D 0; i < count; i++) { >> gi =3D (struct gic_irqsrc *)isrc[i]; >>=20 >> @@ -1128,7 +1128,7 @@ arm_gic_release_msi(device_t dev, device_t = child, int count, >>=20 >> gi->gi_flags &=3D ~GI_FLAG_MSI_USED; >> } >> - mtx_unlock(&sc->mutex); >> + mtx_unlock_spin(&sc->mutex); >>=20 >> return (0); >> } >> @@ -1142,7 +1142,7 @@ arm_gic_alloc_msix(device_t dev, device_t = child, device_t *pic, >>=20 >> sc =3D device_get_softc(dev); >>=20 >> - mtx_lock(&sc->mutex); >> + mtx_lock_spin(&sc->mutex); >> /* Find an unused interrupt */ >> for (irq =3D sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { >> KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) !=3D = 0, >> @@ -1152,13 +1152,13 @@ arm_gic_alloc_msix(device_t dev, device_t = child, device_t *pic, >> } >> /* No free interrupt was found */ >> if (irq =3D=3D sc->sc_spi_end) { >> - mtx_unlock(&sc->mutex); >> + mtx_unlock_spin(&sc->mutex); >> return (ENXIO); >> } >>=20 >> /* Mark the interrupt as used */ >> sc->gic_irqs[irq].gi_flags |=3D GI_FLAG_MSI_USED; >> - mtx_unlock(&sc->mutex); >> + mtx_unlock_spin(&sc->mutex); >>=20 >> *isrcp =3D (struct intr_irqsrc *)&sc->gic_irqs[irq]; >> *pic =3D dev; >> @@ -1178,9 +1178,9 @@ arm_gic_release_msix(device_t dev, device_t = child, struct intr_irqsrc *isrc) >> KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) =3D=3D = GI_FLAG_MSI_USED, >> ("%s: Trying to release an unused MSI-X interrupt", = __func__)); >>=20 >> - mtx_lock(&sc->mutex); >> + mtx_lock_spin(&sc->mutex); >> gi->gi_flags &=3D ~GI_FLAG_MSI_USED; >> - mtx_unlock(&sc->mutex); >> + mtx_unlock_spin(&sc->mutex); >>=20 >> return (0); >> } >=20 > Thank you for the patch, it fixes the MSI-X in my setup, but in order > to operate properly on Marvell SoCs (equipped with a standard GICv2m), > I have to remove the asserts, which were added in c6f3076d4405 (Move > the GICv2m msi handling to the parent): >=20 > diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c > index 89db4e324600..b5d72a2a6c49 100644 > --- a/sys/arm/arm/gic.c > +++ b/sys/arm/arm/gic.c > @@ -528,8 +528,6 @@ arm_gic_write_ivar(device_t dev, device_t child, > int which, uintptr_t value) > * GIC_IVAR_MBI_START must be set once and first. This = allows > * us to reserve the registers when GIC_IVAR_MBI_COUNT = is set. > */ > - MPASS(sc->sc_spi_start =3D=3D 0); > - MPASS(sc->sc_spi_count =3D=3D 0); > MPASS(value >=3D GIC_FIRST_SPI); > MPASS(value < sc->nirqs); >=20 > @@ -537,7 +535,6 @@ arm_gic_write_ivar(device_t dev, device_t child, > int which, uintptr_t value) > return (0); > case GIC_IVAR_MBI_COUNT: > MPASS(sc->sc_spi_start !=3D 0); > - MPASS(sc->sc_spi_count =3D=3D 0); >=20 > sc->sc_spi_count =3D value; > sc->sc_spi_end =3D sc->sc_spi_start + sc->sc_spi_count; >=20 > Any thoughts? Can you try the patch in https://reviews.freebsd.org/D32224. The above = change is to check there is only a single mbi range, however it appears = your hardware has multiple gicv2m devices so will try to reserve = multiple mbi ranges. Andrew From owner-dev-commits-src-all@freebsd.org Wed Sep 29 16:45:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77202676D69; Wed, 29 Sep 2021 16:45: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 4HKMgQ2zSkz4TxZ; Wed, 29 Sep 2021 16:45:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 463EB1BD85; Wed, 29 Sep 2021 16:45:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18TGjMcx042119; Wed, 29 Sep 2021 16:45:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TGjM7m042118; Wed, 29 Sep 2021 16:45:22 GMT (envelope-from git) Date: Wed, 29 Sep 2021 16:45:22 GMT Message-Id: <202109291645.18TGjM7m042118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 0cfc8b10edd7 - main - f00f: We don't need giant to create IDT for workaround. 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/main X-Git-Reftype: branch X-Git-Commit: 0cfc8b10edd78c9e2738e82544fe4c4db401aea1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 16:45:22 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0cfc8b10edd78c9e2738e82544fe4c4db401aea1 commit 0cfc8b10edd78c9e2738e82544fe4c4db401aea1 Author: Warner Losh AuthorDate: 2021-09-29 16:19:51 +0000 Commit: Warner Losh CommitDate: 2021-09-29 16:35:21 +0000 f00f: We don't need giant to create IDT for workaround. We don't need to assert we have Giant here. All machines that require the F00F workaround are UP and interrupts are disabled. Since we are single threaded, it's safe to allocate the IDT area with pmap_trm_alloc, interact with the current idt table and replace the IDT table without any Giant locking. Sponsored by: Netflix Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D31839 --- sys/i386/i386/machdep.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 1366939cda6e..942ff8c2ada8 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -2719,8 +2719,6 @@ f00f_hack(void *unused) if (!has_f00f_bug) return; - GIANT_REQUIRED; - printf("Intel Pentium detected, installing workaround for F00F bug\n"); tmp = (vm_offset_t)pmap_trm_alloc(PAGE_SIZE * 3, M_NOWAIT | M_ZERO); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 16:55:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACB8E677610; Wed, 29 Sep 2021 16:55: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 4HKMvL4FWxz4WN0; Wed, 29 Sep 2021 16:55:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DE861C003; Wed, 29 Sep 2021 16:55: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 18TGtggG055219; Wed, 29 Sep 2021 16:55:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TGtgkk055218; Wed, 29 Sep 2021 16:55:42 GMT (envelope-from git) Date: Wed, 29 Sep 2021 16:55:42 GMT Message-Id: <202109291655.18TGtgkk055218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: f6de51d3e031 - main - Add the arm64 table attributes and use them MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6de51d3e0315891f6ea9d12340b98336df409b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 16:55:42 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f6de51d3e0315891f6ea9d12340b98336df409b7 commit f6de51d3e0315891f6ea9d12340b98336df409b7 Author: Andrew Turner AuthorDate: 2021-09-23 15:00:55 +0000 Commit: Andrew Turner CommitDate: 2021-09-29 16:53:41 +0000 Add the arm64 table attributes and use them Add the table page table attributes on arm64 and use them to add restrictions to the block and page entries below them. This ensures we are unable to increase the permissions in these last level entries without also changing them in the upper levels. Use the attributes to ensure the kernel can't execute from userspace memory and vice versa, userspace has no access to read or write kernel memory, and that the DMAP region is non-executable. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32081 --- sys/arm64/arm64/locore.S | 1 + sys/arm64/arm64/pmap.c | 25 +++++++++++++++++++------ sys/arm64/include/pte.h | 9 +++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index dcc370326671..92415aab1555 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -552,6 +552,7 @@ LENTRY(link_l0_pagetable) /* Build the L0 block entry */ mov x12, #L0_TABLE + orr x12, x12, #(TATTR_UXN_TABLE | TATTR_AP_TABLE_NO_EL0) /* Only use the output address bits */ lsr x9, x9, #PAGE_SHIFT diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index e8a04ee3f2c3..95cb848df14d 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -789,7 +789,8 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, freemempos += PAGE_SIZE; pmap_store(&pagetable_dmap[l1_slot], - (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE); + (l2_pa & ~Ln_TABLE_MASK) | + TATTR_PXN_TABLE | L1_TABLE); memset(l2, 0, PAGE_SIZE); } @@ -1873,14 +1874,26 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) */ if (ptepindex >= (NUL2E + NUL1E)) { - pd_entry_t *l0; + pd_entry_t *l0p, l0e; vm_pindex_t l0index; l0index = ptepindex - (NUL2E + NUL1E); - l0 = &pmap->pm_l0[l0index]; - KASSERT((pmap_load(l0) & ATTR_DESCR_VALID) == 0, - ("%s: L0 entry %#lx is valid", __func__, pmap_load(l0))); - pmap_store(l0, VM_PAGE_TO_PHYS(m) | L0_TABLE); + l0p = &pmap->pm_l0[l0index]; + KASSERT((pmap_load(l0p) & ATTR_DESCR_VALID) == 0, + ("%s: L0 entry %#lx is valid", __func__, pmap_load(l0p))); + l0e = VM_PAGE_TO_PHYS(m) | L0_TABLE; + + /* + * Mark all kernel memory as not accessible from userspace + * and userspace memory as not executable from the kernel. + * This has been done for the bootstrap L0 entries in + * locore.S. + */ + if (pmap == kernel_pmap) + l0e |= TATTR_UXN_TABLE | TATTR_AP_TABLE_NO_EL0; + else + l0e |= TATTR_PXN_TABLE; + pmap_store(l0p, l0e); } else if (ptepindex >= NUL2E) { vm_pindex_t l0index, l1index; pd_entry_t *l0, *l1; diff --git a/sys/arm64/include/pte.h b/sys/arm64/include/pte.h index b3bec720e9f9..6b816464c167 100644 --- a/sys/arm64/include/pte.h +++ b/sys/arm64/include/pte.h @@ -38,6 +38,15 @@ typedef uint64_t pd_entry_t; /* page directory entry */ typedef uint64_t pt_entry_t; /* page table entry */ #endif +/* Table attributes */ +#define TATTR_MASK UINT64_C(0xfff8000000000000) +#define TATTR_AP_TABLE_MASK (3UL << 61) +#define TATTR_AP_TABLE_RO (2UL << 61) +#define TATTR_AP_TABLE_NO_EL0 (1UL << 61) +#define TATTR_UXN_TABLE (1UL << 60) +#define TATTR_PXN_TABLE (1UL << 59) +/* Bits 58:51 are ignored */ + /* Block and Page attributes */ #define ATTR_MASK_H UINT64_C(0xfffc000000000000) #define ATTR_MASK_L UINT64_C(0x0000000000000fff) From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:19:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31F646776C2; Wed, 29 Sep 2021 17:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKNR40fkLz4YTt; Wed, 29 Sep 2021 17:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB1A61BF60; Wed, 29 Sep 2021 17:19: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 18THJhgI082966; Wed, 29 Sep 2021 17:19:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THJhoo082965; Wed, 29 Sep 2021 17:19:43 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:19:43 GMT Message-Id: <202109291719.18THJhoo082965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 1f58b0a80a09 - stable/13 - jail(9): Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1f58b0a80a096b1bd5a227297ea5ad7d4f0d247b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:19:44 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1f58b0a80a096b1bd5a227297ea5ad7d4f0d247b commit 1f58b0a80a096b1bd5a227297ea5ad7d4f0d247b Author: Gordon Bergling AuthorDate: 2021-09-26 13:17:41 +0000 Commit: Gordon Bergling CommitDate: 2021-09-29 17:17:18 +0000 jail(9): Fix a typo in a comment - s/erorr/error/ (cherry picked from commit 8771ff75384dec8c9f95ce25b6ca9a639c4b208c) --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 9784f3bfc23b..c13aa73538a5 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1304,7 +1304,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #endif /* * Allocate a dedicated cpuset for each jail. - * Unlike other initial settings, this may return an erorr. + * Unlike other initial settings, this may return an error. */ error = cpuset_create_root(ppr, &pr->pr_cpuset); if (error) From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:19:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 874BE677AA7; Wed, 29 Sep 2021 17:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKNR62sCrz4YfS; Wed, 29 Sep 2021 17:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CD901C19F; Wed, 29 Sep 2021 17:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18THJkId083014; Wed, 29 Sep 2021 17:19:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THJkhb083013; Wed, 29 Sep 2021 17:19:46 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:19:46 GMT Message-Id: <202109291719.18THJkhb083013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 555989613685 - stable/13 - pcm(4): Fix a common typo in source code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5559896136859dd98e48fa20788990a128860f46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:19:46 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5559896136859dd98e48fa20788990a128860f46 commit 5559896136859dd98e48fa20788990a128860f46 Author: Gordon Bergling AuthorDate: 2021-09-26 09:21:16 +0000 Commit: Gordon Bergling CommitDate: 2021-09-29 17:18:55 +0000 pcm(4): Fix a common typo in source code comments - s/prefered/preferred/ (cherry picked from commit 513ee901eec639da45796d563168f0af966705e6) --- sys/dev/sound/pcm/feeder_chain.c | 4 ++-- sys/dev/sound/pcm/feeder_matrix.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pcm/feeder_chain.c b/sys/dev/sound/pcm/feeder_chain.c index b2d48abd71d1..fe114b727ffd 100644 --- a/sys/dev/sound/pcm/feeder_chain.c +++ b/sys/dev/sound/pcm/feeder_chain.c @@ -52,7 +52,7 @@ struct feeder_chain_desc { struct feeder_chain_state current; /* current state */ struct feeder_chain_state target; /* target state */ struct pcm_feederdesc desc; /* feeder descriptor */ - uint32_t afmt_ne; /* prefered native endian */ + uint32_t afmt_ne; /* preferred native endian */ int mode; /* chain mode */ int use_eq; /* need EQ? */ int use_matrix; /* need channel matrixing? */ @@ -77,7 +77,7 @@ struct feeder_chain_desc { #endif /* - * List of prefered formats that might be required during + * List of preferred formats that might be required during * processing. It will be decided through snd_fmtbest(). */ diff --git a/sys/dev/sound/pcm/feeder_matrix.c b/sys/dev/sound/pcm/feeder_matrix.c index c6a65113574a..d4925fe0d7e6 100644 --- a/sys/dev/sound/pcm/feeder_matrix.c +++ b/sys/dev/sound/pcm/feeder_matrix.c @@ -552,7 +552,7 @@ feeder_matrix_setup(struct pcm_feeder *f, struct pcmchan_matrix *m_in, /* * feeder_matrix_default_id(): For a given number of channels, return - * default prefered id (example: both 5.1 and + * default preferred id (example: both 5.1 and * 6.0 are simply 6 channels, but 5.1 is more * preferable). */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:19:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61544677C26; Wed, 29 Sep 2021 17:19: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 4HKNR51d1cz4Yqj; Wed, 29 Sep 2021 17:19:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 190051C396; Wed, 29 Sep 2021 17:19:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18THJjKa082990; Wed, 29 Sep 2021 17:19:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THJjgH082989; Wed, 29 Sep 2021 17:19:45 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:19:45 GMT Message-Id: <202109291719.18THJjgH082989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 81d34d466c3d - stable/13 - sctp: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 81d34d466c3d6a0a7ee1487be3226dd946bab137 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:19:45 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=81d34d466c3d6a0a7ee1487be3226dd946bab137 commit 81d34d466c3d6a0a7ee1487be3226dd946bab137 Author: Gordon Bergling AuthorDate: 2021-09-26 13:15:39 +0000 Commit: Gordon Bergling CommitDate: 2021-09-29 17:18:27 +0000 sctp: Fix a typo in a comment - s/assue/assume/ (cherry picked from commit d2e616147db7b688f2b6fa8ec6d545bc4253de92) --- sys/netinet/sctp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 0344d4419f32..ce017b74b674 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -512,7 +512,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, /* * Cancel the INIT timer, We do this first before queueing the - * cookie. We always cancel at the primary to assue that we are + * cookie. We always cancel at the primary to assume that we are * canceling the timer started by the INIT which always goes to the * primary. */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:19:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 094006779A4; Wed, 29 Sep 2021 17:19:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKNR73qS3z4YZH; Wed, 29 Sep 2021 17:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60BFA1C247; Wed, 29 Sep 2021 17:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18THJllP083038; Wed, 29 Sep 2021 17:19:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THJlfB083037; Wed, 29 Sep 2021 17:19:47 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:19:47 GMT Message-Id: <202109291719.18THJlfB083037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: b1e764c79f78 - stable/13 - nfsclient: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b1e764c79f78d47fce5d1cf048ff67cb41a3f955 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:19:48 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b1e764c79f78d47fce5d1cf048ff67cb41a3f955 commit b1e764c79f78d47fce5d1cf048ff67cb41a3f955 Author: Gordon Bergling AuthorDate: 2021-09-26 13:17:00 +0000 Commit: Gordon Bergling CommitDate: 2021-09-29 17:19:22 +0000 nfsclient: Fix a typo in a comment - s/derefernce/dereference/ (cherry picked from commit 90d60ca8b7f2483cdc162633f7ea4738dad8fa0e) --- sys/fs/nfsclient/nfs_clcomsubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index 554f5e820f54..c6556d287b1e 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -476,7 +476,7 @@ nfscl_lockunlock(struct nfsv4lock *lckp) } /* - * Called to derefernce a lock on a stateid (delegation or open owner). + * Called to dereference a lock on a stateid (delegation or open owner). */ void nfscl_lockderef(struct nfsv4lock *lckp) From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:23:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EDFB678084; Wed, 29 Sep 2021 17:23: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 4HKNW32CQZz4Z1x; Wed, 29 Sep 2021 17:23:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C7231C602; Wed, 29 Sep 2021 17:23: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 18THNB0J095834; Wed, 29 Sep 2021 17:23:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THNBRr095833; Wed, 29 Sep 2021 17:23:11 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:23:11 GMT Message-Id: <202109291723.18THNBRr095833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 747a47261eee - main - Fix error return of kern.ipc.posix_shm_list, which caused it (and thus "posixshmcontrol ls") to fail for all jails that didn't happen to own the last shm object in the list. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 747a47261eee59b6e9c437cd2c1b3979df5c32ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:23:11 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=747a47261eee59b6e9c437cd2c1b3979df5c32ac commit 747a47261eee59b6e9c437cd2c1b3979df5c32ac Author: Jamie Gritton AuthorDate: 2021-09-29 17:20:36 +0000 Commit: Jamie Gritton CommitDate: 2021-09-29 17:20:36 +0000 Fix error return of kern.ipc.posix_shm_list, which caused it (and thus "posixshmcontrol ls") to fail for all jails that didn't happen to own the last shm object in the list. --- sys/kern/uipc_shm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index c672c0477b95..63c4250f640f 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -2045,8 +2045,10 @@ sysctl_posix_shm_list(SYSCTL_HANDLER_ARGS) LIST_FOREACH(shmm, &shm_dictionary[i], sm_link) { error = shm_fill_kinfo_locked(shmm->sm_shmfd, &kif, true); - if (error == EPERM) + if (error == EPERM) { + error = 0; continue; + } if (error != 0) break; pack_kinfo(&kif); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:24:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77F15678196; Wed, 29 Sep 2021 17:24: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 4HKNXf31Qkz4Z4x; Wed, 29 Sep 2021 17:24:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 485011C3C7; Wed, 29 Sep 2021 17:24: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 18THOY67096052; Wed, 29 Sep 2021 17:24:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THOYKj096051; Wed, 29 Sep 2021 17:24:34 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:24:34 GMT Message-Id: <202109291724.18THOYKj096051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 1a48e00227d6 - stable/12 - jail(9): Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1a48e00227d67d47c08b3708a0304a6e13dd3883 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:24:34 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1a48e00227d67d47c08b3708a0304a6e13dd3883 commit 1a48e00227d67d47c08b3708a0304a6e13dd3883 Author: Gordon Bergling AuthorDate: 2021-09-26 13:17:41 +0000 Commit: Gordon Bergling CommitDate: 2021-09-29 17:20:41 +0000 jail(9): Fix a typo in a comment - s/erorr/error/ (cherry picked from commit 8771ff75384dec8c9f95ce25b6ca9a639c4b208c) --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index e95a0c60bd1e..69762b683f4c 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1309,7 +1309,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #endif /* * Allocate a dedicated cpuset for each jail. - * Unlike other initial settings, this may return an erorr. + * Unlike other initial settings, this may return an error. */ error = cpuset_create_root(ppr, &pr->pr_cpuset); if (error) { From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:24:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1135367802A; Wed, 29 Sep 2021 17:24: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 4HKNXh69TYz4ZQk; Wed, 29 Sep 2021 17:24:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83FF61C680; Wed, 29 Sep 2021 17:24: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 18THOakr096107; Wed, 29 Sep 2021 17:24:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THOaXn096106; Wed, 29 Sep 2021 17:24:36 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:24:36 GMT Message-Id: <202109291724.18THOaXn096106@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 5cd0914ebee0 - stable/12 - pcm(4): Fix a common typo in source code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5cd0914ebee0a781be83193dc861de5ae00e205c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:24:37 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5cd0914ebee0a781be83193dc861de5ae00e205c commit 5cd0914ebee0a781be83193dc861de5ae00e205c Author: Gordon Bergling AuthorDate: 2021-09-26 09:21:16 +0000 Commit: Gordon Bergling CommitDate: 2021-09-29 17:23:47 +0000 pcm(4): Fix a common typo in source code comments - s/prefered/preferred/ (cherry picked from commit 513ee901eec639da45796d563168f0af966705e6) --- sys/dev/sound/pcm/feeder_chain.c | 4 ++-- sys/dev/sound/pcm/feeder_matrix.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pcm/feeder_chain.c b/sys/dev/sound/pcm/feeder_chain.c index b2d48abd71d1..fe114b727ffd 100644 --- a/sys/dev/sound/pcm/feeder_chain.c +++ b/sys/dev/sound/pcm/feeder_chain.c @@ -52,7 +52,7 @@ struct feeder_chain_desc { struct feeder_chain_state current; /* current state */ struct feeder_chain_state target; /* target state */ struct pcm_feederdesc desc; /* feeder descriptor */ - uint32_t afmt_ne; /* prefered native endian */ + uint32_t afmt_ne; /* preferred native endian */ int mode; /* chain mode */ int use_eq; /* need EQ? */ int use_matrix; /* need channel matrixing? */ @@ -77,7 +77,7 @@ struct feeder_chain_desc { #endif /* - * List of prefered formats that might be required during + * List of preferred formats that might be required during * processing. It will be decided through snd_fmtbest(). */ diff --git a/sys/dev/sound/pcm/feeder_matrix.c b/sys/dev/sound/pcm/feeder_matrix.c index ecb3c55a4825..c0dec6415b7b 100644 --- a/sys/dev/sound/pcm/feeder_matrix.c +++ b/sys/dev/sound/pcm/feeder_matrix.c @@ -553,7 +553,7 @@ feeder_matrix_setup(struct pcm_feeder *f, struct pcmchan_matrix *m_in, /* * feeder_matrix_default_id(): For a given number of channels, return - * default prefered id (example: both 5.1 and + * default preferred id (example: both 5.1 and * 6.0 are simply 6 channels, but 5.1 is more * preferable). */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:24:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9490677F2D; Wed, 29 Sep 2021 17:24: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 4HKNXg3r5rz4Z52; Wed, 29 Sep 2021 17:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 640841C547; Wed, 29 Sep 2021 17:24: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 18THOZ6g096083; Wed, 29 Sep 2021 17:24:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THOZWu096082; Wed, 29 Sep 2021 17:24:35 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:24:35 GMT Message-Id: <202109291724.18THOZWu096082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 2616719fdddf - stable/12 - sctp: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2616719fdddf3c3b5b876311731c5994720887cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:24:35 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2616719fdddf3c3b5b876311731c5994720887cf commit 2616719fdddf3c3b5b876311731c5994720887cf Author: Gordon Bergling AuthorDate: 2021-09-26 13:15:39 +0000 Commit: Gordon Bergling CommitDate: 2021-09-29 17:23:17 +0000 sctp: Fix a typo in a comment - s/assue/assume/ (cherry picked from commit d2e616147db7b688f2b6fa8ec6d545bc4253de92) --- sys/netinet/sctp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 00b6f5029c59..da986ca08125 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -544,7 +544,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, /* * Cancel the INIT timer, We do this first before queueing the - * cookie. We always cancel at the primary to assue that we are + * cookie. We always cancel at the primary to assume that we are * canceling the timer started by the INIT which always goes to the * primary. */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 17:24:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D73C3677F39; Wed, 29 Sep 2021 17:24: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 4HKNXj5Wn9z4YwM; Wed, 29 Sep 2021 17:24:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E7FA1C592; Wed, 29 Sep 2021 17:24: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 18THObm9096131; Wed, 29 Sep 2021 17:24:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18THObDl096130; Wed, 29 Sep 2021 17:24:37 GMT (envelope-from git) Date: Wed, 29 Sep 2021 17:24:37 GMT Message-Id: <202109291724.18THObDl096130@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 4f7c9e7be14e - stable/12 - nfsclient: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4f7c9e7be14eaae7ae92bba66e5f4acbe0b64215 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 17:24:38 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4f7c9e7be14eaae7ae92bba66e5f4acbe0b64215 commit 4f7c9e7be14eaae7ae92bba66e5f4acbe0b64215 Author: Gordon Bergling AuthorDate: 2021-09-26 13:17:00 +0000 Commit: Gordon Bergling CommitDate: 2021-09-29 17:24:16 +0000 nfsclient: Fix a typo in a comment - s/derefernce/dereference/ (cherry picked from commit 90d60ca8b7f2483cdc162633f7ea4738dad8fa0e) --- sys/fs/nfsclient/nfs_clcomsubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index f0ac1a0b09ca..4d6205fb0358 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -421,7 +421,7 @@ nfscl_lockunlock(struct nfsv4lock *lckp) } /* - * Called to derefernce a lock on a stateid (delegation or open owner). + * Called to dereference a lock on a stateid (delegation or open owner). */ void nfscl_lockderef(struct nfsv4lock *lckp) From owner-dev-commits-src-all@freebsd.org Wed Sep 29 18:05:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70C596785E5; Wed, 29 Sep 2021 18:05: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 4HKPRP2kHWz4dLy; Wed, 29 Sep 2021 18:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D64A1CD1A; Wed, 29 Sep 2021 18:05: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 18TI55wO049922; Wed, 29 Sep 2021 18:05:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TI55mL049921; Wed, 29 Sep 2021 18:05:05 GMT (envelope-from git) Date: Wed, 29 Sep 2021 18:05:05 GMT Message-Id: <202109291805.18TI55mL049921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f6787614fd4d - main - cmp: accept SI suffixes for skip1 and skip2 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/main X-Git-Reftype: branch X-Git-Commit: f6787614fd4db2a9d5e649af0e819852ebd5a19d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 18:05:05 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f6787614fd4db2a9d5e649af0e819852ebd5a19d commit f6787614fd4db2a9d5e649af0e819852ebd5a19d Author: Kyle Evans AuthorDate: 2021-09-23 05:17:07 +0000 Commit: Kyle Evans CommitDate: 2021-09-29 18:03:34 +0000 cmp: accept SI suffixes for skip1 and skip2 This is compatible with GNU cmp. Reviewed by: bapt (earlier version), markj, imp Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32071 --- usr.bin/cmp/Makefile | 2 ++ usr.bin/cmp/cmp.1 | 16 +++++++++++++++- usr.bin/cmp/cmp.c | 14 ++++++++++++-- usr.bin/cmp/tests/cmp_test2.sh | 17 +++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/usr.bin/cmp/Makefile b/usr.bin/cmp/Makefile index bcde84f0255a..0392fd368503 100644 --- a/usr.bin/cmp/Makefile +++ b/usr.bin/cmp/Makefile @@ -6,6 +6,8 @@ PROG= cmp SRCS= cmp.c link.c misc.c regular.c special.c +LIBADD= util + HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index fc05fb893147..6980f73e7be5 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -31,7 +31,7 @@ .\" @(#)cmp.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 20, 2020 +.Dd September 23, 2021 .Dt CMP 1 .Os .Sh NAME @@ -86,6 +86,11 @@ and respectively, where the comparison will begin. The offset is decimal by default, but may be expressed as a hexadecimal or octal value by preceding it with a leading ``0x'' or ``0''. +.Pp +.Ar skip1 +and +.Ar skip2 +may also be specified with SI size suffixes. .Sh EXIT STATUS The .Nm @@ -164,8 +169,17 @@ The and .Fl z options are extensions to the standard. +.Ar skip1 +and +.Ar skip2 +arguments are extensions to the standard. .Sh HISTORY A .Nm command appeared in .At v1 . +.Sh BUGS +The phrase +.Dq SI size suffixes +above refers to the traditional power of two convention, as described in +.Xr expand_number 3 . diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 47f9b671985c..bab69125e83e 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "extern.h" bool lflag, sflag, xflag, zflag; @@ -81,6 +83,7 @@ main(int argc, char *argv[]) bool special; const char *file1, *file2; + skip1 = skip2 = 0; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+hlsxz", long_opts, NULL)) != -1) switch (ch) { @@ -145,8 +148,15 @@ main(int argc, char *argv[]) exit(ERR_EXIT); } - skip1 = argc > 2 ? strtol(argv[2], NULL, 0) : 0; - skip2 = argc == 4 ? strtol(argv[3], NULL, 0) : 0; + if (argc > 2 && expand_number(argv[2], &skip1) < 0) { + fprintf(stderr, "Invalid skip1: %s\n", argv[2]); + usage(); + } + + if (argc == 4 && expand_number(argv[3], &skip2) < 0) { + fprintf(stderr, "Invalid skip2: %s\n", argv[3]); + usage(); + } if (sflag && skip1 == 0 && skip2 == 0) zflag = true; diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 7f9801fc92bd..334e9f357730 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -75,9 +75,26 @@ pr252542_body() atf_check -s exit:1 -o ignore cmp -z a b 4 3 } +atf_test_case skipsuff +skipsuff_head() +{ + atf_set "descr" "Test cmp(1) accepting SI suffixes on skips" +} +skipsuff_body() +{ + + jot -nb a -s '' 1028 > a + jot -nb b -s '' 1024 > b + jot -nb a -s '' 4 >> b + + atf_check -s exit:1 -o ignore cmp -s a b + atf_check -s exit:0 cmp -s a b 1k 1k +} + atf_init_test_cases() { atf_add_test_case special atf_add_test_case symlink atf_add_test_case pr252542 + atf_add_test_case skipsuff } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 18:05:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4DFD6789CD; Wed, 29 Sep 2021 18:05: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 4HKPRR642Nz4dV0; Wed, 29 Sep 2021 18:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F3C91CAB1; Wed, 29 Sep 2021 18:05: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 18TI57uN049975; Wed, 29 Sep 2021 18:05:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TI57H8049974; Wed, 29 Sep 2021 18:05:07 GMT (envelope-from git) Date: Wed, 29 Sep 2021 18:05:07 GMT Message-Id: <202109291805.18TI57H8049974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 8d546b6832ee - main - cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args 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/main X-Git-Reftype: branch X-Git-Commit: 8d546b6832eea031f95f30eaec3232ec1256a281 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 18:05:08 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8d546b6832eea031f95f30eaec3232ec1256a281 commit 8d546b6832eea031f95f30eaec3232ec1256a281 Author: Kyle Evans AuthorDate: 2021-09-23 05:43:32 +0000 Commit: Kyle Evans CommitDate: 2021-09-29 18:03:34 +0000 cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32073 --- usr.bin/cmp/cmp.1 | 19 +++++++++++++++++++ usr.bin/cmp/cmp.c | 30 +++++++++++++++++++++++++++++- usr.bin/cmp/tests/cmp_test2.sh | 5 +++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 511e09ac8628..5a56802bd22e 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -41,6 +41,7 @@ .Nm .Op Fl l | s | x .Op Fl hz +.Op Fl -ignore-initial Ns Cm = Ns Ar num1 Ns Op :num2 .Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 .Op Ar skip1 Op Ar skip2 @@ -60,6 +61,23 @@ The following options are available: .Bl -tag -width indent .It Fl h Do not follow symbolic links. +.It Fl i Ar num1 Ns Oo :num2 Oc , Fl -ignore-initial= Ns Ar num1 Ns Op :num2 +Skip +.Ar num1 +bytes from +.Ar file1 , +and optionally skip +.Ar num2 +bytes from +.Ar file2 . +If +.Ar num2 +is not specified, then +.Ar num1 +is applied for both +.Ar file1 +and +.Ar file2 . .It Fl l , Fl -verbose Print the byte number (decimal) and the differing byte values (octal) for each difference. @@ -170,6 +188,7 @@ utility is expected to be compatible. The .Fl h , +.Fl i , .Fl n , .Fl x , and diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 384c273f4632..256cef8a0c31 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -66,6 +66,7 @@ bool lflag, sflag, xflag, zflag; static const struct option long_opts[] = { + {"ignore-initial", required_argument, NULL, 'i'}, {"verbose", no_argument, NULL, 'l'}, {"bytes", required_argument, NULL, 'n'}, {"silent", no_argument, NULL, 's'}, @@ -75,6 +76,25 @@ static const struct option long_opts[] = static void usage(void); +static bool +parse_iskipspec(char *spec, off_t *skip1, off_t *skip2) +{ + char *colon; + + colon = strchr(spec, ':'); + if (colon != NULL) + *colon++ = '\0'; + + if (expand_number(spec, skip1) < 0) + return (false); + + if (colon != NULL) + return (expand_number(colon, skip2) == 0); + + *skip2 = *skip1; + return (true); +} + int main(int argc, char *argv[]) { @@ -86,11 +106,19 @@ main(int argc, char *argv[]) skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hln:sxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+hi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; break; + case 'i': + if (!parse_iskipspec(optarg, &skip1, &skip2)) { + fprintf(stderr, + "Invalid --ignore-initial: %s\n", + optarg); + usage(); + } + break; case 'l': /* print all differences */ lflag = true; break; diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index c513984daf8b..893ee59076c3 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -71,8 +71,13 @@ pr252542_body() { echo -n '1234567890' > a echo -n 'abc567890' > b + echo -n 'xbc567890' > c atf_check -s exit:0 cmp -s a b 4 3 + atf_check -s exit:0 cmp -i 4:3 -s a b + atf_check -s exit:0 cmp -i 1 -s b c atf_check -s exit:1 -o ignore cmp -z a b 4 3 + atf_check -s exit:1 -o ignore cmp -i 4:3 -z a b + atf_check -s exit:1 -o ignore cmp -i 1 -z a b } atf_test_case skipsuff From owner-dev-commits-src-all@freebsd.org Wed Sep 29 18:05:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96D42678A05; Wed, 29 Sep 2021 18:05: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 4HKPRQ3RP3z4dRC; Wed, 29 Sep 2021 18:05:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 559951CF04; Wed, 29 Sep 2021 18:05: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 18TI56v9049951; Wed, 29 Sep 2021 18:05:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TI568j049950; Wed, 29 Sep 2021 18:05:06 GMT (envelope-from git) Date: Wed, 29 Sep 2021 18:05:06 GMT Message-Id: <202109291805.18TI568j049950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 4e380e847460 - main - cmp: add -n, --bytes to limit number of bytes to compare 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/main X-Git-Reftype: branch X-Git-Commit: 4e380e8474609875c4cf5277b3755ac29079a8b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 18:05:06 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4e380e8474609875c4cf5277b3755ac29079a8b5 commit 4e380e8474609875c4cf5277b3755ac29079a8b5 Author: Kyle Evans AuthorDate: 2021-09-23 05:26:52 +0000 Commit: Kyle Evans CommitDate: 2021-09-29 18:03:34 +0000 cmp: add -n, --bytes to limit number of bytes to compare This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32072 --- usr.bin/cmp/cmp.1 | 6 ++++++ usr.bin/cmp/cmp.c | 18 +++++++++++++----- usr.bin/cmp/extern.h | 7 ++++--- usr.bin/cmp/link.c | 6 ++++-- usr.bin/cmp/regular.c | 8 +++++--- usr.bin/cmp/special.c | 4 ++-- usr.bin/cmp/tests/cmp_test2.sh | 23 +++++++++++++++++++++++ 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 6980f73e7be5..511e09ac8628 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -41,6 +41,7 @@ .Nm .Op Fl l | s | x .Op Fl hz +.Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 .Op Ar skip1 Op Ar skip2 .Sh DESCRIPTION @@ -62,6 +63,10 @@ Do not follow symbolic links. .It Fl l , Fl -verbose Print the byte number (decimal) and the differing byte values (octal) for each difference. +.It Fl n Ar num , Fl -bytes= Ns num +Only compare up to +.Ar num +bytes. .It Fl s , Fl -silent , Fl -quiet Print nothing for differing files; return exit status only. @@ -165,6 +170,7 @@ utility is expected to be compatible. The .Fl h , +.Fl n , .Fl x , and .Fl z diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index bab69125e83e..384c273f4632 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -67,6 +67,7 @@ bool lflag, sflag, xflag, zflag; static const struct option long_opts[] = { {"verbose", no_argument, NULL, 'l'}, + {"bytes", required_argument, NULL, 'n'}, {"silent", no_argument, NULL, 's'}, {"quiet", no_argument, NULL, 's'}, {NULL, no_argument, NULL, 0} @@ -78,14 +79,14 @@ int main(int argc, char *argv[]) { struct stat sb1, sb2; - off_t skip1, skip2; + off_t skip1, skip2, limit; int ch, fd1, fd2, oflag; bool special; const char *file1, *file2; skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hlsxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+hln:sxz", long_opts, NULL)) != -1) switch (ch) { case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; @@ -93,6 +94,13 @@ main(int argc, char *argv[]) case 'l': /* print all differences */ lflag = true; break; + case 'n': /* Limit */ + if (expand_number(optarg, &limit) < 0 || limit < 0) { + fprintf(stderr, "Invalid --bytes: %s\n", + optarg); + usage(); + } + break; case 's': /* silent run */ sflag = true; break; @@ -163,7 +171,7 @@ main(int argc, char *argv[]) if (fd1 == -1) { if (fd2 == -1) { - c_link(file1, skip1, file2, skip2); + c_link(file1, skip1, file2, skip2, limit); exit(0); } else if (!sflag) errx(ERR_EXIT, "%s: Not a symbolic link", file2); @@ -201,7 +209,7 @@ main(int argc, char *argv[]) } if (special) - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); else { if (zflag && sb1.st_size != sb2.st_size) { if (!sflag) @@ -210,7 +218,7 @@ main(int argc, char *argv[]) exit(DIFF_EXIT); } c_regular(fd1, file1, skip1, sb1.st_size, - fd2, file2, skip2, sb2.st_size); + fd2, file2, skip2, sb2.st_size, limit); } exit(0); } diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h index 82c5ea42b175..803319a50ca4 100644 --- a/usr.bin/cmp/extern.h +++ b/usr.bin/cmp/extern.h @@ -38,9 +38,10 @@ #define DIFF_EXIT 1 #define ERR_EXIT 2 /* error exit code */ -void c_link(const char *, off_t, const char *, off_t); -void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, off_t); -void c_special(int, const char *, off_t, int, const char *, off_t); +void c_link(const char *, off_t, const char *, off_t, off_t); +void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, + off_t, off_t); +void c_special(int, const char *, off_t, int, const char *, off_t, off_t); void diffmsg(const char *, const char *, off_t, off_t); void eofmsg(const char *); diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c index 9193147e830e..f0b4482a5792 100644 --- a/usr.bin/cmp/link.c +++ b/usr.bin/cmp/link.c @@ -40,7 +40,8 @@ __FBSDID("$FreeBSD$"); #include "extern.h" void -c_link(const char *file1, off_t skip1, const char *file2, off_t skip2) +c_link(const char *file1, off_t skip1, const char *file2, off_t skip2, + off_t limit) { char buf1[PATH_MAX], *p1; char buf2[PATH_MAX], *p2; @@ -72,7 +73,8 @@ c_link(const char *file1, off_t skip1, const char *file2, off_t skip2) dfound = 0; byte = 1; - for (p1 = buf1 + skip1, p2 = buf2 + skip2; *p1 && *p2; p1++, p2++) { + for (p1 = buf1 + skip1, p2 = buf2 + skip2; + *p1 && *p2 && (limit == 0 || byte <= limit); p1++, p2++) { if ((ch = *p1) != *p2) { if (xflag) { dfound = 1; diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index fe639663a560..a60398620282 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -60,7 +60,7 @@ static void segv_handler(int); void c_regular(int fd1, const char *file1, off_t skip1, off_t len1, - int fd2, const char *file2, off_t skip2, off_t len2) + int fd2, const char *file2, off_t skip2, off_t len2, off_t limit) { struct sigaction act, oact; cap_rights_t rights; @@ -86,15 +86,17 @@ c_regular(int fd1, const char *file1, off_t skip1, off_t len1, off2 = ROUNDPAGE(skip2); length = MIN(len1, len2); + if (limit > 0) + length = MIN(length, limit); if ((m1 = remmap(NULL, fd1, off1)) == NULL) { - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); return; } if ((m2 = remmap(NULL, fd2, off2)) == NULL) { munmap(m1, MMAP_CHUNK); - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); return; } diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index 930fcd5492ff..25f755f6e70a 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); void c_special(int fd1, const char *file1, off_t skip1, - int fd2, const char *file2, off_t skip2) + int fd2, const char *file2, off_t skip2, off_t limit) { int ch1, ch2; off_t byte, line; @@ -76,7 +76,7 @@ c_special(int fd1, const char *file1, off_t skip1, if (getc(fp2) == EOF) goto eof; - for (byte = line = 1;; ++byte) { + for (byte = line = 1; limit == 0 || byte <= limit; ++byte) { ch1 = getc(fp1); ch2 = getc(fp2); if (ch1 == EOF || ch2 == EOF) diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 334e9f357730..c513984daf8b 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -91,10 +91,33 @@ skipsuff_body() atf_check -s exit:0 cmp -s a b 1k 1k } +atf_test_case limit +limit_head() +{ + atf_set "descr" "Test cmp(1) -n (limit)" +} +limit_body() +{ + echo -n "aaaabbbb" > a + echo -n "aaaaxxxx" > b + + atf_check -s exit:1 -o ignore cmp -s a b + atf_check -s exit:0 cmp -sn 4 a b + atf_check -s exit:0 cmp -sn 3 a b + atf_check -s exit:1 -o ignore cmp -sn 5 a b + + # Test special, too. The implementation for link is effectively + # identical. + atf_check -s exit:0 -e empty -x "cat a | cmp -sn 4 b -" + atf_check -s exit:0 -e empty -x "cat a | cmp -sn 3 b -" + atf_check -s exit:1 -o ignore -x "cat a | cmp -sn 5 b -" +} + atf_init_test_cases() { atf_add_test_case special atf_add_test_case symlink atf_add_test_case pr252542 atf_add_test_case skipsuff + atf_add_test_case limit } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 18:05:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1735C67896C; Wed, 29 Sep 2021 18:05: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 4HKPRS5PpHz4dJG; Wed, 29 Sep 2021 18:05:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B1D21CE86; Wed, 29 Sep 2021 18:05: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 18TI58ef050001; Wed, 29 Sep 2021 18:05:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TI58NI050000; Wed, 29 Sep 2021 18:05:08 GMT (envelope-from git) Date: Wed, 29 Sep 2021 18:05:08 GMT Message-Id: <202109291805.18TI58NI050000@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f66b9b40f403 - main - cmp: add -b, --print-bytes 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/main X-Git-Reftype: branch X-Git-Commit: f66b9b40f403f7c30fec3c4ceed93c6e8fafa8ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 18:05:09 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f66b9b40f403f7c30fec3c4ceed93c6e8fafa8ac commit f66b9b40f403f7c30fec3c4ceed93c6e8fafa8ac Author: Kyle Evans AuthorDate: 2021-09-23 05:46:30 +0000 Commit: Kyle Evans CommitDate: 2021-09-29 18:04:57 +0000 cmp: add -b, --print-bytes This is compatible with GNU cmp. Reviewed by: bapt, markj (earlier version) Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32074 --- usr.bin/cmp/cmp.1 | 5 ++++- usr.bin/cmp/cmp.c | 8 ++++++-- usr.bin/cmp/extern.h | 4 ++-- usr.bin/cmp/link.c | 10 +++++++--- usr.bin/cmp/misc.c | 14 ++++++++++++-- usr.bin/cmp/regular.c | 10 +++++++--- usr.bin/cmp/special.c | 11 ++++++++--- usr.bin/cmp/tests/Makefile | 5 +++++ usr.bin/cmp/tests/b_flag.out | 1 + usr.bin/cmp/tests/bl_flag.out | 1 + usr.bin/cmp/tests/cmp_test2.sh | 17 +++++++++++++++++ 11 files changed, 70 insertions(+), 16 deletions(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 5a56802bd22e..3e616bbe806e 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl l | s | x -.Op Fl hz +.Op Fl bhz .Op Fl -ignore-initial Ns Cm = Ns Ar num1 Ns Op :num2 .Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 @@ -59,6 +59,8 @@ Bytes and lines are numbered beginning with one. .Pp The following options are available: .Bl -tag -width indent +.It Fl b , Fl -print-bytes +Print each byte when a difference is found. .It Fl h Do not follow symbolic links. .It Fl i Ar num1 Ns Oo :num2 Oc , Fl -ignore-initial= Ns Ar num1 Ns Op :num2 @@ -187,6 +189,7 @@ utility is expected to be .St -p1003.2 compatible. The +.Fl b , .Fl h , .Fl i , .Fl n , diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 256cef8a0c31..98ae96c73375 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -62,10 +62,11 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -bool lflag, sflag, xflag, zflag; +bool bflag, lflag, sflag, xflag, zflag; static const struct option long_opts[] = { + {"print-bytes", no_argument, NULL, 'b'}, {"ignore-initial", required_argument, NULL, 'i'}, {"verbose", no_argument, NULL, 'l'}, {"bytes", required_argument, NULL, 'n'}, @@ -106,8 +107,11 @@ main(int argc, char *argv[]) skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hi:ln:sxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+bhi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { + case 'b': /* Print bytes */ + bflag = true; + break; case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; break; diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h index 803319a50ca4..d98daf424995 100644 --- a/usr.bin/cmp/extern.h +++ b/usr.bin/cmp/extern.h @@ -42,7 +42,7 @@ void c_link(const char *, off_t, const char *, off_t, off_t); void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, off_t, off_t); void c_special(int, const char *, off_t, int, const char *, off_t, off_t); -void diffmsg(const char *, const char *, off_t, off_t); +void diffmsg(const char *, const char *, off_t, off_t, int, int); void eofmsg(const char *); -extern bool lflag, sflag, xflag, zflag; +extern bool bflag, lflag, sflag, xflag, zflag; diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c index f0b4482a5792..e01a5911faf7 100644 --- a/usr.bin/cmp/link.c +++ b/usr.bin/cmp/link.c @@ -82,10 +82,14 @@ c_link(const char *file1, off_t skip1, const char *file2, off_t skip2, (long long)byte - 1, ch, *p2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch, *p2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch, ch, *p2, *p2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch, *p2); } else - diffmsg(file1, file2, byte, 1); + diffmsg(file1, file2, byte, 1, ch, *p2); /* NOTREACHED */ } byte++; diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c index 1e84f0d7a527..1dba34d28792 100644 --- a/usr.bin/cmp/misc.c +++ b/usr.bin/cmp/misc.c @@ -56,10 +56,20 @@ eofmsg(const char *file) } void -diffmsg(const char *file1, const char *file2, off_t byte, off_t line) +diffmsg(const char *file1, const char *file2, off_t byte, off_t line, + int b1, int b2) { - if (!sflag) + if (sflag) + goto out; + + if (bflag) { + (void)printf("%s %s differ: char %lld, line %lld is %3o %c %3o %c\n", + file1, file2, (long long)byte, (long long)line, b1, b1, + b2, b2); + } else { (void)printf("%s %s differ: char %lld, line %lld\n", file1, file2, (long long)byte, (long long)line); + } +out: exit(DIFF_EXIT); } diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index a60398620282..d270aeeac396 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -127,10 +127,14 @@ c_regular(int fd1, const char *file1, off_t skip1, off_t len1, (long long)byte - 1, ch, *p2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch, *p2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch, ch, *p2, *p2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch, *p2); } else - diffmsg(file1, file2, byte, line); + diffmsg(file1, file2, byte, line, ch, *p2); /* NOTREACHED */ } if (ch == '\n') diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index 25f755f6e70a..c206a317c0ef 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -88,10 +88,15 @@ c_special(int fd1, const char *file1, off_t skip1, (long long)byte - 1, ch1, ch2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch1, ch2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch1, ch1, ch2, + ch2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch1, ch2); } else { - diffmsg(file1, file2, byte, line); + diffmsg(file1, file2, byte, line, ch1, ch2); /* NOTREACHED */ } } diff --git a/usr.bin/cmp/tests/Makefile b/usr.bin/cmp/tests/Makefile index 087f32f4185f..99469ba42243 100644 --- a/usr.bin/cmp/tests/Makefile +++ b/usr.bin/cmp/tests/Makefile @@ -2,9 +2,14 @@ .include +PACKAGE= tests + ATF_TESTS_SH+= cmp_test2 NETBSD_ATF_TESTS_SH= cmp_test +${PACKAGE}FILES+= b_flag.out +${PACKAGE}FILES+= bl_flag.out + .include .include diff --git a/usr.bin/cmp/tests/b_flag.out b/usr.bin/cmp/tests/b_flag.out new file mode 100644 index 000000000000..bb3d288716b0 --- /dev/null +++ b/usr.bin/cmp/tests/b_flag.out @@ -0,0 +1 @@ +a b differ: char 3, line 1 is 143 c 144 d diff --git a/usr.bin/cmp/tests/bl_flag.out b/usr.bin/cmp/tests/bl_flag.out new file mode 100644 index 000000000000..8ec9007d7ed3 --- /dev/null +++ b/usr.bin/cmp/tests/bl_flag.out @@ -0,0 +1 @@ + 3 143 c 144 d diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 893ee59076c3..c264827646ca 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -118,6 +118,22 @@ limit_body() atf_check -s exit:1 -o ignore -x "cat a | cmp -sn 5 b -" } +atf_test_case bflag +bflag_head() +{ + atf_set "descr" "Test cmp(1) -b (print bytes)" +} +bflag_body() +{ + echo -n "abcd" > a + echo -n "abdd" > b + + atf_check -s exit:1 -o file:$(atf_get_srcdir)/b_flag.out \ + cmp -b a b + atf_check -s exit:1 -o file:$(atf_get_srcdir)/bl_flag.out \ + cmp -bl a b +} + atf_init_test_cases() { atf_add_test_case special @@ -125,4 +141,5 @@ atf_init_test_cases() atf_add_test_case pr252542 atf_add_test_case skipsuff atf_add_test_case limit + atf_add_test_case bflag } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 19:38:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9FD267A48E; Wed, 29 Sep 2021 19:38: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 4HKRWh4tNDz4m2c; Wed, 29 Sep 2021 19:38:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 844981E296; Wed, 29 Sep 2021 19:38: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 18TJcuEq070765; Wed, 29 Sep 2021 19:38:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TJcu8W070764; Wed, 29 Sep 2021 19:38:56 GMT (envelope-from git) Date: Wed, 29 Sep 2021 19:38:56 GMT Message-Id: <202109291938.18TJcu8W070764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 095d3f98fb3d - stable/13 - Temporarily skip flaky tset cases under sys.aio.aio_test in CI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 095d3f98fb3d907fbd2e5c799bb2988532e9bf63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 19:38:56 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=095d3f98fb3d907fbd2e5c799bb2988532e9bf63 commit 095d3f98fb3d907fbd2e5c799bb2988532e9bf63 Author: Li-Wen Hsu AuthorDate: 2021-09-28 19:32:47 +0000 Commit: Li-Wen Hsu CommitDate: 2021-09-29 19:38:35 +0000 Temporarily skip flaky tset cases under sys.aio.aio_test in CI - sys.aio.aio_test.vectored_unaligned - sys.aio.aio_test.vectored_zvol_poll PR: 258766 Sponsored by: The FreeBSD Foundation (cherry picked from commit 0b159faaca08e6cc89abcd29b4b1360f97e18245) --- tests/sys/aio/aio_test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index b34e7c13f5a4..05351b849a0a 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -1668,6 +1668,9 @@ ATF_TC_BODY(vectored_unaligned, tc) ssize_t len, total_len; int fd; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/258766"); + ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); @@ -1757,6 +1760,8 @@ ATF_TC_HEAD(vectored_zvol_poll, tc) } ATF_TC_BODY(vectored_zvol_poll, tc) { + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/258766"); aio_zvol_test(poll, NULL, true); } ATF_TC_CLEANUP(vectored_zvol_poll, tc) From owner-dev-commits-src-all@freebsd.org Wed Sep 29 19:43:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F7C167A2F7; Wed, 29 Sep 2021 19:43: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 4HKRcg2sgKz4mGM; Wed, 29 Sep 2021 19:43:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 432761E2CC; Wed, 29 Sep 2021 19:43: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 18TJhFYA083515; Wed, 29 Sep 2021 19:43:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TJhF3O083514; Wed, 29 Sep 2021 19:43:15 GMT (envelope-from git) Date: Wed, 29 Sep 2021 19:43:15 GMT Message-Id: <202109291943.18TJhF3O083514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: ab4ed843a303 - main - minidump: De-duplicate the progress bar 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/main X-Git-Reftype: branch X-Git-Commit: ab4ed843a303ea3e585f8ed3f79873e46d3b3ae3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 19:43:15 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=ab4ed843a303ea3e585f8ed3f79873e46d3b3ae3 commit ab4ed843a303ea3e585f8ed3f79873e46d3b3ae3 Author: Mitchell Horne AuthorDate: 2021-09-29 17:44:27 +0000 Commit: Mitchell Horne CommitDate: 2021-09-29 19:42:21 +0000 minidump: De-duplicate the progress bar The implementation of the progress bar is simple, but duplicated for most minidump implementations. Extract the common bits to kern_dump.c. Ensure that the bar is reset with each subsequent dump; this was only done on some platforms previously. Reviewed by: markj MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31885 --- sys/amd64/amd64/minidump_machdep.c | 51 +++---------------------- sys/arm/arm/minidump_machdep.c | 13 +------ sys/arm/include/dump.h | 3 ++ sys/arm64/arm64/minidump_machdep.c | 46 ++--------------------- sys/arm64/include/dump.h | 3 ++ sys/i386/i386/minidump_machdep_base.c | 13 +------ sys/kern/kern_dump.c | 69 ++++++++++++++++++++++++++++++++++ sys/mips/include/dump.h | 3 ++ sys/mips/mips/minidump_machdep.c | 48 ++--------------------- sys/powerpc/include/dump.h | 3 ++ sys/powerpc/powerpc/minidump_machdep.c | 54 +++----------------------- sys/riscv/include/dump.h | 3 ++ sys/riscv/riscv/minidump_machdep.c | 46 ++--------------------- sys/sys/kerneldump.h | 3 ++ sys/x86/include/dump.h | 3 ++ 15 files changed, 113 insertions(+), 248 deletions(-) diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c index 7c54c423bbaf..d6bdbfb7e633 100644 --- a/sys/amd64/amd64/minidump_machdep.c +++ b/sys/amd64/amd64/minidump_machdep.c @@ -60,14 +60,12 @@ static struct kerneldumpheader kdh; /* Handle chunked writes. */ static size_t fragsz; static void *dump_va; -static size_t counter, progress, dumpsize, wdog_next; +static size_t progress, dumpsize, wdog_next; static int dump_retry_count = 5; SYSCTL_INT(_machdep, OID_AUTO, dump_retry_count, CTLFLAG_RWTUN, &dump_retry_count, 0, "Number of times dump has to retry before bailing out"); -#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) - static int blk_flush(struct dumperinfo *di) { @@ -81,41 +79,6 @@ blk_flush(struct dumperinfo *di) return (error); } -static struct { - int min_per; - int max_per; - int visited; -} progress_track[10] = { - { 0, 10, 0}, - { 10, 20, 0}, - { 20, 30, 0}, - { 30, 40, 0}, - { 40, 50, 0}, - { 50, 60, 0}, - { 60, 70, 0}, - { 70, 80, 0}, - { 80, 90, 0}, - { 90, 100, 0} -}; - -static void -report_progress(size_t progress, size_t dumpsize) -{ - int sofar, i; - - sofar = 100 - ((progress * 100) / dumpsize); - for (i = 0; i < nitems(progress_track); i++) { - if (sofar < progress_track[i].min_per || - sofar > progress_track[i].max_per) - continue; - if (progress_track[i].visited) - return; - progress_track[i].visited = 1; - printf("..%d%%", sofar); - return; - } -} - /* Pat the watchdog approximately every 128MB of the dump. */ #define WDOG_DUMP_INTERVAL (128 * 1024 * 1024) @@ -152,12 +115,9 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) len = maxdumpsz - fragsz; if (len > sz) len = sz; - counter += len; progress -= len; - if (counter >> 24) { - report_progress(progress, dumpsize); - counter &= (1<<24) - 1; - } + + dumpsys_pb_progress(len); if (progress <= wdog_next) { wdog_kern_pat(WD_LASTVAL); if (wdog_next > WDOG_DUMP_INTERVAL) @@ -213,9 +173,7 @@ minidumpsys(struct dumperinfo *di) retry_count = 0; retry: retry_count++; - counter = 0; - for (i = 0; i < nitems(progress_track); i++) - progress_track[i].visited = 0; + /* Walk page table pages, set bits in vm_page_dump */ pmapsize = 0; for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR, @@ -298,6 +256,7 @@ minidumpsys(struct dumperinfo *di) dumpsize += PAGE_SIZE; wdog_next = progress = dumpsize; + dumpsys_pb_init(dumpsize); /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c index f760d774bfbb..83c607c839ee 100644 --- a/sys/arm/arm/minidump_machdep.c +++ b/sys/arm/arm/minidump_machdep.c @@ -63,9 +63,6 @@ static struct kerneldumpheader kdh; /* Handle chunked writes. */ static size_t fragsz; static void *dump_va; -static uint64_t counter, progress; - -#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) static int blk_flush(struct dumperinfo *di) @@ -115,13 +112,8 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) len = maxdumpsz - fragsz; if (len > sz) len = sz; - counter += len; - progress -= len; - if (counter >> 22) { - printf(" %lld", PG2MB(progress >> PAGE_SHIFT)); - counter &= (1<<22) - 1; - } + dumpsys_pb_progress(len); #ifdef SW_WATCHDOG wdog_kern_pat(WD_LASTVAL); #endif @@ -182,7 +174,6 @@ minidumpsys(struct dumperinfo *di) */ dcache_wbinv_poc_all(); - counter = 0; /* Walk page table pages, set bits in vm_page_dump */ ptesize = 0; for (va = KERNBASE; va < kernel_vm_end; va += PAGE_SIZE) { @@ -206,7 +197,7 @@ minidumpsys(struct dumperinfo *di) } dumpsize += PAGE_SIZE; - progress = dumpsize; + dumpsys_pb_init(dumpsize); /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); diff --git a/sys/arm/include/dump.h b/sys/arm/include/dump.h index 3a7432fd49d3..97db0a819701 100644 --- a/sys/arm/include/dump.h +++ b/sys/arm/include/dump.h @@ -36,6 +36,9 @@ #define DUMPSYS_MD_PA_NPAIRS 20 #define DUMPSYS_NUM_AUX_HDRS 1 +/* How often to check the dump progress bar? */ +#define DUMPSYS_PB_CHECK_BITS 22 /* Every 4MB */ + void dumpsys_wbinv_all(void); int dumpsys_write_aux_headers(struct dumperinfo *di); diff --git a/sys/arm64/arm64/minidump_machdep.c b/sys/arm64/arm64/minidump_machdep.c index 98d0b50be4c6..92b172260ae0 100644 --- a/sys/arm64/arm64/minidump_machdep.c +++ b/sys/arm64/arm64/minidump_machdep.c @@ -62,7 +62,7 @@ static struct kerneldumpheader kdh; /* Handle chunked writes. */ static size_t fragsz; static void *dump_va; -static size_t counter, progress, dumpsize; +static size_t dumpsize; static uint64_t tmpbuffer[Ln_ENTRIES]; @@ -79,41 +79,6 @@ blk_flush(struct dumperinfo *di) return (error); } -static struct { - int min_per; - int max_per; - int visited; -} progress_track[10] = { - { 0, 10, 0}, - { 10, 20, 0}, - { 20, 30, 0}, - { 30, 40, 0}, - { 40, 50, 0}, - { 50, 60, 0}, - { 60, 70, 0}, - { 70, 80, 0}, - { 80, 90, 0}, - { 90, 100, 0} -}; - -static void -report_progress(size_t progress, size_t dumpsize) -{ - int sofar, i; - - sofar = 100 - ((progress * 100) / dumpsize); - for (i = 0; i < nitems(progress_track); i++) { - if (sofar < progress_track[i].min_per || - sofar > progress_track[i].max_per) - continue; - if (progress_track[i].visited) - return; - progress_track[i].visited = 1; - printf("..%d%%", sofar); - return; - } -} - static int blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) { @@ -150,13 +115,8 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) len = maxdumpsz - fragsz; if (len > sz) len = sz; - counter += len; - progress -= len; - if (counter >> 22) { - report_progress(progress, dumpsize); - counter &= (1 << 22) - 1; - } + dumpsys_pb_progress(len); wdog_kern_pat(WD_LASTVAL); if (ptr) { @@ -245,7 +205,7 @@ minidumpsys(struct dumperinfo *di) } dumpsize += PAGE_SIZE; - progress = dumpsize; + dumpsys_pb_init(dumpsize); /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); diff --git a/sys/arm64/include/dump.h b/sys/arm64/include/dump.h index 6f2537550c42..600cc5415970 100644 --- a/sys/arm64/include/dump.h +++ b/sys/arm64/include/dump.h @@ -40,6 +40,9 @@ #define DUMPSYS_MD_PA_NPAIRS 20 #define DUMPSYS_NUM_AUX_HDRS 1 +/* How often to check the dump progress bar? */ +#define DUMPSYS_PB_CHECK_BITS 22 /* Every 4MB */ + void dumpsys_wbinv_all(void); int dumpsys_write_aux_headers(struct dumperinfo *di); diff --git a/sys/i386/i386/minidump_machdep_base.c b/sys/i386/i386/minidump_machdep_base.c index b8e9e4884552..e3e211bf9a46 100644 --- a/sys/i386/i386/minidump_machdep_base.c +++ b/sys/i386/i386/minidump_machdep_base.c @@ -60,9 +60,6 @@ static struct kerneldumpheader kdh; /* Handle chunked writes. */ static size_t fragsz; static void *dump_va; -static uint64_t counter, progress; - -#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) static int blk_flush(struct dumperinfo *di) @@ -110,13 +107,8 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) len = maxdumpsz - fragsz; if (len > sz) len = sz; - counter += len; - progress -= len; - if (counter >> 24) { - printf(" %lld", PG2MB(progress >> PAGE_SHIFT)); - counter &= (1<<24) - 1; - } + dumpsys_pb_progress(len); wdog_kern_pat(WD_LASTVAL); if (ptr) { @@ -173,7 +165,6 @@ minidumpsys(struct dumperinfo *di) int j, k; struct minidumphdr mdhdr; - counter = 0; /* Walk page table pages, set bits in vm_page_dump */ ptesize = 0; for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { @@ -224,7 +215,7 @@ minidumpsys(struct dumperinfo *di) } dumpsize += PAGE_SIZE; - progress = dumpsize; + dumpsys_pb_init(dumpsize); /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); diff --git a/sys/kern/kern_dump.c b/sys/kern/kern_dump.c index 7ba6847e405d..4c592f446f45 100644 --- a/sys/kern/kern_dump.c +++ b/sys/kern/kern_dump.c @@ -385,3 +385,72 @@ dumpsys_generic(struct dumperinfo *di) printf("\n** DUMP FAILED (ERROR %d) **\n", error); return (error); } + +/* Minidump progress bar */ +static struct { + const int min_per; + const int max_per; + bool visited; +} progress_track[10] = { + { 0, 10, false}, + { 10, 20, false}, + { 20, 30, false}, + { 30, 40, false}, + { 40, 50, false}, + { 50, 60, false}, + { 60, 70, false}, + { 70, 80, false}, + { 80, 90, false}, + { 90, 100, false} +}; + +static uint64_t dumpsys_pb_size; +static uint64_t dumpsys_pb_remaining; +static uint64_t dumpsys_pb_check; + +/* Reset the progress bar for a dump of dumpsize. */ +void +dumpsys_pb_init(uint64_t dumpsize) +{ + int i; + + dumpsys_pb_size = dumpsys_pb_remaining = dumpsize; + dumpsys_pb_check = 0; + + for (i = 0; i < nitems(progress_track); i++) + progress_track[i].visited = false; +} + +/* + * Update the progress according to the delta bytes that were written out. + * Check and print the progress percentage. + */ +void +dumpsys_pb_progress(size_t delta) +{ + int sofar, i; + + dumpsys_pb_remaining -= delta; + dumpsys_pb_check += delta; + + /* + * To save time while dumping, only loop through progress_track + * occasionally. + */ + if ((dumpsys_pb_check >> DUMPSYS_PB_CHECK_BITS) == 0) + return; + else + dumpsys_pb_check &= (1 << DUMPSYS_PB_CHECK_BITS) - 1; + + sofar = 100 - ((dumpsys_pb_remaining * 100) / dumpsys_pb_size); + for (i = 0; i < nitems(progress_track); i++) { + if (sofar < progress_track[i].min_per || + sofar > progress_track[i].max_per) + continue; + if (!progress_track[i].visited) { + progress_track[i].visited = true; + printf("..%d%%", sofar); + } + break; + } +} diff --git a/sys/mips/include/dump.h b/sys/mips/include/dump.h index 2224b6eea4b9..4e434861dfcc 100644 --- a/sys/mips/include/dump.h +++ b/sys/mips/include/dump.h @@ -36,6 +36,9 @@ #define DUMPSYS_MD_PA_NPAIRS 20 #define DUMPSYS_NUM_AUX_HDRS 0 +/* How often to check the dump progress bar? */ +#define DUMPSYS_PB_CHECK_BITS 22 /* Every 4MB */ + void dumpsys_wbinv_all(void); static inline void diff --git a/sys/mips/mips/minidump_machdep.c b/sys/mips/mips/minidump_machdep.c index d35b1fd53068..691e1208e684 100644 --- a/sys/mips/mips/minidump_machdep.c +++ b/sys/mips/mips/minidump_machdep.c @@ -58,47 +58,12 @@ CTASSERT(sizeof(struct kerneldumpheader) == 512); static struct kerneldumpheader kdh; /* Handle chunked writes. */ -static uint64_t counter, progress, dumpsize; +static uint64_t dumpsize; /* Just auxiliary bufffer */ static char tmpbuffer[PAGE_SIZE] __aligned(sizeof(uint64_t)); extern pd_entry_t *kernel_segmap; -static struct { - int min_per; - int max_per; - int visited; -} progress_track[10] = { - { 0, 10, 0}, - { 10, 20, 0}, - { 20, 30, 0}, - { 30, 40, 0}, - { 40, 50, 0}, - { 50, 60, 0}, - { 60, 70, 0}, - { 70, 80, 0}, - { 80, 90, 0}, - { 90, 100, 0} -}; - -static void -report_progress(uint64_t progress, uint64_t dumpsize) -{ - int sofar, i; - - sofar = 100 - ((progress * 100) / dumpsize); - for (i = 0; i < nitems(progress_track); i++) { - if (sofar < progress_track[i].min_per || - sofar > progress_track[i].max_per) - continue; - if (progress_track[i].visited) - return; - progress_track[i].visited = 1; - printf("..%d%%", sofar); - return; - } -} - static int write_buffer(struct dumperinfo *di, char *ptr, size_t sz) { @@ -115,14 +80,8 @@ write_buffer(struct dumperinfo *di, char *ptr, size_t sz) while (sz) { len = min(maxdumpsz, sz); - counter += len; - progress -= len; - - if (counter >> 22) { - report_progress(progress, dumpsize); - counter &= (1<<22) - 1; - } + dumpsys_pb_progress(len); wdog_kern_pat(WD_LASTVAL); if (ptr) { @@ -163,7 +122,6 @@ minidumpsys(struct dumperinfo *di) /* Flush cache */ mips_dcache_wbinv_all(); - counter = 0; /* Walk page table pages, set bits in vm_page_dump */ ptesize = 0; @@ -203,7 +161,7 @@ minidumpsys(struct dumperinfo *di) } dumpsize += PAGE_SIZE; - progress = dumpsize; + dumpsys_pb_init(dumpsize); /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); diff --git a/sys/powerpc/include/dump.h b/sys/powerpc/include/dump.h index f6ccb003c89b..3debbfbe25f9 100644 --- a/sys/powerpc/include/dump.h +++ b/sys/powerpc/include/dump.h @@ -35,6 +35,9 @@ #define DUMPSYS_MD_PA_NPAIRS (PHYS_AVAIL_SZ + 1) #define DUMPSYS_NUM_AUX_HDRS 0 +/* How often to check the dump progress bar? */ +#define DUMPSYS_PB_CHECK_BITS 20 /* Every 1MB */ + void dumpsys_pa_init(void); void dumpsys_unmap_chunk(vm_paddr_t, size_t, void *); size_t dumpsys_scan_pmap(void); diff --git a/sys/powerpc/powerpc/minidump_machdep.c b/sys/powerpc/powerpc/minidump_machdep.c index e4d85fe95ed6..908e6f7a3fc7 100644 --- a/sys/powerpc/powerpc/minidump_machdep.c +++ b/sys/powerpc/powerpc/minidump_machdep.c @@ -69,24 +69,7 @@ SYSCTL_INT(_machdep, OID_AUTO, dump_retry_count, CTLFLAG_RWTUN, static struct kerneldumpheader kdh; static char pgbuf[PAGE_SIZE]; -static struct { - int min_per; - int max_per; - int visited; -} progress_track[10] = { - { 0, 10, 0}, - { 10, 20, 0}, - { 20, 30, 0}, - { 30, 40, 0}, - { 40, 50, 0}, - { 50, 60, 0}, - { 60, 70, 0}, - { 70, 80, 0}, - { 80, 90, 0}, - { 90, 100, 0} -}; - -static size_t counter, dumpsize, progress; +static size_t dumpsize; /* Handle chunked writes. */ static size_t fragsz; @@ -98,24 +81,6 @@ pmap_kenter_temporary(vm_offset_t va, vm_paddr_t pa) pmap_kenter(va, pa); } -static void -report_progress(void) -{ - int sofar, i; - - sofar = 100 - ((progress * 100) / dumpsize); - for (i = 0; i < nitems(progress_track); i++) { - if (sofar < progress_track[i].min_per || - sofar > progress_track[i].max_per) - continue; - if (progress_track[i].visited) - return; - progress_track[i].visited = 1; - printf("..%d%%", sofar); - return; - } -} - static int blk_flush(struct dumperinfo *di) { @@ -165,12 +130,8 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) len = maxdumpsz - fragsz; if (len > sz) len = sz; - counter += len; - progress -= len; - if (counter >> 20) { - report_progress(); - counter &= (1<<20) - 1; - } + + dumpsys_pb_progress(len); if (ptr) { error = dump_append(di, ptr, 0, len); @@ -231,7 +192,7 @@ int minidumpsys(struct dumperinfo *di) { vm_paddr_t pa; - int error, i, retry_count; + int error, retry_count; uint32_t pmapsize; struct minidumphdr mdhdr; @@ -241,11 +202,6 @@ retry: fragsz = 0; DBG(total = dumptotal = 0;) - /* Reset progress */ - counter = 0; - for (i = 0; i < nitems(progress_track); i++) - progress_track[i].visited = 0; - /* Build set of dumpable pages from kernel pmap */ pmapsize = dumpsys_scan_pmap(); if (pmapsize % PAGE_SIZE != 0) { @@ -266,7 +222,7 @@ retry: else dump_drop_page(pa); } - progress = dumpsize; + dumpsys_pb_init(dumpsize); /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); diff --git a/sys/riscv/include/dump.h b/sys/riscv/include/dump.h index 182a89eb8f98..3c3152f150e9 100644 --- a/sys/riscv/include/dump.h +++ b/sys/riscv/include/dump.h @@ -37,6 +37,9 @@ #define DUMPSYS_MD_PA_NPAIRS 10 #define DUMPSYS_NUM_AUX_HDRS 0 +/* How often to check the dump progress bar? */ +#define DUMPSYS_PB_CHECK_BITS 22 /* Every 4MB */ + static inline void dumpsys_pa_init(void) { diff --git a/sys/riscv/riscv/minidump_machdep.c b/sys/riscv/riscv/minidump_machdep.c index bcedfbdf2fb2..992ab097e1b3 100644 --- a/sys/riscv/riscv/minidump_machdep.c +++ b/sys/riscv/riscv/minidump_machdep.c @@ -60,45 +60,10 @@ static struct kerneldumpheader kdh; /* Handle chunked writes. */ static size_t fragsz; static void *dump_va; -static size_t counter, progress, dumpsize; +static size_t dumpsize; static uint64_t tmpbuffer[PAGE_SIZE / sizeof(uint64_t)]; -static struct { - int min_per; - int max_per; - int visited; -} progress_track[10] = { - { 0, 10, 0}, - { 10, 20, 0}, - { 20, 30, 0}, - { 30, 40, 0}, - { 40, 50, 0}, - { 50, 60, 0}, - { 60, 70, 0}, - { 70, 80, 0}, - { 80, 90, 0}, - { 90, 100, 0} -}; - -static void -report_progress(size_t progress, size_t dumpsize) -{ - int sofar, i; - - sofar = 100 - ((progress * 100) / dumpsize); - for (i = 0; i < nitems(progress_track); i++) { - if (sofar < progress_track[i].min_per || - sofar > progress_track[i].max_per) - continue; - if (progress_track[i].visited) - return; - progress_track[i].visited = 1; - printf("..%d%%", sofar); - return; - } -} - static int blk_flush(struct dumperinfo *di) { @@ -156,13 +121,8 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) len = maxdumpsz - fragsz; if (len > sz) len = sz; - counter += len; - progress -= len; - if (counter >> 22) { - report_progress(progress, dumpsize); - counter &= (1 << 22) - 1; - } + dumpsys_pb_progress(len); wdog_kern_pat(WD_LASTVAL); if (ptr) { @@ -253,7 +213,7 @@ retry: } dumpsize += PAGE_SIZE; - progress = dumpsize; + dumpsys_pb_init(dumpsize); /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); diff --git a/sys/sys/kerneldump.h b/sys/sys/kerneldump.h index 8ce6a7a47127..c4ce9d2f13ec 100644 --- a/sys/sys/kerneldump.h +++ b/sys/sys/kerneldump.h @@ -151,6 +151,9 @@ void dumpsys_gen_wbinv_all(void); void dumpsys_gen_unmap_chunk(vm_paddr_t, size_t, void *); int dumpsys_gen_write_aux_headers(struct dumperinfo *); +void dumpsys_pb_init(uint64_t); +void dumpsys_pb_progress(size_t); + extern int do_minidump; #endif diff --git a/sys/x86/include/dump.h b/sys/x86/include/dump.h index 91c72acb4e5b..b8da0d50a6a4 100644 --- a/sys/x86/include/dump.h +++ b/sys/x86/include/dump.h @@ -42,6 +42,9 @@ #define DUMPSYS_MD_PA_NPAIRS 10 #define DUMPSYS_NUM_AUX_HDRS 0 +/* How often to check the dump progress bar? */ +#define DUMPSYS_PB_CHECK_BITS 24 /* Every 16MB */ + static inline void dumpsys_pa_init(void) { From owner-dev-commits-src-all@freebsd.org Wed Sep 29 19:43:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C252B67A4B5; Wed, 29 Sep 2021 19:43: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 4HKRcf2TyGz4mJF; Wed, 29 Sep 2021 19:43:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 363161E223; Wed, 29 Sep 2021 19:43: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 18TJhEpf083485; Wed, 29 Sep 2021 19:43:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TJhE5q083484; Wed, 29 Sep 2021 19:43:14 GMT (envelope-from git) Date: Wed, 29 Sep 2021 19:43:14 GMT Message-Id: <202109291943.18TJhE5q083484@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 31991a5a4585 - main - minidump: De-duplicate is_dumpable() 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/main X-Git-Reftype: branch X-Git-Commit: 31991a5a45857e88c29dec422e0b8d6f68f8877b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 19:43:14 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=31991a5a45857e88c29dec422e0b8d6f68f8877b commit 31991a5a45857e88c29dec422e0b8d6f68f8877b Author: Mitchell Horne AuthorDate: 2021-09-29 17:30:11 +0000 Commit: Mitchell Horne CommitDate: 2021-09-29 19:41:52 +0000 minidump: De-duplicate is_dumpable() The function is identical in each minidump implementation, so move it to vm_phys.c. The only slight exception is powerpc where the function was public, for use in moea64_scan_pmap(). Reviewed by: kib, markj, imp (earlier version) MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31884 --- sys/amd64/amd64/minidump_machdep.c | 25 +++++-------------------- sys/amd64/amd64/uma_machdep.c | 1 + sys/arm/arm/minidump_machdep.c | 19 ++----------------- sys/arm64/arm64/minidump_machdep.c | 23 ++++------------------- sys/arm64/arm64/uma_machdep.c | 1 + sys/i386/i386/minidump_machdep_base.c | 21 +++------------------ sys/mips/mips/minidump_machdep.c | 21 +++------------------ sys/mips/mips/uma_machdep.c | 1 + sys/powerpc/aim/mmu_oea64.c | 4 ++-- sys/powerpc/include/md_var.h | 1 - sys/powerpc/powerpc/minidump_machdep.c | 17 +---------------- sys/powerpc/powerpc/uma_machdep.c | 1 + sys/riscv/riscv/minidump_machdep.c | 22 +++------------------- sys/riscv/riscv/uma_machdep.c | 1 + sys/vm/vm_phys.c | 19 +++++++++++++++++++ sys/vm/vm_phys.h | 1 + 16 files changed, 48 insertions(+), 130 deletions(-) diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c index ea8220157083..7c54c423bbaf 100644 --- a/sys/amd64/amd64/minidump_machdep.c +++ b/sys/amd64/amd64/minidump_machdep.c @@ -66,21 +66,6 @@ static int dump_retry_count = 5; SYSCTL_INT(_machdep, OID_AUTO, dump_retry_count, CTLFLAG_RWTUN, &dump_retry_count, 0, "Number of times dump has to retry before bailing out"); -static int -is_dumpable(vm_paddr_t pa) -{ - vm_page_t m; - int i; - - if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) - return ((m->flags & PG_NODUMP) == 0); - for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) - return (1); - } - return (0); -} - #define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) static int @@ -256,7 +241,7 @@ minidumpsys(struct dumperinfo *di) va += NBPDP; pa = pdp[i] & PG_PS_FRAME; for (n = 0; n < NPDEPG * NPTEPG; n++) { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); pa += PAGE_SIZE; } @@ -274,7 +259,7 @@ minidumpsys(struct dumperinfo *di) /* This is an entire 2M page. */ pa = pd[j] & PG_PS_FRAME; for (k = 0; k < NPTEPG; k++) { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); pa += PAGE_SIZE; } @@ -283,7 +268,7 @@ minidumpsys(struct dumperinfo *di) pa = pd[j] & PG_FRAME; /* set bit for this PTE page */ - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); /* and for each valid page in this 2MB block */ pt = (uint64_t *)PHYS_TO_DMAP(pd[j] & PG_FRAME); @@ -291,7 +276,7 @@ minidumpsys(struct dumperinfo *di) if ((pt[k] & PG_V) == 0) continue; pa = pt[k] & PG_FRAME; - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } @@ -304,7 +289,7 @@ minidumpsys(struct dumperinfo *di) dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { /* Clear out undumpable pages now if needed */ - if (is_dumpable(pa)) { + if (vm_phys_is_dumpable(pa)) { dumpsize += PAGE_SIZE; } else { dump_drop_page(pa); diff --git a/sys/amd64/amd64/uma_machdep.c b/sys/amd64/amd64/uma_machdep.c index d080abeefdcc..2fc981f23c83 100644 --- a/sys/amd64/amd64/uma_machdep.c +++ b/sys/amd64/amd64/uma_machdep.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c index c5f9cb58302e..f760d774bfbb 100644 --- a/sys/arm/arm/minidump_machdep.c +++ b/sys/arm/arm/minidump_machdep.c @@ -65,21 +65,6 @@ static size_t fragsz; static void *dump_va; static uint64_t counter, progress; -static int -is_dumpable(vm_paddr_t pa) -{ - vm_page_t m; - int i; - - if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) - return ((m->flags & PG_NODUMP) == 0); - for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) - return (1); - } - return (0); -} - #define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) static int @@ -202,7 +187,7 @@ minidumpsys(struct dumperinfo *di) ptesize = 0; for (va = KERNBASE; va < kernel_vm_end; va += PAGE_SIZE) { pa = pmap_dump_kextract(va, NULL); - if (pa != 0 && is_dumpable(pa)) + if (pa != 0 && vm_phys_is_dumpable(pa)) dump_add_page(pa); ptesize += sizeof(pt2_entry_t); } @@ -214,7 +199,7 @@ minidumpsys(struct dumperinfo *di) dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { /* Clear out undumpable pages now if needed */ - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dumpsize += PAGE_SIZE; else dump_drop_page(pa); diff --git a/sys/arm64/arm64/minidump_machdep.c b/sys/arm64/arm64/minidump_machdep.c index 1dd40806669b..98d0b50be4c6 100644 --- a/sys/arm64/arm64/minidump_machdep.c +++ b/sys/arm64/arm64/minidump_machdep.c @@ -66,21 +66,6 @@ static size_t counter, progress, dumpsize; static uint64_t tmpbuffer[Ln_ENTRIES]; -static int -is_dumpable(vm_paddr_t pa) -{ - vm_page_t m; - int i; - - if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) - return ((m->flags & PG_NODUMP) == 0); - for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) - return (1); - } - return (0); -} - static int blk_flush(struct dumperinfo *di) { @@ -226,14 +211,14 @@ minidumpsys(struct dumperinfo *di) pa = *l1 & ~ATTR_MASK; for (i = 0; i < Ln_ENTRIES * Ln_ENTRIES; i++, pa += PAGE_SIZE) - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); pmapsize += (Ln_ENTRIES - 1) * PAGE_SIZE; va += L1_SIZE - L2_SIZE; } else if ((*l2 & ATTR_DESCR_MASK) == L2_BLOCK) { pa = *l2 & ~ATTR_MASK; for (i = 0; i < Ln_ENTRIES; i++, pa += PAGE_SIZE) { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } else if ((*l2 & ATTR_DESCR_MASK) == L2_TABLE) { @@ -241,7 +226,7 @@ minidumpsys(struct dumperinfo *di) if ((l3[i] & ATTR_DESCR_MASK) != L3_PAGE) continue; pa = l3[i] & ~ATTR_MASK; - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } @@ -253,7 +238,7 @@ minidumpsys(struct dumperinfo *di) dumpsize += round_page(sizeof(dump_avail)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dumpsize += PAGE_SIZE; else dump_drop_page(pa); diff --git a/sys/arm64/arm64/uma_machdep.c b/sys/arm64/arm64/uma_machdep.c index c848edbe32be..3ef3dd3cc9e9 100644 --- a/sys/arm64/arm64/uma_machdep.c +++ b/sys/arm64/arm64/uma_machdep.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include diff --git a/sys/i386/i386/minidump_machdep_base.c b/sys/i386/i386/minidump_machdep_base.c index e2b4234eba11..b8e9e4884552 100644 --- a/sys/i386/i386/minidump_machdep_base.c +++ b/sys/i386/i386/minidump_machdep_base.c @@ -62,21 +62,6 @@ static size_t fragsz; static void *dump_va; static uint64_t counter, progress; -static int -is_dumpable(vm_paddr_t pa) -{ - vm_page_t m; - int i; - - if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) - return ((m->flags & PG_NODUMP) == 0); - for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) - return (1); - } - return (0); -} - #define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) static int @@ -203,7 +188,7 @@ minidumpsys(struct dumperinfo *di) /* This is an entire 2M page. */ pa = pd[j] & PG_PS_FRAME; for (k = 0; k < NPTEPG; k++) { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); pa += PAGE_SIZE; } @@ -215,7 +200,7 @@ minidumpsys(struct dumperinfo *di) for (k = 0; k < NPTEPG; k++) { if ((pt[k] & PG_V) == PG_V) { pa = pt[k] & PG_FRAME; - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } @@ -231,7 +216,7 @@ minidumpsys(struct dumperinfo *di) dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { /* Clear out undumpable pages now if needed */ - if (is_dumpable(pa)) { + if (vm_phys_is_dumpable(pa)) { dumpsize += PAGE_SIZE; } else { dump_drop_page(pa); diff --git a/sys/mips/mips/minidump_machdep.c b/sys/mips/mips/minidump_machdep.c index e1edfa9ad5d3..d35b1fd53068 100644 --- a/sys/mips/mips/minidump_machdep.c +++ b/sys/mips/mips/minidump_machdep.c @@ -64,21 +64,6 @@ static char tmpbuffer[PAGE_SIZE] __aligned(sizeof(uint64_t)); extern pd_entry_t *kernel_segmap; -static int -is_dumpable(vm_paddr_t pa) -{ - vm_page_t m; - int i; - - if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) - return ((m->flags & PG_NODUMP) == 0); - for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) - return (1); - } - return (0); -} - static struct { int min_per; int max_per; @@ -189,7 +174,7 @@ minidumpsys(struct dumperinfo *di) for (i = 0; i < NPTEPG; i++) { if (pte_test(&pte[i], PTE_V)) { pa = TLBLO_PTE_TO_PA(pte[i]); - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } @@ -200,7 +185,7 @@ minidumpsys(struct dumperinfo *di) * and pages allocated by pmap_steal reside */ for (pa = 0; pa < phys_avail[0]; pa += PAGE_SIZE) { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } @@ -211,7 +196,7 @@ minidumpsys(struct dumperinfo *di) dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { /* Clear out undumpable pages now if needed */ - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dumpsize += PAGE_SIZE; else dump_drop_page(pa); diff --git a/sys/mips/mips/uma_machdep.c b/sys/mips/mips/uma_machdep.c index faf70b20b748..5b57447edd6a 100644 --- a/sys/mips/mips/uma_machdep.c +++ b/sys/mips/mips/uma_machdep.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index c2e8e6e49913..55147d47b2bf 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -3362,11 +3362,11 @@ moea64_scan_pmap() if (va & PVO_LARGE) { pa_end = pa + lpsize; for (; pa < pa_end; pa += PAGE_SIZE) { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } else { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } diff --git a/sys/powerpc/include/md_var.h b/sys/powerpc/include/md_var.h index da9232313ffb..ab5f9e33a5bb 100644 --- a/sys/powerpc/include/md_var.h +++ b/sys/powerpc/include/md_var.h @@ -44,7 +44,6 @@ extern int szsigcode64, szsigcode64_elfv2; struct dumperinfo; int minidumpsys(struct dumperinfo *); -int is_dumpable(vm_paddr_t); #endif extern long Maxmem; diff --git a/sys/powerpc/powerpc/minidump_machdep.c b/sys/powerpc/powerpc/minidump_machdep.c index e049f2debcfa..e4d85fe95ed6 100644 --- a/sys/powerpc/powerpc/minidump_machdep.c +++ b/sys/powerpc/powerpc/minidump_machdep.c @@ -91,21 +91,6 @@ static size_t counter, dumpsize, progress; /* Handle chunked writes. */ static size_t fragsz; -int -is_dumpable(vm_paddr_t pa) -{ - vm_page_t m; - int i; - - if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) - return ((m->flags & PG_NODUMP) == 0); - for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) - return (1); - } - return (0); -} - static void pmap_kenter_temporary(vm_offset_t va, vm_paddr_t pa) { @@ -276,7 +261,7 @@ retry: dumpsize += pmapsize; VM_PAGE_DUMP_FOREACH(pa) { /* Clear out undumpable pages now if needed */ - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dumpsize += PAGE_SIZE; else dump_drop_page(pa); diff --git a/sys/powerpc/powerpc/uma_machdep.c b/sys/powerpc/powerpc/uma_machdep.c index 43e2a86456fe..a1769f61d671 100644 --- a/sys/powerpc/powerpc/uma_machdep.c +++ b/sys/powerpc/powerpc/uma_machdep.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include diff --git a/sys/riscv/riscv/minidump_machdep.c b/sys/riscv/riscv/minidump_machdep.c index 2c5e27b6274f..bcedfbdf2fb2 100644 --- a/sys/riscv/riscv/minidump_machdep.c +++ b/sys/riscv/riscv/minidump_machdep.c @@ -99,22 +99,6 @@ report_progress(size_t progress, size_t dumpsize) } } -static bool -is_dumpable(vm_paddr_t pa) -{ - vm_page_t m; - int i; - - if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) - return ((m->flags & PG_NODUMP) == 0); - - for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) - return (true); - } - return (false); -} - static int blk_flush(struct dumperinfo *di) { @@ -241,7 +225,7 @@ retry: if ((*l2 & PTE_RWX) != 0) { pa = (*l2 >> PTE_PPN1_S) << L2_SHIFT; for (i = 0; i < Ln_ENTRIES; i++, pa += PAGE_SIZE) { - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } else { @@ -249,7 +233,7 @@ retry: if ((l3[i] & PTE_V) == 0) continue; pa = (l3[i] >> PTE_PPN0_S) * PAGE_SIZE; - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dump_add_page(pa); } } @@ -262,7 +246,7 @@ retry: dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { /* Clear out undumpable pages now if needed */ - if (is_dumpable(pa)) + if (vm_phys_is_dumpable(pa)) dumpsize += PAGE_SIZE; else dump_drop_page(pa); diff --git a/sys/riscv/riscv/uma_machdep.c b/sys/riscv/riscv/uma_machdep.c index 6b563ea8ab0c..f1725fde4699 100644 --- a/sys/riscv/riscv/uma_machdep.c +++ b/sys/riscv/riscv/uma_machdep.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index c8f98a0b4695..b0aaa822211f 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -1593,6 +1593,25 @@ vm_phys_avail_split(vm_paddr_t pa, int i) return (0); } +/* + * Check if a given physical address can be included as part of a crash dump. + */ +bool +vm_phys_is_dumpable(vm_paddr_t pa) +{ + vm_page_t m; + int i; + + if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) + return ((m->flags & PG_NODUMP) == 0); + + for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { + if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) + return (true); + } + return (false); +} + void vm_phys_early_add_seg(vm_paddr_t start, vm_paddr_t end) { diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h index a650d7dbc380..d10eb96f938f 100644 --- a/sys/vm/vm_phys.h +++ b/sys/vm/vm_phys.h @@ -87,6 +87,7 @@ vm_paddr_t vm_phys_early_alloc(int domain, size_t alloc_size); void vm_phys_early_startup(void); int vm_phys_avail_largest(void); vm_paddr_t vm_phys_avail_size(int i); +bool vm_phys_is_dumpable(vm_paddr_t pa); static inline int vm_phys_domain(vm_paddr_t pa) From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 520E167AEF9; Wed, 29 Sep 2021 20:27: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 4HKSbl1dtXz4q5C; Wed, 29 Sep 2021 20:27:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17F861EBA3; Wed, 29 Sep 2021 20:27: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 18TKRVEF038469; Wed, 29 Sep 2021 20:27:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRUVo038468; Wed, 29 Sep 2021 20:27:30 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:30 GMT Message-Id: <202109292027.18TKRUVo038468@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: a81b36c6d35d - main - LinuxKPI: Implement get_file_rcu() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a81b36c6d35d74177891860b789dd02b9d1c5851 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:31 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=a81b36c6d35d74177891860b789dd02b9d1c5851 commit a81b36c6d35d74177891860b789dd02b9d1c5851 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:12:25 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:12:25 +0000 LinuxKPI: Implement get_file_rcu() get_file_rcu() grabs a file if the file->f_count is not zero. Required by drm-kmod 5.6 Reviewed by: hselasky, manu (previous version) MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31672 --- sys/compat/linuxkpi/common/include/linux/fs.h | 9 +++++++++ sys/compat/linuxkpi/common/src/linux_compat.c | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h index 38911c276216..eaf806b6732c 100644 --- a/sys/compat/linuxkpi/common/include/linux/fs.h +++ b/sys/compat/linuxkpi/common/include/linux/fs.h @@ -108,6 +108,8 @@ struct linux_file { /* pointer to associated character device, if any */ struct linux_cdev *f_cdev; + + struct rcu_head rcu; }; #define file linux_file @@ -254,6 +256,13 @@ get_file(struct linux_file *f) return (f); } +static inline bool +get_file_rcu(struct linux_file *f) +{ + return (refcount_acquire_if_not_zero( + f->_file == NULL ? &f->f_count : &f->_file->f_count)); +} + static inline struct inode * igrab(struct inode *inode) { diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 7ea33c9a0d8d..f15b9396525c 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(__i386__) || defined(__amd64__) #include @@ -472,7 +473,7 @@ linux_file_free(struct linux_file *filp) if (filp->_file == NULL) { if (filp->f_shmem != NULL) vm_object_deallocate(filp->f_shmem); - kfree(filp); + kfree_rcu(filp, rcu); } else { /* * The close method of the character device or file @@ -1538,6 +1539,7 @@ linux_file_close(struct file *file, struct thread *td) ldev = filp->f_cdev; if (ldev != NULL) linux_cdev_deref(ldev); + linux_synchronize_rcu(RCU_TYPE_REGULAR); kfree(filp); return (error); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C0C067B339; Wed, 29 Sep 2021 20:27: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 4HKSbm2Skrz4prk; Wed, 29 Sep 2021 20:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31A581EBA4; Wed, 29 Sep 2021 20:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18TKRW8q038502; Wed, 29 Sep 2021 20:27:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRWl6038501; Wed, 29 Sep 2021 20:27:32 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:32 GMT Message-Id: <202109292027.18TKRWl6038501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 66ea390652d2 - main - LinuxKPI: Remove FreeBSD struct resource from all LKPI headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66ea390652d2ede405b43c168157986bd2b52bb9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:32 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=66ea390652d2ede405b43c168157986bd2b52bb9 commit 66ea390652d2ede405b43c168157986bd2b52bb9 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:12:36 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:12:36 +0000 LinuxKPI: Remove FreeBSD struct resource from all LKPI headers except linux/pci.h to avoid conflicts with Linux version. This allows to #define resource in drm-kmod globally and strip some #ifdef-s Reviewed by: hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31673 --- .../linuxkpi/common/include/linux/interrupt.h | 168 ++------------ sys/compat/linuxkpi/common/src/linux_compat.c | 41 ---- sys/compat/linuxkpi/common/src/linux_interrupt.c | 250 +++++++++++++++++++++ sys/conf/files | 2 + sys/modules/linuxkpi/Makefile | 1 + 5 files changed, 270 insertions(+), 192 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index 6770adad2293..4e6c859853a7 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -38,109 +38,31 @@ #include #include -#include -#include #include typedef irqreturn_t (*irq_handler_t)(int, void *); #define IRQF_SHARED RF_SHAREABLE -struct irq_ent { - struct list_head links; - struct device *dev; - struct resource *res; - void *arg; - irqreturn_t (*handler)(int, void *); - irqreturn_t (*thread_handler)(int, void *); - void *tag; - unsigned int irq; -}; +struct irq_ent; void linux_irq_handler(void *); void lkpi_devm_irq_release(struct device *, void *); void lkpi_irq_release(struct device *, struct irq_ent *); - -static inline int -linux_irq_rid(struct device *dev, unsigned int irq) -{ - /* check for MSI- or MSIX- interrupt */ - if (irq >= dev->irq_start && irq < dev->irq_end) - return (irq - dev->irq_start + 1); - else - return (0); -} - -static inline struct irq_ent * -linux_irq_ent(struct device *dev, unsigned int irq) -{ - struct irq_ent *irqe; - - list_for_each_entry(irqe, &dev->irqents, links) - if (irqe->irq == irq) - return (irqe); - - return (NULL); -} - -static inline int -_request_irq(struct device *xdev, unsigned int irq, - irq_handler_t handler, irq_handler_t thread_handler, - unsigned long flags, const char *name, void *arg) -{ - struct resource *res; - struct irq_ent *irqe; - struct device *dev; - int error; - int rid; - - dev = linux_pci_find_irq_dev(irq); - if (dev == NULL) - return -ENXIO; - if (xdev != NULL && xdev != dev) - return -ENXIO; - rid = linux_irq_rid(dev, irq); - res = bus_alloc_resource_any(dev->bsddev, SYS_RES_IRQ, &rid, - flags | RF_ACTIVE); - if (res == NULL) - return (-ENXIO); - if (xdev != NULL) - irqe = lkpi_devres_alloc(lkpi_devm_irq_release, sizeof(*irqe), - GFP_KERNEL | __GFP_ZERO); - else - irqe = kzalloc(sizeof(*irqe), GFP_KERNEL); - irqe->dev = dev; - irqe->res = res; - irqe->arg = arg; - irqe->handler = handler; - irqe->thread_handler = thread_handler; - irqe->irq = irq; - - error = bus_setup_intr(dev->bsddev, res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, linux_irq_handler, irqe, &irqe->tag); - if (error) - goto errout; - list_add(&irqe->links, &dev->irqents); - if (xdev != NULL) - devres_add(xdev, irqe); - - return 0; - -errout: - bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res); - if (xdev != NULL) - devres_free(irqe); - else - kfree(irqe); - return (-error); -} +int lkpi_request_irq(struct device *, unsigned int, irq_handler_t, + irq_handler_t, unsigned long, const char *, void *); +int lkpi_enable_irq(unsigned int); +void lkpi_disable_irq(unsigned int); +int lkpi_bind_irq_to_cpu(unsigned int, int); +void lkpi_free_irq(unsigned int, void *); +void lkpi_devm_free_irq(struct device *, unsigned int, void *); static inline int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *arg) { - return (_request_irq(NULL, irq, handler, NULL, flags, name, arg)); + return (lkpi_request_irq(NULL, irq, handler, NULL, flags, name, arg)); } static inline int @@ -149,7 +71,7 @@ request_threaded_irq(int irq, irq_handler_t handler, const char *name, void *arg) { - return (_request_irq(NULL, irq, handler, thread_handler, + return (lkpi_request_irq(NULL, irq, handler, thread_handler, flags, name, arg)); } @@ -159,94 +81,38 @@ devm_request_threaded_irq(struct device *dev, int irq, unsigned long flags, const char *name, void *arg) { - return (_request_irq(dev, irq, handler, thread_handler, + return (lkpi_request_irq(dev, irq, handler, thread_handler, flags, name, arg)); } static inline int enable_irq(unsigned int irq) { - struct irq_ent *irqe; - struct device *dev; - - dev = linux_pci_find_irq_dev(irq); - if (dev == NULL) - return -EINVAL; - irqe = linux_irq_ent(dev, irq); - if (irqe == NULL || irqe->tag != NULL) - return -EINVAL; - return -bus_setup_intr(dev->bsddev, irqe->res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, linux_irq_handler, irqe, &irqe->tag); + return (lkpi_enable_irq(irq)); } static inline void disable_irq(unsigned int irq) { - struct irq_ent *irqe; - struct device *dev; - - dev = linux_pci_find_irq_dev(irq); - if (dev == NULL) - return; - irqe = linux_irq_ent(dev, irq); - if (irqe == NULL) - return; - if (irqe->tag != NULL) - bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); - irqe->tag = NULL; + lkpi_disable_irq(irq); } static inline int bind_irq_to_cpu(unsigned int irq, int cpu_id) { - struct irq_ent *irqe; - struct device *dev; - - dev = linux_pci_find_irq_dev(irq); - if (dev == NULL) - return (-ENOENT); - - irqe = linux_irq_ent(dev, irq); - if (irqe == NULL) - return (-ENOENT); - - return (-bus_bind_intr(dev->bsddev, irqe->res, cpu_id)); + return (lkpi_bind_irq_to_cpu(irq, cpu_id)); } static inline void -free_irq(unsigned int irq, void *device __unused) +free_irq(unsigned int irq, void *device) { - struct irq_ent *irqe; - struct device *dev; - - dev = linux_pci_find_irq_dev(irq); - if (dev == NULL) - return; - irqe = linux_irq_ent(dev, irq); - if (irqe == NULL) - return; - lkpi_irq_release(dev, irqe); - kfree(irqe); + lkpi_free_irq(irq, device); } static inline void devm_free_irq(struct device *xdev, unsigned int irq, void *p) { - struct device *dev; - struct irq_ent *irqe; - - dev = linux_pci_find_irq_dev(irq); - if (dev == NULL) - return; - if (xdev != dev) - return; - irqe = linux_irq_ent(dev, irq); - if (irqe == NULL) - return; - lkpi_irq_release(dev, irqe); - lkpi_devres_unlink(dev, irqe); - lkpi_devres_free(irqe); - return; + lkpi_devm_free_irq(xdev, irq, p); } static inline int diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index f15b9396525c..8e3a3ea52ff1 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2466,47 +2466,6 @@ list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, free(ar, M_KMALLOC); } -void -lkpi_irq_release(struct device *dev, struct irq_ent *irqe) -{ - - if (irqe->tag != NULL) - bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); - if (irqe->res != NULL) - bus_release_resource(dev->bsddev, SYS_RES_IRQ, - rman_get_rid(irqe->res), irqe->res); - list_del(&irqe->links); -} - -void -lkpi_devm_irq_release(struct device *dev, void *p) -{ - struct irq_ent *irqe; - - if (dev == NULL || p == NULL) - return; - - irqe = p; - lkpi_irq_release(dev, irqe); -} - -void -linux_irq_handler(void *ent) -{ - struct irq_ent *irqe; - - if (linux_set_current_flags(curthread, M_NOWAIT)) - return; - - irqe = ent; - if (irqe->handler(irqe->irq, irqe->arg) == IRQ_WAKE_THREAD && - irqe->thread_handler != NULL) { - THREAD_SLEEPING_OK(); - irqe->thread_handler(irqe->irq, irqe->arg); - THREAD_NO_SLEEPING(); - } -} - #if defined(__i386__) || defined(__amd64__) int linux_wbinvd_on_all_cpus(void) diff --git a/sys/compat/linuxkpi/common/src/linux_interrupt.c b/sys/compat/linuxkpi/common/src/linux_interrupt.c new file mode 100644 index 000000000000..cc6380553497 --- /dev/null +++ b/sys/compat/linuxkpi/common/src/linux_interrupt.c @@ -0,0 +1,250 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include +#include +#include +#include + +struct irq_ent { + struct list_head links; + struct device *dev; + struct resource *res; + void *arg; + irqreturn_t (*handler)(int, void *); + irqreturn_t (*thread_handler)(int, void *); + void *tag; + unsigned int irq; +}; + +static inline int +lkpi_irq_rid(struct device *dev, unsigned int irq) +{ + /* check for MSI- or MSIX- interrupt */ + if (irq >= dev->irq_start && irq < dev->irq_end) + return (irq - dev->irq_start + 1); + else + return (0); +} + +static inline struct irq_ent * +lkpi_irq_ent(struct device *dev, unsigned int irq) +{ + struct irq_ent *irqe; + + list_for_each_entry(irqe, &dev->irqents, links) + if (irqe->irq == irq) + return (irqe); + + return (NULL); +} + +void +linux_irq_handler(void *ent) +{ + struct irq_ent *irqe; + + if (linux_set_current_flags(curthread, M_NOWAIT)) + return; + + irqe = ent; + if (irqe->handler(irqe->irq, irqe->arg) == IRQ_WAKE_THREAD && + irqe->thread_handler != NULL) { + THREAD_SLEEPING_OK(); + irqe->thread_handler(irqe->irq, irqe->arg); + THREAD_NO_SLEEPING(); + } +} + +void +lkpi_irq_release(struct device *dev, struct irq_ent *irqe) +{ + if (irqe->tag != NULL) + bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); + if (irqe->res != NULL) + bus_release_resource(dev->bsddev, SYS_RES_IRQ, + rman_get_rid(irqe->res), irqe->res); + list_del(&irqe->links); +} + +void +lkpi_devm_irq_release(struct device *dev, void *p) +{ + struct irq_ent *irqe; + + if (dev == NULL || p == NULL) + return; + + irqe = p; + lkpi_irq_release(dev, irqe); +} + +int +lkpi_request_irq(struct device *xdev, unsigned int irq, + irq_handler_t handler, irq_handler_t thread_handler, + unsigned long flags, const char *name, void *arg) +{ + struct resource *res; + struct irq_ent *irqe; + struct device *dev; + int error; + int rid; + + dev = linux_pci_find_irq_dev(irq); + if (dev == NULL) + return -ENXIO; + if (xdev != NULL && xdev != dev) + return -ENXIO; + rid = lkpi_irq_rid(dev, irq); + res = bus_alloc_resource_any(dev->bsddev, SYS_RES_IRQ, &rid, + flags | RF_ACTIVE); + if (res == NULL) + return (-ENXIO); + if (xdev != NULL) + irqe = lkpi_devres_alloc(lkpi_devm_irq_release, sizeof(*irqe), + GFP_KERNEL | __GFP_ZERO); + else + irqe = kzalloc(sizeof(*irqe), GFP_KERNEL); + irqe->dev = dev; + irqe->res = res; + irqe->arg = arg; + irqe->handler = handler; + irqe->thread_handler = thread_handler; + irqe->irq = irq; + + error = bus_setup_intr(dev->bsddev, res, INTR_TYPE_NET | INTR_MPSAFE, + NULL, linux_irq_handler, irqe, &irqe->tag); + if (error) + goto errout; + list_add(&irqe->links, &dev->irqents); + if (xdev != NULL) + devres_add(xdev, irqe); + + return 0; + +errout: + bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res); + if (xdev != NULL) + devres_free(irqe); + else + kfree(irqe); + return (-error); +} + +int +lkpi_enable_irq(unsigned int irq) +{ + struct irq_ent *irqe; + struct device *dev; + + dev = linux_pci_find_irq_dev(irq); + if (dev == NULL) + return -EINVAL; + irqe = lkpi_irq_ent(dev, irq); + if (irqe == NULL || irqe->tag != NULL) + return -EINVAL; + return -bus_setup_intr(dev->bsddev, irqe->res, INTR_TYPE_NET | INTR_MPSAFE, + NULL, linux_irq_handler, irqe, &irqe->tag); +} + +void +lkpi_disable_irq(unsigned int irq) +{ + struct irq_ent *irqe; + struct device *dev; + + dev = linux_pci_find_irq_dev(irq); + if (dev == NULL) + return; + irqe = lkpi_irq_ent(dev, irq); + if (irqe == NULL) + return; + if (irqe->tag != NULL) + bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); + irqe->tag = NULL; +} + +int +lkpi_bind_irq_to_cpu(unsigned int irq, int cpu_id) +{ + struct irq_ent *irqe; + struct device *dev; + + dev = linux_pci_find_irq_dev(irq); + if (dev == NULL) + return (-ENOENT); + + irqe = lkpi_irq_ent(dev, irq); + if (irqe == NULL) + return (-ENOENT); + + return (-bus_bind_intr(dev->bsddev, irqe->res, cpu_id)); +} + +void +lkpi_free_irq(unsigned int irq, void *device __unused) +{ + struct irq_ent *irqe; + struct device *dev; + + dev = linux_pci_find_irq_dev(irq); + if (dev == NULL) + return; + irqe = lkpi_irq_ent(dev, irq); + if (irqe == NULL) + return; + lkpi_irq_release(dev, irqe); + kfree(irqe); +} + +void +lkpi_devm_free_irq(struct device *xdev, unsigned int irq, void *p __unused) +{ + struct device *dev; + struct irq_ent *irqe; + + dev = linux_pci_find_irq_dev(irq); + if (dev == NULL) + return; + if (xdev != dev) + return; + irqe = lkpi_irq_ent(dev, irq); + if (irqe == NULL) + return; + lkpi_irq_release(dev, irqe); + lkpi_devres_unlink(dev, irqe); + lkpi_devres_free(irqe); + return; +} diff --git a/sys/conf/files b/sys/conf/files index eaf356d8dce4..828953628eda 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4564,6 +4564,8 @@ compat/linuxkpi/common/src/linux_fpu.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_hrtimer.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_interrupt.c optional compat_linuxkpi \ + compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_kthread.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_lock.c optional compat_linuxkpi \ diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile index f922a1fc85a2..e1b1eab6ab09 100644 --- a/sys/modules/linuxkpi/Makefile +++ b/sys/modules/linuxkpi/Makefile @@ -11,6 +11,7 @@ SRCS= linux_compat.c \ linux_fpu.c \ linux_hrtimer.c \ linux_idr.c \ + linux_interrupt.c \ linux_kmod.c \ linux_kthread.c \ linux_lock.c \ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E50AA67B33A; Wed, 29 Sep 2021 20:27: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 4HKSbn3Qxyz4ppg; Wed, 29 Sep 2021 20:27:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5416A1EE04; Wed, 29 Sep 2021 20:27: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 18TKRXFM038526; Wed, 29 Sep 2021 20:27:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRXuh038525; Wed, 29 Sep 2021 20:27:33 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:33 GMT Message-Id: <202109292027.18TKRXuh038525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: b58c916f115d - main - LinuxKPI: implement _IOC_TYPE and _IOC_NR macros in linux/ioctl.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b58c916f115d9d40f91397a1b406891f36c39fad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:34 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b58c916f115d9d40f91397a1b406891f36c39fad commit b58c916f115d9d40f91397a1b406891f36c39fad Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:12:47 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:12:47 +0000 LinuxKPI: implement _IOC_TYPE and _IOC_NR macros in linux/ioctl.h They are used by drm-kmod Reviewed by: emaste, hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31674 --- sys/compat/linuxkpi/common/include/linux/ioctl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/ioctl.h b/sys/compat/linuxkpi/common/include/linux/ioctl.h index fdedf9c4a179..fcdb5c547e73 100644 --- a/sys/compat/linuxkpi/common/include/linux/ioctl.h +++ b/sys/compat/linuxkpi/common/include/linux/ioctl.h @@ -33,6 +33,8 @@ #include -#define _IOC_SIZE(cmd) IOCPARM_LEN(cmd) +#define _IOC_SIZE(cmd) IOCPARM_LEN(cmd) +#define _IOC_TYPE(cmd) IOCGROUP(cmd) +#define _IOC_NR(cmd) ((cmd) & 0xff) #endif /* _LINUX_IOCTL_H_ */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1499367AD59; Wed, 29 Sep 2021 20:27: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 4HKSbq5Mtmz4q7Y; Wed, 29 Sep 2021 20:27:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 946571E77F; Wed, 29 Sep 2021 20:27: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 18TKRZh2038574; Wed, 29 Sep 2021 20:27:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRZcq038573; Wed, 29 Sep 2021 20:27:35 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:35 GMT Message-Id: <202109292027.18TKRZcq038573@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 7d92d4835850 - main - LinuxKPI: Invoke release handler when file is destroyed by fput() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d92d4835850fdc5c1ec1fa7c5634826a61ad0a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:36 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=7d92d4835850fdc5c1ec1fa7c5634826a61ad0a5 commit 7d92d4835850fdc5c1ec1fa7c5634826a61ad0a5 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:13:27 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:13:27 +0000 LinuxKPI: Invoke release handler when file is destroyed by fput() Required by drm_kmod 5.6 Reviewed by: hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32067 --- sys/compat/linuxkpi/common/src/linux_compat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 8e3a3ea52ff1..103d7ab0c60b 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -471,6 +471,8 @@ void linux_file_free(struct linux_file *filp) { if (filp->_file == NULL) { + if (filp->f_op != NULL && filp->f_op->release != NULL) + filp->f_op->release(filp->f_vnode, filp); if (filp->f_shmem != NULL) vm_object_deallocate(filp->f_shmem); kfree_rcu(filp, rcu); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 551F267B2F4; Wed, 29 Sep 2021 20:27: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 4HKSbt0Rnwz4pq7; Wed, 29 Sep 2021 20:27:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF4F91E7C2; Wed, 29 Sep 2021 20:27: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 18TKRbu2038628; Wed, 29 Sep 2021 20:27:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRb4g038627; Wed, 29 Sep 2021 20:27:37 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:37 GMT Message-Id: <202109292027.18TKRb4g038627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: bd6d55adb413 - main - LinuxKPI: stub anon_inode_getfile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd6d55adb4131d7172e0485d30ceca4e5aa12ff5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:39 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=bd6d55adb4131d7172e0485d30ceca4e5aa12ff5 commit bd6d55adb4131d7172e0485d30ceca4e5aa12ff5 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:13:53 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:13:53 +0000 LinuxKPI: stub anon_inode_getfile Although drm-kmod contains better implementation which is able to allocate real entries on pseudofs, this feature has never been used. Starting from drm-kmod v5.6 old implementation began to leak entries on each drm device close(). Now just drop pseudofs support instead of fixing it in drm-kmod and provide stub in base. Reviewed by: hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32069 --- .../linuxkpi/common/include/linux/anon_inodes.h | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/anon_inodes.h b/sys/compat/linuxkpi/common/include/linux/anon_inodes.h new file mode 100644 index 000000000000..8fa61cd4b45f --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/anon_inodes.h @@ -0,0 +1,48 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUX_ANON_INODES_H_ +#define _LINUX_ANON_INODES_H_ + +#include +#include +#include + +static inline struct file * +anon_inode_getfile(const char *name __unused, + const struct file_operations *fops, void *priv, int flags __unused) +{ + struct file *file; + + file = alloc_file(FMODE_READ, fops); + file->private_data = priv; + + return (file); +} + +#endif /* _LINUX_ANON_INODES_H_ */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93FBF67B346; Wed, 29 Sep 2021 20:27: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 4HKSbv2Vk9z4psF; Wed, 29 Sep 2021 20:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F30F1EE06; Wed, 29 Sep 2021 20:27: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 18TKRck5038652; Wed, 29 Sep 2021 20:27:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRc5u038651; Wed, 29 Sep 2021 20:27:38 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:38 GMT Message-Id: <202109292027.18TKRc5u038651@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 62ff0566c930 - main - LinuxKPI: Allow cdev_pager prefault handler to steal pages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62ff0566c93056e00b3c9c3f8d2ac1e7d8e0c098 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:39 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=62ff0566c93056e00b3c9c3f8d2ac1e7d8e0c098 commit 62ff0566c93056e00b3c9c3f8d2ac1e7d8e0c098 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:14:05 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:14:05 +0000 LinuxKPI: Allow cdev_pager prefault handler to steal pages from other vm_objects. This workarounds "Page already inserted" panic in vm_page_insert routine triggered on attempt to mmap file created with shmem_file_setup call. After introduction of "GTT mmap interface v4" a.k.a. MMAP_OFFSET, vm_objects allocated by these calls may try to own intersected sets of pages that leads to the assertion. Reviewed by: kib MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32090 --- sys/compat/linuxkpi/common/src/linux_page.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index cbe6d2530b91..c7191fef3429 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -281,6 +281,7 @@ lkpi_vmf_insert_pfn_prot_locked(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn, pgprot_t prot) { vm_object_t vm_obj = vma->vm_obj; + vm_object_t tmp_obj; vm_page_t page; vm_pindex_t pindex; @@ -296,6 +297,32 @@ retry: page = PHYS_TO_VM_PAGE(IDX_TO_OFF(pfn)); if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) goto retry; + if (page->object != NULL) { + tmp_obj = page->object; + vm_page_xunbusy(page); + VM_OBJECT_WUNLOCK(vm_obj); + VM_OBJECT_WLOCK(tmp_obj); + if (page->object == tmp_obj && + vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) { + KASSERT(page->object == tmp_obj, + ("page has changed identity")); + KASSERT((page->oflags & VPO_UNMANAGED) == 0, + ("page does not belong to shmem")); + vm_pager_page_unswapped(page); + if (pmap_page_is_mapped(page)) { + vm_page_xunbusy(page); + VM_OBJECT_WUNLOCK(tmp_obj); + printf("%s: page rename failed: page " + "is mapped\n", __func__); + VM_OBJECT_WLOCK(vm_obj); + return (VM_FAULT_NOPAGE); + } + vm_page_remove(page); + } + VM_OBJECT_WUNLOCK(tmp_obj); + VM_OBJECT_WLOCK(vm_obj); + goto retry; + } if (vm_page_insert(page, vm_obj, pindex)) { vm_page_xunbusy(page); return (VM_FAULT_OOM); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6964D67B609; Wed, 29 Sep 2021 20:27: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 4HKSc20bX7z4qDM; Wed, 29 Sep 2021 20:27:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCDE21ED88; Wed, 29 Sep 2021 20:27: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 18TKRjh1038802; Wed, 29 Sep 2021 20:27:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRjJN038801; Wed, 29 Sep 2021 20:27:45 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:45 GMT Message-Id: <202109292027.18TKRjJN038801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 88531adbfbe2 - main - LinuxKPI: Update pte_fn_t definition to match Linux 5.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88531adbfbe25c6ae56cc7bbe76c825a3f5dc504 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:46 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=88531adbfbe25c6ae56cc7bbe76c825a3f5dc504 commit 88531adbfbe25c6ae56cc7bbe76c825a3f5dc504 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:15:27 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:15:27 +0000 LinuxKPI: Update pte_fn_t definition to match Linux 5.3 Reviewed by: emaste, hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32166 --- sys/compat/linuxkpi/common/include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h index 871d16cb06ff..4301e616f234 100644 --- a/sys/compat/linuxkpi/common/include/linux/mm.h +++ b/sys/compat/linuxkpi/common/include/linux/mm.h @@ -98,7 +98,7 @@ CTASSERT((VM_PROT_ALL & -(1 << 8)) == 0); #define fault_flag_allow_retry_first(flags) \ (((flags) & (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_TRIED)) == FAULT_FLAG_ALLOW_RETRY) -typedef int (*pte_fn_t)(linux_pte_t *, pgtable_t, unsigned long addr, void *data); +typedef int (*pte_fn_t)(linux_pte_t *, unsigned long addr, void *data); struct vm_area_struct { vm_offset_t vm_start; From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEC7A67B33B; Wed, 29 Sep 2021 20:27: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 4HKSbp4FF1z4q2f; Wed, 29 Sep 2021 20:27:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FB791EB31; Wed, 29 Sep 2021 20:27: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 18TKRY5u038550; Wed, 29 Sep 2021 20:27:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRYat038549; Wed, 29 Sep 2021 20:27:34 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:34 GMT Message-Id: <202109292027.18TKRYat038549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 2fe9ea5d3ad6 - main - LinuxKPI: allocate current before taking shrinkers lock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2fe9ea5d3ad69d880138d98b2ae8d2c4309eeafa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:35 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=2fe9ea5d3ad69d880138d98b2ae8d2c4309eeafa commit 2fe9ea5d3ad69d880138d98b2ae8d2c4309eeafa Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:12:58 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:12:58 +0000 LinuxKPI: allocate current before taking shrinkers lock This fixes following warnings when shrinkers are invoked first time: uma_zalloc_debug: zone "lkpicurr" with the following non-sleepable locks held: exclusive sleep mutex lkpi-shrinker (lkpi-shrinker) uma_zalloc_debug: zone "lkpimm" with the following non-sleepable locks held: exclusive sleep mutex lkpi-shrinker (lkpi-shrinker) Reviewed by: hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32066 --- sys/compat/linuxkpi/common/src/linux_shrinker.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_shrinker.c b/sys/compat/linuxkpi/common/src/linux_shrinker.c index 0423f4e05804..b66316c22013 100644 --- a/sys/compat/linuxkpi/common/src/linux_shrinker.c +++ b/sys/compat/linuxkpi/common/src/linux_shrinker.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include TAILQ_HEAD(, shrinker) lkpi_shrinkers = TAILQ_HEAD_INITIALIZER(lkpi_shrinkers); @@ -93,6 +94,7 @@ linuxkpi_vm_lowmem(void *arg __unused) { struct shrinker *s; + linux_set_current(curthread); mtx_lock(&mtx_shrinker); TAILQ_FOREACH(s, &lkpi_shrinkers, next) { shrinker_shrink(s); From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93CEE67B34A; Wed, 29 Sep 2021 20:27: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 4HKSbx3JB5z4psR; Wed, 29 Sep 2021 20:27:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E4481EBA5; Wed, 29 Sep 2021 20:27: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 18TKRfCf038700; Wed, 29 Sep 2021 20:27:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRfNC038699; Wed, 29 Sep 2021 20:27:41 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:41 GMT Message-Id: <202109292027.18TKRfNC038699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 6efabdeede7f - main - LinuxKPI: Import linux/poison.h header MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6efabdeede7f3aac4b133116a421f5a7a721e24c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:41 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=6efabdeede7f3aac4b133116a421f5a7a721e24c commit 6efabdeede7f3aac4b133116a421f5a7a721e24c Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:14:34 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:14:34 +0000 LinuxKPI: Import linux/poison.h header Required by drm-kmod 5.6 Reviewed by: hselasky, imp, manu MFC after: 2 weeks Obtained from: OpenBSD Differential revision: https://reviews.freebsd.org/D32092 --- sys/compat/linuxkpi/common/include/linux/poison.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/poison.h b/sys/compat/linuxkpi/common/include/linux/poison.h new file mode 100644 index 000000000000..35ccb5b5499a --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/poison.h @@ -0,0 +1,9 @@ +/* Public domain. */ + +#ifndef _LINUX_POISON_H +#define _LINUX_POISON_H + +#define POISON_INUSE 0xdb +#define POISON_FREE 0xdf + +#endif From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE28F67B580; Wed, 29 Sep 2021 20:27: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 4HKSby4ZJCz4q9q; Wed, 29 Sep 2021 20:27:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F3841ED87; Wed, 29 Sep 2021 20:27: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 18TKRguf038724; Wed, 29 Sep 2021 20:27:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRgwq038723; Wed, 29 Sep 2021 20:27:42 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:42 GMT Message-Id: <202109292027.18TKRgwq038723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 37eba5b77a57 - main - LinuxKPI: Cast offset_in_page() parameter to unsigned long MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 37eba5b77a5733ac711b119141619c89b8446471 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:43 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=37eba5b77a5733ac711b119141619c89b8446471 commit 37eba5b77a5733ac711b119141619c89b8446471 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:14:47 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:14:47 +0000 LinuxKPI: Cast offset_in_page() parameter to unsigned long to reduce number of patches in drm-kmod Reviewed by: hselasky MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32093 --- sys/compat/linuxkpi/common/include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h index dc75ae4483c3..871d16cb06ff 100644 --- a/sys/compat/linuxkpi/common/include/linux/mm.h +++ b/sys/compat/linuxkpi/common/include/linux/mm.h @@ -229,7 +229,7 @@ vma_pages(struct vm_area_struct *vma) return ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT); } -#define offset_in_page(off) ((off) & (PAGE_SIZE - 1)) +#define offset_in_page(off) ((unsigned long)(off) & (PAGE_SIZE - 1)) static inline void set_page_dirty(struct vm_page *page) From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37C0267B076; Wed, 29 Sep 2021 20:27: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 4HKSbs0LWpz4pq2; Wed, 29 Sep 2021 20:27:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5D161EE05; Wed, 29 Sep 2021 20:27: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 18TKRaLN038598; Wed, 29 Sep 2021 20:27:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRaRQ038597; Wed, 29 Sep 2021 20:27:36 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:36 GMT Message-Id: <202109292027.18TKRaRQ038597@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: f6823dac8fa6 - main - LinuxKPI: Factor out vmf_insert_pfn_prot() routine MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6823dac8fa6e9fc2926a866e9a0c4d43e38e236 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:37 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=f6823dac8fa6e9fc2926a866e9a0c4d43e38e236 commit f6823dac8fa6e9fc2926a866e9a0c4d43e38e236 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:13:41 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:13:41 +0000 LinuxKPI: Factor out vmf_insert_pfn_prot() routine from GEM and TTM page fault handlers and move it in to base system. This code is tightly integrated with LKPI mmap support to belong to drm-kmod. As this routine requires associated vm_object to be locked, it got additional _locked suffix. Reviewed by: hselasky, markj MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32068 --- sys/compat/linuxkpi/common/include/linux/mm.h | 23 +++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_page.c | 32 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h index 74709299ba1a..dc75ae4483c3 100644 --- a/sys/compat/linuxkpi/common/include/linux/mm.h +++ b/sys/compat/linuxkpi/common/include/linux/mm.h @@ -82,6 +82,9 @@ CTASSERT((VM_PROT_ALL & -(1 << 8)) == 0); #define VM_FAULT_RETRY (1 << 9) #define VM_FAULT_FALLBACK (1 << 10) +#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \ + VM_FAULT_HWPOISON |VM_FAULT_HWPOISON_LARGE | VM_FAULT_FALLBACK) + #define FAULT_FLAG_WRITE (1 << 0) #define FAULT_FLAG_MKWRITE (1 << 1) #define FAULT_FLAG_ALLOW_RETRY (1 << 2) @@ -183,6 +186,26 @@ io_remap_pfn_range(struct vm_area_struct *vma, return (0); } +vm_fault_t +lkpi_vmf_insert_pfn_prot_locked(struct vm_area_struct *vma, unsigned long addr, + unsigned long pfn, pgprot_t prot); + +static inline vm_fault_t +vmf_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr, + unsigned long pfn, pgprot_t prot) +{ + vm_fault_t ret; + + VM_OBJECT_WLOCK(vma->vm_obj); + ret = lkpi_vmf_insert_pfn_prot_locked(vma, addr, pfn, prot); + VM_OBJECT_WUNLOCK(vma->vm_obj); + + return (ret); +} +#define vmf_insert_pfn_prot(...) \ + _Static_assert(false, \ +"This function is always called in a loop. Consider using the locked version") + static inline int apply_to_page_range(struct mm_struct *mm, unsigned long address, unsigned long size, pte_fn_t fn, void *data) diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index ee41366c53a6..cbe6d2530b91 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -275,3 +275,35 @@ is_vmalloc_addr(const void *addr) { return (vtoslab((vm_offset_t)addr & ~UMA_SLAB_MASK) != NULL); } + +vm_fault_t +lkpi_vmf_insert_pfn_prot_locked(struct vm_area_struct *vma, unsigned long addr, + unsigned long pfn, pgprot_t prot) +{ + vm_object_t vm_obj = vma->vm_obj; + vm_page_t page; + vm_pindex_t pindex; + + VM_OBJECT_ASSERT_WLOCKED(vm_obj); + pindex = OFF_TO_IDX(addr - vma->vm_start); + if (vma->vm_pfn_count == 0) + vma->vm_pfn_first = pindex; + MPASS(pindex <= OFF_TO_IDX(vma->vm_end)); + +retry: + page = vm_page_grab(vm_obj, pindex, VM_ALLOC_NOCREAT); + if (page == NULL) { + page = PHYS_TO_VM_PAGE(IDX_TO_OFF(pfn)); + if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) + goto retry; + if (vm_page_insert(page, vm_obj, pindex)) { + vm_page_xunbusy(page); + return (VM_FAULT_OOM); + } + vm_page_valid(page); + } + pmap_page_set_memattr(page, pgprot2cachemode(prot)); + vma->vm_pfn_count++; + + return (VM_FAULT_NOPAGE); +} From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53BDE67B41D; Wed, 29 Sep 2021 20:27:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKSc66CxVz4qBH; Wed, 29 Sep 2021 20:27:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A4711EAB9; Wed, 29 Sep 2021 20:27: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 18TKRohX038904; Wed, 29 Sep 2021 20:27:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRoDm038903; Wed, 29 Sep 2021 20:27:50 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:50 GMT Message-Id: <202109292027.18TKRoDm038903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 30acf99a822c - main - Bump __FreeBSD_version to 1400034 for LinuxKPI changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30acf99a822c81f0d8218d966d7f6c51edd9a6d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:51 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=30acf99a822c81f0d8218d966d7f6c51edd9a6d9 commit 30acf99a822c81f0d8218d966d7f6c51edd9a6d9 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:26:46 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:26:46 +0000 Bump __FreeBSD_version to 1400034 for LinuxKPI changes --- 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 be1488b9011a..234111e5d53c 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400033 +#define __FreeBSD_version 1400034 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9276667AD67; Wed, 29 Sep 2021 20:27: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 4HKSbw2NpKz4q5f; Wed, 29 Sep 2021 20:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 296DC1EE07; Wed, 29 Sep 2021 20:27: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 18TKRe9d038676; Wed, 29 Sep 2021 20:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKReF5038675; Wed, 29 Sep 2021 20:27:40 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:40 GMT Message-Id: <202109292027.18TKReF5038675@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: b59ffedae8f3 - main - LinuxKPI: Add helper functions to store integers to linux/xarray.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b59ffedae8f3707bf0079b4fd0cbf8190eed0c5e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:40 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b59ffedae8f3707bf0079b4fd0cbf8190eed0c5e commit b59ffedae8f3707bf0079b4fd0cbf8190eed0c5e Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:14:23 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:14:23 +0000 LinuxKPI: Add helper functions to store integers to linux/xarray.h Required by drm-kmod. Reviewed by: hselasky MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32091 --- sys/compat/linuxkpi/common/include/linux/xarray.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/xarray.h b/sys/compat/linuxkpi/common/include/linux/xarray.h index afe66c1f2b5f..7427f6e4f9f9 100644 --- a/sys/compat/linuxkpi/common/include/linux/xarray.h +++ b/sys/compat/linuxkpi/common/include/linux/xarray.h @@ -97,4 +97,27 @@ xa_init(struct xarray *xa) xa_init_flags(xa, 0); } +static inline void * +xa_mk_value(unsigned long v) +{ + unsigned long r = (v << 1) | 1; + + return ((void *)r); +} + +static inline bool +xa_is_value(const void *e) +{ + unsigned long v = (unsigned long)e; + + return (v & 1); +} + +static inline unsigned long +xa_to_value(const void *e) +{ + unsigned long v = (unsigned long)e; + + return (v >> 1); +} #endif /* _LINUX_XARRAY_H_ */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25EAD67B585; Wed, 29 Sep 2021 20:27: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 4HKSc0735pz4pmL; Wed, 29 Sep 2021 20:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAEE51EE80; Wed, 29 Sep 2021 20:27: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 18TKRi6N038778; Wed, 29 Sep 2021 20:27:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRivY038777; Wed, 29 Sep 2021 20:27:44 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:44 GMT Message-Id: <202109292027.18TKRivY038777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: b52e36384091 - main - LinuxKPI: Implement backlight_enable and backlight_disable functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b52e36384091c5f80b06b79f5889492eac074426 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:45 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b52e36384091c5f80b06b79f5889492eac074426 commit b52e36384091c5f80b06b79f5889492eac074426 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:15:12 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:15:12 +0000 LinuxKPI: Implement backlight_enable and backlight_disable functions For now, disable backlight if brightness level is set to 0. In the future we may implement separate knob in backlight(8). Required by drm-kmod v5.6 Reviewed by: hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32165 --- .../linuxkpi/common/include/linux/backlight.h | 22 ++++++++++++++++++++-- sys/compat/linuxkpi/common/src/linux_pci.c | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/backlight.h b/sys/compat/linuxkpi/common/include/linux/backlight.h index 1d2224811124..b3a07c4cdcaa 100644 --- a/sys/compat/linuxkpi/common/include/linux/backlight.h +++ b/sys/compat/linuxkpi/common/include/linux/backlight.h @@ -79,10 +79,10 @@ void linux_backlight_device_unregister(struct backlight_device *bd); linux_backlight_device_register(name, dev, data, ops, props) #define backlight_device_unregister(bd) linux_backlight_device_unregister(bd) -static inline void +static inline int backlight_update_status(struct backlight_device *bd) { - bd->ops->update_status(bd); + return (bd->ops->update_status(bd)); } static inline void @@ -91,4 +91,22 @@ backlight_force_update(struct backlight_device *bd, int reason) bd->props.brightness = bd->ops->get_brightness(bd); } +static inline int +backlight_enable(struct backlight_device *bd) +{ + if (bd == NULL) + return (0); + bd->props.power = 0/* FB_BLANK_UNBLANK */; + return (backlight_update_status(bd)); +} + +static inline int +backlight_disable(struct backlight_device *bd) +{ + if (bd == NULL) + return (0); + bd->props.power = 4/* FB_BLANK_POWERDOWN */; + return (backlight_update_status(bd)); +} + #endif /* _LINUX_BACKLIGHT_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 73c9b67bbedb..44ed4b22de6f 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -1215,6 +1215,8 @@ linux_backlight_update_status(device_t dev, struct backlight_props *props) pdev->dev.bd->props.brightness = pdev->dev.bd->props.max_brightness * props->brightness / 100; + pdev->dev.bd->props.power = props->brightness == 0 ? + 4/* FB_BLANK_POWERDOWN */ : 0/* FB_BLANK_UNBLANK */; return (pdev->dev.bd->ops->update_status(pdev->dev.bd)); } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0298667B584; Wed, 29 Sep 2021 20:27: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 4HKSbz5h5xz4q9r; Wed, 29 Sep 2021 20:27:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9698A1EE08; Wed, 29 Sep 2021 20:27: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 18TKRhIT038754; Wed, 29 Sep 2021 20:27:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRhro038753; Wed, 29 Sep 2021 20:27:43 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:43 GMT Message-Id: <202109292027.18TKRhro038753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 3d86f8f1d7d1 - main - LinuxKPI: Add dummy pgprot_decrypted() implementation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d86f8f1d7d1a070dd2e81367a4196a272b3bd07 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:44 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3d86f8f1d7d1a070dd2e81367a4196a272b3bd07 commit 3d86f8f1d7d1a070dd2e81367a4196a272b3bd07 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:14:58 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:14:58 +0000 LinuxKPI: Add dummy pgprot_decrypted() implementation to reduce number of #ifdefs in drm-kmod Reviewed by: hselasky MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32094 --- sys/compat/linuxkpi/common/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/asm/pgtable.h b/sys/compat/linuxkpi/common/include/asm/pgtable.h index 1df103060368..4831c144888d 100644 --- a/sys/compat/linuxkpi/common/include/asm/pgtable.h +++ b/sys/compat/linuxkpi/common/include/asm/pgtable.h @@ -40,4 +40,6 @@ typedef unsigned long pgdval_t; typedef unsigned long pgprotval_t; typedef struct page *pgtable_t; +#define pgprot_decrypted(prot) (prot) + #endif /* _ASM_PGTABLE_H_ */ From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B99C767B357; Wed, 29 Sep 2021 20:27: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 4HKSc320ckz4q3N; Wed, 29 Sep 2021 20:27:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12FB91EAB8; Wed, 29 Sep 2021 20:27: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 18TKRkeD038826; Wed, 29 Sep 2021 20:27:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRked038825; Wed, 29 Sep 2021 20:27:46 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:46 GMT Message-Id: <202109292027.18TKRked038825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: c072f6e856bc - main - LinuxKPI: Import linux_page.c and some dependent code from drm-kmod MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c072f6e856bc0348bf6fdd468761041948823f73 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:47 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c072f6e856bc0348bf6fdd468761041948823f73 commit c072f6e856bc0348bf6fdd468761041948823f73 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:15:37 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:15:37 +0000 LinuxKPI: Import linux_page.c and some dependent code from drm-kmod No functional changes intended Reviewed by: hselasky, manu, markj MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D32167 --- sys/compat/linuxkpi/common/include/linux/highmem.h | 118 +++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/mm.h | 4 + sys/compat/linuxkpi/common/include/linux/page.h | 22 ++++ .../linuxkpi/common/include/linux/scatterlist.h | 58 ++++++++++ sys/compat/linuxkpi/common/src/linux_page.c | 34 ++++++ 5 files changed, 236 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/highmem.h b/sys/compat/linuxkpi/common/include/linux/highmem.h new file mode 100644 index 000000000000..9378746ea480 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/highmem.h @@ -0,0 +1,118 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2016 Matthew Macy (mmacy@mattmacy.io) + * Copyright (c) 2017 Mellanox Technologies, Ltd. + * Copyright (c) 2021 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUX_HIGHMEM_H_ +#define _LINUX_HIGHMEM_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#define PageHighMem(p) (0) + +static inline vm_page_t +kmap_to_page(void *addr) +{ + return (virt_to_page(addr)); +} + +static inline void * +kmap(vm_page_t page) +{ + struct sf_buf *sf; + + if (PMAP_HAS_DMAP) { + return ((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(page))); + } else { + sched_pin(); + sf = sf_buf_alloc(page, SFB_NOWAIT | SFB_CPUPRIVATE); + if (sf == NULL) { + sched_unpin(); + return (NULL); + } + return ((void *)sf_buf_kva(sf)); + } +} + +static inline void * +kmap_atomic_prot(vm_page_t page, pgprot_t prot) +{ + vm_memattr_t attr = pgprot2cachemode(prot); + + if (attr != VM_MEMATTR_DEFAULT) { + vm_page_lock(page); + page->flags |= PG_FICTITIOUS; + vm_page_unlock(page); + pmap_page_set_memattr(page, attr); + } + return (kmap(page)); +} + +static inline void * +kmap_atomic(vm_page_t page) +{ + return (kmap_atomic_prot(page, VM_PROT_ALL)); +} + +static inline void +kunmap(vm_page_t page) +{ + struct sf_buf *sf; + + if (!PMAP_HAS_DMAP) { + /* lookup SF buffer in list */ + sf = sf_buf_alloc(page, SFB_NOWAIT | SFB_CPUPRIVATE); + + /* double-free */ + sf_buf_free(sf); + sf_buf_free(sf); + + sched_unpin(); + } +} + +static inline void +kunmap_atomic(void *vaddr) +{ + if (!PMAP_HAS_DMAP) + kunmap(virt_to_page(vaddr)); +} + +#endif /* _LINUX_HIGHMEM_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h index 4301e616f234..0ee9dd58616a 100644 --- a/sys/compat/linuxkpi/common/include/linux/mm.h +++ b/sys/compat/linuxkpi/common/include/linux/mm.h @@ -290,4 +290,8 @@ vmalloc_to_page(const void *addr) extern int is_vmalloc_addr(const void *addr); void si_meminfo(struct sysinfo *si); +#define unmap_mapping_range(...) lkpi_unmap_mapping_range(__VA_ARGS__) +void lkpi_unmap_mapping_range(void *obj, loff_t const holebegin __unused, + loff_t const holelen, int even_cows __unused); + #endif /* _LINUX_MM_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/page.h b/sys/compat/linuxkpi/common/include/linux/page.h index c2dbab769c2a..ca7365419e22 100644 --- a/sys/compat/linuxkpi/common/include/linux/page.h +++ b/sys/compat/linuxkpi/common/include/linux/page.h @@ -41,6 +41,10 @@ #include #include +#if defined(__i386__) || defined(__amd64__) +#include +#endif + typedef unsigned long linux_pte_t; typedef unsigned long linux_pmd_t; typedef unsigned long linux_pgd_t; @@ -53,6 +57,8 @@ typedef unsigned long pgprot_t; CTASSERT((VM_PROT_ALL & -LINUXKPI_PROT_VALID) == 0); +#define PAGE_KERNEL_IO 0x0000 + static inline pgprot_t cachemode2protval(vm_memattr_t attr) { @@ -72,6 +78,7 @@ pgprot2cachemode(pgprot_t prot) #define page_to_pfn(pp) (VM_PAGE_TO_PHYS(pp) >> PAGE_SHIFT) #define pfn_to_page(pfn) (PHYS_TO_VM_PAGE((pfn) << PAGE_SHIFT)) #define nth_page(page,n) pfn_to_page(page_to_pfn(page) + (n)) +#define page_to_phys(page) VM_PAGE_TO_PHYS(page) #define clear_page(page) memset(page, 0, PAGE_SIZE) #define pgprot_noncached(prot) \ @@ -93,4 +100,19 @@ pgprot2cachemode(pgprot_t prot) #undef trunc_page #define trunc_page(x) ((uintptr_t)(x) & ~(PAGE_SIZE - 1)) +#if defined(__i386__) || defined(__amd64__) +#undef clflushopt +static inline void +lkpi_clflushopt(unsigned long addr) +{ + if (cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) + clflushopt(addr); + else if (cpu_feature & CPUID_CLFSH) + clflush(addr); + else + pmap_invalidate_cache(); +} +#define clflushopt(x) lkpi_clflushopt((unsigned long)(x)) +#endif + #endif /* _LINUX_PAGE_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h index 5e42876facd0..13ee34cf9448 100644 --- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h +++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h @@ -4,6 +4,7 @@ * Copyright (c) 2010 Panasas, Inc. * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. * Copyright (c) 2015 Matthew Dillon + * Copyright (c) 2016 Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -534,4 +535,61 @@ sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents, return (copied); } +static inline size_t +sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents, + const void *buf, size_t buflen) +{ + return (sg_pcopy_from_buffer(sgl, nents, buf, buflen, 0)); +} + +static inline size_t +sg_pcopy_to_buffer(struct scatterlist *sgl, unsigned int nents, + void *buf, size_t buflen, off_t offset) +{ + struct sg_page_iter iter; + struct scatterlist *sg; + struct page *page; + struct sf_buf *sf; + char *vaddr; + size_t total = 0; + size_t len; + + if (!PMAP_HAS_DMAP) + sched_pin(); + for_each_sg_page(sgl, &iter, nents, 0) { + sg = iter.sg; + + if (offset >= sg->length) { + offset -= sg->length; + continue; + } + len = ulmin(buflen, sg->length - offset); + if (len == 0) + break; + + page = sg_page_iter_page(&iter); + if (!PMAP_HAS_DMAP) { + sf = sf_buf_alloc(page, SFB_CPUPRIVATE | SFB_NOWAIT); + if (sf == NULL) + break; + vaddr = (char *)sf_buf_kva(sf); + } else + vaddr = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(page)); + memcpy(buf, vaddr + sg->offset + offset, len); + if (!PMAP_HAS_DMAP) + sf_buf_free(sf); + + /* start at beginning of next page */ + offset = 0; + + /* advance buffer */ + buf = (char *)buf + len; + buflen -= len; + total += len; + } + if (!PMAP_HAS_DMAP) + sched_unpin(); + return (total); +} + #endif /* _LINUX_SCATTERLIST_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index c7191fef3429..8da4736ab7d5 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -334,3 +334,37 @@ retry: return (VM_FAULT_NOPAGE); } + +/* + * Although FreeBSD version of unmap_mapping_range has semantics and types of + * parameters compatible with Linux version, the values passed in are different + * @obj should match to vm_private_data field of vm_area_struct returned by + * mmap file operation handler, see linux_file_mmap_single() sources + * @holelen should match to size of area to be munmapped. + */ +void +lkpi_unmap_mapping_range(void *obj, loff_t const holebegin __unused, + loff_t const holelen, int even_cows __unused) +{ + vm_object_t devobj; + vm_page_t page; + int i, page_count; + + devobj = cdev_pager_lookup(obj); + if (devobj != NULL) { + page_count = OFF_TO_IDX(holelen); + + VM_OBJECT_WLOCK(devobj); +retry: + for (i = 0; i < page_count; i++) { + page = vm_page_lookup(devobj, i); + if (page == NULL) + continue; + if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) + goto retry; + cdev_pager_free_page(devobj, page); + } + VM_OBJECT_WUNLOCK(devobj); + vm_object_deallocate(devobj); + } +} From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD6F167B41B; Wed, 29 Sep 2021 20:27: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 4HKSc43WJ8z4qDg; Wed, 29 Sep 2021 20:27:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BF141EC0F; Wed, 29 Sep 2021 20:27: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 18TKRmtk038850; Wed, 29 Sep 2021 20:27:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRmNY038849; Wed, 29 Sep 2021 20:27:48 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:48 GMT Message-Id: <202109292027.18TKRmNY038849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5ca1f3f5e3a3 - main - LinuxKPI: Hide some internal symbols in linux_interrupt.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ca1f3f5e3a322ddb598295825bdc1d831ba71d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:49 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5ca1f3f5e3a322ddb598295825bdc1d831ba71d5 commit 5ca1f3f5e3a322ddb598295825bdc1d831ba71d5 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:26:14 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:26:14 +0000 LinuxKPI: Hide some internal symbols in linux_interrupt.c Reviewed by: hselasky, manu Differential revision: https://reviews.freebsd.org/D32168 --- sys/compat/linuxkpi/common/include/linux/interrupt.h | 5 ----- sys/compat/linuxkpi/common/src/linux_interrupt.c | 12 ++++++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index 4e6c859853a7..964b95edb43f 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -44,11 +44,6 @@ typedef irqreturn_t (*irq_handler_t)(int, void *); #define IRQF_SHARED RF_SHAREABLE -struct irq_ent; - -void linux_irq_handler(void *); -void lkpi_devm_irq_release(struct device *, void *); -void lkpi_irq_release(struct device *, struct irq_ent *); int lkpi_request_irq(struct device *, unsigned int, irq_handler_t, irq_handler_t, unsigned long, const char *, void *); int lkpi_enable_irq(unsigned int); diff --git a/sys/compat/linuxkpi/common/src/linux_interrupt.c b/sys/compat/linuxkpi/common/src/linux_interrupt.c index cc6380553497..f96a47137fab 100644 --- a/sys/compat/linuxkpi/common/src/linux_interrupt.c +++ b/sys/compat/linuxkpi/common/src/linux_interrupt.c @@ -71,8 +71,8 @@ lkpi_irq_ent(struct device *dev, unsigned int irq) return (NULL); } -void -linux_irq_handler(void *ent) +static void +lkpi_irq_handler(void *ent) { struct irq_ent *irqe; @@ -88,7 +88,7 @@ linux_irq_handler(void *ent) } } -void +static inline void lkpi_irq_release(struct device *dev, struct irq_ent *irqe) { if (irqe->tag != NULL) @@ -99,7 +99,7 @@ lkpi_irq_release(struct device *dev, struct irq_ent *irqe) list_del(&irqe->links); } -void +static void lkpi_devm_irq_release(struct device *dev, void *p) { struct irq_ent *irqe; @@ -145,7 +145,7 @@ lkpi_request_irq(struct device *xdev, unsigned int irq, irqe->irq = irq; error = bus_setup_intr(dev->bsddev, res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, linux_irq_handler, irqe, &irqe->tag); + NULL, lkpi_irq_handler, irqe, &irqe->tag); if (error) goto errout; list_add(&irqe->links, &dev->irqents); @@ -176,7 +176,7 @@ lkpi_enable_irq(unsigned int irq) if (irqe == NULL || irqe->tag != NULL) return -EINVAL; return -bus_setup_intr(dev->bsddev, irqe->res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, linux_irq_handler, irqe, &irqe->tag); + NULL, lkpi_irq_handler, irqe, &irqe->tag); } void From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:27:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EA3667B511; Wed, 29 Sep 2021 20:27: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 4HKSc55F2zz4pmR; Wed, 29 Sep 2021 20:27:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50B641EC10; Wed, 29 Sep 2021 20:27: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 18TKRncL038880; Wed, 29 Sep 2021 20:27:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKRn36038879; Wed, 29 Sep 2021 20:27:49 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:27:49 GMT Message-Id: <202109292027.18TKRn36038879@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 062f15004f4e - main - LinuxKPI: Remove vma argument from fault method of vm_operations_struct MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 062f15004f4e92cd984bf59ec95c189a9d998013 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:27:50 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=062f15004f4e92cd984bf59ec95c189a9d998013 commit 062f15004f4e92cd984bf59ec95c189a9d998013 Author: Vladimir Kondratyev AuthorDate: 2021-09-29 20:26:32 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-29 20:26:32 +0000 LinuxKPI: Remove vma argument from fault method of vm_operations_struct It is removed from Linux since 4.11. In FreeBSD it results in several #ifdefs in drm-kmod. Reviewed by: emaste, hselasky, manu Differential revision: https://reviews.freebsd.org/D32169 --- sys/compat/linuxkpi/common/include/linux/mm.h | 2 +- sys/compat/linuxkpi/common/src/linux_compat.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h index 0ee9dd58616a..ec88f39ac410 100644 --- a/sys/compat/linuxkpi/common/include/linux/mm.h +++ b/sys/compat/linuxkpi/common/include/linux/mm.h @@ -137,7 +137,7 @@ struct vm_fault { struct vm_operations_struct { void (*open) (struct vm_area_struct *); void (*close) (struct vm_area_struct *); - int (*fault) (struct vm_area_struct *, struct vm_fault *); + int (*fault) (struct vm_fault *); int (*access) (struct vm_area_struct *, unsigned long, void *, int, int); }; diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 103d7ab0c60b..279f7131fc57 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -560,11 +560,11 @@ linux_cdev_pager_populate(vm_object_t vm_obj, vm_pindex_t pidx, int fault_type, vmap->vm_pfn_pcount = &vmap->vm_pfn_count; vmap->vm_obj = vm_obj; - err = vmap->vm_ops->fault(vmap, &vmf); + err = vmap->vm_ops->fault(&vmf); while (vmap->vm_pfn_count == 0 && err == VM_FAULT_NOPAGE) { kern_yield(PRI_USER); - err = vmap->vm_ops->fault(vmap, &vmf); + err = vmap->vm_ops->fault(&vmf); } } From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:44:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E28567BF2F; Wed, 29 Sep 2021 20:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKSyq3nyFz4rd5; Wed, 29 Sep 2021 20:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 629EE1F209; Wed, 29 Sep 2021 20:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18TKi3lL065396; Wed, 29 Sep 2021 20:44:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKi3Vx065395; Wed, 29 Sep 2021 20:44:03 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:44:03 GMT Message-Id: <202109292044.18TKi3Vx065395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marko Zec Subject: git: c5981a8130e2 - stable/13 - [fib_algo][dxr] Merge adjacent empty range table chunks. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c5981a8130e259a21c29e8c0928aced0b0e17fec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:44:03 -0000 The branch stable/13 has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=c5981a8130e259a21c29e8c0928aced0b0e17fec commit c5981a8130e259a21c29e8c0928aced0b0e17fec Author: Marko Zec AuthorDate: 2021-09-20 04:30:45 +0000 Commit: Marko Zec CommitDate: 2021-09-29 20:40:01 +0000 [fib_algo][dxr] Merge adjacent empty range table chunks. MFC after: 3 days --- sys/netinet/in_fib_dxr.c | 60 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index 3aa357cadedc..c4f42abdda27 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -418,14 +418,15 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) fdesc->base = cdp->cd_base; da->rtbl_top -= size; da->unused_chunks_cnt--; - if (cdp->cd_max_size > size + 1) { + if (cdp->cd_max_size > size) { /* Split the range in two, need a new descriptor */ empty_cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (empty_cdp == NULL) return (1); + empty_cdp->cd_cur_size = 0; empty_cdp->cd_max_size = cdp->cd_max_size - size; empty_cdp->cd_base = cdp->cd_base + size; - LIST_INSERT_AFTER(cdp, empty_cdp, cd_all_le); + LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); LIST_INSERT_AFTER(cdp, empty_cdp, cd_hash_le); da->all_chunks_cnt++; da->unused_chunks_cnt++; @@ -433,7 +434,7 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) } LIST_REMOVE(cdp, cd_hash_le); } else { - /* Alloc a new descriptor */ + /* Alloc a new descriptor at the top of the heap*/ cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (cdp == NULL) return (1); @@ -441,6 +442,8 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) cdp->cd_base = fdesc->base; LIST_INSERT_HEAD(&da->all_chunks, cdp, cd_all_le); da->all_chunks_cnt++; + KASSERT(cdp->cd_base + cdp->cd_max_size == da->rtbl_top, + ("dxr: %s %d", __FUNCTION__, __LINE__)); } cdp->cd_hash = hash; @@ -473,12 +476,12 @@ static void chunk_unref(struct dxr_aux *da, uint32_t chunk) { struct direct_entry *fdesc = &da->direct_tbl[chunk]; - struct chunk_desc *cdp; + struct chunk_desc *cdp, *cdp2; uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); - /* Find an existing descriptor */ + /* Find the corresponding descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], cd_hash_le) if (cdp->cd_hash == hash && cdp->cd_cur_size == size && @@ -492,23 +495,50 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) LIST_REMOVE(cdp, cd_hash_le); da->unused_chunks_cnt++; - if (cdp->cd_base + cdp->cd_max_size != da->rtbl_top) { - LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); - return; + cdp->cd_cur_size = 0; + + /* Attempt to merge with the preceding chunk, if empty */ + cdp2 = LIST_NEXT(cdp, cd_all_le); + if (cdp2 != NULL && cdp2->cd_cur_size == 0) { + KASSERT(cdp2->cd_base + cdp2->cd_max_size == cdp->cd_base, + ("dxr: %s %d", __FUNCTION__, __LINE__)); + LIST_REMOVE(cdp, cd_all_le); + da->all_chunks_cnt--; + LIST_REMOVE(cdp2, cd_hash_le); + da->unused_chunks_cnt--; + cdp2->cd_max_size += cdp->cd_max_size; + uma_zfree(chunk_zone, cdp); + cdp = cdp2; } - do { + /* Attempt to merge with the subsequent chunk, if empty */ + cdp2 = LIST_PREV(cdp, &da->all_chunks, chunk_desc, cd_all_le); + if (cdp2 != NULL && cdp2->cd_cur_size == 0) { + KASSERT(cdp->cd_base + cdp->cd_max_size == cdp2->cd_base, + ("dxr: %s %d", __FUNCTION__, __LINE__)); + LIST_REMOVE(cdp, cd_all_le); + da->all_chunks_cnt--; + LIST_REMOVE(cdp2, cd_hash_le); + da->unused_chunks_cnt--; + cdp2->cd_max_size += cdp->cd_max_size; + cdp2->cd_base = cdp->cd_base; + uma_zfree(chunk_zone, cdp); + cdp = cdp2; + } + + if (cdp->cd_base + cdp->cd_max_size == da->rtbl_top) { + /* Free the chunk on the top of the range heap, trim the heap */ + KASSERT(cdp == LIST_FIRST(&da->all_chunks), + ("dxr: %s %d", __FUNCTION__, __LINE__)); da->all_chunks_cnt--; da->unused_chunks_cnt--; da->rtbl_top -= cdp->cd_max_size; LIST_REMOVE(cdp, cd_all_le); uma_zfree(chunk_zone, cdp); - LIST_FOREACH(cdp, &da->unused_chunks, cd_hash_le) - if (cdp->cd_base + cdp->cd_max_size == da->rtbl_top) { - LIST_REMOVE(cdp, cd_hash_le); - break; - } - } while (cdp != NULL); + return; + } + + LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); } #ifdef DXR2 From owner-dev-commits-src-all@freebsd.org Wed Sep 29 20:44:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBC6067BE65; Wed, 29 Sep 2021 20:44: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 4HKSyr5dZlz4rfx; Wed, 29 Sep 2021 20:44:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 926BA1EEE6; Wed, 29 Sep 2021 20:44: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 18TKi4WG065420; Wed, 29 Sep 2021 20:44:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TKi43M065419; Wed, 29 Sep 2021 20:44:04 GMT (envelope-from git) Date: Wed, 29 Sep 2021 20:44:04 GMT Message-Id: <202109292044.18TKi43M065419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marko Zec Subject: git: 94ad8d7c7a35 - stable/13 - [fib_algo][dxr] Split unused range chunk list in multiple buckets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 94ad8d7c7a35ff5eadada2d542df1b23ba69fed0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 20:44:05 -0000 The branch stable/13 has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=94ad8d7c7a35ff5eadada2d542df1b23ba69fed0 commit 94ad8d7c7a35ff5eadada2d542df1b23ba69fed0 Author: Marko Zec AuthorDate: 2021-09-25 04:29:48 +0000 Commit: Marko Zec CommitDate: 2021-09-29 20:40:56 +0000 [fib_algo][dxr] Split unused range chunk list in multiple buckets Traversing a single list of unused range chunks in search for a block of optimal size was suboptimal. The experience with real-world BGP workloads has shown that on average unused range chunks are tiny, mostly in length from 1 to 4 or 5, when DXR is configured with K = 20 which is the current default (D16X4R). Therefore, introduce a limited amount of buckets to accomodate descriptors of empty blocks of fixed (small) size, so that those can be found in O(1) time. If no empty chunks of the requested size can be found in fixed-size buckets, the search continues in an unsorted list of empty chunks of variable lengths, which should only happen infrequently. This change should permit us to manage significantly more empty range chunks without sacrifying the speed of incremental range table updating. MFC after: 3 days --- sys/netinet/in_fib_dxr.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index c4f42abdda27..6a9f414c3ab0 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -115,6 +115,8 @@ CTASSERT(DXR_TRIE_BITS >= 16 && DXR_TRIE_BITS <= 24); #define XTBL_SIZE_INCR (DIRECT_TBL_SIZE / 16) +#define UNUSED_BUCKETS 8 + /* Lookup structure elements */ struct direct_entry { @@ -181,7 +183,7 @@ struct dxr_aux { struct trie_desc *trietbl[D_TBL_SIZE]; LIST_HEAD(, chunk_desc) chunk_hashtbl[CHUNK_HASH_SIZE]; LIST_HEAD(, chunk_desc) all_chunks; - LIST_HEAD(, chunk_desc) unused_chunks; /* abuses hash link entry */ + LIST_HEAD(, chunk_desc) unused_chunks[UNUSED_BUCKETS]; LIST_HEAD(, trie_desc) trie_hashtbl[TRIE_HASH_SIZE]; LIST_HEAD(, trie_desc) all_trie; LIST_HEAD(, trie_desc) unused_trie; /* abuses hash link entry */ @@ -387,6 +389,7 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); + int i; /* Find an existing descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], @@ -401,15 +404,18 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) return (0); } - /* No matching chunks found. Recycle an empty or allocate a new one */ - cdp = NULL; - LIST_FOREACH(empty_cdp, &da->unused_chunks, cd_hash_le) - if (empty_cdp->cd_max_size >= size && (cdp == NULL || - empty_cdp->cd_max_size < cdp->cd_max_size)) { - cdp = empty_cdp; - if (empty_cdp->cd_max_size == size) - break; - } + /* No matching chunks found. Find an empty one to recycle. */ + for (cdp = NULL, i = size; cdp == NULL && i < UNUSED_BUCKETS; i++) + cdp = LIST_FIRST(&da->unused_chunks[i]); + + if (cdp == NULL) + LIST_FOREACH(empty_cdp, &da->unused_chunks[0], cd_hash_le) + if (empty_cdp->cd_max_size >= size && (cdp == NULL || + empty_cdp->cd_max_size < cdp->cd_max_size)) { + cdp = empty_cdp; + if (empty_cdp->cd_max_size == size) + break; + } if (cdp != NULL) { /* Copy from heap into the recycled chunk */ @@ -423,11 +429,17 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) empty_cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (empty_cdp == NULL) return (1); + LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); + empty_cdp->cd_base = cdp->cd_base + size; empty_cdp->cd_cur_size = 0; empty_cdp->cd_max_size = cdp->cd_max_size - size; - empty_cdp->cd_base = cdp->cd_base + size; - LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); - LIST_INSERT_AFTER(cdp, empty_cdp, cd_hash_le); + + i = empty_cdp->cd_max_size; + if (i >= UNUSED_BUCKETS) + i = 0; + LIST_INSERT_HEAD(&da->unused_chunks[i], empty_cdp, + cd_hash_le); + da->all_chunks_cnt++; da->unused_chunks_cnt++; cdp->cd_max_size = size; @@ -480,6 +492,7 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); + int i; /* Find the corresponding descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], @@ -538,7 +551,10 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) return; } - LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); + i = cdp->cd_max_size; + if (i >= UNUSED_BUCKETS) + i = 0; + LIST_INSERT_HEAD(&da->unused_chunks[i], cdp, cd_hash_le); } #ifdef DXR2 @@ -891,7 +907,8 @@ dxr_build(struct dxr *dxr) LIST_REMOVE(cdp, cd_all_le); uma_zfree(chunk_zone, cdp); } - LIST_INIT(&da->unused_chunks); + for (i = 0; i < UNUSED_BUCKETS; i++) + LIST_INIT(&da->unused_chunks[i]); da->all_chunks_cnt = da->unused_chunks_cnt = 0; da->rtbl_top = 0; da->updates_low = 0; From owner-dev-commits-src-all@freebsd.org Wed Sep 29 21:11:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9594467C71C; Wed, 29 Sep 2021 21:11:26 +0000 (UTC) (envelope-from debdrup@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKTZQ3CRmz4tBR; Wed, 29 Sep 2021 21:11:26 +0000 (UTC) (envelope-from debdrup@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632949886; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OccRYh60Th9f2x9VyXzLVjgEM++6trMn3n8rb51yuqE=; b=RUTuV4KEXaTki6CRkRPi9hLMLpfrQDzBvLFZ/mdvUZua6LO/lJzkWVuvdW/LBqTi6EL1bZ Jh35M6wQZ1fDJLErFgN2kH57Cuoc7SmKTnIpQZtuPSJtxGs6ewaX6Wi4en+XfaZdxT/hbx 8kW/MUJo2IssdJp0erllc6ZR7IgBr8BR8ECOW72bXmwdYyAllaxxCZz2CrfLTQJ17b2/3h /+BQ4OM+Wm22MN5/qNvtrNV5u7E7AtiPLS2LVzJRce9QdVeLABMWmmVsO9lZ1Po/y+mZlR UMePFFAFO7aOBaU8c1TYOhJ5YjdbedDZEMI8rHsGn+fe9szHpUghX4ewXVxQkQ== Received: by freefall.freebsd.org (Postfix, from userid 1471) id 5A24413A2B; Wed, 29 Sep 2021 21:11:26 +0000 (UTC) Date: Wed, 29 Sep 2021 23:11:24 +0200 From: Daniel Ebdrup Jensen To: dev-commits-src-main@freebsd.org, dev-commits-src-all@FreeBSD.org Subject: Re: git: 8d546b6832ee - main - cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args Message-ID: <20210929211124.gpssnyprk3f4unay@nerd-thinkpad.local> Mail-Followup-To: Daniel Ebdrup Jensen , dev-commits-src-main@freebsd.org, dev-commits-src-all@FreeBSD.org References: <202109291805.18TI57H8049974@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bklmzyyzej3laxfj" Content-Disposition: inline In-Reply-To: <202109291805.18TI57H8049974@gitrepo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632949886; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OccRYh60Th9f2x9VyXzLVjgEM++6trMn3n8rb51yuqE=; b=ObFR81F9L+q9HSHMMbxx/WJf0+7juNL8VDHATzGP4TcZoyhmflqE8y/jWs6Nn1sEC36jNk Q5KZSpN0XY27Mm1XdAw7TuByDjei1Ck28aweQX+XgftZ8chkGeFTJfRWOldN4fvlwqZJ9I wQ9Y4T2J3eux7BBN26cLURgICO8bFaRzzfEwkyRD1mY3fe/z8VxOF/90fWx6AJBmg8t6pg cRYhV4YRRBnFKNSlLjdxV2HQlNFlmdABuJU9tLKGwWn+xzQixffGfQO7uvRCMupT4C5rnu +NK8jwVNlNhKI4WFVTm/BuUtdFF1vcH2o2oiw+q+XggVUpKHu3ImTwz4YW+CgQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1632949886; a=rsa-sha256; cv=none; b=Int7mNL4JE9XNRelLv+zLtPRKyR3hfCHa6OSATVcQQxnPBc/Z2My9YUgHz+j8Z2OxvBfIX wQ1mmPFbLYwL5L7a/KdnmZECLz3SG9/zzL+FbiHUd83i0PIBsUt3Fw5KQpv5ANT9qKZEnL UDaL2usK2+MmvFX2D8rqxJRtXjmxwry+fpb6OJG1Et2TqdX2Mw/ZVaJst85UXDYPIwRkO8 CPbnEfCNiEpxq/3+9Yqv94qwe7NO0FbHTATWDeHp3B+JgWWIiKzTaBLv0r+xGqJ34pSnaO LiInQdc4XrcCIiknUfjJhYZQZhu1U5AI9YhuapYAtCg6AWRhxF/0Ed7f15QQjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 21:11:26 -0000 --bklmzyyzej3laxfj Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline On Wed, Sep 29, 2021 at 06:05:07PM +0000, Kyle Evans wrote: >The branch main has been updated by kevans: > >URL: https://cgit.FreeBSD.org/src/commit/?id=8d546b6832eea031f95f30eaec3232ec1256a281 > >commit 8d546b6832eea031f95f30eaec3232ec1256a281 >Author: Kyle Evans >AuthorDate: 2021-09-23 05:43:32 +0000 >Commit: Kyle Evans >CommitDate: 2021-09-29 18:03:34 +0000 > > cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args > > This is compatible with GNU cmp. > > Reviewed by: markj > Sponsored by: Klara, Inc. > Differential Revision: https://reviews.freebsd.org/D32073 >--- > usr.bin/cmp/cmp.1 | 19 +++++++++++++++++++ > usr.bin/cmp/cmp.c | 30 +++++++++++++++++++++++++++++- > usr.bin/cmp/tests/cmp_test2.sh | 5 +++++ > 3 files changed, 53 insertions(+), 1 deletion(-) > >diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 >index 511e09ac8628..5a56802bd22e 100644 >--- a/usr.bin/cmp/cmp.1 >+++ b/usr.bin/cmp/cmp.1 >@@ -41,6 +41,7 @@ [SNIP] Hi Kyle, You forgot a .Dd bump here :) Yours, Daniel Ebdrup Jensen --bklmzyyzej3laxfj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEEDonNJPbg/JLIMoS6Ps5hSHzN87oFAmFU1nxfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDBF ODlDRDI0RjZFMEZDOTJDODMyODRCQTNFQ0U2MTQ4N0NDREYzQkEACgkQPs5hSHzN 87obbwf/WM0fixuTYAHfBGQpygfnZOpW3XzrPIYMU+zfwqvbyPzjtzULQjtwSfmz QERHrYm2IgFZ646V+FQJD1aGyZ2M/rY6qF7NNPS1qLIHrSAFCNZXU4w2yvIOTGFF XRqhZ8CllJHr7e6rsOZkPDgjqLlR9uIdUSdVZqk8lVxsn+58IEel2reGlN020/WF 7xaM6IBc3RFhpDag47AD45+4BqBAHZuuOMFCjCl0qEkpbf9J/kXxve0MtQ2VqF/E vap4fP9XJIJYsvbigq7ShvSaLyLG8GdM7OpfGwhd78rxAS2WtHmTbrLjJQtP6ZeA e+RhUizuBIDBwgi28QtIzvz7dKv/Dw== =OXLf -----END PGP SIGNATURE----- --bklmzyyzej3laxfj-- From owner-dev-commits-src-all@freebsd.org Wed Sep 29 22:02:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64E6167D396 for ; Wed, 29 Sep 2021 22:02:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKVj32Byzz3D7l; Wed, 29 Sep 2021 22:02:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 2B53E2E432; Wed, 29 Sep 2021 22:02:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f41.google.com with SMTP id o15so2417154qvq.4; Wed, 29 Sep 2021 15:02:15 -0700 (PDT) X-Gm-Message-State: AOAM530P4xUEtv/7nZ285OcIkPsGDvE5jD8RS7gTsgR3k9wX/lp9K+1+ uIDuhf2nesfQnrqZQTNa39Z8GDUj8stUR9OPYwI= X-Google-Smtp-Source: ABdhPJyFEOtcW7LTEUV2urEzPER8m6OeZ3lfIhctEflzLRIBFOeew66LY18jTNux3cCLxE00mIrBG+/f/qpoIZZfPlM= X-Received: by 2002:a0c:b559:: with SMTP id w25mr2192292qvd.51.1632952934710; Wed, 29 Sep 2021 15:02:14 -0700 (PDT) MIME-Version: 1.0 References: <202109191245.18JCjDIe088232@gitrepo.freebsd.org> In-Reply-To: <202109191245.18JCjDIe088232@gitrepo.freebsd.org> From: Kyle Evans Date: Wed, 29 Sep 2021 17:02:02 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 2f57ecae4b98..a60ef1802a36 - vendor/bc - vendor branch updated To: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= Cc: src-committers , "" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 22:02:15 -0000 On Sun, Sep 19, 2021 at 7:45 AM Stefan E=C3=9Fer wrote: > > The branch vendor/bc has been updated by se: > > URL: https://cgit.FreeBSD.org/src/log/?id=3D2f57ecae4b98..a60ef1802a36 > > a60ef1802a36 vendor/bc: update to upstream version 5.0.2 Hi, Any estimate on when this will be integrated into main? I've got a local change that benefits from the strcpy rename that took place here: https://github.com/gavinhoward/bc/commit/bbe78f848ce5d471993aa083b8f8= 1f78214f0924 Thanks! Kyle Evans From owner-dev-commits-src-all@freebsd.org Wed Sep 29 23:19:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 326B967D5EF; Wed, 29 Sep 2021 23:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKXQf0gZgz3Hfm; Wed, 29 Sep 2021 23:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8928208F7; Wed, 29 Sep 2021 23:19:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18TNJrjt066301; Wed, 29 Sep 2021 23:19:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18TNJrsn066300; Wed, 29 Sep 2021 23:19:53 GMT (envelope-from git) Date: Wed, 29 Sep 2021 23:19:53 GMT Message-Id: <202109292319.18TNJrsn066300@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9aa29457d55e - main - loader_lua.8: Fix first version 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/main X-Git-Reftype: branch X-Git-Commit: 9aa29457d55e4c9c4eac72785886eff756fef22c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 23:19:54 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9aa29457d55e4c9c4eac72785886eff756fef22c commit 9aa29457d55e4c9c4eac72785886eff756fef22c Author: Warner Losh AuthorDate: 2021-09-29 23:14:14 +0000 Commit: Warner Losh CommitDate: 2021-09-29 23:18:51 +0000 loader_lua.8: Fix first version Lua bindings appeared in FreeBSD 12.0. Delete the authors section of the man page, since it's unclear who wrote different parts of the man page. Noted by: Trond Endrestol Sponsored by: Netflix --- stand/man/loader_lua.8 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/stand/man/loader_lua.8 b/stand/man/loader_lua.8 index 876f75676fc0..32085748bf1c 100644 --- a/stand/man/loader_lua.8 +++ b/stand/man/loader_lua.8 @@ -264,14 +264,4 @@ Unspecified error. The .Nm first appeared in -.Fx 3.1 . -.Sh AUTHORS -.An -nosplit -The -.Nm -was written by -.An Michael Smith Aq msmith@FreeBSD.org . -.Pp -.Tn FICL -was written by -.An John Sadler Aq john_sadler@alum.mit.edu . +.Fx 12.0 . From owner-dev-commits-src-all@freebsd.org Wed Sep 29 23:26:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D770F67DF42 for ; Wed, 29 Sep 2021 23:26:30 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKXZG590pz3Hls for ; Wed, 29 Sep 2021 23:26:30 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-yb1-xb2f.google.com with SMTP id s64so6014928yba.11 for ; Wed, 29 Sep 2021 16:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=nMnD6dEREN8xivG89DdbcMwkrwTf9d5qac7IR2fILao=; b=5urjGPcH3LFXOv1k8YDh+/2RwDf+r4G/raJwfI4snin8bQlWOLn5FFsXvk8M2Kh3PH M5gl0M2SLbaDLVrFGrrECTtCK/qPXZOMcmmSewMC68IwFyBYW3WyBqOKJSSPDAEK7+Tz J0iREnHwE244zAAye0SEEkLarf2P1QWpsN32GB9m9+XQGO9YDNjzhapf8XrXzPA5WZBT ONAEV03aJ1M9EDZguXkgwZqk/xjRMoWeUnCWVdZPJF21XVr6+PhPraF7cL9FnyiVa+HE hnbMamzqqYhqaPLqPVzCwfHWqLR7NS8yRyLStIxhzMjjKQ8jqlJEPtRIAqZGO6jOka+z m2Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=nMnD6dEREN8xivG89DdbcMwkrwTf9d5qac7IR2fILao=; b=i93kBSV4mWIkAoCpNsSW/ZjF1Tu6O5y7D2GR0JvotViTTn3biLeHKTH0h0vEMavWei YLffarOAt8r438yyDdnPUTA3XWxDfVsp600+C5unTaP8pNPJkY3Y78j/sW1qHBIFYoCD v4mI5vEwjWBaGzqKn46HQWKx1jNpD/xo1iFnwFsrw5yvJHc6hcfB9wGqYFonxQF++t15 FRjo4zhw06z8hn5bbvXdGjRZc4AIxBWWwJTnt186YS/ttZJpIrtz/4P8MQuKcsPEZIS4 vYcUsPhpuDSGAvtEVgqVcG1uw2VVgdNVFdSjkI32GxEfk0hKvg7iGQgxMQSRwFP/jsrr ESHw== X-Gm-Message-State: AOAM530K7S+vawsGesVYcOcD2bPuLOzgqXQzre7g86y/P/DwRG1PnIu+ zxolIWXtdSSZMdcjYxxjtIbTxs/lRAlKOstTVzsvJOo/gd0= X-Google-Smtp-Source: ABdhPJxDdAuFHndukuTAua/J+zgdhgX3j2gSybNsRTEG5qiGAJnAomtwCf48MYcmxrsR7VPvIuJFl99j2wrW6empsHo= X-Received: by 2002:a05:6902:1021:: with SMTP id x1mr3310889ybt.544.1632957989991; Wed, 29 Sep 2021 16:26:29 -0700 (PDT) MIME-Version: 1.0 References: <202109281243.18SChldh001988@gitrepo.freebsd.org> <66731C91-BAE9-4D5D-B7DE-F1D7AA94395D@fubar.geek.nz> In-Reply-To: <66731C91-BAE9-4D5D-B7DE-F1D7AA94395D@fubar.geek.nz> From: Marcin Wojtas Date: Thu, 30 Sep 2021 01:26:20 +0200 Message-ID: Subject: Re: git: f3aa0098a82e - main - Use mtx_lock_spin in the gic driver To: Andrew Turner Cc: Andrew Turner , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4HKXZG590pz3Hls X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 23:26:30 -0000 =C5=9Br., 29 wrz 2021 o 17:42 Andrew Turner napisa= =C5=82(a): > > > > > On 28 Sep 2021, at 16:36, Marcin Wojtas wrote: > > > > Hi Andrew, > > > > wt., 28 wrz 2021 o 14:43 Andrew Turner napisa=C5= =82(a): > >> > >> The branch main has been updated by andrew: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=3Df3aa0098a82ebf7712aa137= 16d794aa7e4ac59cd > >> > >> commit f3aa0098a82ebf7712aa13716d794aa7e4ac59cd > >> Author: Andrew Turner > >> AuthorDate: 2021-09-28 11:36:42 +0000 > >> Commit: Andrew Turner > >> CommitDate: 2021-09-28 11:42:06 +0000 > >> > >> Use mtx_lock_spin in the gic driver > >> > >> The mutex was changed to a spin lock when the MSI/MSI-X handling wa= s > >> moved from the gicv2m to the gic driver. Update the calls to lock > >> and unlock the mutex to the spin variant. > >> > >> Submitted by: jrtc27 ("Change all the mtx_(un)lock(&sc->mutex) to= be the _spin versions.") > >> Reported by: mw, antranigv@freebsd.am > >> Sponsored by: The FreeBSD Foundation > >> --- > >> sys/arm/arm/gic.c | 20 ++++++++++---------- > >> 1 file changed, 10 insertions(+), 10 deletions(-) > >> > >> diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c > >> index d7edd7885404..89db4e324600 100644 > >> --- a/sys/arm/arm/gic.c > >> +++ b/sys/arm/arm/gic.c > >> @@ -1056,7 +1056,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, = int count, int maxcount, > >> > >> sc =3D device_get_softc(dev); > >> > >> - mtx_lock(&sc->mutex); > >> + mtx_lock_spin(&sc->mutex); > >> > >> found =3D false; > >> for (irq =3D sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { > >> @@ -1091,7 +1091,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, = int count, int maxcount, > >> > >> /* Not enough interrupts were found */ > >> if (!found || irq =3D=3D sc->sc_spi_end) { > >> - mtx_unlock(&sc->mutex); > >> + mtx_unlock_spin(&sc->mutex); > >> return (ENXIO); > >> } > >> > >> @@ -1099,7 +1099,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, = int count, int maxcount, > >> /* Mark the interrupt as used */ > >> sc->gic_irqs[irq + i].gi_flags |=3D GI_FLAG_MSI_USED; > >> } > >> - mtx_unlock(&sc->mutex); > >> + mtx_unlock_spin(&sc->mutex); > >> > >> for (i =3D 0; i < count; i++) > >> srcs[i] =3D (struct intr_irqsrc *)&sc->gic_irqs[irq + i= ]; > >> @@ -1118,7 +1118,7 @@ arm_gic_release_msi(device_t dev, device_t child= , int count, > >> > >> sc =3D device_get_softc(dev); > >> > >> - mtx_lock(&sc->mutex); > >> + mtx_lock_spin(&sc->mutex); > >> for (i =3D 0; i < count; i++) { > >> gi =3D (struct gic_irqsrc *)isrc[i]; > >> > >> @@ -1128,7 +1128,7 @@ arm_gic_release_msi(device_t dev, device_t child= , int count, > >> > >> gi->gi_flags &=3D ~GI_FLAG_MSI_USED; > >> } > >> - mtx_unlock(&sc->mutex); > >> + mtx_unlock_spin(&sc->mutex); > >> > >> return (0); > >> } > >> @@ -1142,7 +1142,7 @@ arm_gic_alloc_msix(device_t dev, device_t child,= device_t *pic, > >> > >> sc =3D device_get_softc(dev); > >> > >> - mtx_lock(&sc->mutex); > >> + mtx_lock_spin(&sc->mutex); > >> /* Find an unused interrupt */ > >> for (irq =3D sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { > >> KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) !=3D= 0, > >> @@ -1152,13 +1152,13 @@ arm_gic_alloc_msix(device_t dev, device_t chil= d, device_t *pic, > >> } > >> /* No free interrupt was found */ > >> if (irq =3D=3D sc->sc_spi_end) { > >> - mtx_unlock(&sc->mutex); > >> + mtx_unlock_spin(&sc->mutex); > >> return (ENXIO); > >> } > >> > >> /* Mark the interrupt as used */ > >> sc->gic_irqs[irq].gi_flags |=3D GI_FLAG_MSI_USED; > >> - mtx_unlock(&sc->mutex); > >> + mtx_unlock_spin(&sc->mutex); > >> > >> *isrcp =3D (struct intr_irqsrc *)&sc->gic_irqs[irq]; > >> *pic =3D dev; > >> @@ -1178,9 +1178,9 @@ arm_gic_release_msix(device_t dev, device_t chil= d, struct intr_irqsrc *isrc) > >> KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) =3D=3D GI_FLAG_MSI_US= ED, > >> ("%s: Trying to release an unused MSI-X interrupt", __func_= _)); > >> > >> - mtx_lock(&sc->mutex); > >> + mtx_lock_spin(&sc->mutex); > >> gi->gi_flags &=3D ~GI_FLAG_MSI_USED; > >> - mtx_unlock(&sc->mutex); > >> + mtx_unlock_spin(&sc->mutex); > >> > >> return (0); > >> } > > > > Thank you for the patch, it fixes the MSI-X in my setup, but in order > > to operate properly on Marvell SoCs (equipped with a standard GICv2m), > > I have to remove the asserts, which were added in c6f3076d4405 (Move > > the GICv2m msi handling to the parent): > > > > diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c > > index 89db4e324600..b5d72a2a6c49 100644 > > --- a/sys/arm/arm/gic.c > > +++ b/sys/arm/arm/gic.c > > @@ -528,8 +528,6 @@ arm_gic_write_ivar(device_t dev, device_t child, > > int which, uintptr_t value) > > * GIC_IVAR_MBI_START must be set once and first. This a= llows > > * us to reserve the registers when GIC_IVAR_MBI_COUNT i= s set. > > */ > > - MPASS(sc->sc_spi_start =3D=3D 0); > > - MPASS(sc->sc_spi_count =3D=3D 0); > > MPASS(value >=3D GIC_FIRST_SPI); > > MPASS(value < sc->nirqs); > > > > @@ -537,7 +535,6 @@ arm_gic_write_ivar(device_t dev, device_t child, > > int which, uintptr_t value) > > return (0); > > case GIC_IVAR_MBI_COUNT: > > MPASS(sc->sc_spi_start !=3D 0); > > - MPASS(sc->sc_spi_count =3D=3D 0); > > > > sc->sc_spi_count =3D value; > > sc->sc_spi_end =3D sc->sc_spi_start + sc->sc_spi_count; > > > > Any thoughts? > > Can you try the patch in https://reviews.freebsd.org/D32224. The above ch= ange is to check there is only a single mbi range, however it appears your = hardware has multiple gicv2m devices so will try to reserve multiple mbi ra= nges. > After applying this patch the MSI-X work fine and I can boot the OS without issue. Thanks, Marcin From owner-dev-commits-src-all@freebsd.org Thu Sep 30 00:23:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02CEF67E97D; Thu, 30 Sep 2021 00:23: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 4HKYqd6Hm6z3Nhy; Thu, 30 Sep 2021 00:23:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7F252209C; Thu, 30 Sep 2021 00:23: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 18U0N9hX058492; Thu, 30 Sep 2021 00:23:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U0N99g058491; Thu, 30 Sep 2021 00:23:09 GMT (envelope-from git) Date: Thu, 30 Sep 2021 00:23:09 GMT Message-Id: <202109300023.18U0N99g058491@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: 4cb203d8f3a1 - stable/13 - e1000: fix K1 configuration 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: 4cb203d8f3a10e927729e4daafee9d90045de0bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 00:23:10 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4cb203d8f3a10e927729e4daafee9d90045de0bc commit 4cb203d8f3a10e927729e4daafee9d90045de0bc Author: Wenzhuo Lu AuthorDate: 2015-10-16 02:51:09 +0000 Commit: Kevin Bowling CommitDate: 2021-09-30 00:22:59 +0000 e1000: fix K1 configuration This patch is for the following updates to the K1 configurations: Tx idle period for entering K1 should be 128 ns. Minimum Tx idle period in K1 should be 256 ns. Signed-off-by: Wenzhuo Lu PR: 258153 Reviewed by: erj Tested by: iron.udjin@gmail.com Approved by: imp Obtained from: DPDK (6f934fa24dfd437c90ead96bc7598ee77a117ede) MFC after: 1 week (cherry picked from commit d5ad2f2a67df54ac40148cca21e726bc61a48982) --- sys/dev/e1000/e1000_ich8lan.c | 45 ++++++++++++++++++++++++++++++++++++++++++- sys/dev/e1000/e1000_ich8lan.h | 1 + sys/dev/e1000/e1000_phy.h | 7 +++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 4209595a911c..3f3e2307f83f 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1728,7 +1728,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (ret_val) return ret_val; } - /* Clear link partner's EEE ability */ hw->dev_spec.ich8lan.eee_lp_ability = 0; @@ -1749,6 +1748,9 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; E1000_WRITE_REG(hw, E1000_FEXTNVM6, fextnvm6); + + /* Configure K0s minimum time */ + e1000_configure_k0s_lpt(hw, K1_ENTRY_LATENCY, K1_MIN_TIME); } if (!link) @@ -6144,3 +6146,44 @@ release: } } +/** + * e1000_configure_k0s_lpt - Configure K0s power state + * @hw: pointer to the HW structure + * @entry_latency: Tx idle period for entering K0s - valid values are 0 to 3. + * 0 corresponds to 128ns, each value over 0 doubles the duration. + * @min_time: Minimum Tx idle period allowed - valid values are 0 to 4. + * 0 corresponds to 128ns, each value over 0 doubles the duration. + * + * Configure the K1 power state based on the provided parameter. + * Assumes semaphore already acquired. + * + * Success returns 0, Failure returns: + * -E1000_ERR_PHY (-2) in case of access error + * -E1000_ERR_PARAM (-4) in case of parameters error + **/ +s32 e1000_configure_k0s_lpt(struct e1000_hw *hw, u8 entry_latency, u8 min_time) +{ + s32 ret_val; + u16 kmrn_reg = 0; + + DEBUGFUNC("e1000_configure_k0s_lpt"); + + if (entry_latency > 3 || min_time > 4) + return -E1000_ERR_PARAM; + + ret_val = e1000_read_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K0S_CTRL, + &kmrn_reg); + if (ret_val) + return ret_val; + + /* for now don't touch the latency */ + kmrn_reg &= ~(E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_MASK); + kmrn_reg |= ((min_time << E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT)); + + ret_val = e1000_write_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K0S_CTRL, + kmrn_reg); + if (ret_val) + return ret_val; + + return E1000_SUCCESS; +} diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index caff11cbb899..dfa7684f27b7 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -337,6 +337,7 @@ void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw); u32 e1000_resume_workarounds_pchlan(struct e1000_hw *hw); s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); +s32 e1000_configure_k0s_lpt(struct e1000_hw *hw, u8 entry_latency, u8 min_time); void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw); s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable); s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data); diff --git a/sys/dev/e1000/e1000_phy.h b/sys/dev/e1000/e1000_phy.h index 38c8f9b466ce..3a5b231b8bce 100644 --- a/sys/dev/e1000/e1000_phy.h +++ b/sys/dev/e1000/e1000_phy.h @@ -281,6 +281,13 @@ s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, #define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 #define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002 /* enable K1 */ #define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */ +#define E1000_KMRNCTRLSTA_K0S_CTRL 0x1E /* Kumeran K0s Control */ +#define E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_SHIFT 0 +#define E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT 4 +#define E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_MASK \ + (3 << E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_SHIFT) +#define E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_MASK \ + (7 << E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT) #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Ctrl */ From owner-dev-commits-src-all@freebsd.org Thu Sep 30 00:24:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3796767EAED; Thu, 30 Sep 2021 00:24: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 4HKYry6DKKz3NTY; Thu, 30 Sep 2021 00:24:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B710421BD9; Thu, 30 Sep 2021 00:24: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 18U0OIRA058694; Thu, 30 Sep 2021 00:24:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U0OIv5058693; Thu, 30 Sep 2021 00:24:18 GMT (envelope-from git) Date: Thu, 30 Sep 2021 00:24:18 GMT Message-Id: <202109300024.18U0OIv5058693@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: b4c189e2fe07 - stable/12 - e1000: fix K1 configuration 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: b4c189e2fe07d67f8b2d92e5d29aaada48d6d882 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 00:24:19 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b4c189e2fe07d67f8b2d92e5d29aaada48d6d882 commit b4c189e2fe07d67f8b2d92e5d29aaada48d6d882 Author: Wenzhuo Lu AuthorDate: 2015-10-16 02:51:09 +0000 Commit: Kevin Bowling CommitDate: 2021-09-30 00:23:56 +0000 e1000: fix K1 configuration This patch is for the following updates to the K1 configurations: Tx idle period for entering K1 should be 128 ns. Minimum Tx idle period in K1 should be 256 ns. Signed-off-by: Wenzhuo Lu PR: 258153 Reviewed by: erj Tested by: iron.udjin@gmail.com Approved by: imp Obtained from: DPDK (6f934fa24dfd437c90ead96bc7598ee77a117ede) MFC after: 1 week (cherry picked from commit d5ad2f2a67df54ac40148cca21e726bc61a48982) --- sys/dev/e1000/e1000_ich8lan.c | 45 ++++++++++++++++++++++++++++++++++++++++++- sys/dev/e1000/e1000_ich8lan.h | 1 + sys/dev/e1000/e1000_phy.h | 7 +++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index d9efc78e350c..4dec3e22c3a9 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1728,7 +1728,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (ret_val) return ret_val; } - /* Clear link partner's EEE ability */ hw->dev_spec.ich8lan.eee_lp_ability = 0; @@ -1749,6 +1748,9 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; E1000_WRITE_REG(hw, E1000_FEXTNVM6, fextnvm6); + + /* Configure K0s minimum time */ + e1000_configure_k0s_lpt(hw, K1_ENTRY_LATENCY, K1_MIN_TIME); } if (!link) @@ -6144,3 +6146,44 @@ release: } } +/** + * e1000_configure_k0s_lpt - Configure K0s power state + * @hw: pointer to the HW structure + * @entry_latency: Tx idle period for entering K0s - valid values are 0 to 3. + * 0 corresponds to 128ns, each value over 0 doubles the duration. + * @min_time: Minimum Tx idle period allowed - valid values are 0 to 4. + * 0 corresponds to 128ns, each value over 0 doubles the duration. + * + * Configure the K1 power state based on the provided parameter. + * Assumes semaphore already acquired. + * + * Success returns 0, Failure returns: + * -E1000_ERR_PHY (-2) in case of access error + * -E1000_ERR_PARAM (-4) in case of parameters error + **/ +s32 e1000_configure_k0s_lpt(struct e1000_hw *hw, u8 entry_latency, u8 min_time) +{ + s32 ret_val; + u16 kmrn_reg = 0; + + DEBUGFUNC("e1000_configure_k0s_lpt"); + + if (entry_latency > 3 || min_time > 4) + return -E1000_ERR_PARAM; + + ret_val = e1000_read_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K0S_CTRL, + &kmrn_reg); + if (ret_val) + return ret_val; + + /* for now don't touch the latency */ + kmrn_reg &= ~(E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_MASK); + kmrn_reg |= ((min_time << E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT)); + + ret_val = e1000_write_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K0S_CTRL, + kmrn_reg); + if (ret_val) + return ret_val; + + return E1000_SUCCESS; +} diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index caff11cbb899..dfa7684f27b7 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -337,6 +337,7 @@ void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw); u32 e1000_resume_workarounds_pchlan(struct e1000_hw *hw); s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); +s32 e1000_configure_k0s_lpt(struct e1000_hw *hw, u8 entry_latency, u8 min_time); void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw); s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable); s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data); diff --git a/sys/dev/e1000/e1000_phy.h b/sys/dev/e1000/e1000_phy.h index 38c8f9b466ce..3a5b231b8bce 100644 --- a/sys/dev/e1000/e1000_phy.h +++ b/sys/dev/e1000/e1000_phy.h @@ -281,6 +281,13 @@ s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, #define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 #define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002 /* enable K1 */ #define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */ +#define E1000_KMRNCTRLSTA_K0S_CTRL 0x1E /* Kumeran K0s Control */ +#define E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_SHIFT 0 +#define E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT 4 +#define E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_MASK \ + (3 << E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_SHIFT) +#define E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_MASK \ + (7 << E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT) #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Ctrl */ From owner-dev-commits-src-all@freebsd.org Thu Sep 30 00:44:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 046DF67F5D1; Thu, 30 Sep 2021 00:44: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 4HKZJB6R8fz3PQr; Thu, 30 Sep 2021 00:44:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7ADA21F62; Thu, 30 Sep 2021 00:44: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 18U0iQPp084965; Thu, 30 Sep 2021 00:44:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U0iQiD084964; Thu, 30 Sep 2021 00:44:26 GMT (envelope-from git) Date: Thu, 30 Sep 2021 00:44:26 GMT Message-Id: <202109300044.18U0iQiD084964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 4a7b49a0da00 - main - ipfilter: Save time and cycles swapping bucket table sizes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a7b49a0da00d7822656e2adefafac885bbfd310 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 00:44:27 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=4a7b49a0da00d7822656e2adefafac885bbfd310 commit 4a7b49a0da00d7822656e2adefafac885bbfd310 Author: Cy Schubert AuthorDate: 2021-09-28 03:04:18 +0000 Commit: Cy Schubert CommitDate: 2021-09-30 00:44:02 +0000 ipfilter: Save time and cycles swapping bucket table sizes NAT hash tables are inverted for inbound vs outbound. Rather than spend the time and cycles swapping them, let's simply calculate the bucket lengths inversely. MFC after: 1 week --- sys/contrib/ipfilter/netinet/ip_nat.c | 13 +++++-------- sys/contrib/ipfilter/netinet/ip_nat6.c | 29 +++++++++++++++++------------ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 0475a4386079..054f92a93401 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -3521,15 +3521,12 @@ ipf_nat_hashtab_add(softc, softn, nat) u_int hv0; u_int hv1; - hv0 = nat->nat_hv[0] % softn->ipf_nat_table_sz; - hv1 = nat->nat_hv[1] % softn->ipf_nat_table_sz; - if (nat->nat_dir == NAT_INBOUND || nat->nat_dir == NAT_DIVERTIN) { - u_int swap; - - swap = hv0; - hv0 = hv1; - hv1 = swap; + hv1 = nat->nat_hv[0] % softn->ipf_nat_table_sz; + hv0 = nat->nat_hv[1] % softn->ipf_nat_table_sz; + } else { + hv0 = nat->nat_hv[0] % softn->ipf_nat_table_sz; + hv1 = nat->nat_hv[1] % softn->ipf_nat_table_sz; } if (softn->ipf_nat_stats.ns_side[0].ns_bucketlen[hv0] >= diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c index baa3c302504a..c03048ee12ac 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat6.c +++ b/sys/contrib/ipfilter/netinet/ip_nat6.c @@ -2160,19 +2160,24 @@ ipf_nat6_tabmove(softn, nat) /* * Add into the NAT table in the new position */ - hv0 = NAT_HASH_FN6(&nat->nat_osrc6, nat->nat_osport, 0xffffffff); - hv0 = NAT_HASH_FN6(&nat->nat_odst6, hv0 + nat->nat_odport, - softn->ipf_nat_table_sz); - hv1 = NAT_HASH_FN6(&nat->nat_nsrc6, nat->nat_nsport, 0xffffffff); - hv1 = NAT_HASH_FN6(&nat->nat_ndst6, hv1 + nat->nat_ndport, - softn->ipf_nat_table_sz); - if (nat->nat_dir == NAT_INBOUND || nat->nat_dir == NAT_DIVERTIN) { - u_int swap; - - swap = hv0; - hv0 = hv1; - hv1 = swap; + hv1 = NAT_HASH_FN6(&nat->nat_osrc6, + nat->nat_osport, 0xffffffff); + hv1 = NAT_HASH_FN6(&nat->nat_odst6, hv1 + nat->nat_odport, + softn->ipf_nat_table_sz); + hv0 = NAT_HASH_FN6(&nat->nat_nsrc6, + nat->nat_nsport, 0xffffffff); + hv0 = NAT_HASH_FN6(&nat->nat_ndst6, hv0 + nat->nat_ndport, + softn->ipf_nat_table_sz); + } else { + hv0 = NAT_HASH_FN6(&nat->nat_osrc6, + nat->nat_osport, 0xffffffff); + hv0 = NAT_HASH_FN6(&nat->nat_odst6, hv0 + nat->nat_odport, + softn->ipf_nat_table_sz); + hv1 = NAT_HASH_FN6(&nat->nat_nsrc6, + nat->nat_nsport, 0xffffffff); + hv1 = NAT_HASH_FN6(&nat->nat_ndst6, hv1 + nat->nat_ndport, + softn->ipf_nat_table_sz); } /* TRACE nat_osrc6, nat_osport, nat_odst6, nat_odport, hv0 */ From owner-dev-commits-src-all@freebsd.org Thu Sep 30 01:18:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61B6C67F770; Thu, 30 Sep 2021 01:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKb412L0zz3hV8; Thu, 30 Sep 2021 01:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22D542256A; Thu, 30 Sep 2021 01:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18U1IvsJ026218; Thu, 30 Sep 2021 01:18:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U1IvQM026217; Thu, 30 Sep 2021 01:18:57 GMT (envelope-from git) Date: Thu, 30 Sep 2021 01:18:57 GMT Message-Id: <202109300118.18U1IvQM026217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 6a460811b331 - main - ida: Use ida lock instead of Giant for bus_dma allocation 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/main X-Git-Reftype: branch X-Git-Commit: 6a460811b331d9f282811578d3d85f9a7e78936e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 01:18:57 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6a460811b331d9f282811578d3d85f9a7e78936e commit 6a460811b331d9f282811578d3d85f9a7e78936e Author: Warner Losh AuthorDate: 2021-09-30 01:05:39 +0000 Commit: Warner Losh CommitDate: 2021-09-30 01:15:16 +0000 ida: Use ida lock instead of Giant for bus_dma allocation It looks like a reference to Giant was overloooked when jhb made this MPSAFE in 6b5b57ae9f8f. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31841 --- sys/dev/ida/ida.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index 10bba8146706..d45395a1febf 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -248,7 +248,7 @@ ida_setup(struct ida_softc *ida) /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags */ 0, /* lockfunc */ busdma_lock_mutex, - /* lockarg */ &Giant, + /* lockarg */ &ida->lock, &ida->buffer_dmat); if (error) return (ENOMEM); From owner-dev-commits-src-all@freebsd.org Thu Sep 30 02:00:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7D596A8531; Thu, 30 Sep 2021 02:00: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 4HKbzf4sKfz3pDk; Thu, 30 Sep 2021 02:00:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8661522FB7; Thu, 30 Sep 2021 02:00: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 18U20EoV084734; Thu, 30 Sep 2021 02:00:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U20EZD084710; Thu, 30 Sep 2021 02:00:14 GMT (envelope-from git) Date: Thu, 30 Sep 2021 02:00:14 GMT Message-Id: <202109300200.18U20EZD084710@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 79a100e28e3c - main - bluetooth: complete removal of ng_h4 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/main X-Git-Reftype: branch X-Git-Commit: 79a100e28e3c814773bb4c1826cfa25fbe31140e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 02:00:14 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=79a100e28e3c814773bb4c1826cfa25fbe31140e commit 79a100e28e3c814773bb4c1826cfa25fbe31140e Author: Warner Losh AuthorDate: 2021-09-05 18:41:16 +0000 Commit: Warner Losh CommitDate: 2021-09-30 02:00:02 +0000 bluetooth: complete removal of ng_h4 The ng_h4 module was disconnected 13 years ago when the tty later was locked by Ed. It completely fails to compile, and has a number of false positives for Giant use. Remove it for lack of interest. Bluetooth has largely (completely?) moved on from bluetooth over UART transport. OK'd by: emax Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31846 --- ObsoleteFiles.inc | 3 + share/man/man4/Makefile | 1 - share/man/man4/netgraph.4 | 3 +- share/man/man4/ng_h4.4 | 123 --- share/man/man5/bluetooth.device.conf.5 | 3 +- sys/conf/files | 1 - sys/modules/netgraph/bluetooth/h4/Makefile | 12 - sys/netgraph/bluetooth/drivers/h4/TODO | 13 - sys/netgraph/bluetooth/drivers/h4/ng_h4.c | 1020 ------------------------ sys/netgraph/bluetooth/drivers/h4/ng_h4_prse.h | 125 --- sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h | 104 --- sys/netgraph/bluetooth/include/ng_h4.h | 114 --- 12 files changed, 5 insertions(+), 1517 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 19e0428a5017..4a0d2fe1b7ea 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210929: Remove ng_h4 +OLD_FILES+=usr/share/man/man4/ng_h4.4.gz + # 20210923: rename boot(9) to kern_reboot(9) OLD_FILES+=usr/share/man/man9/boot.9.gz diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 4dad9b11ec22..421de8728a05 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -353,7 +353,6 @@ MAN= aac.4 \ ng_frame_relay.4 \ ng_gif.4 \ ng_gif_demux.4 \ - ng_h4.4 \ ng_hci.4 \ ng_hole.4 \ ng_hub.4 \ diff --git a/share/man/man4/netgraph.4 b/share/man/man4/netgraph.4 index 6b850e27762a..bed412193f6b 100644 --- a/share/man/man4/netgraph.4 +++ b/share/man/man4/netgraph.4 @@ -36,7 +36,7 @@ .\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $ .\" $FreeBSD$ .\" -.Dd January 9, 2021 +.Dd September 29, 2021 .Dt NETGRAPH 4 .Os .Sh NAME @@ -1433,7 +1433,6 @@ common networking problems, solved using .Xr ng_frame_relay 4 , .Xr ng_gif 4 , .Xr ng_gif_demux 4 , -.Xr ng_h4 4 , .Xr ng_hci 4 , .Xr ng_hole 4 , .Xr ng_hub 4 , diff --git a/share/man/man4/ng_h4.4 b/share/man/man4/ng_h4.4 deleted file mode 100644 index bb539a230eba..000000000000 --- a/share/man/man4/ng_h4.4 +++ /dev/null @@ -1,123 +0,0 @@ -.\" Copyright (c) 2001-2002 Maksim Yevmenkin -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: ng_h4.4,v 1.2 2003/05/21 19:37:35 max Exp $ -.\" $FreeBSD$ -.\" -.Dd June 14, 2002 -.Dt NG_H4 4 -.Os -.Sh NAME -.Nm ng_h4 -.Nd Netgraph node type that is also an H4 line discipline -.Sh SYNOPSIS -.In sys/types.h -.In netgraph/bluetooth/include/ng_h4.h -.Sh DESCRIPTION -The -.Nm h4 -node type is both a persistent Netgraph node type and a H4 line -discipline. -It implements a Bluetooth HCI UART transport layer as -per chapter H4 of the Bluetooth Specification Book v1.1. -A new node is created when the corresponding line discipline, -.Dv H4DISC , -is registered on a tty device (see -.Xr tty 4 ) . -.Pp -The node has a single hook called -.Dv hook . -Incoming bytes received on the tty device are re-assembled into -HCI frames (according to the length). -Full HCI frames are sent out on the hook. -HCI frames received on -.Dv hook -are transmitted out on the tty device. -No modification to the data is performed in either direction. -While the line discipline is installed on a tty, the normal -read and write operations are unavailable, returning -.Er EIO . -.Pp -Information about the node is available via the netgraph -.Xr ioctl 2 -command -.Dv NGIOCGINFO . -This command returns a -.Vt "struct nodeinfo" -similar to the -.Dv NGM_NODEINFO -.Xr netgraph 4 -control message. -.Sh HOOKS -This node type supports the following hooks: -.Bl -tag -width ".Va hook" -.It Va hook -single HCI frame contained in single -.Vt mbuf -structure. -.El -.Sh CONTROL MESSAGES -This node type supports the generic control messages, plus the following: -.Bl -tag -width foo -.It Dv NGM_H4_NODE_RESET -Reset the node. -.It Dv NGM_H4_NODE_GET_STATE -Returns current receiving state for the node. -.It Dv NGM_H4_NODE_GET_DEBUG -Returns an integer containing the current debug level for the node. -.It Dv NGM_H4_NODE_SET_DEBUG -This command takes an integer argument and sets current debug level -for the node. -.It Dv NGM_H4_NODE_GET_QLEN -Returns current length of outgoing queue for the node. -.It Dv NGM_H4_NODE_SET_QLEN -This command takes an integer argument and sets maximum length of -outgoing queue for the node. -.It Dv NGM_H4_NODE_GET_STAT -Returns various statistic information for the node, such as: number of -bytes (frames) sent, number of bytes (frames) received and number of -input (output) errors. -.It Dv NGM_H4_NODE_RESET_STAT -Reset all statistic counters to zero. -.El -.Sh SHUTDOWN -This node shuts down when the corresponding device is closed -(or the line discipline is uninstalled on the device). -.Sh SEE ALSO -.Xr ioctl 2 , -.Xr netgraph 4 , -.Xr tty 4 , -.Xr ngctl 8 -.Sh HISTORY -The -.Nm h4 -node type was implemented in -.Fx 5.0 . -.Sh AUTHORS -.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com -.Sh BUGS -This node still uses -.Xr spltty 9 -to lock tty layer. -This is wrong. diff --git a/share/man/man5/bluetooth.device.conf.5 b/share/man/man5/bluetooth.device.conf.5 index 681bbd693146..f2f5bcdc8685 100644 --- a/share/man/man5/bluetooth.device.conf.5 +++ b/share/man/man5/bluetooth.device.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 9, 2021 +.Dd September 29, 2021 .Dt BLUETOOTH.DEVICE.CONF 5 .Os .Sh NAME @@ -173,7 +173,6 @@ The file should be used to specify configuration parameters overrides for the second USB Bluetooth device. .Sh SEE ALSO -.Xr ng_h4 4 , .Xr ng_hci 4 , .Xr ng_l2cap 4 , .Xr ng_ubt 4 , diff --git a/sys/conf/files b/sys/conf/files index 828953628eda..fd91666f3718 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4253,7 +4253,6 @@ netgraph/atm/sscop/ng_sscop.c optional ngatm_sscop \ netgraph/atm/uni/ng_uni.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/bluetooth/common/ng_bluetooth.c optional netgraph_bluetooth -netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4 netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c optional netgraph_bluetooth_ubt usb netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c optional netgraph_bluetooth_ubtbcmfw usb diff --git a/sys/modules/netgraph/bluetooth/h4/Makefile b/sys/modules/netgraph/bluetooth/h4/Makefile deleted file mode 100644 index 808f44c9dd2c..000000000000 --- a/sys/modules/netgraph/bluetooth/h4/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $Id: Makefile,v 1.1 2002/11/24 20:40:04 max Exp $ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/netgraph/bluetooth/drivers/h4 - -CFLAGS+= -I${SRCTOP}/sys/netgraph/bluetooth/include \ - -I${SRCTOP}/sys/netgraph/bluetooth/drivers/h4 - -KMOD= ng_h4 -SRCS= ng_h4.c - -.include diff --git a/sys/netgraph/bluetooth/drivers/h4/TODO b/sys/netgraph/bluetooth/drivers/h4/TODO deleted file mode 100644 index 0862688c19d9..000000000000 --- a/sys/netgraph/bluetooth/drivers/h4/TODO +++ /dev/null @@ -1,13 +0,0 @@ -$Id: TODO,v 1.2 2004/08/23 18:08:15 max Exp $ -$FreeBSD$ - -FIXME/TODO list - -This is a list of open issues for H4 node - -1) Locking/SMP - - External code now uses ng_send_fn to inject data into Netgraph, but - i still use splXXX to lock tty level. this is wrong and should be - fixed! - diff --git a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c deleted file mode 100644 index 11560b7c6681..000000000000 --- a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c +++ /dev/null @@ -1,1020 +0,0 @@ -/* - * ng_h4.c - */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001-2002 Maksim Yevmenkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: ng_h4.c,v 1.10 2005/10/31 17:57:43 max Exp $ - * $FreeBSD$ - * - * Based on: - * --------- - * - * FreeBSD: src/sys/netgraph/ng_tty.c - * Author: Archie Cobbs - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/***************************************************************************** - ***************************************************************************** - ** This node implements a Bluetooth HCI UART transport layer as per chapter - ** H4 of the Bluetooth Specification Book v1.1. It is a terminal line - ** discipline that is also a netgraph node. Installing this line discipline - ** on a terminal device instantiates a new netgraph node of this type, which - ** allows access to the device via the "hook" hook of the node. - ** - ** Once the line discipline is installed, you can find out the name of the - ** corresponding netgraph node via a NGIOCGINFO ioctl(). - ***************************************************************************** - *****************************************************************************/ - -/* MALLOC define */ -#ifndef NG_SEPARATE_MALLOC -MALLOC_DEFINE(M_NETGRAPH_H4, "netgraph_h4", "Netgraph Bluetooth H4 node"); -#else -#define M_NETGRAPH_H4 M_NETGRAPH -#endif /* NG_SEPARATE_MALLOC */ - -/* Line discipline methods */ -static int ng_h4_open (struct cdev *, struct tty *); -static int ng_h4_close (struct tty *, int); -static int ng_h4_read (struct tty *, struct uio *, int); -static int ng_h4_write (struct tty *, struct uio *, int); -static int ng_h4_input (int, struct tty *); -static int ng_h4_start (struct tty *); -static int ng_h4_ioctl (struct tty *, u_long, caddr_t, - int, struct thread *); - -/* Line discipline descriptor */ -static struct linesw ng_h4_disc = { - ng_h4_open, /* open */ - ng_h4_close, /* close */ - ng_h4_read, /* read */ - ng_h4_write, /* write */ - ng_h4_ioctl, /* ioctl */ - ng_h4_input, /* input */ - ng_h4_start, /* start */ - ttymodem /* modem */ -}; - -/* Netgraph methods */ -static ng_constructor_t ng_h4_constructor; -static ng_rcvmsg_t ng_h4_rcvmsg; -static ng_shutdown_t ng_h4_shutdown; -static ng_newhook_t ng_h4_newhook; -static ng_connect_t ng_h4_connect; -static ng_rcvdata_t ng_h4_rcvdata; -static ng_disconnect_t ng_h4_disconnect; - -/* Other stuff */ -static void ng_h4_process_timeout (node_p, hook_p, void *, int); -static int ng_h4_mod_event (module_t, int, void *); - -/* Netgraph node type descriptor */ -static struct ng_type typestruct = { - .version = NG_ABI_VERSION, - .name = NG_H4_NODE_TYPE, - .mod_event = ng_h4_mod_event, - .constructor = ng_h4_constructor, - .rcvmsg = ng_h4_rcvmsg, - .shutdown = ng_h4_shutdown, - .newhook = ng_h4_newhook, - .connect = ng_h4_connect, - .rcvdata = ng_h4_rcvdata, - .disconnect = ng_h4_disconnect, - .cmdlist = ng_h4_cmdlist -}; -NETGRAPH_INIT(h4, &typestruct); -MODULE_VERSION(ng_h4, NG_BLUETOOTH_VERSION); - -static int ng_h4_node = 0; - -/***************************************************************************** - ***************************************************************************** - ** Line discipline methods - ***************************************************************************** - *****************************************************************************/ - -/* - * Set our line discipline on the tty. - */ - -static int -ng_h4_open(struct cdev *dev, struct tty *tp) -{ - struct thread *td = curthread; - char name[NG_NODESIZ]; - ng_h4_info_p sc = NULL; - int error; - - /* Super-user only */ - error = priv_check(td, PRIV_NETGRAPH_TTY); /* XXX */ - if (error != 0) - return (error); - - /* Initialize private struct */ - sc = malloc(sizeof(*sc), M_NETGRAPH_H4, M_NOWAIT|M_ZERO); - if (sc == NULL) - return (ENOMEM); - - sc->tp = tp; - sc->debug = NG_H4_WARN_LEVEL; - - sc->state = NG_H4_W4_PKT_IND; - sc->want = 1; - sc->got = 0; - - mtx_init(&sc->outq.ifq_mtx, "ng_h4 node+queue", NULL, MTX_DEF); - IFQ_SET_MAXLEN(&sc->outq, NG_H4_DEFAULTQLEN); - ng_callout_init(&sc->timo); - - NG_H4_LOCK(sc); - - /* Setup netgraph node */ - error = ng_make_node_common(&typestruct, &sc->node); - if (error != 0) { - NG_H4_UNLOCK(sc); - - printf("%s: Unable to create new node!\n", __func__); - - mtx_destroy(&sc->outq.ifq_mtx); - bzero(sc, sizeof(*sc)); - free(sc, M_NETGRAPH_H4); - - return (error); - } - - /* Assign node its name */ - snprintf(name, sizeof(name), "%s%d", typestruct.name, ng_h4_node ++); - - error = ng_name_node(sc->node, name); - if (error != 0) { - NG_H4_UNLOCK(sc); - - printf("%s: %s - node name exists?\n", __func__, name); - - NG_NODE_UNREF(sc->node); - mtx_destroy(&sc->outq.ifq_mtx); - bzero(sc, sizeof(*sc)); - free(sc, M_NETGRAPH_H4); - - return (error); - } - - /* Set back pointers */ - NG_NODE_SET_PRIVATE(sc->node, sc); - tp->t_lsc = (caddr_t) sc; - - /* The node has to be a WRITER because data can change node status */ - NG_NODE_FORCE_WRITER(sc->node); - - /* - * Pre-allocate cblocks to the an appropriate amount. - * I'm not sure what is appropriate. - */ - - ttyflush(tp, FREAD | FWRITE); - clist_alloc_cblocks(&tp->t_canq, 0, 0); - clist_alloc_cblocks(&tp->t_rawq, 0, 0); - clist_alloc_cblocks(&tp->t_outq, - MLEN + NG_H4_HIWATER, MLEN + NG_H4_HIWATER); - - NG_H4_UNLOCK(sc); - - return (error); -} /* ng_h4_open */ - -/* - * Line specific close routine, called from device close routine - * and from ttioctl. This causes the node to be destroyed as well. - */ - -static int -ng_h4_close(struct tty *tp, int flag) -{ - ng_h4_info_p sc = (ng_h4_info_p) tp->t_lsc; - - ttyflush(tp, FREAD | FWRITE); - clist_free_cblocks(&tp->t_outq); - - if (sc != NULL) { - NG_H4_LOCK(sc); - - if (callout_pending(&sc->timo)) - ng_uncallout(&sc->timo, sc->node); - - tp->t_lsc = NULL; - sc->dying = 1; - - NG_H4_UNLOCK(sc); - - ng_rmnode_self(sc->node); - } - - return (0); -} /* ng_h4_close */ - -/* - * Once the device has been turned into a node, we don't allow reading. - */ - -static int -ng_h4_read(struct tty *tp, struct uio *uio, int flag) -{ - return (EIO); -} /* ng_h4_read */ - -/* - * Once the device has been turned into a node, we don't allow writing. - */ - -static int -ng_h4_write(struct tty *tp, struct uio *uio, int flag) -{ - return (EIO); -} /* ng_h4_write */ - -/* - * We implement the NGIOCGINFO ioctl() defined in ng_message.h. - */ - -static int -ng_h4_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, - struct thread *td) -{ - ng_h4_info_p sc = (ng_h4_info_p) tp->t_lsc; - int error = 0; - - if (sc == NULL) - return (ENXIO); - - NG_H4_LOCK(sc); - - switch (cmd) { - case NGIOCGINFO: -#undef NI -#define NI(x) ((struct nodeinfo *)(x)) - - bzero(data, sizeof(*NI(data))); - - if (NG_NODE_HAS_NAME(sc->node)) - strncpy(NI(data)->name, NG_NODE_NAME(sc->node), - sizeof(NI(data)->name) - 1); - - strncpy(NI(data)->type, sc->node->nd_type->name, - sizeof(NI(data)->type) - 1); - - NI(data)->id = (u_int32_t) ng_node2ID(sc->node); - NI(data)->hooks = NG_NODE_NUMHOOKS(sc->node); - break; - - default: - error = ENOIOCTL; - break; - } - - NG_H4_UNLOCK(sc); - - return (error); -} /* ng_h4_ioctl */ - -/* - * Receive data coming from the device. We get one character at a time, which - * is kindof silly. - */ - -static int -ng_h4_input(int c, struct tty *tp) -{ - ng_h4_info_p sc = (ng_h4_info_p) tp->t_lsc; - - if (sc == NULL || tp != sc->tp || - sc->node == NULL || NG_NODE_NOT_VALID(sc->node)) - return (0); - - NG_H4_LOCK(sc); - - /* Check for error conditions */ - if ((tp->t_state & TS_CONNECTED) == 0) { - NG_H4_INFO("%s: %s - no carrier\n", __func__, - NG_NODE_NAME(sc->node)); - - sc->state = NG_H4_W4_PKT_IND; - sc->want = 1; - sc->got = 0; - - NG_H4_UNLOCK(sc); - - return (0); /* XXX Loss of synchronization here! */ - } - - /* Check for framing error or overrun on this char */ - if (c & TTY_ERRORMASK) { - NG_H4_ERR("%s: %s - line error %#x, c=%#x\n", __func__, - NG_NODE_NAME(sc->node), c & TTY_ERRORMASK, - c & TTY_CHARMASK); - - NG_H4_STAT_IERROR(sc->stat); - - sc->state = NG_H4_W4_PKT_IND; - sc->want = 1; - sc->got = 0; - - NG_H4_UNLOCK(sc); - - return (0); /* XXX Loss of synchronization here! */ - } - - NG_H4_STAT_BYTES_RECV(sc->stat, 1); - - /* Append char to mbuf */ - if (sc->got >= sizeof(sc->ibuf)) { - NG_H4_ALERT("%s: %s - input buffer overflow, c=%#x, got=%d\n", - __func__, NG_NODE_NAME(sc->node), c & TTY_CHARMASK, - sc->got); - - NG_H4_STAT_IERROR(sc->stat); - - sc->state = NG_H4_W4_PKT_IND; - sc->want = 1; - sc->got = 0; - - NG_H4_UNLOCK(sc); - - return (0); /* XXX Loss of synchronization here! */ - } - - sc->ibuf[sc->got ++] = (c & TTY_CHARMASK); - - NG_H4_INFO("%s: %s - got char %#x, want=%d, got=%d\n", __func__, - NG_NODE_NAME(sc->node), c, sc->want, sc->got); - - if (sc->got < sc->want) { - NG_H4_UNLOCK(sc); - - return (0); /* Wait for more */ - } - - switch (sc->state) { - /* Got packet indicator */ - case NG_H4_W4_PKT_IND: - NG_H4_INFO("%s: %s - got packet indicator %#x\n", __func__, - NG_NODE_NAME(sc->node), sc->ibuf[0]); - - sc->state = NG_H4_W4_PKT_HDR; - - /* - * Since packet indicator included in the packet header - * just set sc->want to sizeof(packet header). - */ - - switch (sc->ibuf[0]) { - case NG_HCI_ACL_DATA_PKT: - sc->want = sizeof(ng_hci_acldata_pkt_t); - break; - - case NG_HCI_SCO_DATA_PKT: - sc->want = sizeof(ng_hci_scodata_pkt_t); - break; - - case NG_HCI_EVENT_PKT: - sc->want = sizeof(ng_hci_event_pkt_t); - break; - - default: - NG_H4_WARN("%s: %s - ignoring unknown packet " \ - "type=%#x\n", __func__, NG_NODE_NAME(sc->node), - sc->ibuf[0]); - - NG_H4_STAT_IERROR(sc->stat); - - sc->state = NG_H4_W4_PKT_IND; - sc->want = 1; - sc->got = 0; - break; - } - break; - - /* Got packet header */ - case NG_H4_W4_PKT_HDR: - sc->state = NG_H4_W4_PKT_DATA; - - switch (sc->ibuf[0]) { - case NG_HCI_ACL_DATA_PKT: - c = le16toh(((ng_hci_acldata_pkt_t *) - (sc->ibuf))->length); - break; - - case NG_HCI_SCO_DATA_PKT: - c = ((ng_hci_scodata_pkt_t *)(sc->ibuf))->length; - break; - - case NG_HCI_EVENT_PKT: - c = ((ng_hci_event_pkt_t *)(sc->ibuf))->length; - break; - - default: - KASSERT((0), ("Invalid packet type=%#x\n", - sc->ibuf[0])); - break; - } - - NG_H4_INFO("%s: %s - got packet header, packet type=%#x, " \ - "packet size=%d, payload size=%d\n", __func__, - NG_NODE_NAME(sc->node), sc->ibuf[0], sc->got, c); - - if (c > 0) { - sc->want += c; - - /* - * Try to prevent possible buffer overrun - * - * XXX I'm *really* confused here. It turns out - * that Xircom card sends us packets with length - * greater then 512 bytes! This is greater then - * our old receive buffer (ibuf) size. In the same - * time the card demands from us *not* to send - * packets greater then 192 bytes. Weird! How the - * hell i should know how big *receive* buffer - * should be? For now increase receiving buffer - * size to 1K and add the following check. - */ - - if (sc->want >= sizeof(sc->ibuf)) { - int b; - - NG_H4_ALERT("%s: %s - packet too big for " \ - "buffer, type=%#x, got=%d, want=%d, " \ - "length=%d\n", __func__, - NG_NODE_NAME(sc->node), sc->ibuf[0], - sc->got, sc->want, c); - - NG_H4_ALERT("Packet header:\n"); - for (b = 0; b < sc->got; b++) - NG_H4_ALERT("%#x ", sc->ibuf[b]); - NG_H4_ALERT("\n"); - - /* Reset state */ - NG_H4_STAT_IERROR(sc->stat); - - sc->state = NG_H4_W4_PKT_IND; - sc->want = 1; - sc->got = 0; - } - - break; - } - - /* else FALLTHROUGH and deliver frame */ - /* XXX Is this true? Should we deliver empty frame? */ - - /* Got packet data */ - case NG_H4_W4_PKT_DATA: - NG_H4_INFO("%s: %s - got full packet, packet type=%#x, " \ - "packet size=%d\n", __func__, - NG_NODE_NAME(sc->node), sc->ibuf[0], sc->got); - - if (sc->hook != NULL && NG_HOOK_IS_VALID(sc->hook)) { - struct mbuf *m = NULL; - - MGETHDR(m, M_NOWAIT, MT_DATA); - if (m != NULL) { - m->m_pkthdr.len = 0; - - /* XXX m_copyback() is stupid */ - m->m_len = min(MHLEN, sc->got); - - m_copyback(m, 0, sc->got, sc->ibuf); - NG_SEND_DATA_ONLY(c, sc->hook, m); - } else { - NG_H4_ERR("%s: %s - could not get mbuf\n", - __func__, NG_NODE_NAME(sc->node)); - - NG_H4_STAT_IERROR(sc->stat); - } - } - - sc->state = NG_H4_W4_PKT_IND; - sc->want = 1; - sc->got = 0; - - NG_H4_STAT_PCKTS_RECV(sc->stat); - break; - - default: - KASSERT((0), ("Invalid H4 node state=%d", sc->state)); - break; - } - - NG_H4_UNLOCK(sc); - - return (0); -} /* ng_h4_input */ - -/* - * This is called when the device driver is ready for more output. Called from - * tty system. - */ - -static int -ng_h4_start(struct tty *tp) -{ - ng_h4_info_p sc = (ng_h4_info_p) tp->t_lsc; - struct mbuf *m = NULL; - int size; - - if (sc == NULL || tp != sc->tp || - sc->node == NULL || NG_NODE_NOT_VALID(sc->node)) - return (0); - -#if 0 - while (tp->t_outq.c_cc < NG_H4_HIWATER) { /* XXX 2.2 specific ? */ -#else - while (1) { -#endif - /* Remove first mbuf from queue */ - IF_DEQUEUE(&sc->outq, m); - if (m == NULL) - break; - - /* Send as much of it as possible */ - while (m != NULL) { - size = m->m_len - b_to_q(mtod(m, u_char *), - m->m_len, &tp->t_outq); - - NG_H4_LOCK(sc); - NG_H4_STAT_BYTES_SENT(sc->stat, size); - NG_H4_UNLOCK(sc); - - m->m_data += size; - m->m_len -= size; - if (m->m_len > 0) - break; /* device can't take no more */ - - m = m_free(m); - } - - /* Put remainder of mbuf chain (if any) back on queue */ - if (m != NULL) { - IF_PREPEND(&sc->outq, m); - break; - } - - /* Full packet has been sent */ - NG_H4_LOCK(sc); - NG_H4_STAT_PCKTS_SENT(sc->stat); - NG_H4_UNLOCK(sc); - } - - /* - * Call output process whether or not there is any output. We are - * being called in lieu of ttstart and must do what it would. - */ - - tt_oproc(sc->tp); - - /* - * This timeout is needed for operation on a pseudo-tty, because the - * pty code doesn't call pppstart after it has drained the t_outq. - */ - - NG_H4_LOCK(sc); - - if (!IFQ_IS_EMPTY(&sc->outq) && !callout_pending(&sc->timo)) - ng_callout(&sc->timo, sc->node, NULL, 1, - ng_h4_process_timeout, NULL, 0); - - NG_H4_UNLOCK(sc); - - return (0); -} /* ng_h4_start */ - -/***************************************************************************** - ***************************************************************************** - ** Netgraph node methods - ***************************************************************************** - *****************************************************************************/ - -/* - * Initialize a new node of this type. We only allow nodes to be created as - * a result of setting the line discipline on a tty, so always return an error - * if not. - */ - -static int -ng_h4_constructor(node_p node) -{ - return (EOPNOTSUPP); -} /* ng_h4_constructor */ - -/* - * Add a new hook. There can only be one. - */ - -static int -ng_h4_newhook(node_p node, hook_p hook, const char *name) -{ - ng_h4_info_p sc = (ng_h4_info_p) NG_NODE_PRIVATE(node); - - if (strcmp(name, NG_H4_HOOK) != 0) - return (EINVAL); - - NG_H4_LOCK(sc); - - if (sc->hook != NULL) { - NG_H4_UNLOCK(sc); - return (EISCONN); - } - sc->hook = hook; - - NG_H4_UNLOCK(sc); - - return (0); -} /* ng_h4_newhook */ - -/* - * Connect hook. Just say yes. - */ - -static int -ng_h4_connect(hook_p hook) -{ - ng_h4_info_p sc = (ng_h4_info_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - - if (hook != sc->hook) - panic("%s: hook != sc->hook\n", __func__); - - NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); - NG_HOOK_FORCE_QUEUE(hook); - - return (0); *** 681 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Sep 30 02:08:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59AD06A825D; Thu, 30 Sep 2021 02:08: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 4HKc9X1rXlz3pmT; Thu, 30 Sep 2021 02:08:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F2562324A; Thu, 30 Sep 2021 02:08: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 18U28mwn092477; Thu, 30 Sep 2021 02:08:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U28mVl092476; Thu, 30 Sep 2021 02:08:48 GMT (envelope-from git) Date: Thu, 30 Sep 2021 02:08:48 GMT Message-Id: <202109300208.18U28mVl092476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 8ea95b2fbab8 - main - loader.efi: remove extra extern ST 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/main X-Git-Reftype: branch X-Git-Commit: 8ea95b2fbab8eb891c4191c1879199685951b1f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 02:08:48 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea95b2fbab8eb891c4191c1879199685951b1f6 commit 8ea95b2fbab8eb891c4191c1879199685951b1f6 Author: Warner Losh AuthorDate: 2021-09-30 02:07:13 +0000 Commit: Warner Losh CommitDate: 2021-09-30 02:07:13 +0000 loader.efi: remove extra extern ST The definition for 'ST' is in efilib.h, so we don't need extern ST here. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D32225 --- stand/efi/loader/bootinfo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index f4501f18f14c..15b5d86f82b6 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -63,8 +63,6 @@ __FBSDID("$FreeBSD$"); int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs); -extern EFI_SYSTEM_TABLE *ST; - int boot_services_gone; static int From owner-dev-commits-src-all@freebsd.org Thu Sep 30 02:19:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D06826A827C; Thu, 30 Sep 2021 02:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKcQM5QLRz3r2h; Thu, 30 Sep 2021 02:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A904236C5; Thu, 30 Sep 2021 02:19: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 18U2Jt72006391; Thu, 30 Sep 2021 02:19:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U2Jtq3006390; Thu, 30 Sep 2021 02:19:55 GMT (envelope-from git) Date: Thu, 30 Sep 2021 02:19:55 GMT Message-Id: <202109300219.18U2Jtq3006390@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e2c1243f427b - main - fd: Move from using device_busy to a refcount 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/main X-Git-Reftype: branch X-Git-Commit: e2c1243f427b7dd387efd42669cc199cbb9b514c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 02:19:55 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e2c1243f427b7dd387efd42669cc199cbb9b514c commit e2c1243f427b7dd387efd42669cc199cbb9b514c Author: Warner Losh AuthorDate: 2021-09-30 02:18:28 +0000 Commit: Warner Losh CommitDate: 2021-09-30 02:18:28 +0000 fd: Move from using device_busy to a refcount Use refcounting to delay the detach rather than device_busy and/or device_unbusy. fd/fdc is one of the few consumers of device_busy in the tree for that, and it's not a good fit. Also, nothing is waking 'fd' and other drivers don't loop like this. Return EBUSY if we still have active users. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D31830 --- sys/dev/fdc/fdc.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 11262231c3b2..6f035e9689f1 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -261,6 +261,7 @@ struct fd_data { struct g_provider *fd_provider; device_t dev; struct bio_queue_head fd_bq; + bool gone; }; #define FD_NOT_VALID -2 @@ -1398,6 +1399,7 @@ fdautoselect(struct fd_data *fd) static g_access_t fd_access; static g_start_t fd_start; static g_ioctl_t fd_ioctl; +static g_provgone_t fd_providergone; struct g_class g_fd_class = { .name = "FD", @@ -1405,6 +1407,7 @@ struct g_class g_fd_class = { .start = fd_start, .access = fd_access, .ioctl = fd_ioctl, + .providergone = fd_providergone, }; static int @@ -1413,7 +1416,6 @@ fd_access(struct g_provider *pp, int r, int w, int e) struct fd_data *fd; struct fdc_data *fdc; int ar, aw, ae; - int busy; fd = pp->geom->softc; fdc = fd->fdc; @@ -1431,11 +1433,9 @@ fd_access(struct g_provider *pp, int r, int w, int e) if (ar == 0 && aw == 0 && ae == 0) { fd->options &= ~(FDOPT_NORETRY | FDOPT_NOERRLOG | FDOPT_NOERROR); - device_unbusy(fd->dev); return (0); } - busy = 0; if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) { if (fdmisccmd(fd, BIO_PROBE, NULL)) return (ENXIO); @@ -1453,13 +1453,9 @@ fd_access(struct g_provider *pp, int r, int w, int e) fd->flags &= ~FD_NEWDISK; mtx_unlock(&fdc->fdc_mtx); } - device_busy(fd->dev); - busy = 1; } if (w > 0 && (fd->flags & FD_WP)) { - if (busy) - device_unbusy(fd->dev); return (EROFS); } @@ -1588,8 +1584,6 @@ fd_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread return (error); }; - - /* * Configuration/initialization stuff, per controller. */ @@ -2055,6 +2049,16 @@ fd_attach(device_t dev) return (0); } +static void +fd_providergone(struct g_provider *pp) +{ + struct fd_data *fd; + + fd = pp->geom->softc; + fd->gone = true; + wakeup(fd); +} + static void fd_detach_geom(void *arg, int flag) { @@ -2070,9 +2074,17 @@ fd_detach(device_t dev) struct fd_data *fd; fd = device_get_softc(dev); + g_waitfor_event(fd_detach_geom, fd, M_WAITOK, NULL); - while (device_get_state(dev) == DS_BUSY) - tsleep(fd, PZERO, "fdd", hz/10); + while (!fd->gone) { + tsleep(fd, PZERO, "fdgone", hz/10); + } + + /* + * There may be accesses to the floppy while we're waitng, so drain the + * motor callback here. fdc_detach turns off motor if it's still on when + * we get to this point. + */ callout_drain(&fd->toffhandle); return (0); From owner-dev-commits-src-all@freebsd.org Thu Sep 30 03:14:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76DCA6A979D; Thu, 30 Sep 2021 03:14: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 4HKddN2jp7z3tk1; Thu, 30 Sep 2021 03:14:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D9BF24435; Thu, 30 Sep 2021 03:14:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18U3EWUJ086183; Thu, 30 Sep 2021 03:14:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U3EWY6086182; Thu, 30 Sep 2021 03:14:32 GMT (envelope-from git) Date: Thu, 30 Sep 2021 03:14:32 GMT Message-Id: <202109300314.18U3EWY6086182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: 4fa690be2cfc - main - bluetooth: Fix build after ng_h4 removal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4fa690be2cfcda81eb6d1f61025d0baff6fcc19f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 03:14:32 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=4fa690be2cfcda81eb6d1f61025d0baff6fcc19f commit 4fa690be2cfcda81eb6d1f61025d0baff6fcc19f Author: Jung-uk Kim AuthorDate: 2021-09-30 03:10:56 +0000 Commit: Jung-uk Kim CommitDate: 2021-09-30 03:10:56 +0000 bluetooth: Fix build after ng_h4 removal It was caused by 79a100e28e3c814773bb4c1826cfa25fbe31140e. --- usr.sbin/bluetooth/hcseriald/hcseriald.c | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bluetooth/hcseriald/hcseriald.c b/usr.sbin/bluetooth/hcseriald/hcseriald.c index 3d2fc60cf4de..e019d52618b8 100644 --- a/usr.sbin/bluetooth/hcseriald/hcseriald.c +++ b/usr.sbin/bluetooth/hcseriald/hcseriald.c @@ -36,7 +36,6 @@ #include #include -#include #include #include From owner-dev-commits-src-all@freebsd.org Thu Sep 30 03:23:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38E296A96C0; Thu, 30 Sep 2021 03:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKdqc0vcZz3vwk; Thu, 30 Sep 2021 03:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F128B246AD; Thu, 30 Sep 2021 03:23: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 18U3NNis099777; Thu, 30 Sep 2021 03:23:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U3NNsb099776; Thu, 30 Sep 2021 03:23:23 GMT (envelope-from git) Date: Thu, 30 Sep 2021 03:23:23 GMT Message-Id: <202109300323.18U3NNsb099776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 66d6299848c3 - main - bluetooth: remove hcseriald 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/main X-Git-Reftype: branch X-Git-Commit: 66d6299848c39c35327a7ea19d7cd6b03283784c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 03:23:24 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=66d6299848c39c35327a7ea19d7cd6b03283784c commit 66d6299848c39c35327a7ea19d7cd6b03283784c Author: Warner Losh AuthorDate: 2021-09-30 03:08:30 +0000 Commit: Warner Losh CommitDate: 2021-09-30 03:18:17 +0000 bluetooth: remove hcseriald Without ng_h4 gone, there's no need for hcseriald. Sponsored by: Netflix --- ObsoleteFiles.inc | 4 + libexec/rc/rc.d/bluetooth | 29 --- usr.sbin/bluetooth/Makefile | 1 - usr.sbin/bluetooth/hccontrol/hccontrol.8 | 3 +- usr.sbin/bluetooth/hcsecd/hcsecd.8 | 3 +- usr.sbin/bluetooth/hcseriald/Makefile | 11 -- usr.sbin/bluetooth/hcseriald/Makefile.depend | 18 -- usr.sbin/bluetooth/hcseriald/hcseriald.8 | 86 --------- usr.sbin/bluetooth/hcseriald/hcseriald.c | 269 --------------------------- 9 files changed, 6 insertions(+), 418 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 4a0d2fe1b7ea..ee77a56b7acc 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20210929: +OLD_FILES+=usr/sbin/hcseriald +OLD_FILES+=usr/share/man/man8/hcseriald.8.gz + # 20210929: Remove ng_h4 OLD_FILES+=usr/share/man/man4/ng_h4.4.gz diff --git a/libexec/rc/rc.d/bluetooth b/libexec/rc/rc.d/bluetooth index 318428ba2fee..b89a2c328048 100755 --- a/libexec/rc/rc.d/bluetooth +++ b/libexec/rc/rc.d/bluetooth @@ -235,26 +235,6 @@ bluetooth_start() # Try to figure out device type by looking at device name case "${dev}" in - # uartX - serial/UART Bluetooth device - uart*) - load_kld ng_h4 || return 1 - - hook="hook" - - # Obtain unit number from device. - unit=`expr ${dev} : 'uart\([0-9]\{1,\}\)'` - if [ -z "${unit}" ]; then - err 1 "Unable to get uart unit number: ${dev}" - fi - - ${hcseriald} -f /dev/cuau${unit} -n ${dev} - sleep 1 # wait a little bit - - if [ ! -f "/var/run/hcseriald.${dev}.pid" ]; then - err 1 "Unable to start hcseriald on ${dev}" - fi - ;; - # USB Bluetooth adapters ubt*) hook="hook" @@ -316,14 +296,6 @@ bluetooth_stop() # Try to figure out device type by looking at device name case "${dev}" in - # uartX - serial/UART Bluetooth device - uart*) - if [ -f "/var/run/hcseriald.${dev}.pid" ]; then - kill `cat /var/run/hcseriald.${dev}.pid` - sleep 1 # wait a little bit - fi - ;; - # 3Com Bluetooth Adapter 3CRWB60-A btccc*) ;; @@ -349,7 +321,6 @@ bluetooth_stop() load_rc_config $name hccontrol="${bluetooth_hccontrol:-/usr/sbin/hccontrol}" -hcseriald="${bluetooth_hcseriald:-/usr/sbin/hcseriald}" run_rc_command $* diff --git a/usr.sbin/bluetooth/Makefile b/usr.sbin/bluetooth/Makefile index 5868ffe90747..99f2a2eb9087 100644 --- a/usr.sbin/bluetooth/Makefile +++ b/usr.sbin/bluetooth/Makefile @@ -8,7 +8,6 @@ SUBDIR= \ btpand \ hccontrol \ hcsecd \ - hcseriald \ l2control \ l2ping \ rfcomm_pppd \ diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.8 b/usr.sbin/bluetooth/hccontrol/hccontrol.8 index e04b1f01b427..1d6e519f6acc 100644 --- a/usr.sbin/bluetooth/hccontrol/hccontrol.8 +++ b/usr.sbin/bluetooth/hccontrol/hccontrol.8 @@ -209,8 +209,7 @@ hccontrol -n ubt0hci le_set_advertising_enable enable .Xr bluetooth 3 , .Xr netgraph 3 , .Xr netgraph 4 , -.Xr ng_hci 4 , -.Xr hcseriald 8 +.Xr ng_hci 4 .Sh AUTHORS .An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS diff --git a/usr.sbin/bluetooth/hcsecd/hcsecd.8 b/usr.sbin/bluetooth/hcsecd/hcsecd.8 index a55e85e5ab8c..2550fa1a143e 100644 --- a/usr.sbin/bluetooth/hcsecd/hcsecd.8 +++ b/usr.sbin/bluetooth/hcsecd/hcsecd.8 @@ -117,8 +117,7 @@ Display usage message and exit. .Xr ng_btsocket 4 , .Xr ng_hci 4 , .Xr hcsecd.conf 5 , -.Xr hccontrol 8 , -.Xr hcseriald 8 +.Xr hccontrol 8 .Sh AUTHORS .An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS diff --git a/usr.sbin/bluetooth/hcseriald/Makefile b/usr.sbin/bluetooth/hcseriald/Makefile deleted file mode 100644 index 8a0d422ee74a..000000000000 --- a/usr.sbin/bluetooth/hcseriald/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $Id: Makefile,v 1.5 2003/08/14 20:06:21 max Exp $ -# $FreeBSD$ - -PACKAGE= bluetooth -PROG= hcseriald -MAN= hcseriald.8 -WARNS?= 2 - -LIBADD= netgraph - -.include diff --git a/usr.sbin/bluetooth/hcseriald/Makefile.depend b/usr.sbin/bluetooth/hcseriald/Makefile.depend deleted file mode 100644 index 3f4cb50e1709..000000000000 --- a/usr.sbin/bluetooth/hcseriald/Makefile.depend +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/libnetgraph \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.sbin/bluetooth/hcseriald/hcseriald.8 b/usr.sbin/bluetooth/hcseriald/hcseriald.8 deleted file mode 100644 index 15f08411f98d..000000000000 --- a/usr.sbin/bluetooth/hcseriald/hcseriald.8 +++ /dev/null @@ -1,86 +0,0 @@ -.\" Copyright (c) 2001-2002 Maksim Yevmenkin -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: hcseriald.8,v 1.3 2003/05/21 00:47:26 max Exp $ -.\" $FreeBSD$ -.\" -.Dd June 14, 2002 -.Dt HCSERIALD 8 -.Os -.Sh NAME -.Nm hcseriald -.Nd supervise serial Bluetooth devices -.Sh SYNOPSIS -.Nm -.Op Fl dh -.Fl f Ar device -.Fl n Ar node_name -.Op Fl s Ar speed -.Sh DESCRIPTION -The -.Nm -utility handles serial Bluetooth devices. -It does one simple thing: -it opens the specified serial device, sets the device parameters, and pushes -the -.Dv H4 -line discipline. -.Pp -The options are as follows: -.Bl -tag -width indent -.It Fl d -Do not disassociate from the controlling terminal, i.e., run in foreground. -.It Fl f Ar device -Callout device name. -Example: -.Fl f Pa /dev/cuau0 . -.It Fl h -Display usage message and exit. -.It Fl n Ar node_name -Set H4 Netgraph node name. -Example: -.Fl n Li sio0 . -.It Fl s Ar speed -Set serial device speed to -.Ar speed . -Example: -.Fl s Li 115200 . -.El -.Sh FILES -.Bl -tag -width ".Pa /var/run/hcserial. Ns Ar * Ns Pa .pid" -compact -.It Pa /var/run/hcserial . Ns Ar * Ns Pa .pid -Process ID of the currently running -.Nm -daemon. -Where -.Ar * -is an H4 Netgraph node name. -.El -.Sh SEE ALSO -.Xr ng_h4 4 , -.Xr ng_hci 4 , -.Xr tty 4 , -.Xr hccontrol 8 -.Sh AUTHORS -.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com diff --git a/usr.sbin/bluetooth/hcseriald/hcseriald.c b/usr.sbin/bluetooth/hcseriald/hcseriald.c deleted file mode 100644 index e019d52618b8..000000000000 --- a/usr.sbin/bluetooth/hcseriald/hcseriald.c +++ /dev/null @@ -1,269 +0,0 @@ -/*- - * hcseriald.c - * - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001-2002 Maksim Yevmenkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: hcseriald.c,v 1.3 2003/05/21 22:40:32 max Exp $ - * $FreeBSD$ - */ - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Prototypes */ -static int open_device (char const *, speed_t, char const *); -static void sighandler (int); -static void usage (); - -static char const * const hcseriald = "hcseriald"; -static int done = 0; - -int -main(int argc, char *argv[]) -{ - char *device = NULL, *name = NULL; - speed_t speed = 115200; - int n, detach = 1; - char p[FILENAME_MAX]; - FILE *f = NULL; - struct sigaction sa; - - /* Process command line arguments */ - while ((n = getopt(argc, argv, "df:n:s:h")) != -1) { - switch (n) { - case 'd': - detach = 0; - break; - - case 'f': - device = optarg; - break; - - case 'n': - name = optarg; - break; - - case 's': - speed = atoi(optarg); - if (speed < 0) - usage(argv[0]); - break; - - case 'h': - default: - usage(argv[0]); - break; - } - } - - if (device == NULL || name == NULL) - usage(argv[0]); - - openlog(hcseriald, LOG_PID | LOG_NDELAY, LOG_USER); - - /* Open device */ - n = open_device(device, speed, name); - - if (detach && daemon(0, 0) < 0) { - syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)", - strerror(errno), errno); - exit(1); - } - - /* Write PID file */ - snprintf(p, sizeof(p), "/var/run/%s.%s.pid", hcseriald, name); - f = fopen(p, "w"); - if (f == NULL) { - syslog(LOG_ERR, "Could not fopen(%s). %s (%d)", - p, strerror(errno), errno); - exit(1); - } - fprintf(f, "%d", getpid()); - fclose(f); - - /* Install signal handler */ - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = sighandler; - - if (sigaction(SIGTERM, &sa, NULL) < 0) { - syslog(LOG_ERR, "Could not sigaction(SIGTERM). %s (%d)", - strerror(errno), errno); - exit(1); - } - - if (sigaction(SIGHUP, &sa, NULL) < 0) { - syslog(LOG_ERR, "Could not sigaction(SIGHUP). %s (%d)", - strerror(errno), errno); - exit(1); - } - - if (sigaction(SIGINT, &sa, NULL) < 0) { - syslog(LOG_ERR, "Could not sigaction(SIGINT). %s (%d)", - strerror(errno), errno); - exit(1); - } - - /* Keep running */ - while (!done) - select(0, NULL, NULL, NULL, NULL); - - /* Remove PID file and close device */ - unlink(p); - close(n); - closelog(); - - return (0); -} /* main */ - -/* Open terminal, set settings, push H4 line discipline and set node name */ -static int -open_device(char const *device, speed_t speed, char const *name) -{ - int fd, disc, cs, ds; - struct termios t; - struct nodeinfo ni; - struct ngm_name n; - char p[NG_NODESIZ]; - - /* Open terminal device and setup H4 line discipline */ - fd = open(device, O_RDWR|O_NOCTTY); - if (fd < 0) { - syslog(LOG_ERR, "Could not open(%s). %s (%d)", - device, strerror(errno), errno); - exit(1); - } - - tcflush(fd, TCIOFLUSH); - - if (tcgetattr(fd, &t) < 0) { - syslog(LOG_ERR, "Could not tcgetattr(%s). %s (%d)", - device, strerror(errno), errno); - exit(1); - } - - cfmakeraw(&t); - - t.c_cflag |= CLOCAL; /* clocal */ - t.c_cflag &= ~CSIZE; /* cs8 */ - t.c_cflag |= CS8; /* cs8 */ - t.c_cflag &= ~PARENB; /* -parenb */ - t.c_cflag &= ~CSTOPB; /* -cstopb */ - t.c_cflag |= CRTSCTS; /* crtscts */ - - if (tcsetattr(fd, TCSANOW, &t) < 0) { - syslog(LOG_ERR, "Could not tcsetattr(%s). %s (%d)", - device, strerror(errno), errno); - exit(1); - } - - tcflush(fd, TCIOFLUSH); - - if (cfsetspeed(&t, speed) < 0) { - syslog(LOG_ERR, "Could not cfsetspeed(%s). %s (%d)", - device, strerror(errno), errno); - exit(1); - } - - if (tcsetattr(fd, TCSANOW, &t) < 0) { - syslog(LOG_ERR, "Could not tcsetattr(%s). %s (%d)", - device, strerror(errno), errno); - exit(1); - } - - disc = H4DISC; - if (ioctl(fd, TIOCSETD, &disc) < 0) { - syslog(LOG_ERR, "Could not ioctl(%s, TIOCSETD, %d). %s (%d)", - device, disc, strerror(errno), errno); - exit(1); - } - - /* Get default name of the Netgraph node */ - memset(&ni, 0, sizeof(ni)); - if (ioctl(fd, NGIOCGINFO, &ni) < 0) { - syslog(LOG_ERR, "Could not ioctl(%d, NGIOGINFO). %s (%d)", - fd, strerror(errno), errno); - exit(1); - } - - /* Assign new name to the Netgraph node */ - snprintf(p, sizeof(p), "%s:", ni.name); - snprintf(n.name, sizeof(n.name), "%s", name); - - if (NgMkSockNode(NULL, &cs, &ds) < 0) { - syslog(LOG_ERR, "Could not NgMkSockNode(). %s (%d)", - strerror(errno), errno); - exit(1); - } - - if (NgSendMsg(cs, p, NGM_GENERIC_COOKIE, NGM_NAME, &n, sizeof(n)) < 0) { - syslog(LOG_ERR, "Could not NgSendMsg(%d, %s, NGM_NAME, %s). " \ - "%s (%d)", cs, p, n.name, strerror(errno), errno); - exit(1); - } - - close(cs); - close(ds); - - return (fd); -} /* open_device */ - -/* Signal handler */ -static void -sighandler(int s) -{ - done = 1; -} /* sighandler */ - -/* Usage */ -static void -usage(void) -{ - fprintf(stderr, "Usage: %s -f device -n node_name [-s speed -d -h]\n" \ - "Where:\n" \ - "\t-f device tty device name, ex. /dev/cuau1\n" \ - "\t-n node_name set Netgraph node name to node_name\n" \ - "\t-s speed set tty speed, ex. 115200\n" \ - "\t-d run in foreground\n" \ - "\t-h display this message\n", - hcseriald); - exit(255); -} /* usage */ - From owner-dev-commits-src-all@freebsd.org Thu Sep 30 03:57:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C0616A9E96; Thu, 30 Sep 2021 03:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKfZz2vJsz4Sv0; Thu, 30 Sep 2021 03:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43B6924668; Thu, 30 Sep 2021 03:57: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 18U3vV63039865; Thu, 30 Sep 2021 03:57:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U3vV01039864; Thu, 30 Sep 2021 03:57:31 GMT (envelope-from git) Date: Thu, 30 Sep 2021 03:57:31 GMT Message-Id: <202109300357.18U3vV01039864@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 60921d4b2d68 - stable/13 - gmultipath failloop test: Add a checker for dtrace executes successfully or not MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 60921d4b2d6826229159117288256a906df0bffa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 03:57:31 -0000 The branch stable/13 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=60921d4b2d6826229159117288256a906df0bffa commit 60921d4b2d6826229159117288256a906df0bffa Author: Li-Wen Hsu AuthorDate: 2021-09-28 18:02:27 +0000 Commit: Li-Wen Hsu CommitDate: 2021-09-30 03:57:06 +0000 gmultipath failloop test: Add a checker for dtrace executes successfully or not To provide a more informative error message. Sponsored by: The FreeBSD Foundation (cherry picked from commit 819961c5808b053c626648e202dec42a19ebe7a6) (cherry picked from commit 38dac71d0a95ab2cf2cdfa1232cc556008b7ac94) (cherry picked from commit b9b5a4dd590e1b30d92dc73b3d1f22d3303e7e41) --- tests/sys/geom/class/multipath/failloop.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/sys/geom/class/multipath/failloop.sh b/tests/sys/geom/class/multipath/failloop.sh index f9a1417ae37f..0f0202bb8b01 100755 --- a/tests/sys/geom/class/multipath/failloop.sh +++ b/tests/sys/geom/class/multipath/failloop.sh @@ -56,6 +56,9 @@ failloop_body() -i 'geom:multipath:config:restore {@restore = count()}' \ -c "dd if=/dev/zero of=/dev/multipath/"$name" bs=4096 count=1" \ 2>&1 | awk '/exited with status/ {print $NF}'` + if [ ! -f restore_count ]; then + atf_fail "dtrace didn't execute successfully" + fi # The dd command should've failed ... atf_check_equal 1 $dd_status # and triggered 1 or 2 path restores From owner-dev-commits-src-all@freebsd.org Thu Sep 30 03:59:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FFCF6AA105; Thu, 30 Sep 2021 03:59: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 4HKfdF217Kz4Sxq; Thu, 30 Sep 2021 03:59:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25DF124EDC; Thu, 30 Sep 2021 03:59: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 18U3xTZl040109; Thu, 30 Sep 2021 03:59:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U3xTJR040108; Thu, 30 Sep 2021 03:59:29 GMT (envelope-from git) Date: Thu, 30 Sep 2021 03:59:29 GMT Message-Id: <202109300359.18U3xTJR040108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 3c25f7e860d8 - stable/12 - gmultipath failloop test: Add a checker for dtrace executes successfully or not MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3c25f7e860d8dc18aaa370352cb968df65c176f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 03:59:29 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=3c25f7e860d8dc18aaa370352cb968df65c176f5 commit 3c25f7e860d8dc18aaa370352cb968df65c176f5 Author: Li-Wen Hsu AuthorDate: 2021-09-28 18:02:27 +0000 Commit: Li-Wen Hsu CommitDate: 2021-09-30 03:58:46 +0000 gmultipath failloop test: Add a checker for dtrace executes successfully or not To provide a more informative error message. Sponsored by: The FreeBSD Foundation (cherry picked from commit 819961c5808b053c626648e202dec42a19ebe7a6) (cherry picked from commit 38dac71d0a95ab2cf2cdfa1232cc556008b7ac94) (cherry picked from commit b9b5a4dd590e1b30d92dc73b3d1f22d3303e7e41) --- tests/sys/geom/class/multipath/failloop.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/sys/geom/class/multipath/failloop.sh b/tests/sys/geom/class/multipath/failloop.sh index f9a1417ae37f..0f0202bb8b01 100755 --- a/tests/sys/geom/class/multipath/failloop.sh +++ b/tests/sys/geom/class/multipath/failloop.sh @@ -56,6 +56,9 @@ failloop_body() -i 'geom:multipath:config:restore {@restore = count()}' \ -c "dd if=/dev/zero of=/dev/multipath/"$name" bs=4096 count=1" \ 2>&1 | awk '/exited with status/ {print $NF}'` + if [ ! -f restore_count ]; then + atf_fail "dtrace didn't execute successfully" + fi # The dd command should've failed ... atf_check_equal 1 $dd_status # and triggered 1 or 2 path restores From owner-dev-commits-src-all@freebsd.org Thu Sep 30 04:03:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73E826A9D4E; Thu, 30 Sep 2021 04:03: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 4HKfkC2m1cz4TxX; Thu, 30 Sep 2021 04:03:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3ECAD24DD9; Thu, 30 Sep 2021 04:03: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 18U43l0N053711; Thu, 30 Sep 2021 04:03:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U43lQ9053710; Thu, 30 Sep 2021 04:03:47 GMT (envelope-from git) Date: Thu, 30 Sep 2021 04:03:47 GMT Message-Id: <202109300403.18U43lQ9053710@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 24ccef81405e - main - bluetooth: Remove stray btccc references 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/main X-Git-Reftype: branch X-Git-Commit: 24ccef81405eb25efc65f16b6e9a787f3a51151a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 04:03:47 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=24ccef81405eb25efc65f16b6e9a787f3a51151a commit 24ccef81405eb25efc65f16b6e9a787f3a51151a Author: Warner Losh AuthorDate: 2021-09-30 03:58:27 +0000 Commit: Warner Losh CommitDate: 2021-09-30 03:58:27 +0000 bluetooth: Remove stray btccc references The 3com bluetooth PC Card adapter was removed from the tree when PC Card support was removed earlier this year. Remove stray references to it still in the tree. Sponsored by: Netflix --- lib/libbluetooth/hci.c | 1 - libexec/rc/rc.d/bluetooth | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib/libbluetooth/hci.c b/lib/libbluetooth/hci.c index 3a524cebc3ae..95e96c479157 100644 --- a/lib/libbluetooth/hci.c +++ b/lib/libbluetooth/hci.c @@ -762,7 +762,6 @@ static char * bt_dev2node(char const *devname, char *nodename, int nnlen) { static char const * bt_dev_prefix[] = { - "btccc", /* 3Com Bluetooth PC-CARD */ "h4", /* UART/serial Bluetooth devices */ "ubt", /* Bluetooth USB devices */ NULL /* should be last */ diff --git a/libexec/rc/rc.d/bluetooth b/libexec/rc/rc.d/bluetooth index b89a2c328048..ca83792ab96c 100755 --- a/libexec/rc/rc.d/bluetooth +++ b/libexec/rc/rc.d/bluetooth @@ -296,10 +296,6 @@ bluetooth_stop() # Try to figure out device type by looking at device name case "${dev}" in - # 3Com Bluetooth Adapter 3CRWB60-A - btccc*) - ;; - # USB Bluetooth adapters ubt*) ;; From owner-dev-commits-src-all@freebsd.org Thu Sep 30 04:03:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B54756A9BDF; Thu, 30 Sep 2021 04: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 4HKfkD4DLwz4TkM; Thu, 30 Sep 2021 04:03:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 610E9249F7; Thu, 30 Sep 2021 04: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 18U43mbx053735; Thu, 30 Sep 2021 04: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 18U43mo8053734; Thu, 30 Sep 2021 04:03:48 GMT (envelope-from git) Date: Thu, 30 Sep 2021 04:03:48 GMT Message-Id: <202109300403.18U43mo8053734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 5547ed2cb2bd - main - bluetooth: Remove one more h4 reference. 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/main X-Git-Reftype: branch X-Git-Commit: 5547ed2cb2bdc0c8b35d50b59a10807d5e4ec4b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 04:03:48 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5547ed2cb2bdc0c8b35d50b59a10807d5e4ec4b9 commit 5547ed2cb2bdc0c8b35d50b59a10807d5e4ec4b9 Author: Warner Losh AuthorDate: 2021-09-30 04:02:25 +0000 Commit: Warner Losh CommitDate: 2021-09-30 04:02:25 +0000 bluetooth: Remove one more h4 reference. Sponsored by: Netflix --- lib/libbluetooth/hci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/libbluetooth/hci.c b/lib/libbluetooth/hci.c index 95e96c479157..b4ee0a9069e4 100644 --- a/lib/libbluetooth/hci.c +++ b/lib/libbluetooth/hci.c @@ -762,7 +762,6 @@ static char * bt_dev2node(char const *devname, char *nodename, int nnlen) { static char const * bt_dev_prefix[] = { - "h4", /* UART/serial Bluetooth devices */ "ubt", /* Bluetooth USB devices */ NULL /* should be last */ }; From owner-dev-commits-src-all@freebsd.org Thu Sep 30 04:10:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 703966A9EF6; Thu, 30 Sep 2021 04:10:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKftN2bqjz4VcL; Thu, 30 Sep 2021 04:10:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38F542509C; Thu, 30 Sep 2021 04:10:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18U4AqYM062534; Thu, 30 Sep 2021 04:10:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U4AqTi062533; Thu, 30 Sep 2021 04:10:52 GMT (envelope-from git) Date: Thu, 30 Sep 2021 04:10:52 GMT Message-Id: <202109300410.18U4AqTi062533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 58ca99d11648 - main - modules: acpi_video: need opt_evdev.h 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/main X-Git-Reftype: branch X-Git-Commit: 58ca99d11648f0b1749a4b29f534e87b0d88b83a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 04:10:52 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=58ca99d11648f0b1749a4b29f534e87b0d88b83a commit 58ca99d11648f0b1749a4b29f534e87b0d88b83a Author: Kyle Evans AuthorDate: 2021-09-30 04:04:00 +0000 Commit: Kyle Evans CommitDate: 2021-09-30 04:08:25 +0000 modules: acpi_video: need opt_evdev.h This fixes the standalone build. --- sys/modules/acpi/acpi_video/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/acpi/acpi_video/Makefile b/sys/modules/acpi/acpi_video/Makefile index 803598144a9a..d2556c8a56dc 100644 --- a/sys/modules/acpi/acpi_video/Makefile +++ b/sys/modules/acpi/acpi_video/Makefile @@ -4,6 +4,6 @@ KMOD= acpi_video SRCS= acpi_video.c -SRCS+= opt_acpi.h acpi_if.h bus_if.h device_if.h +SRCS+= opt_acpi.h opt_evdev.h acpi_if.h bus_if.h device_if.h .include From owner-dev-commits-src-all@freebsd.org Thu Sep 30 04:10:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE6C56AA2C0; Thu, 30 Sep 2021 04:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKftQ5cLWz4Vwv; Thu, 30 Sep 2021 04:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A16324F5F; Thu, 30 Sep 2021 04:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18U4Assd063307; Thu, 30 Sep 2021 04:10:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U4AsML063306; Thu, 30 Sep 2021 04:10:54 GMT (envelope-from git) Date: Thu, 30 Sep 2021 04:10:54 GMT Message-Id: <202109300410.18U4AsML063306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 1d8c9d3c0c55 - main - modules: p2sb: need opt_platform.h 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/main X-Git-Reftype: branch X-Git-Commit: 1d8c9d3c0c5574d4da868d37db4c32d833a7a59c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 04:10:55 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1d8c9d3c0c5574d4da868d37db4c32d833a7a59c commit 1d8c9d3c0c5574d4da868d37db4c32d833a7a59c Author: Kyle Evans AuthorDate: 2021-09-30 04:04:52 +0000 Commit: Kyle Evans CommitDate: 2021-09-30 04:09:45 +0000 modules: p2sb: need opt_platform.h This fixes the standalone build. --- sys/modules/p2sb/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/p2sb/Makefile b/sys/modules/p2sb/Makefile index 8f4d604f73d5..8dc643240d27 100644 --- a/sys/modules/p2sb/Makefile +++ b/sys/modules/p2sb/Makefile @@ -2,6 +2,6 @@ KMOD= p2sb SRCS= p2sb.c lewisburg_gpio.c lewisburg_gpiocm.c -SRCS+= device_if.h bus_if.h pci_if.h gpio_if.h +SRCS+= device_if.h bus_if.h pci_if.h gpio_if.h opt_platform.h .include From owner-dev-commits-src-all@freebsd.org Thu Sep 30 04:10:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FC0C6AA168; Thu, 30 Sep 2021 04:10: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 4HKftR6sf0z4Vk3; Thu, 30 Sep 2021 04:10:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4A8025123; Thu, 30 Sep 2021 04:10: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 18U4Atlr063331; Thu, 30 Sep 2021 04:10:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U4AtDR063330; Thu, 30 Sep 2021 04:10:55 GMT (envelope-from git) Date: Thu, 30 Sep 2021 04:10:55 GMT Message-Id: <202109300410.18U4AtDR063330@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: a335f76f2a40 - main - modules: a lot: need opt_kern_tls.h 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/main X-Git-Reftype: branch X-Git-Commit: a335f76f2a40a248df01e22422b84d707bfcc4a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 04:10:56 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=a335f76f2a40a248df01e22422b84d707bfcc4a9 commit a335f76f2a40a248df01e22422b84d707bfcc4a9 Author: Kyle Evans AuthorDate: 2021-09-30 04:07:17 +0000 Commit: Kyle Evans CommitDate: 2021-09-30 04:10:31 +0000 modules: a lot: need opt_kern_tls.h This fixes the standalone build. --- sys/modules/cc/cc_cdg/Makefile | 2 +- sys/modules/cc/cc_chd/Makefile | 2 +- sys/modules/cc/cc_dctcp/Makefile | 2 +- sys/modules/cc/cc_hd/Makefile | 2 +- sys/modules/cc/cc_htcp/Makefile | 2 +- sys/modules/cc/cc_vegas/Makefile | 2 +- sys/modules/cxgbe/cxgbei/Makefile | 1 + sys/modules/cxgbe/iw_cxgbe/Makefile | 2 +- sys/modules/ipfilter/Makefile | 2 +- sys/modules/ipfw/Makefile | 2 +- sys/modules/ipsec/Makefile | 2 +- sys/modules/khelp/h_ertt/Makefile | 2 +- sys/modules/nfscommon/Makefile | 1 + sys/modules/pf/Makefile | 3 ++- sys/modules/sctp/Makefile | 3 ++- sys/modules/siftr/Makefile | 2 +- sys/modules/tcp/tcpmd5/Makefile | 2 +- sys/modules/toecore/Makefile | 2 +- 18 files changed, 20 insertions(+), 16 deletions(-) diff --git a/sys/modules/cc/cc_cdg/Makefile b/sys/modules/cc/cc_cdg/Makefile index 83a4887af705..4e69e2d803a4 100644 --- a/sys/modules/cc/cc_cdg/Makefile +++ b/sys/modules/cc/cc_cdg/Makefile @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/netinet/cc KMOD= cc_cdg -SRCS= cc_cdg.c +SRCS= cc_cdg.c opt_kern_tls.h .include diff --git a/sys/modules/cc/cc_chd/Makefile b/sys/modules/cc/cc_chd/Makefile index db7e350d49fc..02242094860a 100644 --- a/sys/modules/cc/cc_chd/Makefile +++ b/sys/modules/cc/cc_chd/Makefile @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/netinet/cc KMOD= cc_chd -SRCS= cc_chd.c +SRCS= cc_chd.c opt_kern_tls.h .include diff --git a/sys/modules/cc/cc_dctcp/Makefile b/sys/modules/cc/cc_dctcp/Makefile index cb6cb06682ef..73712583ff8b 100644 --- a/sys/modules/cc/cc_dctcp/Makefile +++ b/sys/modules/cc/cc_dctcp/Makefile @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/netinet/cc KMOD= cc_dctcp -SRCS= cc_dctcp.c +SRCS= cc_dctcp.c opt_kern_tls.h .include diff --git a/sys/modules/cc/cc_hd/Makefile b/sys/modules/cc/cc_hd/Makefile index 49c0dfce84e0..9ff5ee3c4594 100644 --- a/sys/modules/cc/cc_hd/Makefile +++ b/sys/modules/cc/cc_hd/Makefile @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/netinet/cc KMOD= cc_hd -SRCS= cc_hd.c +SRCS= cc_hd.c opt_kern_tls.h .include diff --git a/sys/modules/cc/cc_htcp/Makefile b/sys/modules/cc/cc_htcp/Makefile index 99f3f8f8f99d..3256bc6d9445 100644 --- a/sys/modules/cc/cc_htcp/Makefile +++ b/sys/modules/cc/cc_htcp/Makefile @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/netinet/cc KMOD= cc_htcp -SRCS= cc_htcp.c +SRCS= cc_htcp.c opt_kern_tls.h .include diff --git a/sys/modules/cc/cc_vegas/Makefile b/sys/modules/cc/cc_vegas/Makefile index eda8ee62d88a..5e309c96ed5c 100644 --- a/sys/modules/cc/cc_vegas/Makefile +++ b/sys/modules/cc/cc_vegas/Makefile @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/netinet/cc KMOD= cc_vegas -SRCS= cc_vegas.c +SRCS= cc_vegas.c opt_kern_tls.h .include diff --git a/sys/modules/cxgbe/cxgbei/Makefile b/sys/modules/cxgbe/cxgbei/Makefile index ecd92218c8ef..7b575e320b20 100644 --- a/sys/modules/cxgbe/cxgbei/Makefile +++ b/sys/modules/cxgbe/cxgbei/Makefile @@ -11,6 +11,7 @@ SRCS+= bus_if.h SRCS+= device_if.h SRCS+= opt_inet.h SRCS+= opt_inet6.h +SRCS+= opt_kern_tls.h SRCS+= pci_if.h SRCS+= opt_cam.h SRCS+= icl_conn_if.h diff --git a/sys/modules/cxgbe/iw_cxgbe/Makefile b/sys/modules/cxgbe/iw_cxgbe/Makefile index 69ac1a4de752..72631f585bc4 100644 --- a/sys/modules/cxgbe/iw_cxgbe/Makefile +++ b/sys/modules/cxgbe/iw_cxgbe/Makefile @@ -14,7 +14,7 @@ SRCS+= provider.c SRCS+= qp.c SRCS+= resource.c SRCS+= ${LINUXKPI_GENSRCS} -SRCS+= opt_inet.h opt_inet6.h opt_ktr.h opt_ofed.h +SRCS+= opt_inet.h opt_inet6.h opt_kern_tls.h opt_ktr.h opt_ofed.h CFLAGS+= -I${CXGBE} -I${SRCTOP}/sys/ofed/include -DLINUX_TYPES_DEFINED CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi diff --git a/sys/modules/ipfilter/Makefile b/sys/modules/ipfilter/Makefile index e8c8893bdf59..3c2ba2c74c08 100644 --- a/sys/modules/ipfilter/Makefile +++ b/sys/modules/ipfilter/Makefile @@ -7,7 +7,7 @@ SRCS= mlfk_ipl.c ip_nat.c ip_frag.c ip_state.c ip_proxy.c ip_auth.c \ ip_log.c ip_fil_freebsd.c fil.c ip_lookup.c ip_pool.c ip_htable.c \ ip_sync.c \ ip_nat6.c ip_rules.c ip_scan.c ip_dstlist.c radix_ipf.c -SRCS+= opt_bpf.h opt_inet6.h +SRCS+= opt_bpf.h opt_inet6.h opt_kern_tls.h CFLAGS+= -I${SRCTOP}/sys/contrib/ipfilter CFLAGS+= -DIPFILTER=1 -DIPFILTER_LKM -DIPFILTER_LOG -DIPFILTER_LOOKUP diff --git a/sys/modules/ipfw/Makefile b/sys/modules/ipfw/Makefile index ae1b597d08ce..274b1b1e6cf5 100644 --- a/sys/modules/ipfw/Makefile +++ b/sys/modules/ipfw/Makefile @@ -7,7 +7,7 @@ SRCS= ip_fw2.c ip_fw_pfil.c ip_fw_bpf.c SRCS+= ip_fw_dynamic.c ip_fw_log.c ip_fw_eaction.c SRCS+= ip_fw_sockopt.c ip_fw_table.c ip_fw_table_algo.c ip_fw_iface.c SRCS+= ip_fw_table_value.c -SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h +SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h opt_kern_tls.h CFLAGS+= -DIPFIREWALL -I${SRCTOP}/sys/contrib/ck/include # diff --git a/sys/modules/ipsec/Makefile b/sys/modules/ipsec/Makefile index 46472f910d16..8bc9f47bd99a 100644 --- a/sys/modules/ipsec/Makefile +++ b/sys/modules/ipsec/Makefile @@ -5,7 +5,7 @@ KMOD= ipsec SRCS= if_ipsec.c ipsec.c ipsec_input.c ipsec_mbuf.c ipsec_mod.c \ ipsec_output.c xform_ah.c xform_esp.c xform_ipcomp.c \ - opt_inet.h opt_inet6.h opt_ipsec.h opt_sctp.h + opt_inet.h opt_inet6.h opt_ipsec.h opt_kern_tls.h opt_sctp.h SRCS.INET= udpencap.c .include diff --git a/sys/modules/khelp/h_ertt/Makefile b/sys/modules/khelp/h_ertt/Makefile index fa58264c3190..e63154ea248f 100644 --- a/sys/modules/khelp/h_ertt/Makefile +++ b/sys/modules/khelp/h_ertt/Makefile @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/netinet/khelp KMOD= h_ertt -SRCS= h_ertt.c +SRCS= h_ertt.c opt_kern_tls.h .include diff --git a/sys/modules/nfscommon/Makefile b/sys/modules/nfscommon/Makefile index 28d658db75fa..cc2d48c1b1bc 100644 --- a/sys/modules/nfscommon/Makefile +++ b/sys/modules/nfscommon/Makefile @@ -9,6 +9,7 @@ SRCS= vnode_if.h \ nfs_commonsubs.c \ opt_inet.h \ opt_inet6.h \ + opt_kern_tls.h \ opt_kgssapi.h \ opt_nfs.h \ opt_ufs.h diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile index d361ea0802fb..fbf5e0cbfa89 100644 --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -6,7 +6,8 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ pf_ruleset.c pf_nv.c pf_syncookies.c in4_cksum.c \ bus_if.h device_if.h \ - opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h + opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h \ + opt_kern_tls.h .if !defined(KERNBUILDDIR) # pflog can be loaded as a module, have the additional checks turned on diff --git a/sys/modules/sctp/Makefile b/sys/modules/sctp/Makefile index 1896c22dd833..925f6ef5fdfb 100644 --- a/sys/modules/sctp/Makefile +++ b/sys/modules/sctp/Makefile @@ -25,6 +25,7 @@ SRCS= sctp_asconf.c \ sctputil.c SRCS+= device_if.h bus_if.h vnode_if.h -SRCS+= opt_capsicum.h opt_ktrace.h opt_inet.h opt_inet6.h opt_sctp.h +SRCS+= opt_capsicum.h opt_ktrace.h opt_inet.h opt_inet6.h opt_kern_tls.h \ + opt_sctp.h .include diff --git a/sys/modules/siftr/Makefile b/sys/modules/siftr/Makefile index bb92bb2ac4c5..eac884ae6bab 100644 --- a/sys/modules/siftr/Makefile +++ b/sys/modules/siftr/Makefile @@ -2,7 +2,7 @@ .PATH: ${SRCTOP}/sys/netinet KMOD= siftr -SRCS= siftr.c +SRCS= siftr.c opt_kern_tls.h # Uncomment to add IPv6 support #CFLAGS+=-DSIFTR_IPV6 diff --git a/sys/modules/tcp/tcpmd5/Makefile b/sys/modules/tcp/tcpmd5/Makefile index e2d96195d806..0a10caea6845 100644 --- a/sys/modules/tcp/tcpmd5/Makefile +++ b/sys/modules/tcp/tcpmd5/Makefile @@ -3,6 +3,6 @@ .PATH: ${SRCTOP}/sys/netipsec KMOD= tcpmd5 -SRCS= xform_tcp.c opt_inet.h opt_inet6.h opt_ipsec.h +SRCS= xform_tcp.c opt_inet.h opt_inet6.h opt_ipsec.h opt_kern_tls.h .include diff --git a/sys/modules/toecore/Makefile b/sys/modules/toecore/Makefile index d3bf3b820da3..48a311c38ebf 100644 --- a/sys/modules/toecore/Makefile +++ b/sys/modules/toecore/Makefile @@ -4,6 +4,6 @@ KMOD= toecore SRCS= toecore.c -SRCS+= opt_ofed.h opt_inet.h opt_inet6.h +SRCS+= opt_ofed.h opt_inet.h opt_inet6.h opt_kern_tls.h .include From owner-dev-commits-src-all@freebsd.org Thu Sep 30 04:10:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99C506AA2BA; Thu, 30 Sep 2021 04:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKftP3n6Cz4Vwn; Thu, 30 Sep 2021 04:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DA6124DE5; Thu, 30 Sep 2021 04:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18U4ArJU063283; Thu, 30 Sep 2021 04:10:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U4ArWx063282; Thu, 30 Sep 2021 04:10:53 GMT (envelope-from git) Date: Thu, 30 Sep 2021 04:10:53 GMT Message-Id: <202109300410.18U4ArWx063282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6caae81d93e2 - main - modules: netflow: need opt_inet.h 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/main X-Git-Reftype: branch X-Git-Commit: 6caae81d93e2a14fa42cb831506c3a60c25d9791 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 04:10:53 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6caae81d93e2a14fa42cb831506c3a60c25d9791 commit 6caae81d93e2a14fa42cb831506c3a60c25d9791 Author: Kyle Evans AuthorDate: 2021-09-30 04:04:18 +0000 Commit: Kyle Evans CommitDate: 2021-09-30 04:09:43 +0000 modules: netflow: need opt_inet.h This fixes the standalone build. --- sys/modules/netgraph/netflow/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/netgraph/netflow/Makefile b/sys/modules/netgraph/netflow/Makefile index 365c99b3ddbe..35e8e6db7f36 100644 --- a/sys/modules/netgraph/netflow/Makefile +++ b/sys/modules/netgraph/netflow/Makefile @@ -6,6 +6,6 @@ .PATH: ${SRCTOP}/sys/netgraph/netflow KMOD= ng_netflow -SRCS= ng_netflow.c netflow.c netflow_v9.c opt_inet6.h opt_route.h +SRCS= ng_netflow.c netflow.c netflow_v9.c opt_inet.h opt_inet6.h opt_route.h .include From owner-dev-commits-src-all@freebsd.org Thu Sep 30 04:10:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BB456AA31C; Thu, 30 Sep 2021 04:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKftT0327z4Vx4; Thu, 30 Sep 2021 04:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D309D2509E; Thu, 30 Sep 2021 04:10: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 18U4AuA2063355; Thu, 30 Sep 2021 04:10:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U4AuxU063354; Thu, 30 Sep 2021 04:10:56 GMT (envelope-from git) Date: Thu, 30 Sep 2021 04:10:56 GMT Message-Id: <202109300410.18U4AuxU063354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 335c4f8edb3a - main - modules: iichid: needs opt_acpi.h 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/main X-Git-Reftype: branch X-Git-Commit: 335c4f8edb3a02ea101b0f833c22182594e63c9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 04:10:57 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=335c4f8edb3a02ea101b0f833c22182594e63c9e commit 335c4f8edb3a02ea101b0f833c22182594e63c9e Author: Kyle Evans AuthorDate: 2021-09-30 03:47:15 +0000 Commit: Kyle Evans CommitDate: 2021-09-30 04:10:35 +0000 modules: iichid: needs opt_acpi.h This fixes the standalone build. --- sys/modules/i2c/iichid/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/modules/i2c/iichid/Makefile b/sys/modules/i2c/iichid/Makefile index 36cdb3127088..a6affe1d76fc 100644 --- a/sys/modules/i2c/iichid/Makefile +++ b/sys/modules/i2c/iichid/Makefile @@ -3,6 +3,7 @@ .PATH: ${SRCTOP}/sys/dev/iicbus KMOD = iichid SRCS = iichid.c -SRCS += acpi_if.h bus_if.h device_if.h hid_if.h iicbus_if.h opt_hid.h +SRCS += acpi_if.h bus_if.h device_if.h hid_if.h iicbus_if.h +SRCS += opt_acpi.h opt_hid.h .include From owner-dev-commits-src-all@freebsd.org Thu Sep 30 05:52:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 555AF6AB55A; Thu, 30 Sep 2021 05:52:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKj8520yqz4f5G; Thu, 30 Sep 2021 05:52:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24952260F2; Thu, 30 Sep 2021 05:52:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18U5qr2E099456; Thu, 30 Sep 2021 05:52:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U5qrCj099455; Thu, 30 Sep 2021 05:52:53 GMT (envelope-from git) Date: Thu, 30 Sep 2021 05:52:53 GMT Message-Id: <202109300552.18U5qrCj099455@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: c926cf71d444 - stable/13 - Eliminate an unnecessary rerun request in fsck_ffs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c926cf71d4445575069214881bf13bdeb4a6a6d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 05:52:53 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=c926cf71d4445575069214881bf13bdeb4a6a6d1 commit c926cf71d4445575069214881bf13bdeb4a6a6d1 Author: Kirk McKusick AuthorDate: 2021-09-22 23:16:39 +0000 Commit: Kirk McKusick CommitDate: 2021-09-30 05:52:04 +0000 Eliminate an unnecessary rerun request in fsck_ffs. (cherry picked from commit b31c5a25321363ab95c1642dffc6e92319dc42ce) --- sbin/fsck_ffs/dir.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index e806f113ff16..42ecf4112253 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -132,7 +132,6 @@ dirscan(struct inodesc *idesc) (size_t)dsize); dirty(bp); sbdirty(); - rerun = 1; } if (n & STOP) return (n); From owner-dev-commits-src-all@freebsd.org Thu Sep 30 07:48:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACDE46AD176; Thu, 30 Sep 2021 07:48: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 4HKljB4GmNz4mjs; Thu, 30 Sep 2021 07:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 727EF118; Thu, 30 Sep 2021 07:48: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 18U7mEfV046434; Thu, 30 Sep 2021 07:48:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U7mEjY046433; Thu, 30 Sep 2021 07:48:14 GMT (envelope-from git) Date: Thu, 30 Sep 2021 07:48:14 GMT Message-Id: <202109300748.18U7mEjY046433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 3bf42363b02c - main - ocs_fc: Emulex Gen 7 HBA support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3bf42363b02c9bd728c92b9d9c4a5d022982a21a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 07:48:14 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=3bf42363b02c9bd728c92b9d9c4a5d022982a21a commit 3bf42363b02c9bd728c92b9d9c4a5d022982a21a Author: Ram Kishore Vegesna AuthorDate: 2021-09-23 06:51:26 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-09-30 07:31:15 +0000 ocs_fc: Emulex Gen 7 HBA support. Emulex Gen7 adapter support in ocs_fc driver. Reviewed by: mav, ken --- sys/dev/ocs_fc/ocs_hw.c | 10 ++- sys/dev/ocs_fc/ocs_os.h | 10 ++- sys/dev/ocs_fc/ocs_pci.c | 63 +++++++++++++-- sys/dev/ocs_fc/sli4.c | 200 +++++++++++++++++++++++++++++++++++++---------- sys/dev/ocs_fc/sli4.h | 80 ++++++++++++++++--- 5 files changed, 296 insertions(+), 67 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_hw.c b/sys/dev/ocs_fc/ocs_hw.c index aa7d5857d9d9..c14b7a97fd97 100644 --- a/sys/dev/ocs_fc/ocs_hw.c +++ b/sys/dev/ocs_fc/ocs_hw.c @@ -272,7 +272,8 @@ ocs_hw_read_max_dump_size(ocs_hw_t *hw) int rc; /* lancer only */ - if (SLI4_IF_TYPE_LANCER_FC_ETH != sli_get_if_type(&hw->sli)) { + if ((SLI4_IF_TYPE_LANCER_FC_ETH != sli_get_if_type(&hw->sli)) && + (SLI4_IF_TYPE_LANCER_G7 != sli_get_if_type(&hw->sli))) { ocs_log_debug(hw->os, "Function only supported for I/F type 2\n"); return OCS_HW_RTN_ERROR; } @@ -414,7 +415,9 @@ ocs_hw_setup(ocs_hw_t *hw, ocs_os_handle_t os, sli4_port_type_e port_type) } /* Must be done after the workaround setup */ - if (SLI4_IF_TYPE_LANCER_FC_ETH == sli_get_if_type(&hw->sli)) { + if ((SLI4_IF_TYPE_LANCER_FC_ETH == sli_get_if_type(&hw->sli)) || + (SLI4_IF_TYPE_LANCER_G7 == sli_get_if_type(&hw->sli))) { + (void)ocs_hw_read_max_dump_size(hw); } @@ -6001,7 +6004,8 @@ ocs_hw_get_linkcfg(ocs_hw_t *hw, uint32_t opts, ocs_hw_port_control_cb_t cb, voi return OCS_HW_RTN_ERROR; } - if (SLI4_IF_TYPE_LANCER_FC_ETH == sli_get_if_type(&hw->sli)) { + if ((SLI4_IF_TYPE_LANCER_FC_ETH == sli_get_if_type(&hw->sli)) || + (SLI4_IF_TYPE_LANCER_G7 == sli_get_if_type(&hw->sli))){ return ocs_hw_get_linkcfg_lancer(hw, opts, cb, arg); } else if ((SLI4_IF_TYPE_BE3_SKH_PF == sli_get_if_type(&hw->sli)) || (SLI4_IF_TYPE_BE3_SKH_VF == sli_get_if_type(&hw->sli))) { diff --git a/sys/dev/ocs_fc/ocs_os.h b/sys/dev/ocs_fc/ocs_os.h index 5e36cca3b829..ae10b00cb465 100644 --- a/sys/dev/ocs_fc/ocs_os.h +++ b/sys/dev/ocs_fc/ocs_os.h @@ -1031,14 +1031,16 @@ typedef struct ocs_pci_reg_s { #define PCI_MAX_BAR 6 #define PCI_64BIT_BAR0 0 -#define PCI_VENDOR_EMULEX 0x10df /* Emulex */ +#define PCI_VENDOR_EMULEX 0x10df /* Emulex */ -#define PCI_PRODUCT_EMULEX_OCE16001 0xe200 /* OneCore 16Gb FC (lancer) */ -#define PCI_PRODUCT_EMULEX_OCE16002 0xe200 /* OneCore 16Gb FC (lancer) */ +#define PCI_PRODUCT_EMULEX_OCE16001 0xe200 /* OneCore 16Gb FC (lancer) */ +#define PCI_PRODUCT_EMULEX_OCE16002 0xe200 /* OneCore 16Gb FC (lancer) */ #define PCI_PRODUCT_EMULEX_LPE31004 0xe300 /* LightPulse 16Gb x 4 FC (lancer-g6) */ #define PCI_PRODUCT_EMULEX_LPE32002 0xe300 /* LightPulse 32Gb x 2 FC (lancer-g6) */ +#define PCI_PRODUCT_EMULEX_LANCER_G7 0xf400 /* LightPulse 32Gb x 4 FC (lancer-g7) */ + #define PCI_PRODUCT_EMULEX_OCE1600_VF 0xe208 -#define PCI_PRODUCT_EMULEX_OCE50102 0xe260 /* OneCore FCoE (lancer) */ +#define PCI_PRODUCT_EMULEX_OCE50102 0xe260 /* OneCore FCoE (lancer) */ #define PCI_PRODUCT_EMULEX_OCE50102_VF 0xe268 /** diff --git a/sys/dev/ocs_fc/ocs_pci.c b/sys/dev/ocs_fc/ocs_pci.c index f7e67b9bd047..8714c242a212 100644 --- a/sys/dev/ocs_fc/ocs_pci.c +++ b/sys/dev/ocs_fc/ocs_pci.c @@ -102,6 +102,9 @@ ocs_pci_probe(device_t dev) case PCI_PRODUCT_EMULEX_OCE50102: desc = "Emulex LightPulse 10GbE FCoE/NIC Adapter"; break; + case PCI_PRODUCT_EMULEX_LANCER_G7: + desc = "Emulex LightPulse G7 FC Adapter"; + break; default: return ENXIO; } @@ -112,9 +115,50 @@ ocs_pci_probe(device_t dev) } static int -ocs_map_bars(device_t dev, struct ocs_softc *ocs) +ocs_map_g7_bars(device_t dev, struct ocs_softc *ocs) { + int i, r; + uint32_t val = 0; + + for (i = 0, r = 0; i < PCI_MAX_BAR; i++) { + val = pci_read_config(dev, PCIR_BAR(i), 4); + if (!PCI_BAR_MEM(val)) { + continue; + } + if (!(val & PCIM_BAR_MEM_BASE)) { + /* no address */ + continue; + } + ocs->reg[r].rid = PCIR_BAR(i); + ocs->reg[r].res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &ocs->reg[r].rid, RF_ACTIVE); + if (ocs->reg[r].res) { + ocs->reg[r].btag = rman_get_bustag(ocs->reg[r].res); + ocs->reg[r].bhandle = rman_get_bushandle(ocs->reg[r].res); + r++; + } else { + device_printf(dev, "bus_alloc_resource failed rid=%#x\n", + ocs->reg[r].rid); + ocs_release_bus(ocs); + return ENXIO; + } + + /* + * If the 64-bit attribute is set, both this BAR and the + * next form the complete address. Skip processing the + * next BAR. + */ + if (val & PCIM_BAR_MEM_64) { + i++; + } + } + return 0; +} + +static int +ocs_map_bars(device_t dev, struct ocs_softc *ocs) +{ /* * Map PCI BAR0 register into the CPU's space. */ @@ -401,7 +445,7 @@ ocs_device_attach(ocs_t *ocs) goto fail_intr_setup; } - if(ocs_cam_attach(ocs)) { + if (ocs_cam_attach(ocs)) { device_printf(ocs->dev, "cam attach failed \n"); goto fail_intr_setup; } @@ -489,10 +533,17 @@ ocs_pci_attach(device_t dev) pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev)); /* Map all memory BARs */ - if (ocs_map_bars(dev, ocs)) { - device_printf(dev, "Failed to map pci bars\n"); - goto release_bus; - } + if (ocs->pci_device == PCI_PRODUCT_EMULEX_LANCER_G7) { + if(ocs_map_g7_bars(dev,ocs)) { + device_printf(dev, "Failed to map pci bars\n"); + goto release_bus; + } + } else { + if (ocs_map_bars(dev, ocs)) { + device_printf(dev, "Failed to map pci bars\n"); + goto release_bus; + } + } /* create a root DMA tag for the device */ if (bus_dma_tag_create(bus_get_dma_tag(dev), diff --git a/sys/dev/ocs_fc/sli4.c b/sys/dev/ocs_fc/sli4.c index f7cea514255d..b40c4cfa2946 100644 --- a/sys/dev/ocs_fc/sli4.c +++ b/sys/dev/ocs_fc/sli4.c @@ -91,7 +91,8 @@ sli4_asic_entry_t sli4_asic_table[] = { { 0x0, 0x0c, SLI4_ASIC_TYPE_LANCERG6,SLI4_ASIC_REV_A0}, { 0x1, 0x0c, SLI4_ASIC_TYPE_LANCERG6,SLI4_ASIC_REV_A1}, { 0x3, 0x0c, SLI4_ASIC_TYPE_LANCERG6,SLI4_ASIC_REV_A3}, - + { 0x1, 0x0d, SLI4_ASIC_TYPE_LANCERG7,SLI4_ASIC_REV_A1}, + { 0x10, 0x0d, SLI4_ASIC_TYPE_LANCERG7,SLI4_ASIC_REV_B0}, { 0x00, 0x05, SLI4_ASIC_TYPE_CORSAIR, SLI4_ASIC_REV_A0}, }; @@ -124,74 +125,126 @@ const sli4_reg_t regmap[SLI4_REG_MAX][SLI4_MAX_IF_TYPES] = { /* SLI4_REG_BMBX */ { { 2, SLI4_BMBX_REG }, { 0, SLI4_BMBX_REG }, { 0, SLI4_BMBX_REG }, { 0, SLI4_BMBX_REG }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX } , { 0, SLI4_BMBX_REG }, }, /* SLI4_REG_EQCQ_DOORBELL */ { { 2, SLI4_EQCQ_DOORBELL_REG }, { 0, SLI4_EQCQ_DOORBELL_REG }, { 0, SLI4_EQCQ_DOORBELL_REG }, { 0, SLI4_EQCQ_DOORBELL_REG }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 1, SLI4_IF6_EQ_DOORBELL_REG } + }, + // SLI4_REG_CQ_DOORBELL + { + { 2, SLI4_EQCQ_DOORBELL_REG }, { 0, SLI4_EQCQ_DOORBELL_REG }, + { 0, SLI4_EQCQ_DOORBELL_REG }, { 0, SLI4_EQCQ_DOORBELL_REG }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 1, SLI4_IF6_CQ_DOORBELL_REG } }, /* SLI4_REG_FCOE_RQ_DOORBELL */ { { 2, SLI4_RQ_DOORBELL_REG }, { 0, SLI4_RQ_DOORBELL_REG }, { 0, SLI4_RQ_DOORBELL_REG }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 1, SLI4_IF6_RQ_DOORBELL_REG } }, /* SLI4_REG_IO_WQ_DOORBELL */ { - { 2, SLI4_IO_WQ_DOORBELL_REG }, { 0, SLI4_IO_WQ_DOORBELL_REG }, { 0, SLI4_IO_WQ_DOORBELL_REG }, { UINT32_MAX, UINT32_MAX }, - }, + { 2, SLI4_IO_WQ_DOORBELL_REG }, { 0, SLI4_IO_WQ_DOORBELL_REG }, + { 0, SLI4_IO_WQ_DOORBELL_REG }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 1, SLI4_IF6_WQ_DOORBELL_REG } + }, /* SLI4_REG_MQ_DOORBELL */ { { 2, SLI4_MQ_DOORBELL_REG }, { 0, SLI4_MQ_DOORBELL_REG }, { 0, SLI4_MQ_DOORBELL_REG }, { 0, SLI4_MQ_DOORBELL_REG }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 1, SLI4_IF6_MQ_DOORBELL_REG } }, /* SLI4_REG_PHYSDEV_CONTROL */ { - { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { 0, SLI4_PHSDEV_CONTROL_REG_23 }, { 0, SLI4_PHSDEV_CONTROL_REG_23 }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_PHSDEV_CONTROL_REG_236 }, { 0, SLI4_PHSDEV_CONTROL_REG_236 }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_PHSDEV_CONTROL_REG_236 } }, /* SLI4_REG_SLIPORT_CONTROL */ { - { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { 0, SLI4_SLIPORT_CONTROL_REG }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_SLIPORT_CONTROL_REG }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_SLIPORT_CONTROL_REG }, }, /* SLI4_REG_SLIPORT_ERROR1 */ { - { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { 0, SLI4_SLIPORT_ERROR1 }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_SLIPORT_ERROR1 }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_SLIPORT_ERROR1 }, }, /* SLI4_REG_SLIPORT_ERROR2 */ { - { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { 0, SLI4_SLIPORT_ERROR2 }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_SLIPORT_ERROR2 }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_SLIPORT_ERROR2 }, }, /* SLI4_REG_SLIPORT_SEMAPHORE */ { { 1, SLI4_PORT_SEMAPHORE_REG_0 }, { 0, SLI4_PORT_SEMAPHORE_REG_1 }, - { 0, SLI4_PORT_SEMAPHORE_REG_23 }, { 0, SLI4_PORT_SEMAPHORE_REG_23 }, + { 0, SLI4_PORT_SEMAPHORE_REG_236 }, { 0, SLI4_PORT_SEMAPHORE_REG_236 }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_PORT_SEMAPHORE_REG_236 }, }, /* SLI4_REG_SLIPORT_STATUS */ { - { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { 0, SLI4_PORT_STATUS_REG_23 }, { 0, SLI4_PORT_STATUS_REG_23 }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_PORT_STATUS_REG_236 }, { 0, SLI4_PORT_STATUS_REG_236 }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_PORT_STATUS_REG_236 }, }, /* SLI4_REG_UERR_MASK_HI */ { - { 0, SLI4_UERR_MASK_HIGH_REG }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_UERR_MASK_HIGH_REG }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX } }, /* SLI4_REG_UERR_MASK_LO */ { - { 0, SLI4_UERR_MASK_LOW_REG }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_UERR_MASK_LOW_REG }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX } }, /* SLI4_REG_UERR_STATUS_HI */ { - { 0, SLI4_UERR_STATUS_HIGH_REG }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_UERR_STATUS_HIGH_REG }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX } }, /* SLI4_REG_UERR_STATUS_LO */ { - { 0, SLI4_UERR_STATUS_LOW_REG }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 0, SLI4_UERR_STATUS_LOW_REG }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX } }, /* SLI4_REG_SW_UE_CSR1 */ { - { 1, SLI4_SW_UE_CSR1}, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 1, SLI4_SW_UE_CSR1}, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX } }, /* SLI4_REG_SW_UE_CSR2 */ { - { 1, SLI4_SW_UE_CSR2}, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { 1, SLI4_SW_UE_CSR2}, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX }, { UINT32_MAX, UINT32_MAX }, + { UINT32_MAX, UINT32_MAX } }, }; @@ -1739,6 +1792,7 @@ sli_cmd_common_create_cq(sli4_t *sli4, void *buf, size_t size, cmd_size = sizeof(sli4_req_common_create_cq_v0_t) + (8 * num_pages); break; case SLI4_IF_TYPE_LANCER_FC_ETH: + case SLI4_IF_TYPE_LANCER_G7: n_cqe = qmem->size / SLI4_CQE_BYTES; switch (n_cqe) { case 256: @@ -1814,6 +1868,7 @@ sli_cmd_common_create_cq(sli4_t *sli4, void *buf, size_t size, break; case SLI4_IF_TYPE_LANCER_FC_ETH: + case SLI4_IF_TYPE_LANCER_G7: { cqv2 = (sli4_req_common_create_cq_v2_t *)((uint8_t *)buf + sli_config_off); cqv2->hdr.opcode = SLI4_OPC_COMMON_CREATE_CQ; @@ -1821,6 +1876,9 @@ sli_cmd_common_create_cq(sli4_t *sli4, void *buf, size_t size, cqv2->hdr.version = 2; cqv2->hdr.request_length = cmd_size - sizeof(sli4_req_hdr_t); + if (if_type == SLI4_IF_TYPE_LANCER_G7) + cqv2->autovalid = TRUE; + cqv2->page_size = page_size; /* valid values for number of pages: 1, 2, 4, 8 (sec 4.4.3) */ @@ -1993,6 +2051,10 @@ sli_cmd_common_create_eq(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *qmem, eq->hdr.subsystem = SLI4_SUBSYSTEM_COMMON; eq->hdr.request_length = sizeof(sli4_req_common_create_eq_t) - sizeof(sli4_req_hdr_t); + if (sli4->if_type == SLI4_IF_TYPE_LANCER_G7) { + eq->hdr.version = 2; + eq->autovalid = TRUE; + } /* valid values for number of pages: 1, 2, 4 (sec 4.4.3) */ eq->num_pages = qmem->size / SLI_PAGE_SIZE; switch (eq->num_pages) { @@ -2445,6 +2507,7 @@ sli_cmd_common_get_port_name(sli4_t *sli4, void *buf, size_t size) break; case SLI4_IF_TYPE_LANCER_FC_ETH: case SLI4_IF_TYPE_LANCER_RDMA: + case SLI4_IF_TYPE_LANCER_G7: version = 1; break; default: @@ -3309,6 +3372,7 @@ sli_fw_init(sli4_t *sli4) } break; case SLI4_IF_TYPE_LANCER_FC_ETH: + case SLI4_IF_TYPE_LANCER_G7: #if BYTE_ORDER == LITTLE_ENDIAN endian = SLI4_SLIPORT_CONTROL_LITTLE_ENDIAN; #else @@ -3387,11 +3451,17 @@ sli_queue_doorbell(sli4_t *sli4, sli4_queue_t *q) switch (q->type) { case SLI_QTYPE_EQ: - val = sli_eq_doorbell(q->n_posted, q->id, FALSE); + if (sli4->if_type == SLI4_IF_TYPE_LANCER_G7) + val = sli_iftype6_eq_doorbell(q->n_posted, q->id, FALSE); + else + val = sli_eq_doorbell(q->n_posted, q->id, FALSE); ocs_reg_write32(sli4->os, q->doorbell_rset, q->doorbell_offset, val); break; case SLI_QTYPE_CQ: - val = sli_cq_doorbell(q->n_posted, q->id, FALSE); + if (sli4->if_type == SLI4_IF_TYPE_LANCER_G7) + val = sli_iftype6_cq_doorbell(q->n_posted, q->id, FALSE); + else + val = sli_cq_doorbell(q->n_posted, q->id, FALSE); ocs_reg_write32(sli4->os, q->doorbell_rset, q->doorbell_offset, val); break; case SLI_QTYPE_MQ: @@ -3435,7 +3505,13 @@ sli_queue_doorbell(sli4_t *sli4, sli4_queue_t *q) break; } case SLI_QTYPE_WQ: - val = SLI4_WQ_DOORBELL(q->n_posted, q->index, q->id); + if (sli4->if_type == SLI4_IF_TYPE_LANCER_G7) { + val = SLI4_WQ_DOORBELL(q->n_posted, 0, q->id); + } else { + /* For iftype = 2 and 3, q->index value is ignored */ + val = SLI4_WQ_DOORBELL(q->n_posted, q->index, q->id); + } + ocs_reg_write32(sli4->os, q->doorbell_rset, q->doorbell_offset, val); break; default: @@ -3627,7 +3703,7 @@ sli_get_config(sli4_t *sli4) sli4->config.extent[SLI_RSRC_FCOE_RPI].size = read_config->rpi_count; sli4->config.extent[SLI_RSRC_FCOE_XRI].base[0] = read_config->xri_base; - sli4->config.extent[SLI_RSRC_FCOE_XRI].size = read_config->xri_count; + sli4->config.extent[SLI_RSRC_FCOE_XRI].size = OCS_MIN(255,read_config->xri_count); sli4->config.extent[SLI_RSRC_FCOE_FCFI].base[0] = 0; sli4->config.extent[SLI_RSRC_FCOE_FCFI].size = read_config->fcfi_count; @@ -3988,7 +4064,8 @@ sli_setup(sli4_t *sli4, ocs_os_handle_t os, sli4_port_type_e port_type) sli4->if_type = sli_intf_if_type(sli_intf); - if (SLI4_IF_TYPE_LANCER_FC_ETH == sli4->if_type) { + if ((SLI4_IF_TYPE_LANCER_FC_ETH == sli4->if_type) || + (SLI4_IF_TYPE_LANCER_G7 == sli4->if_type)) { ocs_log_debug(os, "status=%#x error1=%#x error2=%#x\n", sli_reg_read(sli4, SLI4_REG_SLIPORT_STATUS), sli_reg_read(sli4, SLI4_REG_SLIPORT_ERROR1), @@ -4320,6 +4397,11 @@ __sli_queue_init(sli4_t *sli4, sli4_queue_t *q, uint32_t qtype, /* Limit to hwf the queue size per interrupt */ q->proc_limit = n_entries / 2; + if ( (q->type == SLI_QTYPE_EQ) || (q->type == SLI_QTYPE_CQ) ) { + /* For prism, phase will be flipped after a sweep through eq and cq */ + q->phase = 1; + } + switch(q->type) { case SLI_QTYPE_EQ: q->posted_limit = q->length / 2; @@ -4381,13 +4463,13 @@ __sli_create_queue(sli4_t *sli4, sli4_queue_t *q) switch (q->type) { case SLI_QTYPE_EQ: /* No doorbell information in response for EQs */ - q->doorbell_offset = regmap[SLI4_REG_EQCQ_DOORBELL][sli4->if_type].off; - q->doorbell_rset = regmap[SLI4_REG_EQCQ_DOORBELL][sli4->if_type].rset; + q->doorbell_offset = regmap[SLI4_REG_EQ_DOORBELL][sli4->if_type].off; + q->doorbell_rset = regmap[SLI4_REG_EQ_DOORBELL][sli4->if_type].rset; break; case SLI_QTYPE_CQ: /* No doorbell information in response for CQs */ - q->doorbell_offset = regmap[SLI4_REG_EQCQ_DOORBELL][sli4->if_type].off; - q->doorbell_rset = regmap[SLI4_REG_EQCQ_DOORBELL][sli4->if_type].rset; + q->doorbell_offset = regmap[SLI4_REG_CQ_DOORBELL][sli4->if_type].off; + q->doorbell_rset = regmap[SLI4_REG_CQ_DOORBELL][sli4->if_type].rset; break; case SLI_QTYPE_MQ: /* No doorbell information in response for MQs */ @@ -4694,6 +4776,9 @@ sli_cq_alloc_set(sli4_t *sli4, sli4_queue_t *qs[], uint32_t num_cqs, req->arm = FALSE; req->num_cq_req = num_cqs; + if (sli4->if_type == SLI4_IF_TYPE_LANCER_G7) + req->autovalid = TRUE; + /* Fill page addresses of all the CQs. */ for (i = 0; i < num_cqs; i++) { req->eq_id[i] = eqs[i]->id; @@ -4724,8 +4809,8 @@ sli_cq_alloc_set(sli4_t *sli4, sli4_queue_t *qs[], uint32_t num_cqs, /* Fill the resp cq ids. */ for (i = 0; i < num_cqs; i++) { qs[i]->id = res->q_id + i; - qs[i]->doorbell_offset = regmap[SLI4_REG_EQCQ_DOORBELL][sli4->if_type].off; - qs[i]->doorbell_rset = regmap[SLI4_REG_EQCQ_DOORBELL][sli4->if_type].rset; + qs[i]->doorbell_offset = regmap[SLI4_REG_CQ_DOORBELL][sli4->if_type].off; + qs[i]->doorbell_rset = regmap[SLI4_REG_CQ_DOORBELL][sli4->if_type].rset; } } @@ -4922,9 +5007,13 @@ sli_queue_eq_arm(sli4_t *sli4, sli4_queue_t *q, uint8_t arm) uint32_t val = 0; ocs_lock(&q->lock); + if (sli4->if_type == SLI4_IF_TYPE_LANCER_G7) + val = sli_iftype6_eq_doorbell(q->n_posted, q->id, arm); + else val = sli_eq_doorbell(q->n_posted, q->id, arm); - ocs_reg_write32(sli4->os, q->doorbell_rset, q->doorbell_offset, val); - q->n_posted = 0; + + ocs_reg_write32(sli4->os, q->doorbell_rset, q->doorbell_offset, val); + q->n_posted = 0; ocs_unlock(&q->lock); return 0; @@ -4949,12 +5038,18 @@ sli_queue_arm(sli4_t *sli4, sli4_queue_t *q, uint8_t arm) switch (q->type) { case SLI_QTYPE_EQ: - val = sli_eq_doorbell(q->n_posted, q->id, arm); + if (sli4->if_type == SLI4_IF_TYPE_LANCER_G7) + val = sli_iftype6_eq_doorbell(q->n_posted, q->id, arm); + else + val = sli_eq_doorbell(q->n_posted, q->id, arm); ocs_reg_write32(sli4->os, q->doorbell_rset, q->doorbell_offset, val); q->n_posted = 0; break; case SLI_QTYPE_CQ: - val = sli_cq_doorbell(q->n_posted, q->id, arm); + if (sli4->if_type == SLI4_IF_TYPE_LANCER_G7) + val = sli_iftype6_cq_doorbell(q->n_posted, q->id, arm); + else + val = sli_cq_doorbell(q->n_posted, q->id, arm); ocs_reg_write32(sli4->os, q->doorbell_rset, q->doorbell_offset, val); q->n_posted = 0; break; @@ -5069,10 +5164,11 @@ static uint8_t sli_queue_entry_is_valid(sli4_queue_t *q, uint8_t *qe, uint8_t clear) { uint8_t valid = FALSE; + uint8_t valid_bit_set = 0; switch (q->type) { case SLI_QTYPE_EQ: - valid = ((sli4_eqe_t *)qe)->vld; + valid = (((sli4_eqe_t *)qe)->vld == q->phase) ? 1 : 0; if (valid && clear) { ((sli4_eqe_t *)qe)->vld = 0; } @@ -5082,7 +5178,10 @@ sli_queue_entry_is_valid(sli4_queue_t *q, uint8_t *qe, uint8_t clear) * For both MCQE and WCQE/RCQE, the valid bit * is bit 31 of dword 3 (0 based) */ - valid = (qe[15] & 0x80) != 0; + valid_bit_set = (qe[15] & 0x80) != 0; + if (valid_bit_set == q->phase) + valid = 1; + if (valid & clear) { qe[15] &= ~0x80; } @@ -5099,6 +5198,7 @@ sli_queue_entry_is_valid(sli4_queue_t *q, uint8_t *qe, uint8_t clear) } if (clear) { + ocs_dma_sync(&q->dma, OCS_DMASYNC_PREWRITE); } @@ -5122,6 +5222,7 @@ sli_queue_read(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry) uint8_t *qe = q->dma.virt; uint32_t *qindex = NULL; + uint8_t clear = (SLI4_IF_TYPE_LANCER_G7 == sli_get_if_type(sli4)) ? FALSE : TRUE; if (SLI_QTYPE_MQ == q->type) { qindex = &q->u.r_idx; } else { @@ -5134,7 +5235,7 @@ sli_queue_read(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry) qe += *qindex * q->size; - if (!sli_queue_entry_is_valid(q, qe, TRUE)) { + if (!sli_queue_entry_is_valid(q, qe, clear)) { ocs_unlock(&q->lock); return -1; } @@ -5165,6 +5266,13 @@ sli_queue_read(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry) *qindex = (*qindex + 1) & (q->length - 1); if (SLI_QTYPE_MQ != q->type) { q->n_posted++; + /* + * For prism, the phase value will be used to check the validity of eq/cq entries. + * The value toggles after a complete sweep through the queue. + */ + if ((SLI4_IF_TYPE_LANCER_G7 == sli_get_if_type(sli4)) && (*qindex == 0)) { + q->phase ^= (uint16_t) 0x1; + } } break; default: @@ -5487,8 +5595,9 @@ int32_t sli_raise_ue(sli4_t *sli4, uint8_t dump) ocs_log_test(sli4->os, "invalid asic type %d\n", sli_get_asic_type(sli4)); return -1; } - } else if (SLI4_IF_TYPE_LANCER_FC_ETH == sli_get_if_type(sli4)) { - if (dump == FDD) { + } else if ((SLI4_IF_TYPE_LANCER_FC_ETH == sli_get_if_type(sli4)) || + (SLI4_IF_TYPE_LANCER_G7 == sli_get_if_type(sli4))) { + if (FDD == dump) { sli_reg_write(sli4, SLI4_REG_SLIPORT_CONTROL, SLI4_SLIPORT_CONTROL_FDD | SLI4_SLIPORT_CONTROL_IP); } else { uint32_t value = SLI4_PHYDEV_CONTROL_FRST; @@ -5532,7 +5641,8 @@ int32_t sli_dump_is_ready(sli4_t *sli4) rc = 1; } - } else if (SLI4_IF_TYPE_LANCER_FC_ETH == sli_get_if_type(sli4)) { + } else if ((SLI4_IF_TYPE_LANCER_FC_ETH == sli_get_if_type(sli4)) || + (SLI4_IF_TYPE_LANCER_G7 == sli_get_if_type(sli4))) { /* * Ensure that the port is ready AND the mailbox is * ready before signaling that the dump is ready to go. @@ -5542,7 +5652,7 @@ int32_t sli_dump_is_ready(sli4_t *sli4) if ((bmbx_val & SLI4_BMBX_RDY) && SLI4_PORT_STATUS_READY(port_val)) { - if(SLI4_PORT_STATUS_DUMP_PRESENT(port_val)) { + if(SLI4_PORT_STATUS_DUMP_PRESENT(port_val)) { rc = 1; }else if( SLI4_PORT_STATUS_FDP_PRESENT(port_val)) { rc = 2; @@ -5571,7 +5681,8 @@ int32_t sli_dump_is_present(sli4_t *sli4) uint32_t val; uint32_t ready; - if (SLI4_IF_TYPE_LANCER_FC_ETH != sli_get_if_type(sli4)) { + if ((SLI4_IF_TYPE_LANCER_FC_ETH != sli_get_if_type(sli4)) && + (SLI4_IF_TYPE_LANCER_G7 != sli_get_if_type(sli4))) { ocs_log_test(sli4->os, "Function only supported for I/F type 2"); return -1; } @@ -5658,7 +5769,8 @@ int32_t sli_fw_error_status(sli4_t *sli4) (uerr_mask_hi & uerr_status_hi) != 0) { rc = 1; } - } else if ((SLI4_IF_TYPE_LANCER_FC_ETH == sli4->if_type)) { + } else if (SLI4_IF_TYPE_LANCER_FC_ETH == sli4->if_type || + SLI4_IF_TYPE_LANCER_G7 == sli4->if_type) { uint32_t sliport_status; sliport_status = sli_reg_read(sli4, SLI4_REG_SLIPORT_STATUS); @@ -5692,9 +5804,10 @@ sli_fw_ready(sli4_t *sli4) SLI4_IF_TYPE_BE3_SKH_VF == sli4->if_type) { val = sli_reg_read(sli4, SLI4_REG_SLIPORT_SEMAPHORE); rc = ((SLI4_PORT_SEMAPHORE_STATUS_POST_READY == - SLI4_PORT_SEMAPHORE_PORT(val)) && - (!SLI4_PORT_SEMAPHORE_IN_ERR(val)) ? 1 : 0); - } else if (SLI4_IF_TYPE_LANCER_FC_ETH == sli4->if_type) { + SLI4_PORT_SEMAPHORE_PORT(val)) && + (!SLI4_PORT_SEMAPHORE_IN_ERR(val)) ? 1 : 0); + } else if (SLI4_IF_TYPE_LANCER_FC_ETH == sli4->if_type || + SLI4_IF_TYPE_LANCER_G7 == sli4->if_type) { val = sli_reg_read(sli4, SLI4_REG_SLIPORT_STATUS); rc = (SLI4_PORT_STATUS_READY(val) ? 1 : 0); } @@ -5726,6 +5839,7 @@ int32_t sli_link_is_configurable(sli4_t *sli) rc = 1; break; case SLI4_ASIC_TYPE_LANCERG6: + case SLI4_ASIC_TYPE_LANCERG7: case SLI4_ASIC_TYPE_BE3: default: rc = 0; @@ -5755,7 +5869,7 @@ int32_t sli_link_is_configurable(sli4_t *sli) */ int32_t sli_cmd_fcoe_wq_create(sli4_t *sli4, void *buf, size_t size, - ocs_dma_t *qmem, uint16_t cq_id, uint16_t ulp) + ocs_dma_t *qmem, uint16_t cq_id, uint16_t ulp) { sli4_req_fcoe_wq_create_t *wq = NULL; uint32_t sli_config_off = 0; diff --git a/sys/dev/ocs_fc/sli4.h b/sys/dev/ocs_fc/sli4.h index 4d0c8013b063..54e1915a715c 100644 --- a/sys/dev/ocs_fc/sli4.h +++ b/sys/dev/ocs_fc/sli4.h @@ -114,7 +114,8 @@ sli_page_count(size_t bytes, uint32_t page_size) #define SLI4_IF_TYPE_BE3_SKH_VF 1 #define SLI4_IF_TYPE_LANCER_FC_ETH 2 #define SLI4_IF_TYPE_LANCER_RDMA 3 -#define SLI4_MAX_IF_TYPES 4 +#define SLI4_IF_TYPE_LANCER_G7 6 +#define SLI4_MAX_IF_TYPES 7 /** * @brief ASIC_ID - SLI ASIC Type and Revision Register @@ -150,7 +151,7 @@ sli_page_count(size_t bytes, uint32_t page_size) /** * @brief EQCQ_DOORBELL - EQ and CQ Doorbell Register */ -#define SLI4_EQCQ_DOORBELL_REG 0x120 +#define SLI4_EQCQ_DOORBELL_REG 0x120 #define SLI4_EQCQ_DOORBELL_CI BIT(9) #define SLI4_EQCQ_DOORBELL_QT BIT(10) #define SLI4_EQCQ_DOORBELL_ARM BIT(29) @@ -162,6 +163,8 @@ sli_page_count(size_t bytes, uint32_t page_size) #define SLI4_EQCQ_EQ_ID_MASK_LO 0x01ff #define SLI4_EQCQ_CQ_ID_MASK_LO 0x03ff #define SLI4_EQCQ_EQCQ_ID_MASK_HI 0xf800 +#define SLI4_IF6_EQ_DOORBELL_REG 0x120 +#define SLI4_IF6_CQ_DOORBELL_REG 0xC0 /** * @brief SLIPORT_CONTROL - SLI Port Control Register @@ -257,10 +260,56 @@ static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t a return reg; } +static inline uint32_t sli_iftype6_eq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm) +{ + uint32_t reg = 0; +#if BYTE_ORDER == LITTLE_ENDIAN + struct { + uint32_t eq_id:12, + :4, /* clear interrupt */ + number_popped:13, + arm:1, + :1, + io:1; + } * eq_doorbell = (void *)® +#else +#error big endian version not defined +#endif + + eq_doorbell->eq_id = id; + eq_doorbell->number_popped = n_popped; + eq_doorbell->arm = arm; + + return reg; +} + +static inline uint32_t sli_iftype6_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm) +{ + uint32_t reg = 0; +#if BYTE_ORDER == LITTLE_ENDIAN + struct { + uint32_t cq_id:16, + number_popped:13, + arm:1, + :1, + se:1; + } * cq_doorbell = (void *)® +#else +#error big endian version not defined +#endif + + cq_doorbell->cq_id = id; + cq_doorbell->number_popped = n_popped; + cq_doorbell->arm = arm; + + return reg; +} + /** * @brief MQ_DOORBELL - MQ Doorbell Register */ -#define SLI4_MQ_DOORBELL_REG 0x0140 /* register offset */ +#define SLI4_MQ_DOORBELL_REG 0x0140 /* register offset */ +#define SLI4_IF6_MQ_DOORBELL_REG 0x0160 /* register offset if_type = 6 */ #define SLI4_MQ_DOORBELL_NUM_SHIFT 16 #define SLI4_MQ_DOORBELL_NUM_MASK 0x3fff #define SLI4_MQ_DOORBELL_ID_MASK 0xffff @@ -270,7 +319,8 @@ static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t a /** * @brief RQ_DOORBELL - RQ Doorbell Register */ -#define SLI4_RQ_DOORBELL_REG 0x0a0 /* register offset */ +#define SLI4_RQ_DOORBELL_REG 0x0a0 /* register offset */ +#define SLI4_IF6_RQ_DOORBELL_REG 0x0080 /* register offset of if_type = 6 */ #define SLI4_RQ_DOORBELL_NUM_SHIFT 16 #define SLI4_RQ_DOORBELL_NUM_MASK 0x3fff #define SLI4_RQ_DOORBELL_ID_MASK 0xffff @@ -280,7 +330,8 @@ static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t a /** * @brief WQ_DOORBELL - WQ Doorbell Register */ -#define SLI4_IO_WQ_DOORBELL_REG 0x040 /* register offset */ +#define SLI4_IO_WQ_DOORBELL_REG 0x040 /* register offset */ +#define SLI4_IF6_WQ_DOORBELL_REG 0x040 /* register offset for if_type = 6 */ #define SLI4_WQ_DOORBELL_IDX_SHIFT 16 #define SLI4_WQ_DOORBELL_IDX_MASK 0x00ff #define SLI4_WQ_DOORBELL_NUM_SHIFT 24 @@ -295,7 +346,7 @@ static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t a */ #define SLI4_PORT_SEMAPHORE_REG_0 0x00ac /** register offset Interface Type 0 + 1 */ #define SLI4_PORT_SEMAPHORE_REG_1 0x0180 /** register offset Interface Type 0 + 1 */ -#define SLI4_PORT_SEMAPHORE_REG_23 0x0400 /** register offset Interface Type 2 + 3 */ +#define SLI4_PORT_SEMAPHORE_REG_236 0x0400 /** register offset Interface Type 2 + 3 + 6*/ #define SLI4_PORT_SEMAPHORE_PORT_MASK 0x0000ffff #define SLI4_PORT_SEMAPHORE_PORT(r) ((r) & SLI4_PORT_SEMAPHORE_PORT_MASK) #define SLI4_PORT_SEMAPHORE_HOST_MASK 0x00ff0000 @@ -319,7 +370,7 @@ static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t a * @brief SLIPORT_STATUS - SLI Port Status Register */ -#define SLI4_PORT_STATUS_REG_23 0x0404 /** register offset Interface Type 2 + 3 */ +#define SLI4_PORT_STATUS_REG_236 0x0404 /** register offset Interface Type 2 + 3 + 6*/ #define SLI4_PORT_STATUS_FDP BIT(21) /** function specific dump present */ #define SLI4_PORT_STATUS_RDY BIT(23) /** ready */ #define SLI4_PORT_STATUS_RN BIT(24) /** reset needed */ @@ -332,7 +383,7 @@ static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t a #define SLI4_PORT_STATUS_DUMP_PRESENT(r) ((r) & SLI4_PORT_STATUS_DIP) #define SLI4_PORT_STATUS_FDP_PRESENT(r) ((r) & SLI4_PORT_STATUS_FDP) -#define SLI4_PHSDEV_CONTROL_REG_23 0x0414 /** register offset Interface Type 2 + 3 */ +#define SLI4_PHSDEV_CONTROL_REG_236 0x0414 /** register offset Interface Type 2 + 3 + 6*/ #define SLI4_PHYDEV_CONTROL_DRST BIT(0) /** physical device reset */ #define SLI4_PHYDEV_CONTROL_FRST BIT(1) /** firmware reset */ #define SLI4_PHYDEV_CONTROL_DD BIT(2) /** diagnostic dump */ @@ -1557,7 +1608,8 @@ typedef struct sli4_req_common_create_cq_v2_s { clswm:2, nodelay:1, autovalid:1, - :11, + :9, + cqe_size:2, cqecnt:2, valid:1, :1, @@ -1691,7 +1743,8 @@ typedef struct sli4_req_common_create_eq_s { #if BYTE_ORDER == LITTLE_ENDIAN uint32_t num_pages:16, :16; - uint32_t :29, + uint32_t :28, + autovalid:1, valid:1, :1, eqesz:1; @@ -2960,7 +3013,8 @@ typedef struct sli4_acqe_s { */ typedef enum { SLI4_REG_BMBX, - SLI4_REG_EQCQ_DOORBELL, + SLI4_REG_EQ_DOORBELL, + SLI4_REG_CQ_DOORBELL, SLI4_REG_FCOE_RQ_DOORBELL, SLI4_REG_IO_WQ_DOORBELL, SLI4_REG_MQ_DOORBELL, @@ -3027,6 +3081,9 @@ typedef struct sli4_queue_s { uint32_t max_num_processed; time_t max_process_time; + uint16_t phase; /** For if_type = 6, this value toggle for each iteration + of the queue, a queue entry is valid when a cqe valid + bit matches this value */ /* Type specific gunk */ union { uint32_t r_idx; /** "read" index (MQ only) */ @@ -3131,6 +3188,7 @@ typedef enum { SLI4_ASIC_TYPE_LANCER, SLI4_ASIC_TYPE_CORSAIR, SLI4_ASIC_TYPE_LANCERG6, + SLI4_ASIC_TYPE_LANCERG7 } sli4_asic_type_e; typedef enum { From owner-dev-commits-src-all@freebsd.org Thu Sep 30 07:48:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11B996ACB50; Thu, 30 Sep 2021 07:48: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 4HKljC6kd5z4mdv; Thu, 30 Sep 2021 07:48:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A350A119; Thu, 30 Sep 2021 07:48: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 18U7mFBg046458; Thu, 30 Sep 2021 07:48:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U7mFFQ046457; Thu, 30 Sep 2021 07:48:15 GMT (envelope-from git) Date: Thu, 30 Sep 2021 07:48:15 GMT Message-Id: <202109300748.18U7mFFQ046457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 322dbb8ce8f6 - main - ocs_fc: Increase maximum supported SG elements to support larger transfer sizes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 322dbb8ce8f63fd6f542309fd38324664ce8dd3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 07:48:16 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=322dbb8ce8f63fd6f542309fd38324664ce8dd3f commit 322dbb8ce8f63fd6f542309fd38324664ce8dd3f Author: Ram Kishore Vegesna AuthorDate: 2021-09-24 09:05:03 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-09-30 07:31:16 +0000 ocs_fc: Increase maximum supported SG elements to support larger transfer sizes. Reported by: ken@kdm.org Reviewed by: mav, ken --- sys/dev/ocs_fc/ocs_cam.c | 14 +++++++++----- sys/dev/ocs_fc/ocs_device.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index d3c275920c4b..53b53d1b696d 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -1704,7 +1704,7 @@ ocs_target_io(struct ocs_softc *ocs, union ccb *ccb) rc = ocs_scsi_send_resp(io, 0, &resp, ocs_scsi_target_io_cb, ccb); } else if (xferlen != 0) { - ocs_scsi_sgl_t sgl[OCS_FC_MAX_SGL]; + ocs_scsi_sgl_t *sgl; int32_t sgl_count = 0; io->tgt_io.state = OCS_CAM_IO_DATA; @@ -1712,7 +1712,9 @@ ocs_target_io(struct ocs_softc *ocs, union ccb *ccb) if (sendstatus) io->tgt_io.sendresp = 1; - sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, ARRAY_SIZE(sgl)); + sgl = io->sgl; + + sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, io->sgl_allocated); if (sgl_count > 0) { if (cam_dir == CAM_DIR_IN) { rc = ocs_scsi_send_rd_data(io, 0, NULL, sgl, @@ -1785,7 +1787,7 @@ ocs_initiator_io(struct ocs_softc *ocs, union ccb *ccb) struct ccb_hdr *ccb_h = &csio->ccb_h; ocs_node_t *node = NULL; ocs_io_t *io = NULL; - ocs_scsi_sgl_t sgl[OCS_FC_MAX_SGL]; + ocs_scsi_sgl_t *sgl; int32_t flags, sgl_count; ocs_fcport *fcp; @@ -1828,8 +1830,9 @@ ocs_initiator_io(struct ocs_softc *ocs, union ccb *ccb) csio->ccb_h.ccb_ocs_ptr = ocs; csio->ccb_h.ccb_io_ptr = io; + sgl = io->sgl; - sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, ARRAY_SIZE(sgl)); + sgl_count = ocs_build_scsi_sgl(ocs, ccb, io, sgl, io->sgl_allocated); if (sgl_count < 0) { ocs_scsi_io_free(io); device_printf(ocs->dev, "%s: building SGL failed\n", __func__); @@ -2068,7 +2071,8 @@ ocs_action(struct cam_sim *sim, union ccb *ccb) /* Calculate the max IO supported * Worst case would be an OS page per SGL entry */ - cpi->maxio = PAGE_SIZE * + + cpi->maxio = PAGE_SIZE * (ocs_scsi_get_property(ocs, OCS_SCSI_MAX_SGL) - 1); strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); diff --git a/sys/dev/ocs_fc/ocs_device.h b/sys/dev/ocs_fc/ocs_device.h index f4c5baae0c54..b6d3a5d4897f 100644 --- a/sys/dev/ocs_fc/ocs_device.h +++ b/sys/dev/ocs_fc/ocs_device.h @@ -55,7 +55,7 @@ * @brief Defines the number of SGLs allocated on each IO object */ #ifndef OCS_FC_MAX_SGL -#define OCS_FC_MAX_SGL 128 +#define OCS_FC_MAX_SGL 256 #endif /*************************************************************************** From owner-dev-commits-src-all@freebsd.org Thu Sep 30 07:48:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 060216ACCAC; Thu, 30 Sep 2021 07:48: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 4HKljD6M5Lz4mJy; Thu, 30 Sep 2021 07:48:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B14C427FB8; Thu, 30 Sep 2021 07:48: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 18U7mGIk046482; Thu, 30 Sep 2021 07:48:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U7mG0e046481; Thu, 30 Sep 2021 07:48:16 GMT (envelope-from git) Date: Thu, 30 Sep 2021 07:48:16 GMT Message-Id: <202109300748.18U7mG0e046481@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 1af49c2eeb4a - main - ocs_fc: Fix CAM status reporting in ocs_fc(4) when no data is returned. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1af49c2eeb4a05f524ed9a6657c741bc96fbaf87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 07:48:17 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=1af49c2eeb4a05f524ed9a6657c741bc96fbaf87 commit 1af49c2eeb4a05f524ed9a6657c741bc96fbaf87 Author: Ram Kishore Vegesna AuthorDate: 2021-09-24 09:19:49 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-09-30 07:31:16 +0000 ocs_fc: Fix CAM status reporting in ocs_fc(4) when no data is returned. In ocs_scsi_initiator_io_cb(), if the SCSI command that is getting completed had a residual equal to the transfer length, it was setting the CCB status to CAM_REQ_CMP. That breaks the expected behavior for commands like READ ATTRIBUTE. For READ ATTRIBUTE, if the first attribute requested doesn't exist, the command is supposed to return an error (Illegal Request, Invalid Field in CDB). The broken behavior for READ ATTRIBUTE caused LTFS tape formatting to fail. It looks for attribute 0x1623, and expects to see an error if the attribute isn't present. In addition, if the residual is negative (indicating an overrun), only set the CCB status to CAM_DATA_RUN_ERR if we have not already reported an error. The SCSI sense data will have more detail about what went wrong. sys/dev/ocs_fc/ocs_cam.c: In ocs_scsi_initiator_io_cb(), don't set the status to CAM_REQ_CMP if the residual is equal to the transfer length. Also, only set CAM_DATA_RUN_ERR if we didn't get SCSI status. Submitted by: ken@kdm.org Reviewed by: mav, ken --- sys/dev/ocs_fc/ocs_cam.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index 53b53d1b696d..82b5371b7875 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -1491,18 +1491,18 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, if (scsi_status == OCS_SCSI_STATUS_CHECK_RESPONSE) { csio->scsi_status = rsp->scsi_status; - if (SCSI_STATUS_OK != rsp->scsi_status) { + if (SCSI_STATUS_OK != rsp->scsi_status) ccb_status = CAM_SCSI_STATUS_ERROR; - } + else + ccb_status = CAM_REQ_CMP; csio->resid = rsp->residual; - if (rsp->residual > 0) { - uint32_t length = rsp->response_wire_length; - /* underflow */ - if (csio->dxfer_len == (length + csio->resid)) { - ccb_status = CAM_REQ_CMP; - } - } else if (rsp->residual < 0) { + + /* + * If we've already got a SCSI error, prefer that because it + * will have more detail. + */ + if ((rsp->residual < 0) && (ccb_status == CAM_REQ_CMP)) { ccb_status = CAM_DATA_RUN_ERR; } From owner-dev-commits-src-all@freebsd.org Thu Sep 30 07:48:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 706DB6AD024; Thu, 30 Sep 2021 07:48: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 4HKljG0Zy0z4mjt; Thu, 30 Sep 2021 07:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC6C027ECB; Thu, 30 Sep 2021 07:48: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 18U7mHHh046506; Thu, 30 Sep 2021 07:48:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U7mHwO046505; Thu, 30 Sep 2021 07:48:17 GMT (envelope-from git) Date: Thu, 30 Sep 2021 07:48:17 GMT Message-Id: <202109300748.18U7mHwO046505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: d063d1bc9281 - main - ocs_fc: When commands complete with an error, freeze the device queue. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d063d1bc928165e7798df5ec1c424794a1ec41e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 07:48:18 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=d063d1bc928165e7798df5ec1c424794a1ec41e9 commit d063d1bc928165e7798df5ec1c424794a1ec41e9 Author: Ram Kishore Vegesna AuthorDate: 2021-09-24 09:32:09 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-09-30 07:31:17 +0000 ocs_fc: When commands complete with an error, freeze the device queue. Proper error recovery depends on freezing the device queue when an error occurs, so we can recover from an error before sending additional commands. The ocs_fc(4) driver was not freezing the device queue for most SCSI errors, and that broke error recovery. sys/dev/ocs_fc/ocs_cam.c: In ocs_scsi_initiator_io_cb(), freeze the device queue if we're passing back status other than CAM_REQ_CMP. Submitted by: ken@kdm.org Reviewed by: mav, ken --- sys/dev/ocs_fc/ocs_cam.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index 82b5371b7875..6a9ef6160cee 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -1523,10 +1523,6 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, } } else if (scsi_status != OCS_SCSI_STATUS_GOOD) { ccb_status = CAM_REQ_CMP_ERR; - ocs_set_ccb_status(ccb, ccb_status); - csio->ccb_h.status |= CAM_DEV_QFRZN; - xpt_freeze_devq(csio->ccb_h.path, 1); - } else { ccb_status = CAM_REQ_CMP; } @@ -1537,8 +1533,15 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, csio->ccb_h.ccb_io_ptr = NULL; csio->ccb_h.ccb_ocs_ptr = NULL; + ccb->ccb_h.status &= ~CAM_SIM_QUEUED; + if ((ccb_status != CAM_REQ_CMP) && + ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0)) { + ccb->ccb_h.status |= CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); + } + xpt_done(ccb); return 0; From owner-dev-commits-src-all@freebsd.org Thu Sep 30 07:48:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5510B6ACB52; Thu, 30 Sep 2021 07:48: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 4HKljH19XMz4mK4; Thu, 30 Sep 2021 07:48:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3B0727E60; Thu, 30 Sep 2021 07:48: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 18U7mIuU046536; Thu, 30 Sep 2021 07:48:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18U7mI1C046535; Thu, 30 Sep 2021 07:48:18 GMT (envelope-from git) Date: Thu, 30 Sep 2021 07:48:18 GMT Message-Id: <202109300748.18U7mI1C046535@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 41e946694333 - main - ocs_fc: Fix device lost timer where device is not getting deleted. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 41e946694333bcc6f64242f294312553f2ef2dcd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 07:48:19 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=41e946694333bcc6f64242f294312553f2ef2dcd commit 41e946694333bcc6f64242f294312553f2ef2dcd Author: Ram Kishore Vegesna AuthorDate: 2021-09-24 09:35:30 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-09-30 07:31:17 +0000 ocs_fc: Fix device lost timer where device is not getting deleted. Issue: Devices wont go away after the link down. Device lost timer functionality in ocs_fc is broken, `is_target` flag is not set in the target database and target delete is skipped. Fix: Remove unused flags and delete the device when timer expires. Reported by: ken@kdm.org Reviewed by: mav, ken --- sys/dev/ocs_fc/ocs.h | 4 ---- sys/dev/ocs_fc/ocs_cam.c | 5 +---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/dev/ocs_fc/ocs.h b/sys/dev/ocs_fc/ocs.h index cd212b628bd1..4d7671aa8fb6 100644 --- a/sys/dev/ocs_fc/ocs.h +++ b/sys/dev/ocs_fc/ocs.h @@ -64,14 +64,10 @@ typedef struct ocs_intr_ctx_s { typedef struct ocs_fc_rport_db_s { uint32_t node_id; uint32_t state; - uint8_t is_target; - uint8_t is_initiator; - uint32_t port_id; uint64_t wwnn; uint64_t wwpn; uint32_t gone_timer; - } ocs_fc_target_t; #define OCS_TGT_STATE_NONE 0 /* Empty DB slot */ diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index 6a9ef6160cee..b734880cefb8 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -1118,10 +1118,7 @@ ocs_ldt_task(void *arg, int pending) continue; } - if (tgt->is_target) { - tgt->is_target = 0; - ocs_delete_target(ocs, fcp, i); - } + ocs_delete_target(ocs, fcp, i); tgt->state = OCS_TGT_STATE_NONE; } From owner-dev-commits-src-all@freebsd.org Thu Sep 30 09:11:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CE476AE41B; Thu, 30 Sep 2021 09:11:29 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKnYD6jTqz4sp8; Thu, 30 Sep 2021 09:11:28 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1632993081; 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=430p0AtP9MCn55BxHYRDErrhEbWlSu4jjke48UHrXPY=; b=HRez+Ijd142sGoy6MGtdOyX+QELVsz4CVakPBjvlH5a6JGhSJ59ubB1xNLLLx+XskIdFnL wbk9OO+H9ksLs/jNWMNYDKWoH2AvFtlUhsD70wHq4UtgHqpoUve8IKkFlcN5dgbJr2EkhJ M+jRINSwgb5XpLieDBjHDJihWAHbUnU= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 8767f146 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 30 Sep 2021 09:11:21 +0000 (UTC) Date: Thu, 30 Sep 2021 11:11:20 +0200 From: Emmanuel Vadot To: Warner Losh Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 79a100e28e3c - main - bluetooth: complete removal of ng_h4 Message-Id: <20210930111120.e038ca0a2a3c770f4778fa84@bidouilliste.com> In-Reply-To: <202109300200.18U20EZD084710@gitrepo.freebsd.org> References: <202109300200.18U20EZD084710@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HKnYD6jTqz4sp8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 09:11:29 -0000 On Thu, 30 Sep 2021 02:00:14 GMT Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=79a100e28e3c814773bb4c1826cfa25fbe31140e > > commit 79a100e28e3c814773bb4c1826cfa25fbe31140e > Author: Warner Losh > AuthorDate: 2021-09-05 18:41:16 +0000 > Commit: Warner Losh > CommitDate: 2021-09-30 02:00:02 +0000 > > bluetooth: complete removal of ng_h4 > > The ng_h4 module was disconnected 13 years ago when the tty later was > locked by Ed. It completely fails to compile, and has a number of false > positives for Giant use. Remove it for lack of interest. Bluetooth has > largely (completely?) moved on from bluetooth over UART transport. > > OK'd by: emax > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D31846 Every BT+WIFI combo chip used in SBC uses uart for bluetooth. I have no idea if it uses this or need something else as I've never looked. But anyway, if it fails to compile now I'm fine with removing it, if someone wants to add support for bluetooth to SBC they could always revive this code. -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Thu Sep 30 11:01:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDF5E6AF5CC; Thu, 30 Sep 2021 11:01: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 4HKr065SFkz3GRg; Thu, 30 Sep 2021 11:01:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B99428BA; Thu, 30 Sep 2021 11:01: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 18UB1QAt009007; Thu, 30 Sep 2021 11:01:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UB1Qxv009006; Thu, 30 Sep 2021 11:01:26 GMT (envelope-from git) Date: Thu, 30 Sep 2021 11:01:26 GMT Message-Id: <202109301101.18UB1Qxv009006@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 85c855d31b18 - main - fd: add pwd_hold_proc 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/main X-Git-Reftype: branch X-Git-Commit: 85c855d31b18d7a8ab534259f27444c81b6ec797 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 11:01:26 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=85c855d31b18d7a8ab534259f27444c81b6ec797 commit 85c855d31b18d7a8ab534259f27444c81b6ec797 Author: Mateusz Guzik AuthorDate: 2021-09-30 10:49:51 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-30 10:49:51 +0000 fd: add pwd_hold_proc --- sys/kern/kern_descrip.c | 20 ++++++++++++++++++++ sys/sys/filedesc.h | 1 + 2 files changed, 21 insertions(+) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 58c2d1939dba..755b5df51c6a 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3791,6 +3791,26 @@ pwd_hold(struct thread *td) return (pwd); } +struct pwd * +pwd_hold_proc(struct proc *p) +{ + struct pwddesc *pdp; + struct pwd *pwd; + + PROC_ASSERT_HELD(p); + PROC_LOCK(p); + pdp = pdhold(p); + MPASS(pdp != NULL); + PROC_UNLOCK(p); + + PWDDESC_XLOCK(pdp); + pwd = pwd_hold_pwddesc(pdp); + MPASS(pwd != NULL); + PWDDESC_XUNLOCK(pdp); + pddrop(pdp); + return (pwd); +} + static struct pwd * pwd_alloc(void) { diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 7f18d8a2286c..f17fdf601ba1 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -341,6 +341,7 @@ void pwd_set_rootvnode(void); struct pwd *pwd_hold_pwddesc(struct pwddesc *pdp); bool pwd_hold_smr(struct pwd *pwd); +struct pwd *pwd_hold_proc(struct proc *p); struct pwd *pwd_hold(struct thread *td); void pwd_drop(struct pwd *pwd); static inline void From owner-dev-commits-src-all@freebsd.org Thu Sep 30 11:01:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F08F36AFAA8; Thu, 30 Sep 2021 11:01: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 4HKr076MFWz3Gk1; Thu, 30 Sep 2021 11:01:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB5872A88; Thu, 30 Sep 2021 11:01: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 18UB1RGX009031; Thu, 30 Sep 2021 11:01:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UB1Rur009030; Thu, 30 Sep 2021 11:01:27 GMT (envelope-from git) Date: Thu, 30 Sep 2021 11:01:27 GMT Message-Id: <202109301101.18UB1Rur009030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 69ab52838655 - main - linprocfs: find cwd and root handling 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/main X-Git-Reftype: branch X-Git-Commit: 69ab52838655912cf89699e0b2d21d244d3b9b27 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 11:01:28 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=69ab52838655912cf89699e0b2d21d244d3b9b27 commit 69ab52838655912cf89699e0b2d21d244d3b9b27 Author: Mateusz Guzik AuthorDate: 2021-09-30 10:50:18 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-30 10:59:58 +0000 linprocfs: find cwd and root handling The code would incorrectly use curthread instead of the target proc to resolve vnodes. Fixes: 8d03b99b9dafe928 ("fd: move vnodes out of filedesc into a dedicated structure") PR: 258729 Noted by: Damjan Jovanovic --- sys/compat/linprocfs/linprocfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index ae5823d96fdf..18dec7e01aae 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -1169,7 +1169,7 @@ linprocfs_doproccwd(PFS_FILL_ARGS) char *fullpath = "unknown"; char *freepath = NULL; - pwd = pwd_hold(td); + pwd = pwd_hold_proc(p); vn_fullpath(pwd->pwd_cdir, &fullpath, &freepath); sbuf_printf(sb, "%s", fullpath); if (freepath) @@ -1189,7 +1189,7 @@ linprocfs_doprocroot(PFS_FILL_ARGS) char *fullpath = "unknown"; char *freepath = NULL; - pwd = pwd_hold(td); + pwd = pwd_hold_proc(p); vp = jailed(p->p_ucred) ? pwd->pwd_jdir : pwd->pwd_rdir; vn_fullpath(vp, &fullpath, &freepath); sbuf_printf(sb, "%s", fullpath); From owner-dev-commits-src-all@freebsd.org Thu Sep 30 11:35:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F175B6B0308; Thu, 30 Sep 2021 11:35: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 4HKrkx6GySz3JRV; Thu, 30 Sep 2021 11:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3DFF2DC4; Thu, 30 Sep 2021 11:35: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 18UBZ5Og052515; Thu, 30 Sep 2021 11:35:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UBZ5as052514; Thu, 30 Sep 2021 11:35:05 GMT (envelope-from git) Date: Thu, 30 Sep 2021 11:35:05 GMT Message-Id: <202109301135.18UBZ5as052514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Leandro Lupori Subject: git: cc8e726c85be - stable/13 - powerpc64: change CAS to support Radix MMU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cc8e726c85bee3f3da0fb02c12028f2310a7ee17 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 11:35:06 -0000 The branch stable/13 has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=cc8e726c85bee3f3da0fb02c12028f2310a7ee17 commit cc8e726c85bee3f3da0fb02c12028f2310a7ee17 Author: Leandro Lupori AuthorDate: 2021-09-15 18:12:37 +0000 Commit: Leandro Lupori CommitDate: 2021-09-30 11:34:16 +0000 powerpc64: change CAS to support Radix MMU Use radix_mmu environment variable to select between Hash or Radix MMU, when performing the CAS method call. This matches kernel's behavior, by selecting Hash MMU by default and Radix if radix_mmu is not zero, to make sure that both loader and kernel always select the same MMU. The device tree is queried to detect Radix/GTSE support and to find out if CAS is supported, making the old CPU version and HV bit checks unnecessary now. Reviewed by: jhibbits Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31951 (cherry picked from commit a58abcde2c83b71e5bf19575750564f7bff78833) --- stand/powerpc/ofw/cas.c | 120 +++++++++++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 46 deletions(-) diff --git a/stand/powerpc/ofw/cas.c b/stand/powerpc/ofw/cas.c index 96d276386b71..4f36a147f36d 100644 --- a/stand/powerpc/ofw/cas.c +++ b/stand/powerpc/ofw/cas.c @@ -29,6 +29,13 @@ __FBSDID("$FreeBSD$"); #include #include +/* #define CAS_DEBUG */ +#ifdef CAS_DEBUG +#define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__) +#else +#define DPRINTF(fmt, ...) do { ; } while (0) +#endif + /* PVR */ #define PVR_CPU_P8E 0x004b0000 #define PVR_CPU_P8NVL 0x004c0000 @@ -83,13 +90,19 @@ __FBSDID("$FreeBSD$"); #define OV5_INTC_XICS 0 /* byte 24: MMU */ +#define OV5_MMU_INDEX 24 #define OV5_MMU_HPT 0 +#define OV5_MMU_RADIX 0x40 +#define OV5_MMU_EITHER 0x80 +#define OV5_MMU_DYNAMIC 0xc0 /* byte 25: HPT MMU Extensions */ -#define OV5_HPT_EXT_NONE 0 +#define OV5_HPT_EXT_INDEX 25 +#define OV5_HPT_GTSE 0x40 /* byte 26: Radix MMU Extensions */ -#define OV5_RPT_EXT_NONE 0 +#define OV5_RADIX_EXT_INDEX 26 +#define OV5_RADIX_GTSE 0x40 struct pvr { @@ -163,69 +176,84 @@ static struct ibm_arch_vec { 0, /* DRMEM_V2 */ OV5_INTC_XICS, OV5_MMU_HPT, - OV5_HPT_EXT_NONE, - OV5_RPT_EXT_NONE + 0, + 0 } }; -static __inline register_t -mfpvr(void) -{ - register_t value; - - __asm __volatile ("mfpvr %0" : "=r"(value)); - - return (value); -} - -static __inline int -ppc64_hv(void) -{ - int hv; - - /* PSL_HV is bit 3 of 64-bit MSR */ - __asm __volatile ("mfmsr %0\n\t" - "rldicl %0,%0,4,63" : "=r"(hv)); - - return (hv); -} - int ppc64_cas(void) { - int rc; - ihandle_t ihandle; + phandle_t pkg; + ihandle_t inst; cell_t err; + uint8_t buf[16], idx, val; + int i, len, rc, radix_mmu; + const char *var; + char *ov5; + + pkg = OF_finddevice("/chosen"); + if (pkg == -1) { + printf("cas: couldn't find /chosen\n"); + return (-1); + } + + len = OF_getprop(pkg, "ibm,arch-vec-5-platform-support", buf, + sizeof(buf)); + if (len == -1) + /* CAS not supported */ + return (0); - /* Perform CAS only for POWER8 and later cores */ - switch (mfpvr() & PVR_CPU_MASK) { - case PVR_CPU_P8: - case PVR_CPU_P8E: - case PVR_CPU_P8NVL: - case PVR_CPU_P9: + radix_mmu = 0; + ov5 = ibm_arch_vec.vec5.data; + for (i = 0; i < len; i += 2) { + idx = buf[i]; + val = buf[i + 1]; + DPRINTF("idx 0x%02x val 0x%02x\n", idx, val); + + switch (idx) { + case OV5_MMU_INDEX: + /* + * Note that testing for OV5_MMU_RADIX/OV5_MMU_EITHER + * also covers OV5_MMU_DYNAMIC. + */ + if ((val & OV5_MMU_RADIX) || (val & OV5_MMU_EITHER)) + radix_mmu = 1; break; + + case OV5_RADIX_EXT_INDEX: + if (val & OV5_RADIX_GTSE) + ov5[idx] = OV5_RADIX_GTSE; + break; + + case OV5_HPT_EXT_INDEX: default: - return (0); + break; + } } - /* Skip CAS when running on PowerNV */ - if (ppc64_hv()) - return (0); + if (radix_mmu && (var = getenv("radix_mmu")) != NULL && var[0] != '0') + ov5[OV5_MMU_INDEX] = OV5_MMU_RADIX; + else + radix_mmu = 0; - ihandle = OF_open("/"); - if (ihandle == -1) { + inst = OF_open("/"); + if (inst == -1) { printf("cas: failed to open / node\n"); return (-1); } - if (rc = OF_call_method("ibm,client-architecture-support", - ihandle, 1, 1, &ibm_arch_vec, &err)) - printf("cas: failed to call CAS method\n"); - else if (err) { - printf("cas: error: 0x%08lX\n", err); + DPRINTF("MMU 0x%02x RADIX_EXT 0x%02x\n", + ov5[OV5_MMU_INDEX], ov5[OV5_RADIX_EXT_INDEX]); + rc = OF_call_method("ibm,client-architecture-support", + inst, 1, 1, &ibm_arch_vec, &err); + if (rc != 0 || err) { + printf("cas: CAS method returned an error: rc %d err %jd\n", + rc, (intmax_t)err); rc = -1; } - OF_close(ihandle); + OF_close(inst); + printf("cas: selected %s MMU\n", radix_mmu ? "radix" : "hash"); return (rc); } From owner-dev-commits-src-all@freebsd.org Thu Sep 30 12:21:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C37DE6B0CB0; Thu, 30 Sep 2021 12:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKsn059NYz3LSy; Thu, 30 Sep 2021 12:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91C5E3D2F; Thu, 30 Sep 2021 12:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18UCLuJH015614; Thu, 30 Sep 2021 12:21:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UCLu6X015613; Thu, 30 Sep 2021 12:21:56 GMT (envelope-from git) Date: Thu, 30 Sep 2021 12:21:56 GMT Message-Id: <202109301221.18UCLu6X015613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3c9253c2f6d1 - stable/13 - pf: fix pagefault in pf_getstatus() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3c9253c2f6d1f076ef35a5538b207a5cc866480f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 12:21:56 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c9253c2f6d1f076ef35a5538b207a5cc866480f commit 3c9253c2f6d1f076ef35a5538b207a5cc866480f Author: Kristof Provost AuthorDate: 2021-09-23 08:39:49 +0000 Commit: Kristof Provost CommitDate: 2021-09-30 11:51:32 +0000 pf: fix pagefault in pf_getstatus() We can't copyout() while holding a lock, in case it triggers a page fault. Release the lock before copyout, which is safe because we've already copied all the data into the nvlist. PR: 258601 Reviewed by: mjg MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32076 (cherry picked from commit cb13059663e455b3fc69c293dadec53c164490dc) --- sys/netpfil/pf/pf_ioctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index aac47e5512cf..7a8d0cdda836 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5017,11 +5017,14 @@ pf_getstatus(struct pfioc_nv *nv) else if (nv->size < nv->len) ERROUT(ENOSPC); + PF_RULES_RUNLOCK(); error = copyout(nvlpacked, nv->data, nv->len); + goto done; #undef ERROUT errout: PF_RULES_RUNLOCK(); +done: free(nvlpacked, M_NVLIST); nvlist_destroy(nvc); nvlist_destroy(nvl); From owner-dev-commits-src-all@freebsd.org Thu Sep 30 12:21:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C12C96B0CB2; Thu, 30 Sep 2021 12:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKsn155rQz3Lf8; Thu, 30 Sep 2021 12:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90A65375B; Thu, 30 Sep 2021 12:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18UCLvSo015694; Thu, 30 Sep 2021 12:21:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UCLvCq015693; Thu, 30 Sep 2021 12:21:57 GMT (envelope-from git) Date: Thu, 30 Sep 2021 12:21:57 GMT Message-Id: <202109301221.18UCLvCq015693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 9419d273e471 - stable/12 - pf: fix pagefault in pf_getstatus() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9419d273e4718ee8c768865cd73a3b907f365d8d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 12:21:57 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9419d273e4718ee8c768865cd73a3b907f365d8d commit 9419d273e4718ee8c768865cd73a3b907f365d8d Author: Kristof Provost AuthorDate: 2021-09-23 08:39:49 +0000 Commit: Kristof Provost CommitDate: 2021-09-30 07:54:44 +0000 pf: fix pagefault in pf_getstatus() We can't copyout() while holding a lock, in case it triggers a page fault. Release the lock before copyout, which is safe because we've already copied all the data into the nvlist. PR: 258601 Reviewed by: mjg MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32076 (cherry picked from commit cb13059663e455b3fc69c293dadec53c164490dc) --- sys/netpfil/pf/pf_ioctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index cf17d67cc894..bbafaed0c1b0 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5023,11 +5023,14 @@ pf_getstatus(struct pfioc_nv *nv) else if (nv->size < nv->len) ERROUT(ENOSPC); + PF_RULES_RUNLOCK(); error = copyout(nvlpacked, nv->data, nv->len); + goto done; #undef ERROUT errout: PF_RULES_RUNLOCK(); +done: free(nvlpacked, M_NVLIST); nvlist_destroy(nvc); nvlist_destroy(nvl); From owner-dev-commits-src-all@freebsd.org Thu Sep 30 13:33:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A20B66B14DD for ; Thu, 30 Sep 2021 13:33:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HKvMk3s0wz3kDX for ; Thu, 30 Sep 2021 13:33:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x92e.google.com with SMTP id u5so1255122uao.13 for ; Thu, 30 Sep 2021 06:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qoEfhX16VGpVnWzC/7+0WdYZEAS1KoA9urNmROre28A=; b=hhYnNcGQ8VLIe/1EVQKmYkt8Hwj56KZ6IjHqUD7BiAAEAhGeYgLGjITDAxRp2LZG85 EKo8lvWelDV7cKsTM+wVfUEiFHDvE2Y7HQQ/rr1GtZG/GipWmCU1lBxn8LEV0gdkuheG REiFOcVrQ/GAdougTucwfFS0kbvrzJetUzuC49E6qeJNUY/fpPVh82f+bWBqK9GAtdIr KnkuTukb1wd1yDslMoJz4lWyOEaq5LkkVgnHPdtt5qJN4LPEtX49JvtkbN3FHUN19LHH 9PjQrclxBXWTC+1YoeuZK6b08zwWEhrvzJvETHnqWs0BNi1Nj5hvAFXCrA3WCP1m4hoc nsrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qoEfhX16VGpVnWzC/7+0WdYZEAS1KoA9urNmROre28A=; b=71ZyOBd6YaVwOEO58TOqq5p9uwh4HsJ+C9STPIu2c6CCnJUWUTWkyhjy0AwrEzX5yl pA1JMi4K+0pOHLg+gJ6PSJS2Ej3tSurSfxWe0JnoGehpjNxc8R6WbjNenn7zW7ECv+ga LvnrlsiS/MmMuu+jw3N8mXMFYA5O4M+QbfEilSYpROzIxO7czgCeE5zcGccA8KoNCmHv RQ7Lu1Mo3DNfI57300ba9zr+cGMRf/jnL7INRKREUlmH/DwF+2WJjVhOrZZS0ei72QLZ 8SUQOFzeRLhnsDXTM6fbCVudp97lUC8YBQo902rUfAtMEp8SAFPQSelniR7MUcUGoOBi WWKA== X-Gm-Message-State: AOAM531U1nCbrCSG9R2Qq9gxQsKKXyq6gg7EsO8f9Edkc5sMCwQF69DY adQR3kQjkngW3kRajIJKYREz7FSmU1zeoZ8nNSm1fZjDHD0Xu0uH X-Google-Smtp-Source: ABdhPJwTCnfHnrc5KlZVdXG9PwfHI/OQEYdd33ASU+E5fz4PMb/Ary6n/NHmD9gybaqECLJlhlD59vrPqwgSmXs3ZKU= X-Received: by 2002:a9f:23d0:: with SMTP id 74mr5406973uao.69.1633008817739; Thu, 30 Sep 2021 06:33:37 -0700 (PDT) MIME-Version: 1.0 References: <202109300200.18U20EZD084710@gitrepo.freebsd.org> <20210930111120.e038ca0a2a3c770f4778fa84@bidouilliste.com> In-Reply-To: <20210930111120.e038ca0a2a3c770f4778fa84@bidouilliste.com> From: Warner Losh Date: Thu, 30 Sep 2021 07:33:26 -0600 Message-ID: Subject: Re: git: 79a100e28e3c - main - bluetooth: complete removal of ng_h4 To: Emmanuel Vadot Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4HKvMk3s0wz3kDX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 13:33:38 -0000 On Thu, Sep 30, 2021 at 3:11 AM Emmanuel Vadot wrote: > On Thu, 30 Sep 2021 02:00:14 GMT > Warner Losh wrote: > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=79a100e28e3c814773bb4c1826cfa25fbe31140e > > > > commit 79a100e28e3c814773bb4c1826cfa25fbe31140e > > Author: Warner Losh > > AuthorDate: 2021-09-05 18:41:16 +0000 > > Commit: Warner Losh > > CommitDate: 2021-09-30 02:00:02 +0000 > > > > bluetooth: complete removal of ng_h4 > > > > The ng_h4 module was disconnected 13 years ago when the tty later was > > locked by Ed. It completely fails to compile, and has a number of > false > > positives for Giant use. Remove it for lack of interest. Bluetooth > has > > largely (completely?) moved on from bluetooth over UART transport. > > > > OK'd by: emax > > Sponsored by: Netflix > > Differential Revision: https://reviews.freebsd.org/D31846 > > Every BT+WIFI combo chip used in SBC uses uart for bluetooth. > I have no idea if it uses this or need something else as I've never > looked. > But anyway, if it fails to compile now I'm fine with removing it, if > someone wants to add support for bluetooth to SBC they could always > revive this code. > Yes. If there's a need, we can revive the code... once it's fixed... It looked to take a bit more time than I had.... I've had others make the same or similar correction... Warner From owner-dev-commits-src-all@freebsd.org Thu Sep 30 14:17:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20AFD6B1D6C; Thu, 30 Sep 2021 14:17: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 4HKwL90K1Xz3nrp; Thu, 30 Sep 2021 14:17:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEE425157; Thu, 30 Sep 2021 14:17: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 18UEHKPu065918; Thu, 30 Sep 2021 14:17:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UEHKYt065917; Thu, 30 Sep 2021 14:17:20 GMT (envelope-from git) Date: Thu, 30 Sep 2021 14:17:20 GMT Message-Id: <202109301417.18UEHKYt065917@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 937539e0a32c - main - libpmc: fix the 'cycles' event alias on x86 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/main X-Git-Reftype: branch X-Git-Commit: 937539e0a32ce1da46223664ca1cf3b252e02ece Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 14:17:21 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=937539e0a32ce1da46223664ca1cf3b252e02ece commit 937539e0a32ce1da46223664ca1cf3b252e02ece Author: Mitchell Horne AuthorDate: 2021-09-30 14:11:36 +0000 Commit: Mitchell Horne CommitDate: 2021-09-30 14:15:26 +0000 libpmc: fix the 'cycles' event alias on x86 Looking for "tsc-tsc" in the pmu tables will fail every time. Instead, make this an alias for the static TSC event defined in pmc_events.h. This fixes 'pmcstat -s cycles' on Intel and AMD. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32197 --- lib/libpmc/libpmc.c | 2 +- lib/libpmc/libpmc_pmu_util.c | 1 - sys/dev/hwpmc/pmc_events.h | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 4ff7eb893959..4df888f497c0 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -178,7 +178,7 @@ static const struct pmc_event_descr cortex_a76_event_table[] = static const struct pmc_event_descr tsc_event_table[] = { - __PMC_EV_TSC() + __PMC_EV_ALIAS_TSC() }; #undef PMC_CLASS_TABLE_DESC diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index edd99357678e..2584f08b8dc3 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -74,7 +74,6 @@ static struct pmu_alias pmu_intel_alias_table[] = { {"BRANCH-INSTRUCTION-RETIRED", "BR_INST_RETIRED.ALL_BRANCHES"}, {"BRANCH_MISSES_RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, {"BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, - {"cycles", "tsc-tsc"}, {"unhalted-cycles", "CPU_CLK_UNHALTED.THREAD_P_ANY"}, {"instructions", "inst_retired.any_p"}, {"branch-mispredicts", "br_misp_retired.all_branches"}, diff --git a/sys/dev/hwpmc/pmc_events.h b/sys/dev/hwpmc/pmc_events.h index ae56685f5fc5..e319d72f3fa8 100644 --- a/sys/dev/hwpmc/pmc_events.h +++ b/sys/dev/hwpmc/pmc_events.h @@ -54,6 +54,9 @@ #define PMC_EV_TSC_FIRST PMC_EV_TSC_TSC #define PMC_EV_TSC_LAST PMC_EV_TSC_TSC +#define __PMC_EV_ALIAS_TSC() \ +__PMC_EV_ALIAS("cycles", TSC_TSC) + /* * Software events are dynamically defined. */ From owner-dev-commits-src-all@freebsd.org Thu Sep 30 14:17:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FC776B21F1; Thu, 30 Sep 2021 14:17: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 4HKwLB23kfz3nRp; Thu, 30 Sep 2021 14:17:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25C36567C; Thu, 30 Sep 2021 14:17:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18UEHL1q065947; Thu, 30 Sep 2021 14:17:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UEHLJm065946; Thu, 30 Sep 2021 14:17:21 GMT (envelope-from git) Date: Thu, 30 Sep 2021 14:17:21 GMT Message-Id: <202109301417.18UEHLJm065946@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: a20c10893eb1 - main - libpmc: add some AMD pmu counter aliases 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/main X-Git-Reftype: branch X-Git-Commit: a20c10893eb17e281f119d1b9b39c175dbf4d7bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 14:17:22 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a20c10893eb17e281f119d1b9b39c175dbf4d7bd commit a20c10893eb17e281f119d1b9b39c175dbf4d7bd Author: Mitchell Horne AuthorDate: 2021-09-30 14:13:37 +0000 Commit: Mitchell Horne CommitDate: 2021-09-30 14:15:26 +0000 libpmc: add some AMD pmu counter aliases Make it mostly compatible with what's defined for Intel. Except where noted, these are defined for all of amdzen(1|2|3). Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32162 --- lib/libpmc/libpmc_pmu_util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 2584f08b8dc3..0f9fc0391589 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -86,6 +86,19 @@ static struct pmu_alias pmu_intel_alias_table[] = { static struct pmu_alias pmu_amd_alias_table[] = { {"UNHALTED_CORE_CYCLES", "ls_not_halted_cyc"}, {"UNHALTED-CORE-CYCLES", "ls_not_halted_cyc"}, + {"LLC_MISSES", "l3_comb_clstr_state.request_miss"}, + {"LLC-MISSES", "l3_comb_clstr_state.request_miss"}, + {"LLC_REFERENCE", "l3_request_g1.caching_l3_cache_accesses"}, + {"LLC-REFERENCE", "l3_request_g1.caching_l3_cache_accesses"}, + {"BRANCH_INSTRUCTION_RETIRED", "ex_ret_brn"}, + {"BRANCH-INSTRUCTION-RETIRED", "ex_ret_brn"}, + {"BRANCH_MISSES_RETIRED", "ex_ret_brn_misp"}, + {"BRANCH-MISSES-RETIRED", "ex_ret_brn_misp"}, + {"unhalted-cycles", "ls_not_halted_cyc"}, + {"instructions", "ex_ret_instr",}, + {"branch-mispredicts", "ex_ret_brn_misp"}, + {"branches", "ex_ret_brn"}, + {"interrupts", "ls_int_taken"}, /* Not on amdzen1 */ {NULL, NULL}, }; From owner-dev-commits-src-all@freebsd.org Thu Sep 30 14:49:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C6DD6B25FE; Thu, 30 Sep 2021 14:49: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 4HKx3M1fQPz3qZ8; Thu, 30 Sep 2021 14:49:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1876B5C2C; Thu, 30 Sep 2021 14:49:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18UEnZ4P006066; Thu, 30 Sep 2021 14:49:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UEnYIr006065; Thu, 30 Sep 2021 14:49:34 GMT (envelope-from git) Date: Thu, 30 Sep 2021 14:49:34 GMT Message-Id: <202109301449.18UEnYIr006065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 11572d7d7fb9 - main - net80211: reject mixed plaintext/encrypted fragments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11572d7d7fb9802ceb46ea9dc6cbe3bb95373e55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 14:49:35 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=11572d7d7fb9802ceb46ea9dc6cbe3bb95373e55 commit 11572d7d7fb9802ceb46ea9dc6cbe3bb95373e55 Author: Mathy Vanhoef AuthorDate: 2021-06-06 22:10:41 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-30 14:47:41 +0000 net80211: reject mixed plaintext/encrypted fragments ieee80211_defrag() accepts fragmented 802.11 frames in a protected Wi-Fi network even when some of the fragments are not encrypted. Track whether the fragments are encrypted or not and only accept successive ones if they match the state of the first fragment. This relates to section 6.3 in the 2021 Usenix "FragAttacks" (Fragment and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation) paper. Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be) Security: CVE-2020-26147 PR: 256118 Differential Revision: https://reviews.freebsd.org/D30663 --- sys/net80211/ieee80211_adhoc.c | 2 +- sys/net80211/ieee80211_hostap.c | 2 +- sys/net80211/ieee80211_input.c | 21 ++++++++++++++++++--- sys/net80211/ieee80211_input.h | 2 +- sys/net80211/ieee80211_mesh.c | 2 +- sys/net80211/ieee80211_sta.c | 2 +- sys/net80211/ieee80211_wds.c | 2 +- 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index ea1519b3381d..a23f138802dc 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -531,7 +531,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, * Next up, any fragmentation. */ if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { - m = ieee80211_defrag(ni, m, hdrspace); + m = ieee80211_defrag(ni, m, hdrspace, has_decrypted); if (m == NULL) { /* Fragment dropped or frame not complete yet */ goto out; diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 16a3d97ae7f2..15d42a682355 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -719,7 +719,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, * Next up, any fragmentation. */ if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { - m = ieee80211_defrag(ni, m, hdrspace); + m = ieee80211_defrag(ni, m, hdrspace, has_decrypted); if (m == NULL) { /* Fragment dropped or frame not complete yet */ goto out; diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index aa557fc1ec24..eaeceb9d228e 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -170,7 +170,8 @@ ieee80211_input_mimo_all(struct ieee80211com *ic, struct mbuf *m) * XXX should handle 3 concurrent reassemblies per-spec. */ struct mbuf * -ieee80211_defrag(struct ieee80211_node *ni, struct mbuf *m, int hdrspace) +ieee80211_defrag(struct ieee80211_node *ni, struct mbuf *m, int hdrspace, + int has_decrypted) { struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); @@ -189,6 +190,11 @@ ieee80211_defrag(struct ieee80211_node *ni, struct mbuf *m, int hdrspace) if (!more_frag && fragno == 0 && ni->ni_rxfrag[0] == NULL) return m; + /* Temporarily set flag to remember if fragment was encrypted. */ + /* XXX use a non-packet altering storage for this in the future. */ + if (has_decrypted) + wh->i_fc[1] |= IEEE80211_FC1_PROTECTED; + /* * Remove frag to insure it doesn't get reaped by timer. */ @@ -219,10 +225,14 @@ ieee80211_defrag(struct ieee80211_node *ni, struct mbuf *m, int hdrspace) lwh = mtod(mfrag, struct ieee80211_frame *); last_rxseq = le16toh(*(uint16_t *)lwh->i_seq); - /* NB: check seq # and frag together */ + /* + * NB: check seq # and frag together. Also check that both + * fragments are plaintext or that both are encrypted. + */ if (rxseq == last_rxseq+1 && IEEE80211_ADDR_EQ(wh->i_addr1, lwh->i_addr1) && - IEEE80211_ADDR_EQ(wh->i_addr2, lwh->i_addr2)) { + IEEE80211_ADDR_EQ(wh->i_addr2, lwh->i_addr2) && + !((wh->i_fc[1] ^ lwh->i_fc[1]) & IEEE80211_FC1_PROTECTED)) { /* XXX clear MORE_FRAG bit? */ /* track last seqnum and fragno */ *(uint16_t *) lwh->i_seq = *(uint16_t *) wh->i_seq; @@ -253,6 +263,11 @@ ieee80211_defrag(struct ieee80211_node *ni, struct mbuf *m, int hdrspace) ni->ni_rxfrag[0] = mfrag; mfrag = NULL; } + /* Remember to clear protected flag that was temporarily set. */ + if (mfrag != NULL) { + wh = mtod(mfrag, struct ieee80211_frame *); + wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + } return mfrag; } diff --git a/sys/net80211/ieee80211_input.h b/sys/net80211/ieee80211_input.h index 7456fc68b365..61e3099cb0a4 100644 --- a/sys/net80211/ieee80211_input.h +++ b/sys/net80211/ieee80211_input.h @@ -309,7 +309,7 @@ fail: void ieee80211_deliver_data(struct ieee80211vap *, struct ieee80211_node *, struct mbuf *); struct mbuf *ieee80211_defrag(struct ieee80211_node *, - struct mbuf *, int); + struct mbuf *, int, int); struct mbuf *ieee80211_realign(struct ieee80211vap *, struct mbuf *, size_t); struct mbuf *ieee80211_decap(struct ieee80211vap *, struct mbuf *, int); struct mbuf *ieee80211_decap1(struct mbuf *, int *); diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index b4326905a7a3..8dcbfa918e3b 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -1641,7 +1641,7 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m, */ hdrspace = ieee80211_hdrspace(ic, wh); if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { - m = ieee80211_defrag(ni, m, hdrspace); + m = ieee80211_defrag(ni, m, hdrspace, 0); if (m == NULL) { /* Fragment dropped or frame not complete yet */ goto out; diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 43dc8b6dfeca..6d24eadc11a6 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -795,7 +795,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, * Next up, any fragmentation. */ if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { - m = ieee80211_defrag(ni, m, hdrspace); + m = ieee80211_defrag(ni, m, hdrspace, has_decrypted); if (m == NULL) { /* Fragment dropped or frame not complete yet */ goto out; diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c index 8eaffcf87733..f59a92b992d7 100644 --- a/sys/net80211/ieee80211_wds.c +++ b/sys/net80211/ieee80211_wds.c @@ -594,7 +594,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, * Next up, any fragmentation. */ if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { - m = ieee80211_defrag(ni, m, hdrspace); + m = ieee80211_defrag(ni, m, hdrspace, has_decrypted); if (m == NULL) { /* Fragment dropped or frame not complete yet */ goto out; From owner-dev-commits-src-all@freebsd.org Thu Sep 30 14:52:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30FB96B2856; Thu, 30 Sep 2021 14:52: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 4HKx6b0xC7z3qyW; Thu, 30 Sep 2021 14:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 003A05CA3; Thu, 30 Sep 2021 14:52: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 18UEqMX0016270; Thu, 30 Sep 2021 14:52:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UEqMXl016269; Thu, 30 Sep 2021 14:52:22 GMT (envelope-from git) Date: Thu, 30 Sep 2021 14:52:22 GMT Message-Id: <202109301452.18UEqMXl016269@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f024bdf1155f - main - net80211: mitigation against A-MSDU design flaw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f024bdf1155f36d2d8c4caa533b66e4040c4c469 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 14:52:23 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f024bdf1155f36d2d8c4caa533b66e4040c4c469 commit f024bdf1155f36d2d8c4caa533b66e4040c4c469 Author: Mathy Vanhoef AuthorDate: 2021-06-06 22:10:52 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-30 14:50:45 +0000 net80211: mitigation against A-MSDU design flaw Mitigate A-MSDU injection attacks by detecting if the destination address of a subframe equals an RFC1042 (i.e., LLC/SNAP) header, and if so dropping the complete A-MSDU frame. This mitigates known attacks, although new (unknown) aggregation-based attacks may remain possible. This defense works because in A-MSDU aggregation injection attacks, a normal encrypted Wi-Fi frame is turned into an A-MSDU frame. This means the first 6 bytes of the first A-MSDU subframe correspond to an RFC1042 header. In other words, the destination MAC address of the first A-MSDU subframe contains the start of an RFC1042 header during an aggregation attack. We can detect this and thereby prevent this specific attack. This relates to section 7.2 in the 2021 Usenix "FragAttacks" (Fragment and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation) paper. Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be) Security: CVE-2020-24588 PR: 256119 Differential Revision: https://reviews.freebsd.org/D30664 --- sys/net80211/ieee80211_adhoc.c | 2 +- sys/net80211/ieee80211_hostap.c | 2 +- sys/net80211/ieee80211_input.c | 20 ++++++++++++++++++-- sys/net80211/ieee80211_input.h | 3 ++- sys/net80211/ieee80211_sta.c | 2 +- sys/net80211/ieee80211_wds.c | 2 +- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index a23f138802dc..e2164bbb46a1 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -558,7 +558,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, /* * Finally, strip the 802.11 header. */ - m = ieee80211_decap(vap, m, hdrspace); + m = ieee80211_decap(vap, m, hdrspace, qos); if (m == NULL) { /* XXX mask bit to check for both */ /* don't count Null data frames as errors */ diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 15d42a682355..75fa1c0f7b31 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -744,7 +744,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, /* * Finally, strip the 802.11 header. */ - m = ieee80211_decap(vap, m, hdrspace); + m = ieee80211_decap(vap, m, hdrspace, qos); if (m == NULL) { /* XXX mask bit to check for both */ /* don't count Null data frames as errors */ diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index eaeceb9d228e..66a5ba1c4035 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -309,7 +309,8 @@ ieee80211_deliver_data(struct ieee80211vap *vap, } struct mbuf * -ieee80211_decap(struct ieee80211vap *vap, struct mbuf *m, int hdrlen) +ieee80211_decap(struct ieee80211vap *vap, struct mbuf *m, int hdrlen, + uint8_t qos) { struct ieee80211_qosframe_addr4 wh; struct ether_header *eh; @@ -331,7 +332,9 @@ ieee80211_decap(struct ieee80211vap *vap, struct mbuf *m, int hdrlen) llc->llc_snap.org_code[1] == 0 && llc->llc_snap.org_code[2] == 0 && /* NB: preserve AppleTalk frames that have a native SNAP hdr */ !(llc->llc_snap.ether_type == htons(ETHERTYPE_AARP) || - llc->llc_snap.ether_type == htons(ETHERTYPE_IPX))) { + llc->llc_snap.ether_type == htons(ETHERTYPE_IPX)) && + /* Do not want to touch A-MSDU frames. */ + !(qos & IEEE80211_QOS_AMSDU)) { m_adj(m, hdrlen + sizeof(struct llc) - sizeof(*eh)); llc = NULL; } else { @@ -379,6 +382,10 @@ ieee80211_decap1(struct mbuf *m, int *framelen) #define FF_LLC_SIZE (sizeof(struct ether_header) + sizeof(struct llc)) struct ether_header *eh; struct llc *llc; + const uint8_t llc_hdr_mac[ETHER_ADDR_LEN] = { + /* MAC address matching the 802.2 LLC header */ + LLC_SNAP_LSAP, LLC_SNAP_LSAP, LLC_UI, 0, 0, 0 + }; /* * The frame has an 802.3 header followed by an 802.2 @@ -391,6 +398,15 @@ ieee80211_decap1(struct mbuf *m, int *framelen) if (m->m_len < FF_LLC_SIZE && (m = m_pullup(m, FF_LLC_SIZE)) == NULL) return NULL; eh = mtod(m, struct ether_header *); /* 802.3 header is first */ + + /* + * Detect possible attack where a single 802.11 frame is processed + * as an A-MSDU frame due to an adversary setting the A-MSDU present + * bit in the 802.11 QoS header. [FragAttacks] + */ + if (memcmp(eh->ether_dhost, llc_hdr_mac, ETHER_ADDR_LEN) == 0) + return NULL; + llc = (struct llc *)&eh[1]; /* 802.2 header follows */ *framelen = ntohs(eh->ether_type) /* encap'd frame size */ + sizeof(struct ether_header) - sizeof(struct llc); diff --git a/sys/net80211/ieee80211_input.h b/sys/net80211/ieee80211_input.h index 61e3099cb0a4..2192bba405d2 100644 --- a/sys/net80211/ieee80211_input.h +++ b/sys/net80211/ieee80211_input.h @@ -311,7 +311,8 @@ void ieee80211_deliver_data(struct ieee80211vap *, struct mbuf *ieee80211_defrag(struct ieee80211_node *, struct mbuf *, int, int); struct mbuf *ieee80211_realign(struct ieee80211vap *, struct mbuf *, size_t); -struct mbuf *ieee80211_decap(struct ieee80211vap *, struct mbuf *, int); +struct mbuf *ieee80211_decap(struct ieee80211vap *, struct mbuf *, int, + uint8_t); struct mbuf *ieee80211_decap1(struct mbuf *, int *); int ieee80211_setup_rates(struct ieee80211_node *ni, const uint8_t *rates, const uint8_t *xrates, int flags); diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 6d24eadc11a6..60a5ea100556 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -827,7 +827,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, /* * Finally, strip the 802.11 header. */ - m = ieee80211_decap(vap, m, hdrspace); + m = ieee80211_decap(vap, m, hdrspace, qos); if (m == NULL) { /* XXX mask bit to check for both */ /* don't count Null data frames as errors */ diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c index f59a92b992d7..f88871ca4ae6 100644 --- a/sys/net80211/ieee80211_wds.c +++ b/sys/net80211/ieee80211_wds.c @@ -621,7 +621,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, /* * Finally, strip the 802.11 header. */ - m = ieee80211_decap(vap, m, hdrspace); + m = ieee80211_decap(vap, m, hdrspace, qos); if (m == NULL) { /* XXX mask bit to check for both */ /* don't count Null data frames as errors */ From owner-dev-commits-src-all@freebsd.org Thu Sep 30 14:55:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B644B6B2AEF; Thu, 30 Sep 2021 14:55: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 4HKx9y4mp0z3rTM; Thu, 30 Sep 2021 14:55:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 841055DBE; Thu, 30 Sep 2021 14:55: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 18UEtIUn018974; Thu, 30 Sep 2021 14:55:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UEtI0O018973; Thu, 30 Sep 2021 14:55:18 GMT (envelope-from git) Date: Thu, 30 Sep 2021 14:55:18 GMT Message-Id: <202109301455.18UEtI0O018973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ffc19cf52da5 - main - net80211: prevent plaintext injection by A-MSDU RFC1042/EAPOL frames MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffc19cf52da5546973965f78cf32aa0f2c9657f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 14:55:18 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ffc19cf52da5546973965f78cf32aa0f2c9657f8 commit ffc19cf52da5546973965f78cf32aa0f2c9657f8 Author: Mathy Vanhoef AuthorDate: 2021-06-06 22:10:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-09-30 14:54:04 +0000 net80211: prevent plaintext injection by A-MSDU RFC1042/EAPOL frames No longer accept plaintext A-MSDU frames that start with an RFC1042 header with EtherType EAPOL. This is done by only accepting EAPOL packets that are included in non-aggregated 802.11 frames. Note that before this patch, FreeBSD also only accepted EAPOL frames that are sent in a non-aggregated 802.11 frame due to bugs in processing EAPOL packets inside A-MSDUs. In other words, compatibility with legitimate devices remains the same. This relates to section 6.5 in the 2021 Usenix "FragAttacks" (Fragment and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation) paper. Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be) Security: CVE-2020-26144 PR: 256120 MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D30665 --- sys/net80211/ieee80211_adhoc.c | 18 ++++++++++++------ sys/net80211/ieee80211_hostap.c | 18 ++++++++++++------ sys/net80211/ieee80211_sta.c | 18 ++++++++++++------ sys/net80211/ieee80211_wds.c | 18 ++++++++++++------ 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index e2164bbb46a1..150515222268 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -571,7 +571,10 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, IEEE80211_NODE_STAT(ni, rx_decap); goto err; } - eh = mtod(m, struct ether_header *); + if (!(qos & IEEE80211_QOS_AMSDU)) + eh = mtod(m, struct ether_header *); + else + eh = NULL; if (!ieee80211_node_is_authorized(ni)) { /* * Deny any non-PAE frames received prior to @@ -581,11 +584,13 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, * the port is not marked authorized by the * authenticator until the handshake has completed. */ - if (eh->ether_type != htons(ETHERTYPE_PAE)) { + if (eh == NULL || + eh->ether_type != htons(ETHERTYPE_PAE)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, - eh->ether_shost, "data", - "unauthorized port: ether type 0x%x len %u", - eh->ether_type, m->m_pkthdr.len); + ni->ni_macaddr, "data", "unauthorized or " + "unknown port: ether type 0x%x len %u", + eh == NULL ? -1 : eh->ether_type, + m->m_pkthdr.len); vap->iv_stats.is_rx_unauth++; IEEE80211_NODE_STAT(ni, rx_unauth); goto err; @@ -598,7 +603,8 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && (is_hw_decrypted == 0) && - eh->ether_type != htons(ETHERTYPE_PAE)) { + (eh == NULL || + eh->ether_type != htons(ETHERTYPE_PAE))) { /* * Drop unencrypted frames. */ diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 75fa1c0f7b31..4fa9c6a72145 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -757,7 +757,10 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, IEEE80211_NODE_STAT(ni, rx_decap); goto err; } - eh = mtod(m, struct ether_header *); + if (!(qos & IEEE80211_QOS_AMSDU)) + eh = mtod(m, struct ether_header *); + else + eh = NULL; if (!ieee80211_node_is_authorized(ni)) { /* * Deny any non-PAE frames received prior to @@ -767,11 +770,13 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, * the port is not marked authorized by the * authenticator until the handshake has completed. */ - if (eh->ether_type != htons(ETHERTYPE_PAE)) { + if (eh == NULL || + eh->ether_type != htons(ETHERTYPE_PAE)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, - eh->ether_shost, "data", - "unauthorized port: ether type 0x%x len %u", - eh->ether_type, m->m_pkthdr.len); + ni->ni_macaddr, "data", "unauthorized or " + "unknown port: ether type 0x%x len %u", + eh == NULL ? -1 : eh->ether_type, + m->m_pkthdr.len); vap->iv_stats.is_rx_unauth++; IEEE80211_NODE_STAT(ni, rx_unauth); goto err; @@ -784,7 +789,8 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && (is_hw_decrypted == 0) && - eh->ether_type != htons(ETHERTYPE_PAE)) { + (eh == NULL || + eh->ether_type != htons(ETHERTYPE_PAE))) { /* * Drop unencrypted frames. */ diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index 60a5ea100556..cd62266ab942 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -840,7 +840,10 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, IEEE80211_NODE_STAT(ni, rx_decap); goto err; } - eh = mtod(m, struct ether_header *); + if (!(qos & IEEE80211_QOS_AMSDU)) + eh = mtod(m, struct ether_header *); + else + eh = NULL; if (!ieee80211_node_is_authorized(ni)) { /* * Deny any non-PAE frames received prior to @@ -850,11 +853,13 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, * the port is not marked authorized by the * authenticator until the handshake has completed. */ - if (eh->ether_type != htons(ETHERTYPE_PAE)) { + if (eh == NULL || + eh->ether_type != htons(ETHERTYPE_PAE)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, - eh->ether_shost, "data", - "unauthorized port: ether type 0x%x len %u", - eh->ether_type, m->m_pkthdr.len); + ni->ni_macaddr, "data", "unauthorized or " + "unknown port: ether type 0x%x len %u", + eh == NULL ? -1 : eh->ether_type, + m->m_pkthdr.len); vap->iv_stats.is_rx_unauth++; IEEE80211_NODE_STAT(ni, rx_unauth); goto err; @@ -867,7 +872,8 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && (is_hw_decrypted == 0) && - eh->ether_type != htons(ETHERTYPE_PAE)) { + (eh == NULL || + eh->ether_type != htons(ETHERTYPE_PAE))) { /* * Drop unencrypted frames. */ diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c index f88871ca4ae6..b73988b10d5e 100644 --- a/sys/net80211/ieee80211_wds.c +++ b/sys/net80211/ieee80211_wds.c @@ -634,7 +634,10 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, IEEE80211_NODE_STAT(ni, rx_decap); goto err; } - eh = mtod(m, struct ether_header *); + if (!(qos & IEEE80211_QOS_AMSDU)) + eh = mtod(m, struct ether_header *); + else + eh = NULL; if (!ieee80211_node_is_authorized(ni)) { /* * Deny any non-PAE frames received prior to @@ -644,11 +647,13 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, * the port is not marked authorized by the * authenticator until the handshake has completed. */ - if (eh->ether_type != htons(ETHERTYPE_PAE)) { + if (eh == NULL || + eh->ether_type != htons(ETHERTYPE_PAE)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, - eh->ether_shost, "data", - "unauthorized port: ether type 0x%x len %u", - eh->ether_type, m->m_pkthdr.len); + ni->ni_macaddr, "data", "unauthorized or " + "unknown port: ether type 0x%x len %u", + eh == NULL ? -1 : eh->ether_type, + m->m_pkthdr.len); vap->iv_stats.is_rx_unauth++; IEEE80211_NODE_STAT(ni, rx_unauth); goto err; @@ -661,7 +666,8 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, if ((vap->iv_flags & IEEE80211_F_DROPUNENC) && ((has_decrypted == 0) && (m->m_flags & M_WEP) == 0) && (is_hw_decrypted == 0) && - eh->ether_type != htons(ETHERTYPE_PAE)) { + (eh == NULL || + eh->ether_type != htons(ETHERTYPE_PAE))) { /* * Drop unencrypted frames. */ From owner-dev-commits-src-all@freebsd.org Thu Sep 30 16:13:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F17C06B421B; Thu, 30 Sep 2021 16:13: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 4HKyw36T7Sz4RjK; Thu, 30 Sep 2021 16:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDF336AF7; Thu, 30 Sep 2021 16:13: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 18UGDNoF027671; Thu, 30 Sep 2021 16:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UGDNmG027670; Thu, 30 Sep 2021 16:13:23 GMT (envelope-from git) Date: Thu, 30 Sep 2021 16:13:23 GMT Message-Id: <202109301613.18UGDNmG027670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 1ad2d8777897 - main - mgb: Fix nop admin interrupt handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ad2d87778970582854082bcedd2df0394fd4933 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 16:13:24 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=1ad2d87778970582854082bcedd2df0394fd4933 commit 1ad2d87778970582854082bcedd2df0394fd4933 Author: Ed Maste AuthorDate: 2021-09-29 21:24:39 +0000 Commit: Ed Maste CommitDate: 2021-09-30 15:50:00 +0000 mgb: Fix nop admin interrupt handling Previously mgb_admin_intr printed a diagnostic message if no interrupt status bits were set, but it's not valid to call device_printf() from a filter. Just drop the message as it has no user-facing value. Also return FILTER_STRAY in this case - there is nothing further for the driver to do. Reviewed by: kbowling MFC after: 1 week Fixes: 8890ab7758b8 ("Introduce if_mgb driver...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32231 --- sys/dev/mgb/if_mgb.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index bc944c92625c..6d94f96c09db 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -779,16 +779,9 @@ mgb_admin_intr(void *xsc) intr_en = CSR_READ_REG(sc, MGB_INTR_ENBL_SET); intr_sts &= intr_en; - /* - * NOTE: Debugging printfs here - * will likely cause interrupt test failure. - */ - /* TODO: shouldn't continue if suspended */ - if ((intr_sts & MGB_INTR_STS_ANY) == 0) { - device_printf(sc->dev, "non-mgb interrupt triggered.\n"); - return (FILTER_SCHEDULE_THREAD); - } + if ((intr_sts & MGB_INTR_STS_ANY) == 0) + return (FILTER_STRAY); if ((intr_sts & MGB_INTR_STS_TEST) != 0) { sc->isr_test_flag = true; CSR_WRITE_REG(sc, MGB_INTR_STS, MGB_INTR_STS_TEST); From owner-dev-commits-src-all@freebsd.org Thu Sep 30 20:26:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F7C36B7A7D for ; Thu, 30 Sep 2021 20:26: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 4HL4WY1WFqz4pDm; Thu, 30 Sep 2021 20:26:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 105721279A; Thu, 30 Sep 2021 20:26: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 18UKQ0PX061472; Thu, 30 Sep 2021 20:26:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UKQ0te061471; Thu, 30 Sep 2021 20:26:00 GMT (envelope-from git) Date: Thu, 30 Sep 2021 20:26:00 GMT Message-Id: <202109302026.18UKQ0te061471@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: 0cf556dfb854 - Create tag vendor/acpica/20210930 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/tags/vendor/acpica/20210930 X-Git-Reftype: annotated tag X-Git-Commit: 0cf556dfb854482965d106078119a101887d6c33 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 20:26:01 -0000 The annotated tag vendor/acpica/20210930 has been created by jkim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/acpica/20210930 tag vendor/acpica/20210930 Tagger: Jung-uk Kim TaggerDate: 2021-09-30 20:25:38 +0000 Tag ACPICA 20210930 commit c509b6ab0d7e5bafc5348b08653b8738bd40716e Author: Jung-uk Kim AuthorDate: 2021-09-30 20:23:21 +0000 Commit: Jung-uk Kim CommitDate: 2021-09-30 20:23:21 +0000 Import ACPICA 20210930 From owner-dev-commits-src-all@freebsd.org Thu Sep 30 20:32:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B97BE6B7447 for ; Thu, 30 Sep 2021 20:32: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 4HL4fh4sMQz4pTL; Thu, 30 Sep 2021 20:32:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C9B512A06; Thu, 30 Sep 2021 20:32: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 18UKWC1i074224; Thu, 30 Sep 2021 20:32:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UKWCxL074223; Thu, 30 Sep 2021 20:32:12 GMT (envelope-from git) Date: Thu, 30 Sep 2021 20:32:12 GMT Message-Id: <202109302032.18UKWCxL074223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: 34cfdff1f386..c509b6ab0d7e - vendor/acpica - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/vendor/acpica X-Git-Reftype: branch X-Git-Commit: c509b6ab0d7e5bafc5348b08653b8738bd40716e X-Git-Oldrev: 34cfdff1f386b2d7bf0a8ea873acf604753991e6 X-Git-Newrev: c509b6ab0d7e5bafc5348b08653b8738bd40716e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 20:32:12 -0000 The branch vendor/acpica has been updated by jkim: URL: https://cgit.FreeBSD.org/src/log/?id=34cfdff1f386..c509b6ab0d7e c509b6ab0d7e Import ACPICA 20210930 From owner-dev-commits-src-all@freebsd.org Thu Sep 30 20:35:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBFE16B7C0B; Thu, 30 Sep 2021 20:35: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 4HL4kQ5rsxz4pt8; Thu, 30 Sep 2021 20:35:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B5BB1226E; Thu, 30 Sep 2021 20:35: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 18UKZQn2074593; Thu, 30 Sep 2021 20:35:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UKZQiC074592; Thu, 30 Sep 2021 20:35:26 GMT (envelope-from git) Date: Thu, 30 Sep 2021 20:35:26 GMT Message-Id: <202109302035.18UKZQiC074592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: bf40080762e9 - main - uart: Allow PCI quirk for not using MSI interrupts 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/main X-Git-Reftype: branch X-Git-Commit: bf40080762e939b44d4dd0fbfac5127f2a2562ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 20:35:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bf40080762e939b44d4dd0fbfac5127f2a2562ce commit bf40080762e939b44d4dd0fbfac5127f2a2562ce Author: Warner Losh AuthorDate: 2021-09-30 20:15:32 +0000 Commit: Warner Losh CommitDate: 2021-09-30 20:15:32 +0000 uart: Allow PCI quirk for not using MSI interrupts Some setups claim to have one MSI, but they don't actually work. Allow these to be flagged. Sponsored by: Netflix Reviewed by: kbowling Differential Revision: https://reviews.freebsd.org/D32229 --- sys/dev/uart/uart_bus_pci.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 92046261f544..4090af0ea9a0 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -75,6 +75,9 @@ struct pci_id { int regshft; }; +#define PCI_NO_MSI 0x40000000 +#define PCI_RID_MASK 0x0000ffff + static const struct pci_id pci_ns8250_ids[] = { { 0x1028, 0x0008, 0xffff, 0, "Dell Remote Access Card III", 0x14, 128 * DEFAULT_RCLK }, @@ -171,7 +174,8 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x8cbd, 0xffff, 0, "Intel Wildcat Point KT Controller", 0x10 }, { 0x8086, 0x9c3d, 0xffff, 0, "Intel Lynx Point-LP HECI KT", 0x10 }, { 0x8086, 0xa13d, 0xffff, 0, - "100 Series/C230 Series Chipset Family KT Redirection", 0x10 }, + "100 Series/C230 Series Chipset Family KT Redirection", + 0x10 | PCI_NO_MSI }, { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, @@ -227,7 +231,8 @@ uart_pci_probe(device_t dev) return (ENXIO); match: - result = uart_bus_probe(dev, id->regshft, 0, id->rclk, id->rid, 0, 0); + result = uart_bus_probe(dev, id->regshft, 0, id->rclk, + id->rid & PCI_RID_MASK, 0, 0); /* Bail out on error. */ if (result > 0) return (result); @@ -241,6 +246,7 @@ static int uart_pci_attach(device_t dev) { struct uart_softc *sc; + const struct pci_id *id; int count; sc = device_get_softc(dev); @@ -249,7 +255,9 @@ uart_pci_attach(device_t dev) * Use MSI in preference to legacy IRQ if available. However, experience * suggests this is only reliable when one MSI vector is advertised. */ - if (pci_msi_count(dev) == 1) { + id = uart_pci_match(dev, pci_ns8250_ids); + if ((id == NULL || (id->rid & PCI_NO_MSI) == 0) && + pci_msi_count(dev) == 1) { count = 1; if (pci_alloc_msi(dev, &count) == 0) { sc->sc_irid = 1; From owner-dev-commits-src-all@freebsd.org Thu Sep 30 20:35:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1D476B7BFE; Thu, 30 Sep 2021 20:35: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 4HL4kR5w5zz4pl5; Thu, 30 Sep 2021 20:35:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC3C712768; Thu, 30 Sep 2021 20:35: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 18UKZRxN074617; Thu, 30 Sep 2021 20:35:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18UKZRUe074616; Thu, 30 Sep 2021 20:35:27 GMT (envelope-from git) Date: Thu, 30 Sep 2021 20:35:27 GMT Message-Id: <202109302035.18UKZRUe074616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9eb5fd359969 - main - uart: Match simple comm 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/main X-Git-Reftype: branch X-Git-Commit: 9eb5fd3599695acc76291777bc587e14746e960c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 20:35:28 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9eb5fd3599695acc76291777bc587e14746e960c commit 9eb5fd3599695acc76291777bc587e14746e960c Author: Warner Losh AuthorDate: 2021-09-30 20:16:19 +0000 Commit: Warner Losh CommitDate: 2021-09-30 20:16:19 +0000 uart: Match simple comm Match the PCI simple comm devices (or try to). Be conservative and use legacy interrupts rather than msi messages by default for this 'catch all' since it matches what Linux does (it has opt-in generally for MSI, but also matches more devices because it does a catch-all like implemented in this commit). Sponsored by: Netflix Reviewed by: kbowling Differential Revision: https://reviews.freebsd.org/D32228 --- sys/dev/uart/uart_bus_pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 4090af0ea9a0..fe5ad2b6d206 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -218,6 +219,12 @@ uart_pci_probe(device_t dev) { struct uart_softc *sc; const struct pci_id *id; + struct pci_id cid = { + .regshft = 0, + .rclk = 0, + .rid = 0x10 | PCI_NO_MSI, + .desc = "Generic SimpleComm PCI device", + }; int result; sc = device_get_softc(dev); @@ -227,6 +234,14 @@ uart_pci_probe(device_t dev) sc->sc_class = &uart_ns8250_class; goto match; } + if (pci_get_class(dev) == PCIC_SIMPLECOMM && + pci_get_subclass(dev) == PCIS_SIMPLECOMM_UART && + pci_get_progif(dev) < PCIP_SIMPLECOMM_UART_16550A) { + /* XXX rclk what to do */ + id = &cid; + sc->sc_class = &uart_ns8250_class; + goto match; + } /* Add checks for non-ns8250 IDs here. */ return (ENXIO); From owner-dev-commits-src-all@freebsd.org Thu Sep 30 21:31:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B850F670557; Thu, 30 Sep 2021 21:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HL5zW4qncz4trP; Thu, 30 Sep 2021 21:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85769135C6; Thu, 30 Sep 2021 21:31:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18ULVpUe054471; Thu, 30 Sep 2021 21:31:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ULVpdS054470; Thu, 30 Sep 2021 21:31:51 GMT (envelope-from git) Date: Thu, 30 Sep 2021 21:31:51 GMT Message-Id: <202109302131.18ULVpdS054470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6a7647eccd3e - main - jail(3lua): add a jail.list() method 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/main X-Git-Reftype: branch X-Git-Commit: 6a7647eccd3ef35189c63a61b0ec8865fd559839 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 21:31:51 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6a7647eccd3ef35189c63a61b0ec8865fd559839 commit 6a7647eccd3ef35189c63a61b0ec8865fd559839 Author: Kyle Evans AuthorDate: 2020-10-13 02:11:14 +0000 Commit: Kyle Evans CommitDate: 2021-09-30 21:30:57 +0000 jail(3lua): add a jail.list() method This is implemented as an iterator, reusing parts of the earlier logic to populate jailparams from a passed in table. The user may request any number of parameters to pull in while we're searching, but we'll force jid and name to appear at a minimum. Reviewed by: freqlabs Differential Revision: https://reviews.freebsd.org/D26756 --- lib/flua/libjail/jail.3lua | 47 ++++++ lib/flua/libjail/lua_jail.c | 322 +++++++++++++++++++++++++++++++++++----- share/examples/flua/libjail.lua | 55 ++++++- 3 files changed, 385 insertions(+), 39 deletions(-) diff --git a/lib/flua/libjail/jail.3lua b/lib/flua/libjail/jail.3lua index fb54b94844f5..aa1e0ec49616 100644 --- a/lib/flua/libjail/jail.3lua +++ b/lib/flua/libjail/jail.3lua @@ -32,6 +32,7 @@ .Sh NAME .Nm getid , .Nm getname , +.Nm list , .Nm allparams , .Nm getparams , .Nm setparams , @@ -50,6 +51,7 @@ local jail = require('jail') .It Dv jid, err = jail.getid(name) .It Dv name, err = jail.getname(jid) .It Dv params, err = jail.allparams() +.It Dv iter, jail_obj = jail.list([params]) .It Dv jid, res = jail.getparams(jid|name, params [, flags ] ) .It Dv jid, err = jail.setparams(jid|name, params, flags ) .It Dv jail.CREATE @@ -79,6 +81,21 @@ is the name of a jail or a jid in the form of a string. Get the name of a jail as a string for the given .Fa jid .Pq an integer . +.It Dv iter, jail_obj = jail.list([params]) +Returns an iterator over running jails on the system. +.Dv params +is a list of parameters to fetch for each jail as we iterate. +.Dv jid +and +.Dv name +will always be returned, and may be omitted from +.Dv params . +Additionally, +.Dv params +may be omitted or an empty table, but not nil. +.Pp +See +.Sx EXAMPLES . .It Dv params, err = jail.allparams() Get a list of all supported parameter names .Pq as strings . @@ -167,6 +184,10 @@ function returns a jail identifier integer and a table of jail parameters with parameter name strings as keys and strings for values on success, or .Dv nil and an error message string if an error occurred. +.Pp +The +.Fn list +function returns an iterator over the list of running jails. .Sh EXAMPLES Set the hostname of jail .Dq foo @@ -193,6 +214,32 @@ if not jid then end print(res["host.hostname"]) .Ed +.Pp +Iterate over jails on the system: +.Bd -literal -offset indent +local jail = require('jail') + +-- Recommended: just loop over it +for jparams in jail.list() do + print(jparams["jid"] .. " = " .. jparams["name"]) +end + +-- Request path and hostname, too +for jparams in jail.list({"path", "host.hostname"}) do + print(jparams["host.hostname"] .. " mounted at " .. jparams["path"]) +end + +-- Raw iteration protocol +local iter, jail_obj = jail.list() + +-- Request the first params +local jparams = jail_obj:next() +while jparams do + print(jparams["jid"] .. " = " .. jparams["name"]) + -- Subsequent calls may return nil + jparams = jail_obj:next() +end +.Ed .Sh SEE ALSO .Xr jail 2 , .Xr jail 3 , diff --git a/lib/flua/libjail/lua_jail.c b/lib/flua/libjail/lua_jail.c index b66c60b43bc8..7bb0e13cceea 100644 --- a/lib/flua/libjail/lua_jail.c +++ b/lib/flua/libjail/lua_jail.c @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2020, Ryan Moeller + * Copyright (c) 2020, Kyle Evans * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -41,8 +43,222 @@ __FBSDID("$FreeBSD$"); #include #include +#define JAIL_METATABLE "jail iterator metatable" + +/* + * Taken from RhodiumToad's lspawn implementation, let static analyzers make + * better decisions about the behavior after we raise an error. + */ +#if defined(LUA_VERSION_NUM) && defined(LUA_API) +LUA_API int (lua_error) (lua_State *L) __dead2; +#endif +#if defined(LUA_ERRFILE) && defined(LUALIB_API) +LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg) __dead2; +LUALIB_API int (luaL_typeerror) (lua_State *L, int arg, const char *tname) __dead2; +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...) __dead2; +#endif + int luaopen_jail(lua_State *); +typedef bool (*getparam_filter)(const char *, void *); + +static void getparam_table(lua_State *L, int paramindex, + struct jailparam *params, size_t paramoff, size_t *params_countp, + getparam_filter keyfilt, void *udata); + +struct l_jail_iter { + struct jailparam *params; + size_t params_count; + int jid; +}; + +static bool +l_jail_filter(const char *param_name, void *data __unused) +{ + + /* + * Allowing lastjid will mess up our iteration over all jails on the + * system, as this is a special paramter that indicates where the search + * starts from. We'll always add jid and name, so just silently remove + * these. + */ + return (strcmp(param_name, "lastjid") != 0 && + strcmp(param_name, "jid") != 0 && + strcmp(param_name, "name") != 0); +} + +static int +l_jail_iter_next(lua_State *L) +{ + struct l_jail_iter *iter, **iterp; + struct jailparam *jp; + int serrno; + + iterp = (struct l_jail_iter **)luaL_checkudata(L, 1, JAIL_METATABLE); + iter = *iterp; + luaL_argcheck(L, iter != NULL, 1, "closed jail iterator"); + + jp = iter->params; + /* Populate lastjid; we must keep it in params[0] for our sake. */ + if (jailparam_import_raw(&jp[0], &iter->jid, sizeof(iter->jid))) { + jailparam_free(jp, iter->params_count); + free(jp); + free(iter); + *iterp = NULL; + return (luaL_error(L, "jailparam_import_raw: %s", jail_errmsg)); + } + + /* The list of requested params was populated back in l_list(). */ + iter->jid = jailparam_get(jp, iter->params_count, 0); + if (iter->jid == -1) { + /* + * We probably got an ENOENT to signify the end of the jail + * listing, but just in case we didn't; stash it off and start + * cleaning up. We'll handle non-ENOENT errors later. + */ + serrno = errno; + jailparam_free(jp, iter->params_count); + free(iter->params); + free(iter); + *iterp = NULL; + if (serrno != ENOENT) + return (luaL_error(L, "jailparam_get: %s", + strerror(serrno))); + return (0); + } + + /* + * Finally, we'll fill in the return table with whatever parameters the + * user requested, in addition to the ones we forced with exception to + * lastjid. + */ + lua_newtable(L); + for (size_t i = 0; i < iter->params_count; ++i) { + char *value; + + jp = &iter->params[i]; + if (strcmp(jp->jp_name, "lastjid") == 0) + continue; + value = jailparam_export(jp); + lua_pushstring(L, value); + lua_setfield(L, -2, jp->jp_name); + free(value); + } + + return (1); +} + +static int +l_jail_iter_close(lua_State *L) +{ + struct l_jail_iter *iter, **iterp; + + /* + * Since we're using this as the __gc method as well, there's a good + * chance that it's already been cleaned up by iterating to the end of + * the list. + */ + iterp = (struct l_jail_iter **)lua_touserdata(L, 1); + iter = *iterp; + if (iter == NULL) + return (0); + + jailparam_free(iter->params, iter->params_count); + free(iter->params); + free(iter); + *iterp = NULL; + return (0); +} + +static int +l_list(lua_State *L) +{ + struct l_jail_iter *iter; + int nargs; + + nargs = lua_gettop(L); + if (nargs >= 1) + luaL_checktype(L, 1, LUA_TTABLE); + + iter = malloc(sizeof(*iter)); + if (iter == NULL) + return (luaL_error(L, "malloc: %s", strerror(errno))); + + /* + * lastjid, jid, name + length of the table. This may be too much if + * we have duplicated one of those fixed parameters. + */ + iter->params_count = 3 + (nargs != 0 ? lua_rawlen(L, 1) : 0); + iter->params = malloc(iter->params_count * sizeof(*iter->params)); + if (iter->params == NULL) { + free(iter); + return (luaL_error(L, "malloc params: %s", strerror(errno))); + } + + /* The :next() method will populate lastjid before jail_getparam(). */ + if (jailparam_init(&iter->params[0], "lastjid") == -1) { + free(iter->params); + free(iter); + return (luaL_error(L, "jailparam_init: %s", jail_errmsg)); + } + /* These two will get populated by jail_getparam(). */ + if (jailparam_init(&iter->params[1], "jid") == -1) { + jailparam_free(iter->params, 1); + free(iter->params); + free(iter); + return (luaL_error(L, "jailparam_init: %s", + jail_errmsg)); + } + if (jailparam_init(&iter->params[2], "name") == -1) { + jailparam_free(iter->params, 2); + free(iter->params); + free(iter); + return (luaL_error(L, "jailparam_init: %s", + jail_errmsg)); + } + + /* + * We only need to process additional arguments if we were given any. + * That is, we don't descend into getparam_table if we're passed nothing + * or an empty table. + */ + iter->jid = 0; + if (iter->params_count != 3) + getparam_table(L, 1, iter->params, 2, &iter->params_count, + l_jail_filter, NULL); + + /* + * Part of the iterator magic. We give it an iterator function with a + * metatable defining next() and close() that can be used for manual + * iteration. iter->jid is how we track which jail we last iterated, to + * be supplied as "lastjid". + */ + lua_pushcfunction(L, l_jail_iter_next); + *(struct l_jail_iter **)lua_newuserdata(L, + sizeof(struct l_jail_iter **)) = iter; + luaL_getmetatable(L, JAIL_METATABLE); + lua_setmetatable(L, -2); + return (2); +} + +static void +register_jail_metatable(lua_State *L) +{ + luaL_newmetatable(L, JAIL_METATABLE); + lua_newtable(L); + lua_pushcfunction(L, l_jail_iter_next); + lua_setfield(L, -2, "next"); + lua_pushcfunction(L, l_jail_iter_close); + lua_setfield(L, -2, "close"); + + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, l_jail_iter_close); + lua_setfield(L, -2, "__gc"); + + lua_pop(L, 1); +} + static int l_getid(lua_State *L) { @@ -100,12 +316,71 @@ l_allparams(lua_State *L) return (1); } +static void +getparam_table(lua_State *L, int paramindex, struct jailparam *params, + size_t params_off, size_t *params_countp, getparam_filter keyfilt, + void *udata) +{ + size_t params_count; + int skipped; + + params_count = *params_countp; + skipped = 0; + for (size_t i = 1 + params_off; i < params_count; ++i) { + const char *param_name; + + lua_rawgeti(L, -1, i - params_off); + param_name = lua_tostring(L, -1); + if (param_name == NULL) { + jailparam_free(params, i - skipped); + free(params); + luaL_argerror(L, paramindex, + "param names must be strings"); + } + lua_pop(L, 1); + if (keyfilt != NULL && !keyfilt(param_name, udata)) { + ++skipped; + continue; + } + if (jailparam_init(¶ms[i - skipped], param_name) == -1) { + jailparam_free(params, i - skipped); + free(params); + luaL_error(L, "jailparam_init: %s", jail_errmsg); + } + } + *params_countp -= skipped; +} + +struct getparams_filter_args { + int filter_type; +}; + +static bool +l_getparams_filter(const char *param_name, void *udata) +{ + struct getparams_filter_args *gpa; + + gpa = udata; + + /* Skip name or jid, whichever was given. */ + if (gpa->filter_type == LUA_TSTRING) { + if (strcmp(param_name, "name") == 0) + return (false); + } else /* type == LUA_TNUMBER */ { + if (strcmp(param_name, "jid") == 0) + return (false); + } + + return (true); +} + static int l_getparams(lua_State *L) { const char *name; struct jailparam *params; - size_t params_count, skipped; + size_t params_count; + struct getparams_filter_args gpa; int flags, jid, type; type = lua_type(L, 1); @@ -154,40 +429,8 @@ l_getparams(lua_State *L) /* * Set the remaining param names being requested. */ - - skipped = 0; - for (size_t i = 1; i < params_count; ++i) { - const char *param_name; - - lua_rawgeti(L, -1, i); - param_name = lua_tostring(L, -1); - if (param_name == NULL) { - jailparam_free(params, i - skipped); - free(params); - return (luaL_argerror(L, 2, - "param names must be strings")); - } - lua_pop(L, 1); - /* Skip name or jid, whichever was given. */ - if (type == LUA_TSTRING) { - if (strcmp(param_name, "name") == 0) { - ++skipped; - continue; - } - } else /* type == LUA_TNUMBER */ { - if (strcmp(param_name, "jid") == 0) { - ++skipped; - continue; - } - } - if (jailparam_init(¶ms[i - skipped], param_name) == -1) { - jailparam_free(params, i - skipped); - free(params); - return (luaL_error(L, "jailparam_init: %s", - jail_errmsg)); - } - } - params_count -= skipped; + gpa.filter_type = type; + getparam_table(L, 2, params, 0, ¶ms_count, l_getparams_filter, &gpa); /* * Get the values and convert to a table. @@ -366,6 +609,13 @@ static const struct luaL_Reg l_jail[] = { * or nil, error (string) on error */ {"setparams", l_setparams}, + /** Get a list of jail parameters for running jails on the system. + * @param params optional list of parameter names (table of + * strings) + * @return iterator (function), jail_obj (object) with next and + * close methods + */ + {"list", l_list}, {NULL, NULL} }; @@ -385,5 +635,7 @@ luaopen_jail(lua_State *L) lua_pushinteger(L, JAIL_DYING); lua_setfield(L, -2, "DYING"); + register_jail_metatable(L); + return (1); } diff --git a/share/examples/flua/libjail.lua b/share/examples/flua/libjail.lua index 3ff878460d2f..1761f5c86b24 100644 --- a/share/examples/flua/libjail.lua +++ b/share/examples/flua/libjail.lua @@ -35,10 +35,23 @@ ucl = require("ucl") name = "demo" --- Create a persistent jail named "demo" with all other parameters default. -jid, err = jail.setparams(name, {persist = "true"}, jail.CREATE) -if not jid then - error(err) +local has_demo = false + +-- Make sure we don't have a demo jail to start with; "jid" and "name" are +-- always present. +for jparams in jail.list() do + if jparams["name"] == name then + has_demo = true + break + end +end + +if not has_demo then + -- Create a persistent jail named "demo" with all other parameters default. + jid, err = jail.setparams(name, {persist = "true"}, jail.CREATE) + if not jid then + error(err) + end end -- Get a list of all known jail parameter names. @@ -53,8 +66,42 @@ end -- Display the jail's parameters as a pretty-printed JSON object. print(ucl.to_json(res)) +-- Confirm that we still have it for now. +has_demo = false +for jparams in jail.list() do + if jparams["name"] == name then + has_demo = true + break + end +end + +if not has_demo then + print("demo does not exist") +end + -- Update the "persist" parameter to "false" to remove the jail. jid, err = jail.setparams(name, {persist = "false"}, jail.UPDATE) if not jid then error(err) end + +-- Verify that the jail is no longer on the system. +local is_persistent = false +has_demo = false +for jparams in jail.list({"persist"}) do + if jparams["name"] == name then + has_demo = true + jid = jparams["jid"] + is_persistent = jparams["persist"] ~= "false" + end +end + +-- In fact, it does remain until this process ends -- c'est la vie. +if has_demo then + io.write("demo still exists, jid " .. jid .. ", ") + if is_persistent then + io.write("persistent\n") + else + io.write("not persistent\n") + end +end From owner-dev-commits-src-all@freebsd.org Thu Sep 30 21:31:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 086B067077D; Thu, 30 Sep 2021 21:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HL5zX5X0Cz4vCs; Thu, 30 Sep 2021 21:31:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EF391339F; Thu, 30 Sep 2021 21:31:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18ULVqCP054497; Thu, 30 Sep 2021 21:31:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ULVqMP054496; Thu, 30 Sep 2021 21:31:52 GMT (envelope-from git) Date: Thu, 30 Sep 2021 21:31:52 GMT Message-Id: <202109302131.18ULVqMP054496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: a6499c56ab6c - main - jail(3lua): add jail.attach()/jail.remove() methods 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/main X-Git-Reftype: branch X-Git-Commit: a6499c56ab6ca54f01dca44b7e34a0fc6a680e90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 21:31:53 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=a6499c56ab6ca54f01dca44b7e34a0fc6a680e90 commit a6499c56ab6ca54f01dca44b7e34a0fc6a680e90 Author: Kyle Evans AuthorDate: 2020-10-23 17:52:31 +0000 Commit: Kyle Evans CommitDate: 2021-09-30 21:31:04 +0000 jail(3lua): add jail.attach()/jail.remove() methods These aren't a part of or use libjail(3), but rather are direct syscalls. Still, they seem like good additions, allowing us to attach to already-running jails. Reviewed by: freqlabs Differential Revision: https://reviews.freebsd.org/D26927 --- lib/flua/libjail/jail.3lua | 22 ++++++++++++++ lib/flua/libjail/lua_jail.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/lib/flua/libjail/jail.3lua b/lib/flua/libjail/jail.3lua index aa1e0ec49616..a0cb7ae1381e 100644 --- a/lib/flua/libjail/jail.3lua +++ b/lib/flua/libjail/jail.3lua @@ -30,11 +30,13 @@ .Dt JAIL 3lua .Os .Sh NAME +.Nm attach , .Nm getid , .Nm getname , .Nm list , .Nm allparams , .Nm getparams , +.Nm remove , .Nm setparams , .Nm CREATE , .Nm UPDATE , @@ -48,11 +50,13 @@ local jail = require('jail') .Ed .Pp .Bl -tag -width XXXX -compact +.It Dv ok, err = jail.attach(jid|name) .It Dv jid, err = jail.getid(name) .It Dv name, err = jail.getname(jid) .It Dv params, err = jail.allparams() .It Dv iter, jail_obj = jail.list([params]) .It Dv jid, res = jail.getparams(jid|name, params [, flags ] ) +.It Dv ok, err = jail.remove(jid|name) .It Dv jid, err = jail.setparams(jid|name, params, flags ) .It Dv jail.CREATE .It Dv jail.UPDATE @@ -71,6 +75,11 @@ and .Xr jail_set 2 system calls. .Bl -tag -width XXXX +.It Dv ok, err = jail.attach(jid|name) +Attach to the given jail, identified by an integer +.Fa jid +or the +.Fa name . .It Dv jid, err = jail.getid(name) Get the jail identifier .Pq jid @@ -114,6 +123,11 @@ See the list of flags below. Only the .Dv DYING flag is valid to set. +.It Dv ok, err = jail.remove(jid|name) +Remove the given jail, identified by an integer +.Fa jid +or the +.Fa name . .It Dv jid, err = jail.setparams(jid|name, params [, flags ] ) Set parameters for a given jail. This is used to create, update, attach to, or destroy a jail. @@ -188,6 +202,14 @@ and an error message string if an error occurred. The .Fn list function returns an iterator over the list of running jails. +.Pp +The +.Fn attach +and +.Fn remove +functions return true on success, or +.Dv nil +and an error message string if an error occurred. .Sh EXAMPLES Set the hostname of jail .Dq foo diff --git a/lib/flua/libjail/lua_jail.c b/lib/flua/libjail/lua_jail.c index 7bb0e13cceea..025694bf1181 100644 --- a/lib/flua/libjail/lua_jail.c +++ b/lib/flua/libjail/lua_jail.c @@ -575,6 +575,68 @@ l_setparams(lua_State *L) return (1); } +static int +l_attach(lua_State *L) +{ + int jid, type; + + type = lua_type(L, 1); + luaL_argcheck(L, type == LUA_TSTRING || type == LUA_TNUMBER, 1, + "expected a jail name (string) or id (integer)"); + + if (lua_isstring(L, 1)) { + /* Resolve it to a jid. */ + jid = jail_getid(lua_tostring(L, 1)); + if (jid == -1) { + lua_pushnil(L); + lua_pushstring(L, jail_errmsg); + return (2); + } + } else { + jid = lua_tointeger(L, 1); + } + + if (jail_attach(jid) == -1) { + lua_pushnil(L); + lua_pushstring(L, strerror(errno)); + return (2); + } + + lua_pushboolean(L, 1); + return (1); +} + +static int +l_remove(lua_State *L) +{ + int jid, type; + + type = lua_type(L, 1); + luaL_argcheck(L, type == LUA_TSTRING || type == LUA_TNUMBER, 1, + "expected a jail name (string) or id (integer)"); + + if (lua_isstring(L, 1)) { + /* Resolve it to a jid. */ + jid = jail_getid(lua_tostring(L, 1)); + if (jid == -1) { + lua_pushnil(L); + lua_pushstring(L, jail_errmsg); + return (2); + } + } else { + jid = lua_tointeger(L, 1); + } + + if (jail_remove(jid) == -1) { + lua_pushnil(L); + lua_pushstring(L, strerror(errno)); + return (2); + } + + lua_pushboolean(L, 1); + return (1); +} + static const struct luaL_Reg l_jail[] = { /** Get id of a jail by name. * @param name jail name (string) @@ -616,6 +678,18 @@ static const struct luaL_Reg l_jail[] = { * close methods */ {"list", l_list}, + /** Attach to a running jail. + * @param jail jail name (string) or id (integer) + * @return true (boolean) + * or nil, error (string) on error + */ + {"attach", l_attach}, + /** Remove a running jail. + * @param jail jail name (string) or id (integer) + * @return true (boolean) + * or nil, error (string) on error + */ + {"remove", l_remove}, {NULL, NULL} }; From owner-dev-commits-src-all@freebsd.org Thu Sep 30 21:59:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C40B6670E5B; Thu, 30 Sep 2021 21:59: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 4HL6b952Bkz4wbB; Thu, 30 Sep 2021 21:59:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D2191386A; Thu, 30 Sep 2021 21:59: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 18ULxHrb081954; Thu, 30 Sep 2021 21:59:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ULxH0H081953; Thu, 30 Sep 2021 21:59:17 GMT (envelope-from git) Date: Thu, 30 Sep 2021 21:59:17 GMT Message-Id: <202109302159.18ULxH0H081953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: ce73f768b764 - main - EFI loader: Don't free bcache for DEVT_DISK devs 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/main X-Git-Reftype: branch X-Git-Commit: ce73f768b76486b1562f207a6fc1cef87065418a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 21:59:17 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=ce73f768b76486b1562f207a6fc1cef87065418a commit ce73f768b76486b1562f207a6fc1cef87065418a Author: Colin Percival AuthorDate: 2021-09-30 21:48:14 +0000 Commit: Colin Percival CommitDate: 2021-09-30 21:48:14 +0000 EFI loader: Don't free bcache for DEVT_DISK devs Booting on an EC2 c5.xlarge instance, this reduces the number of I/Os performed from 609 to 432, reduces the total number of blocks read from 61963 to 60797, and reduces the time spent in the loader by 39 ms. Note that b4cb3fe0e39a allowed the bcache to be retained for most of the boot process, but relies on mounting filesystems; this commit allows the bcache to be retained at the start of the boot process, before the root filesystem has been located. Reviewed by: imp, tsoome MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32239 --- stand/efi/libefi/efipart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c index aede28ef40c3..7807c17077a6 100644 --- a/stand/efi/libefi/efipart.c +++ b/stand/efi/libefi/efipart.c @@ -949,8 +949,10 @@ efipart_close(struct open_file *f) pd->pd_open--; if (pd->pd_open == 0) { pd->pd_blkio = NULL; - bcache_free(pd->pd_bcache); - pd->pd_bcache = NULL; + if (dev->dd.d_dev->dv_type != DEVT_DISK) { + bcache_free(pd->pd_bcache); + pd->pd_bcache = NULL; + } } if (dev->dd.d_dev->dv_type == DEVT_DISK) return (disk_close(dev)); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 00:33:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D251B6737E8; Fri, 1 Oct 2021 00:33: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 4HLB175QKJz55W7; Fri, 1 Oct 2021 00:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 998C915DA7; Fri, 1 Oct 2021 00:33: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 1910XVKl095922; Fri, 1 Oct 2021 00:33:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1910XVdJ095921; Fri, 1 Oct 2021 00:33:31 GMT (envelope-from git) Date: Fri, 1 Oct 2021 00:33:31 GMT Message-Id: <202110010033.1910XVdJ095921@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: 9499d3c1e40d - stable/13 - aio_aqueue(): avoid ucred leak on failure path 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: 9499d3c1e40dfeb1f63f61af7cdf25ee27f9a2ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 00:33:31 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9499d3c1e40dfeb1f63f61af7cdf25ee27f9a2ec commit 9499d3c1e40dfeb1f63f61af7cdf25ee27f9a2ec Author: Konstantin Belousov AuthorDate: 2021-09-24 00:14:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-01 00:32:22 +0000 aio_aqueue(): avoid ucred leak on failure path PR: 258698 (cherry picked from commit 45c2c7c484de7747014492b17ff89e323ee66496) --- sys/kern/vfs_aio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 865eaeee2d13..82fa7990937a 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1709,7 +1709,7 @@ no_kqueue: else error = fo_aio_queue(fp, job); if (error) - goto err3; + goto err4; AIO_LOCK(ki); job->jobflags &= ~KAIOCB_QUEUEING; @@ -1730,6 +1730,8 @@ no_kqueue: AIO_UNLOCK(ki); return (0); +err4: + crfree(job->cred); err3: if (fp) fdrop(fp, td); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 00:33:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED124673B78; Fri, 1 Oct 2021 00:33: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 4HLB186MXvz55Fh; Fri, 1 Oct 2021 00:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC01715E08; Fri, 1 Oct 2021 00:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1910XWHd095946; Fri, 1 Oct 2021 00:33:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1910XW9C095945; Fri, 1 Oct 2021 00:33:32 GMT (envelope-from git) Date: Fri, 1 Oct 2021 00:33:32 GMT Message-Id: <202110010033.1910XW9C095945@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: 288a4784012c - stable/13 - pidfile test: guarantee nul termination of the read pid string 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: 288a4784012ca3f2b2c2cb46e67d9c65cd55b5e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 00:33:33 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=288a4784012ca3f2b2c2cb46e67d9c65cd55b5e0 commit 288a4784012ca3f2b2c2cb46e67d9c65cd55b5e0 Author: Konstantin Belousov AuthorDate: 2021-09-24 03:12:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-01 00:32:22 +0000 pidfile test: guarantee nul termination of the read pid string PR: 258701 (cherry picked from commit 364790beafec707ca3e334683e4030684d829be2) --- lib/libutil/tests/pidfile_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libutil/tests/pidfile_test.c b/lib/libutil/tests/pidfile_test.c index 9e516c35273c..9bfa6754ce54 100644 --- a/lib/libutil/tests/pidfile_test.c +++ b/lib/libutil/tests/pidfile_test.c @@ -286,7 +286,8 @@ test_pidfile_relative(void) fd = open(path, O_RDONLY); if (fd < 0) return (strerror(errno)); - if (read(fd, pid, sizeof(pid)) < 0) + memset(pid, 0, sizeof(pid)); + if (read(fd, pid, sizeof(pid) - 1) < 0) return (strerror(errno)); if (atoi(pid) != getpid()) return ("pid mismatch"); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 00:33:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23F47673937; Fri, 1 Oct 2021 00:33: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 4HLB1B0CNPz55L3; Fri, 1 Oct 2021 00:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D538715D2F; Fri, 1 Oct 2021 00:33: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 1910XXgN095970; Fri, 1 Oct 2021 00:33:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1910XXBQ095969; Fri, 1 Oct 2021 00:33:33 GMT (envelope-from git) Date: Fri, 1 Oct 2021 00:33:33 GMT Message-Id: <202110010033.1910XXBQ095969@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: deabab2f0719 - stable/13 - malloc_aligned(9): allow zero size and alignment 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: deabab2f07190dd6d2a598868696edc790cfce8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 00:33:34 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=deabab2f07190dd6d2a598868696edc790cfce8b commit deabab2f07190dd6d2a598868696edc790cfce8b Author: Konstantin Belousov AuthorDate: 2021-09-24 19:38:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-01 00:32:23 +0000 malloc_aligned(9): allow zero size and alignment (cherry picked from commit 71d31f1cf6012b143fd676f099430818ae949c3f) --- sys/kern/kern_malloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 364828e6a1e6..0fc4fcbc0539 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -777,7 +777,7 @@ malloc_domainset_aligned(size_t size, size_t align, void *res; size_t asize; - KASSERT(align != 0 && powerof2(align), + KASSERT(powerof2(align), ("malloc_domainset_aligned: wrong align %#zx size %#zx", align, size)); KASSERT(align <= PAGE_SIZE, @@ -792,6 +792,8 @@ malloc_domainset_aligned(size_t size, size_t align, * align, since malloc zones provide alignment equal to their * size. */ + if (size == 0) + size = 1; asize = size <= align ? align : 1UL << flsl(size - 1); res = malloc_domainset(asize, mtp, ds, flags); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 00:33:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA2CF673642; Fri, 1 Oct 2021 00:33: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 4HLB1C1JG1z55WK; Fri, 1 Oct 2021 00:33:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC96C15CD0; Fri, 1 Oct 2021 00:33: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 1910XY4E095997; Fri, 1 Oct 2021 00:33:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1910XY1G095996; Fri, 1 Oct 2021 00:33:34 GMT (envelope-from git) Date: Fri, 1 Oct 2021 00:33:34 GMT Message-Id: <202110010033.1910XY1G095996@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: 4e24899efe31 - stable/13 - x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible 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: 4e24899efe31ced394f8ce334d0725c416497363 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 00:33:35 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4e24899efe31ced394f8ce334d0725c416497363 commit 4e24899efe31ced394f8ce334d0725c416497363 Author: Konstantin Belousov AuthorDate: 2021-09-24 17:46:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-01 00:32:24 +0000 x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible (cherry picked from commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c) --- sys/x86/x86/busdma_bounce.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c index 75fdf4143b9b..26d1f1028d82 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -434,6 +434,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags, /* * Allocate the buffer from the malloc(9) allocator if... * - It's small enough to fit into a single page. + * - Its alignment requirement is also smaller than the page size. * - The low address requirement is fulfilled. * - Default cache attributes are requested (WB). * else allocate non-contiguous pages if... @@ -448,6 +449,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags, * Warn the user if malloc gets it wrong. */ if (dmat->common.maxsize <= PAGE_SIZE && + dmat->common.alignment <= PAGE_SIZE && dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) && attr == VM_MEMATTR_DEFAULT) { *vaddr = malloc_domainset_aligned(dmat->common.maxsize, From owner-dev-commits-src-all@freebsd.org Fri Oct 1 00:33:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6249C673943; Fri, 1 Oct 2021 00:33: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 4HLB1D23Pgz556g; Fri, 1 Oct 2021 00:33:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DDB915B28; Fri, 1 Oct 2021 00:33: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 1910XZ9o096024; Fri, 1 Oct 2021 00:33:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1910XZX2096023; Fri, 1 Oct 2021 00:33:35 GMT (envelope-from git) Date: Fri, 1 Oct 2021 00:33:35 GMT Message-Id: <202110010033.1910XZX2096023@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: caaf4ae21e06 - stable/13 - amd64 UEFI loader: enable automatic disable of staging area copying 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: caaf4ae21e0600844aa723f87c57dcff37c27a39 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 00:33:36 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=caaf4ae21e0600844aa723f87c57dcff37c27a39 commit caaf4ae21e0600844aa723f87c57dcff37c27a39 Author: Konstantin Belousov AuthorDate: 2021-08-10 01:38:55 +0000 Commit: Konstantin Belousov CommitDate: 2021-10-01 00:32:24 +0000 amd64 UEFI loader: enable automatic disable of staging area copying (cherry picked from commit 6032b6ba9596927aba15a8004ade521a593a7d58) --- stand/efi/loader/copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index cd1f9f00c88a..2552ae86d966 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -216,7 +216,7 @@ efi_copy_free(void) } #ifdef __amd64__ -int copy_staging = COPY_STAGING_ENABLE; +int copy_staging = COPY_STAGING_AUTO; static int command_copy_staging(int argc, char *argv[]) From owner-dev-commits-src-all@freebsd.org Fri Oct 1 02:17:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D22276754AC; Fri, 1 Oct 2021 02:17: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 4HLDJl5KGvz3Dg9; Fri, 1 Oct 2021 02:17:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9347B171BD; Fri, 1 Oct 2021 02:17: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 1912HBZ2029313; Fri, 1 Oct 2021 02:17:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1912HBW1029312; Fri, 1 Oct 2021 02:17:11 GMT (envelope-from git) Date: Fri, 1 Oct 2021 02:17:11 GMT Message-Id: <202110010217.1912HBW1029312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: 1b7a2680fba5 - main - Import ACPICA 20210930 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b7a2680fba589daf6f700565214919cb941ab56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 02:17:11 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=1b7a2680fba589daf6f700565214919cb941ab56 commit 1b7a2680fba589daf6f700565214919cb941ab56 Author: Jung-uk Kim AuthorDate: 2021-09-30 20:23:21 +0000 Commit: Jung-uk Kim CommitDate: 2021-10-01 02:05:52 +0000 Import ACPICA 20210930 (cherry picked from commit c509b6ab0d7e5bafc5348b08653b8738bd40716e) --- sys/contrib/dev/acpica/changes.txt | 50 ++++ sys/contrib/dev/acpica/common/dmtable.c | 58 ++++ sys/contrib/dev/acpica/common/dmtbdump2.c | 300 +++++++++++++++++++++ sys/contrib/dev/acpica/common/dmtbdump3.c | 5 + sys/contrib/dev/acpica/common/dmtbinfo2.c | 183 +++++++++++++ sys/contrib/dev/acpica/common/dmtbinfo3.c | 28 +- sys/contrib/dev/acpica/compiler/aslmethod.c | 70 ++--- sys/contrib/dev/acpica/compiler/dtcompiler.h | 4 + sys/contrib/dev/acpica/compiler/dttable2.c | 5 + sys/contrib/dev/acpica/compiler/dtutils.c | 2 + sys/contrib/dev/acpica/compiler/preprocess.h | 2 +- .../dev/acpica/components/dispatcher/dsfield.c | 2 +- .../dev/acpica/components/hardware/hwesleep.c | 7 +- .../dev/acpica/components/hardware/hwsleep.c | 10 +- .../dev/acpica/components/hardware/hwxfsleep.c | 6 + .../dev/acpica/components/utilities/utosi.c | 1 + sys/contrib/dev/acpica/include/acdisasm.h | 25 +- sys/contrib/dev/acpica/include/acglobal.h | 2 + sys/contrib/dev/acpica/include/acpixf.h | 2 +- sys/contrib/dev/acpica/include/actbinfo.h | 14 + sys/contrib/dev/acpica/include/actbl2.h | 289 +++++++++++++++++++- sys/contrib/dev/acpica/include/actbl3.h | 10 +- sys/contrib/dev/acpica/include/actypes.h | 1 + 23 files changed, 1005 insertions(+), 71 deletions(-) diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 64ca5cccdce4..ad2323971aea 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,3 +1,53 @@ +---------------------------------------- +30 September 2021. Summary of changes for version 20210930: + +This release is available at https://acpica.org/downloads + +1) ACPICA kernel-resident subsystem: + +Hardware: Avoid evaluating methods too early during system resume. During +wakeup from system-wide sleep states, AcpiGetSleepTypeData() is called +and it tries to get memory from the OS in order to evaluate a control +method, but if KFENCE is enabled in the Linux kernel, the memory +allocation attempt causes an IRQ work to be queued and a self-IPI to be +sent to the CPU running the code which requires the memory controller to +be ready, so if that happens too early in the wakeup path, it doesn't +work. + +Prevent that from taking place by calling AcpiGetSleepTypeData() for S0 +upfront, when preparing to enter a given sleep state, and saving the data +obtained by it for later use during system wakeup. + +Added a new _OSI string, "Windows 2020". Posted by superm1. + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL compiler: Updated the check for usage of _CRS, _DIS, _PRS, and _SRS +objects: +New/latest rules: Under a Device Object: + 1) If _PRS is present, must have _CRS and _SRS + 2) If _SRS is present, must have _PRS (_PRS requires _CRS and +_SRS) + 3) If _DIS is present, must have _SRS (_SRS requires _PRS, _PRS +requires _CRS and _SRS) + 4) If _SRS is present, probably should have a _DIS (Remark only) + +iASL table disassembler: Added disassembly support for the NHLT ACPI +table. Note: support for Vendor-defined microphone arrays and SNR +extensions are not supported at this time -- mostly due to a lack of +example tables. Actual compiler support for NHLT is forthcoming. + +Added a new subtable type for ACPI 6.4 SRAT Generic Port Affinity. It +uses the same subtable structure as the existing Generic Initiator +Affinity type. + +Added the flag for online capable in the MADT, introduced in ACPI 6.3. +Posted by superm1. + +3) ACPICA documentation: Updated the legal info (that appears at the +start of the Documents) to clarify distribution rights that are granted. + + ---------------------------------------- 30 July 2021. Summary of changes for version 20210730: diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index cbef83364e73..5e3f2ef748da 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -417,6 +417,26 @@ static const char *AcpiDmNfitSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmNhltLinkTypeNames[] = +{ + "Reserved for HD-Audio", /* ACPI_NHLT_RESERVED_HD_AUDIO */ + "Reserved for DSP", /* ACPI_NHLT_RESERVED_DSP */ + "Type PDM", /* ACPI_NHLT_PDM */ + "Type SSP", /* ACPI_NHLT_SSP */ + "Reserved for SlimBus", /* ACPI_NHLT_RESERVED_SLIMBUS */ + "Reserved for SoundWire", /* ACPI_NHLT_RESERVED_SOUNDWIRE */ + "Unknown Link Type" /* Reserved */ +}; + +static const char *AcpiDmNhltDirectionNames[] = +{ + "Render", /* ACPI_NHLT_DIR_RENDER */ + "Capture", /* ACPI_NHLT_DIR_CAPTURE */ + "Render with Loopback", /* ACPI_NHLT_DIR_RENDER_LOOPBACK */ + "Feedback for Render", /* ACPI_NHLT_DIR_RENDER_FEEDBACK */ + "Unknown Direction" /* Reserved */ +}; + static const char *AcpiDmPcctSubnames[] = { "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */ @@ -473,6 +493,7 @@ static const char *AcpiDmSratSubnames[] = "GICC Affinity", "GIC ITS Affinity", /* Acpi 6.2 */ "Generic Initiator Affinity", /* Acpi 6.3 */ + "Generic Port Affinity", /* Acpi 6.4 */ "Unknown Subtable Type" /* Reserved */ }; @@ -614,6 +635,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct}, {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm}, {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, + {ACPI_SIG_NHLT, AcpiDmTableInfoNhlt, AcpiDmDumpNhlt, NULL, NULL}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt}, {ACPI_SIG_PHAT, NULL, AcpiDmDumpPhat, DtCompilePhat, TemplatePhat}, @@ -1050,6 +1072,8 @@ AcpiDmDumpTable ( case ACPI_DMT_IVRS_DE: case ACPI_DMT_GTDT: case ACPI_DMT_MADT: + case ACPI_DMT_NHLT1: + case ACPI_DMT_NHLT1a: case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: @@ -1138,6 +1162,11 @@ AcpiDmDumpTable ( ByteLength = 16; break; + case ACPI_DMT_BUF18: + + ByteLength = 18; + break; + case ACPI_DMT_BUF128: ByteLength = 128; @@ -1343,6 +1372,7 @@ AcpiDmDumpTable ( case ACPI_DMT_BUF10: case ACPI_DMT_BUF12: case ACPI_DMT_BUF16: + case ACPI_DMT_BUF18: case ACPI_DMT_BUF128: /* * Buffer: Size depends on the opcode and was set above. @@ -1790,6 +1820,34 @@ AcpiDmDumpTable ( AcpiDmNfitSubnames[Temp16]); break; + case ACPI_DMT_NHLT1: + + /* NHLT link types */ + + Temp8 = *Target; + if (Temp8 > ACPI_NHLT_TYPE_RESERVED) + { + Temp8 = ACPI_NHLT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmNhltLinkTypeNames[Temp8]); + break; + + case ACPI_DMT_NHLT1a: + + /* NHLT direction */ + + Temp8 = *Target; + if (Temp8 > ACPI_NHLT_DIR_RESERVED) + { + Temp8 = ACPI_NHLT_DIR_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmNhltDirectionNames[Temp8]); + break; + case ACPI_DMT_PCCT: /* PCCT subtable types */ diff --git a/sys/contrib/dev/acpica/common/dmtbdump2.c b/sys/contrib/dev/acpica/common/dmtbdump2.c index a13e77e5c03b..e3ad649479b0 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump2.c +++ b/sys/contrib/dev/acpica/common/dmtbdump2.c @@ -1467,6 +1467,306 @@ NextSubtable: } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpNhlt + * + * PARAMETERS: Table - A NHLT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of an NHLT. + * + ******************************************************************************/ + +void +AcpiDmDumpNhlt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset; + UINT32 TableLength = Table->Length; + UINT32 EndpointCount; + UINT8 FormatsCount; + ACPI_NHLT_ENDPOINT *Subtable; + ACPI_NHLT_FORMAT_CONFIG *FormatSubtable; + ACPI_TABLE_NHLT *InfoTable; + UINT32 CapabilitiesSize; + UINT32 i; + UINT32 j; + UINT32 k; + UINT32 EndpointEndOffset; + UINT8 ConfigType = 0; + UINT8 ArrayType; + ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A *DevSpecific; + ACPI_NHLT_FORMATS_CONFIG *FormatsConfig; + ACPI_NHLT_LINUX_SPECIFIC_COUNT *Count; + ACPI_NHLT_LINUX_SPECIFIC_DATA *LinuxData; + + + /* Main table */ + + AcpiOsPrintf ("/* Main table */\n"); + + Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNhlt); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Get the Endpoint Descriptor Count */ + + InfoTable = ACPI_ADD_PTR (ACPI_TABLE_NHLT, Table, 0); + EndpointCount = InfoTable->EndpointCount; + + /* Subtables */ + + Offset = sizeof (ACPI_TABLE_NHLT); + + while (Offset < TableLength) + { + /* A variable number of Endpoint Descriptors - process each */ + + for (i = 0; i < EndpointCount; i++) + { + /* Do the Endpoint Descriptor table */ + + Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset); + if (Subtable->DescriptorLength > TableLength) + { + Offset += 1; + AcpiOsPrintf ("\n/* Endpoint Descriptor Length larger than" + " table size: %X, table %X, adjusting table offset (+1) */\n", + Subtable->DescriptorLength, TableLength); + + Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset); + } + + AcpiOsPrintf ("\n/* Endpoint Descriptor #%u */\n", i+1); + Status = AcpiDmDumpTable (TableLength, Offset, Subtable, + Subtable->DescriptorLength, AcpiDmTableInfoNhlt0); + if (ACPI_FAILURE (Status)) + { + return; + } + EndpointEndOffset = Subtable->DescriptorLength + Offset; + + /* Check for endpoint descriptor beyond end-of-table */ + + if (Subtable->DescriptorLength > TableLength) + { + AcpiOsPrintf ("\n/* Endpoint Descriptor Length larger than table size: %X, table %X */\n", + Subtable->DescriptorLength, TableLength); + } + Offset += sizeof (ACPI_NHLT_ENDPOINT); + Subtable = ACPI_ADD_PTR (ACPI_NHLT_ENDPOINT, Table, Offset); + + /* Do the Device Specific table */ + + AcpiOsPrintf ("\n/* Endpoint Device_Specific_Config table */\n"); + DevSpecific = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A, Subtable); + CapabilitiesSize = DevSpecific->CapabilitiesSize; + + /* Different subtables based upon capabilities_size */ + + switch (CapabilitiesSize) + { + case 0: + Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific, + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B); + break; + + case 1: + Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific, + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C), AcpiDmTableInfoNhlt5c); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_C); + break; + + case 2: + Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific, + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG), AcpiDmTableInfoNhlt5); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG); + break; + + case 3: + ConfigType = DevSpecific->ConfigType; + ArrayType = DevSpecific->ArrayType; + + Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific, + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A), AcpiDmTableInfoNhlt5a); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Capabilities Size == 3 */ + Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A); + + /* Check for a vendor-defined mic array */ + + if ((ConfigType == ACPI_NHLT_TYPE_MIC_ARRAY) && ((ArrayType & ARRAY_TYPE_MASK) == VENDOR_DEFINED)) + { + /* Vendor-defined microphone array */ + + AcpiOsPrintf ("\n/* Vendor-defined microphone array */\n"); + + Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific, + sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG), AcpiDmTableInfoNhlt6); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_NHLT_VENDOR_MIC_CONFIG); + } + break; + + default: + Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific, + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b); + if (ACPI_FAILURE (Status)) + { + return; + } + + Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B); + Status = AcpiDmDumpTable (TableLength, Offset, DevSpecific, + CapabilitiesSize, AcpiDmTableInfoNhlt3a); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += CapabilitiesSize; + break; + } + + /* Do the Formats_Config table */ + + FormatsConfig = ACPI_ADD_PTR (ACPI_NHLT_FORMATS_CONFIG, Table, Offset); + FormatsCount = FormatsConfig->FormatsCount; + + AcpiOsPrintf ("\n/* Formats_Config table */\n"); + + Status = AcpiDmDumpTable (TableLength, Offset, FormatsConfig, + sizeof (ACPI_NHLT_FORMATS_CONFIG), AcpiDmTableInfoNhlt4); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_NHLT_FORMATS_CONFIG); + + /* A variable number of Format_Config Descriptors - process each */ + + for (j = 0; j < FormatsCount; j++) + { + FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset); + CapabilitiesSize = FormatSubtable->CapabilitySize; + + /* Do the Wave_extensible struct */ + + AcpiOsPrintf ("\n/* Wave_Format_Extensible table #%u */\n", j+1); + Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable, + sizeof (ACPI_NHLT_FORMAT_CONFIG), AcpiDmTableInfoNhlt3); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_NHLT_WAVE_EXTENSIBLE); + + /* Do the Capabilities array */ + + Offset += sizeof (UINT32); + AcpiOsPrintf ("\n/* Specific_Config table #%u */\n", j+1); + FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset); + Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable, + CapabilitiesSize, AcpiDmTableInfoNhlt3a); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += CapabilitiesSize; + } + + /* + * If we are not done with the Endpoint(s) yet, then there must be + * some Linux-specific structure(s) yet to be processed. + */ + if (Offset < EndpointEndOffset) + { + AcpiOsPrintf ("\n"); + Count = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_COUNT, Table, Offset); + Status = AcpiDmDumpTable (TableLength, Offset, Count, + sizeof (ACPI_NHLT_LINUX_SPECIFIC_COUNT), AcpiDmTableInfoNhlt7); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_NHLT_LINUX_SPECIFIC_COUNT); + + /* Variable number of linux-specific structures */ + + for (k = 0; k < Count->StructureCount; k++) + { + LinuxData = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_DATA, Table, Offset); + + AcpiOsPrintf ("\n/* Linux-specific structure #%u */\n", k+1); + + Status = AcpiDmDumpTable (TableLength, Offset, LinuxData, + sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA), AcpiDmTableInfoNhlt7a); + if (ACPI_FAILURE (Status)) + { + return; + } + + Offset += sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA); + } + + /* Should be at the end of the Endpoint structure. Skip any extra bytes */ + + if (Offset < EndpointEndOffset) + { + AcpiOsPrintf ("\n/* Endpoint descriptor ended before endpoint size was reached. " + "skipped %X input bytes, current offset: %X, Endpoint End Offset: %X */\n", + EndpointEndOffset - Offset, Offset, EndpointEndOffset); + AcpiUtDumpBuffer (((UINT8 *)Table)+Offset, + EndpointEndOffset - Offset, DB_BYTE_DISPLAY, Offset); + Offset = EndpointEndOffset; + } + } + } + + /* Emit the table terminator (if present) */ + + if (Offset == TableLength - sizeof (ACPI_NHLT_TABLE_TERMINATOR)) + { + LinuxData = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_DATA, Table, Offset); + AcpiOsPrintf ("\n/* Table terminator structure */\n"); + + Status = AcpiDmDumpTable (TableLength, Offset, LinuxData, + sizeof (ACPI_NHLT_TABLE_TERMINATOR), AcpiDmTableInfoNhlt8); + if (ACPI_FAILURE (Status)) + { + return; + } + } + + return; + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpPcct diff --git a/sys/contrib/dev/acpica/common/dmtbdump3.c b/sys/contrib/dev/acpica/common/dmtbdump3.c index 26cfe2f9b695..f23aeaf8ee64 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump3.c +++ b/sys/contrib/dev/acpica/common/dmtbdump3.c @@ -338,6 +338,11 @@ AcpiDmDumpSrat ( InfoTable = AcpiDmTableInfoSrat5; break; + case ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat6; + break; + default: AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", Subtable->Type); diff --git a/sys/contrib/dev/acpica/common/dmtbinfo2.c b/sys/contrib/dev/acpica/common/dmtbinfo2.c index 3eb4e44902d3..52173c5f8a0e 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo2.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo2.c @@ -1194,6 +1194,189 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit7[] = }; +/******************************************************************************* + * + * NHLT - Non HD Audio Link Table. Conforms to Intel Smart Sound Technology + * NHLT Specification, January 2020 Revision 0.8.1 + * + ******************************************************************************/ + +/* Main table */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt[] = +{ + {ACPI_DMT_UINT8, ACPI_NHLT_OFFSET (EndpointCount), "Endpoint Count", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Endpoint config */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt0[] = +{ + {ACPI_DMT_UINT32, ACPI_NHLT0_OFFSET (DescriptorLength), "Descriptor Length", DT_LENGTH}, + {ACPI_DMT_NHLT1, ACPI_NHLT0_OFFSET (LinkType), "Link Type", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT0_OFFSET (InstanceId), "Instance Id", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT0_OFFSET (VendorId), "Vendor Id", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT0_OFFSET (DeviceId), "Device Id", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT0_OFFSET (RevisionId), "Revision Id", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT0_OFFSET (SubsystemId), "Subsystem Id", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT0_OFFSET (DeviceType), "Device Type", 0}, + {ACPI_DMT_NHLT1a, ACPI_NHLT0_OFFSET (Direction), "Direction", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT0_OFFSET (VirtualBusId), "Virtual Bus Id", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Device_Specific config */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt1[] = +{ + {ACPI_DMT_UINT32, ACPI_NHLT1_OFFSET (CapabilitiesSize), "Capabilities Size", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_NHLT1_OFFSET (VirtualSlot), "Virtual Slot", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT1_OFFSET (ConfigType), "Config Type", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Wave Format Extensible */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt2[] = +{ + {ACPI_DMT_UINT16, ACPI_NHLT2_OFFSET (FormatTag), "Format Tag", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT2_OFFSET (ChannelCount), "Channel Count", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT2_OFFSET (SamplesPerSec), "Samples Per Second", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT2_OFFSET (AvgBytesPerSec), "Average Bytes Per Second", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT2_OFFSET (BlockAlign), "Block Alignment", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT2_OFFSET (BitsPerSample), "Bits Per Sample", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT2_OFFSET (ExtraFormatSize), "Extra Format Size", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT2_OFFSET (ValidBitsPerSample), "Valid Bits Per Sample", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT2_OFFSET (ChannelMask), "Channel Mask", 0}, + {ACPI_DMT_UUID, ACPI_NHLT2_OFFSET (SubFormatGuid), "SubFormat GUID", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Format Config */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt3[] = +{ + {ACPI_DMT_UINT16, ACPI_NHLT3_OFFSET (Format.FormatTag), "Format Tag", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT3_OFFSET (Format.ChannelCount), "Channel Count", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT3_OFFSET (Format.SamplesPerSec), "Samples Per Second", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT3_OFFSET (Format.AvgBytesPerSec), "Average Bytes Per Second", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT3_OFFSET (Format.BlockAlign), "Block Alignment", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT3_OFFSET (Format.BitsPerSample), "Bits Per Sample", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT3_OFFSET (Format.ExtraFormatSize), "Extra Format Size", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT3_OFFSET (Format.ValidBitsPerSample), "Valid Bits Per Sample", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT3_OFFSET (Format.ChannelMask), "Channel Mask", 0}, + {ACPI_DMT_UUID, ACPI_NHLT3_OFFSET (Format.SubFormatGuid), "SubFormat GUID", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT3_OFFSET (CapabilitySize), "Capabilities Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR +}; + +/* + * We treat the binary Capabilities field as its own subtable (to make + * ACPI_DMT_RAW_BUFFER work properly). + */ +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt3a[] = +{ + {ACPI_DMT_RAW_BUFFER, 0, "Capabilities", 0}, + ACPI_DMT_TERMINATOR +}; + + +/* Formats Config */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt4[] = +{ + {ACPI_DMT_UINT8, ACPI_NHLT4_OFFSET (FormatsCount), "Formats Count", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Specific Config, CapabilitiesSize == 2 */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt5[] = +{ + {ACPI_DMT_UINT32, ACPI_NHLT5_OFFSET (CapabilitiesSize), "Capabilities Size", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_NHLT5_OFFSET (VirtualSlot), "Virtual Slot", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT5_OFFSET (ConfigType), "Config Type", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Specific Config, CapabilitiesSize == 3 */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt5a[] = +{ + {ACPI_DMT_UINT32, ACPI_NHLT5A_OFFSET (CapabilitiesSize), "Capabilities Size", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_NHLT5A_OFFSET (VirtualSlot), "Virtual Slot", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT5A_OFFSET (ConfigType), "Config Type", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT5A_OFFSET (ArrayType), "Array Type", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Specific Config, CapabilitiesSize == 0 */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt5b[] = +{ + {ACPI_DMT_UINT32, ACPI_NHLT5B_OFFSET (CapabilitiesSize), "Capabilities Size", DT_LENGTH}, + ACPI_DMT_TERMINATOR +}; + +/* Specific Config, CapabilitiesSize == 1 */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt5c[] = +{ + {ACPI_DMT_UINT32, ACPI_NHLT5C_OFFSET (CapabilitiesSize), "Capabilities Size", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_NHLT5C_OFFSET (VirtualSlot), "Virtual Slot", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Microphone array Config */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt6[] = +{ + {ACPI_DMT_UINT8, ACPI_NHLT6_OFFSET (Type), "Type", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT6_OFFSET (Panel), "Panel", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (SpeakerPositionDistance), "Speaker Position Distance", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (HorizontalOffset), "Horizontal Offset", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (VerticalOffset), "Vertical Offset", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT6_OFFSET (FrequencyLowBand), "Frequency Low Band", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT6_OFFSET (FrequencyHighBand), "Frequency High Band", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (DirectionAngle), "Direction Angle", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (ElevationAngle), "Elevation Angle", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (WorkVerticalAngleBegin), "Work Vertical Angle Begin", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (WorkVerticalAngleEnd), "Work Vertical Angle End", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (WorkHorizontalAngleBegin), "Work Horizontal Angle Begin", 0}, + {ACPI_DMT_UINT16, ACPI_NHLT6_OFFSET (WorkHorizontalAngleEnd), "Work Horizontal Angle End", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Number of Linux-specific structures */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7[] = +{ + {ACPI_DMT_UINT8, ACPI_NHLT7_OFFSET (StructureCount), "Linux-specific struct count", 0}, + ACPI_DMT_TERMINATOR +}; + +/* The Linux-specific structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7a[] = +{ + {ACPI_DMT_BUF16, ACPI_NHLT7A_OFFSET (DeviceId), "Device ID", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT7A_OFFSET (DeviceInstanceId), "Device Instance ID", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT7A_OFFSET (DevicePortId), "Device Port ID", 0}, + {ACPI_DMT_BUF18, ACPI_NHLT7A_OFFSET (Filler), "Specific Data", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Table terminator (may or may not be present) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt8[] = +{ + {ACPI_DMT_UINT32, ACPI_NHLT8_OFFSET (TerminatorValue), "Terminator Value", 0}, + {ACPI_DMT_UINT32, ACPI_NHLT8_OFFSET (TerminatorSignature), "Terminator Signature", 0}, + ACPI_DMT_TERMINATOR +}; + + /******************************************************************************* * * PCCT - Platform Communications Channel Table (ACPI 5.0) diff --git a/sys/contrib/dev/acpica/common/dmtbinfo3.c b/sys/contrib/dev/acpica/common/dmtbinfo3.c index 9b2e30814921..63c49f2680e4 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo3.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo3.c @@ -368,21 +368,33 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat4[] = ACPI_DMT_TERMINATOR }; +/* Common SRAT structure for Generic Affinity Subtables */ + +#define ACPI_DM_SRAT_GENERIC_AFFINITY \ + {ACPI_DMT_UINT8, ACPI_SRAT5_OFFSET (Reserved), "Reserved1", 0}, \ + {ACPI_DMT_UINT8, ACPI_SRAT5_OFFSET (DeviceHandleType), "Device Handle Type", 0}, \ + {ACPI_DMT_UINT32, ACPI_SRAT5_OFFSET (ProximityDomain), "Proximity Domain", 0}, \ + {ACPI_DMT_BUF16, ACPI_SRAT5_OFFSET (DeviceHandle), "Device Handle", 0}, \ + {ACPI_DMT_UINT32, ACPI_SRAT5_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, \ + {ACPI_DMT_FLAG0, ACPI_SRAT5_FLAG_OFFSET (Flags,0), "Enabled", 0}, \ + {ACPI_DMT_FLAG1, ACPI_SRAT5_FLAG_OFFSET (Flags,0), "Architectural Transactions", 0}, \ + {ACPI_DMT_UINT32, ACPI_SRAT5_OFFSET (Reserved1), "Reserved2", 0} + /* 5: Generic Initiator Affinity Structure (ACPI 6.3) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat5[] = { - {ACPI_DMT_UINT8, ACPI_SRAT5_OFFSET (Reserved), "Reserved1", 0}, - {ACPI_DMT_UINT8, ACPI_SRAT5_OFFSET (DeviceHandleType), "Device Handle Type", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT5_OFFSET (ProximityDomain), "Proximity Domain", 0}, - {ACPI_DMT_BUF16, ACPI_SRAT5_OFFSET (DeviceHandle), "Device Handle", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT5_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_SRAT5_FLAG_OFFSET (Flags,0), "Enabled", 0}, - {ACPI_DMT_FLAG1, ACPI_SRAT5_FLAG_OFFSET (Flags,0), "Architectural Transactions", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT5_OFFSET (Reserved1), "Reserved2", 0}, + ACPI_DM_SRAT_GENERIC_AFFINITY, ACPI_DMT_TERMINATOR }; +/* 6: Generic Port Affinity Structure (ACPI 6.4) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSrat6[] = +{ + ACPI_DM_SRAT_GENERIC_AFFINITY, + ACPI_DMT_TERMINATOR +}; /******************************************************************************* * diff --git a/sys/contrib/dev/acpica/compiler/aslmethod.c b/sys/contrib/dev/acpica/compiler/aslmethod.c index a0cb02ae6dc8..889f2baf5e95 100644 --- a/sys/contrib/dev/acpica/compiler/aslmethod.c +++ b/sys/contrib/dev/acpica/compiler/aslmethod.c @@ -559,74 +559,56 @@ MtMethodAnalysisWalkBegin ( * * Under the Device Object: * - * 1) If _DIS is present, must have a _CRS, _PRS, and _SRS - * 2) If _PRS is present, must have a _CRS and _SRS - * 3) If _SRS is present, must have a _CRS and _PRS + * 1) If _PRS present, must have _CRS and _SRS + * 2) If _SRS present, must have _PRS (_PRS requires _CRS and _SRS) + * 3) If _DIS present, must have _SRS (_SRS requires _PRS, _PRS requires _CRS and _SRS) + * 4) If _SRS present, probably should have a _DIS (Remark only) */ CrsExists = ApFindNameInDeviceTree (METHOD_NAME__CRS, Op); DisExists = ApFindNameInDeviceTree (METHOD_NAME__DIS, Op); PrsExists = ApFindNameInDeviceTree (METHOD_NAME__PRS, Op); SrsExists = ApFindNameInDeviceTree (METHOD_NAME__SRS, Op); - /* 1) If _DIS is present, must have a _CRS, _PRS, and _SRS */ + /* 1) If _PRS is present, must have a _CRS and _SRS */ - if (DisExists) + if (PrsExists) { if (!CrsExists) { AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - "_DIS is missing a _CRS, requires a _CRS, _PRS, and a _SRS"); - } - - if (!PrsExists) - { - AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - "_DIS is missing a _PRS, requires a _CRS, _PRS, and a _SRS"); + "Device has a _PRS, missing a _CRS, required"); } - if (!SrsExists) { AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - "_DIS is missing a _SRS, requires a _CRS, _PRS, and a _SRS"); + "Device has a _PRS, missing a _SRS, required"); } } - /* 2) If _PRS is present, must have a _CRS and _SRS */ + /* 2) If _SRS is present, must have _PRS (_PRS requires _CRS and _SRS) */ - if (PrsExists) + if ((SrsExists) && (!PrsExists)) { - if (!CrsExists) - { - AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - "_PRS is missing a _CRS, requires a _CRS and a _SRS"); - } - - if (!SrsExists) - { - AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - "_PRS is missing a _SRS, requires a _CRS and a _SRS"); - } + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "Device has a _SRS, missing a _PRS, required"); } - /* 3) If _SRS is present, must have a _CRS and _PRS */ + /* 3) If _DIS is present, must have a _SRS */ - if (SrsExists) + if ((DisExists) && (!SrsExists)) { - if (!CrsExists) - { - AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - "_SRS is missing a _CRS, requires a _CRS and a _PRS"); - } - if (!PrsExists) - { - AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, - "_SRS is missing a _PRS, requires a _CRS and a _PRS"); - } - if (!DisExists) - { - AslError (ASL_REMARK, ASL_MSG_MISSING_DEPENDENCY, Op, - "_SRS is missing a _DIS"); - } + AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, + "Device has a _DIS, missing a _SRS, required"); + } + + /* + * 4) If _SRS is present, should have a _DIS (_PRS requires _CRS + * and _SRS) Remark only. + */ + if ((SrsExists) && (!DisExists)) + { + AslError (ASL_REMARK, ASL_MSG_MISSING_DEPENDENCY, Op, + "Device has a _SRS, no corresponding _DIS"); } break; diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h index c58ad55cd6cb..e31566e0c3d3 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompiler.h +++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h @@ -657,6 +657,10 @@ ACPI_STATUS DtCompileNfit ( void **PFieldList); +ACPI_STATUS +DtCompileNhlt ( + void **PFieldList); + ACPI_STATUS DtCompilePcct ( void **PFieldList); diff --git a/sys/contrib/dev/acpica/compiler/dttable2.c b/sys/contrib/dev/acpica/compiler/dttable2.c index 13a4a562d3ed..a8c81e2c4729 100644 --- a/sys/contrib/dev/acpica/compiler/dttable2.c +++ b/sys/contrib/dev/acpica/compiler/dttable2.c @@ -2062,6 +2062,11 @@ DtCompileSrat ( InfoTable = AcpiDmTableInfoSrat5; break; + case ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat6; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT"); diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index a847539289a1..78c0bdd8528e 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/compiler/dtutils.c @@ -581,6 +581,8 @@ DtGetFieldLength ( case ACPI_DMT_IVRS_DE: case ACPI_DMT_GTDT: case ACPI_DMT_MADT: + case ACPI_DMT_NHLT1: + case ACPI_DMT_NHLT1a: case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: diff --git a/sys/contrib/dev/acpica/compiler/preprocess.h b/sys/contrib/dev/acpica/compiler/preprocess.h index 6343a49c1ff2..f4c8c30966a2 100644 --- a/sys/contrib/dev/acpica/compiler/preprocess.h +++ b/sys/contrib/dev/acpica/compiler/preprocess.h @@ -355,7 +355,7 @@ PrEvaluateExpression ( /* - * prutils - Preprocesor utilities + * prutils - Preprocessor utilities */ char * PrGetNextToken ( diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsfield.c b/sys/contrib/dev/acpica/components/dispatcher/dsfield.c index 5067a7aa1689..70ba3fbd8124 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsfield.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsfield.c @@ -797,7 +797,7 @@ AcpiDsInitFieldObjects ( } #ifdef ACPI_EXEC_APP - Flags |= ACPI_NS_OVERRIDE_IF_FOUND; + Flags |= ACPI_NS_OVERRIDE_IF_FOUND; #endif /* * Walk the list of entries in the FieldList diff --git a/sys/contrib/dev/acpica/components/hardware/hwesleep.c b/sys/contrib/dev/acpica/components/hardware/hwesleep.c index 6fb1a6718378..97554dfb9880 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwesleep.c +++ b/sys/contrib/dev/acpica/components/hardware/hwesleep.c @@ -312,18 +312,15 @@ ACPI_STATUS AcpiHwExtendedWakePrep ( UINT8 SleepState) { - ACPI_STATUS Status; UINT8 SleepTypeValue; ACPI_FUNCTION_TRACE (HwExtendedWakePrep); - Status = AcpiGetSleepTypeData (ACPI_STATE_S0, - &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); - if (ACPI_SUCCESS (Status)) + if (AcpiGbl_SleepTypeAS0 != ACPI_SLEEP_TYPE_INVALID) { - SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) & + SleepTypeValue = ((AcpiGbl_SleepTypeAS0 << ACPI_X_SLEEP_TYPE_POSITION) & ACPI_X_SLEEP_TYPE_MASK); (void) AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE), diff --git a/sys/contrib/dev/acpica/components/hardware/hwsleep.c b/sys/contrib/dev/acpica/components/hardware/hwsleep.c index 9ce6fe3f93cf..63e9c69cbdb4 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwsleep.c +++ b/sys/contrib/dev/acpica/components/hardware/hwsleep.c @@ -339,7 +339,7 @@ ACPI_STATUS AcpiHwLegacyWakePrep ( UINT8 SleepState) { - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; *** 543 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Oct 1 02:31:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 904F2675C83; Fri, 1 Oct 2021 02:31: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 4HLDdV3WcTz3FZB; Fri, 1 Oct 2021 02:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58C5917076; Fri, 1 Oct 2021 02:31: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 1912VgNL054493; Fri, 1 Oct 2021 02:31:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1912VgYQ054492; Fri, 1 Oct 2021 02:31:42 GMT (envelope-from git) Date: Fri, 1 Oct 2021 02:31:42 GMT Message-Id: <202110010231.1912VgYQ054492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 9c999a259f00 - main - kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME 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/main X-Git-Reftype: branch X-Git-Commit: 9c999a259f00b35f0467acd351fea9157ed7e1e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 02:31:42 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9c999a259f00b35f0467acd351fea9157ed7e1e4 commit 9c999a259f00b35f0467acd351fea9157ed7e1e4 Author: Kyle Evans AuthorDate: 2021-09-29 19:55:59 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 02:31:24 +0000 kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME NOTE_ABSTIME values are converted to values relative to boottime in filt_timervalidate(), and negative values are currently rejected. We don't reject times in the past in general, so clamp this up to 0 as needed such that the timer fires immediately rather than imposing what looks like an arbitrary restriction. Another possible scenario is that the system clock had to be adjusted by ~minutes or ~hours and we have less than that in terms of uptime, making a reasonable short-timeout suddenly invalid. Firing it is still a valid choice in this scenario so that applications can at least expect a consistent behavior. Reviewed by: kib, markj Discussed with: allanjude Differential Revision: https://reviews.freebsd.org/D32230 --- sys/kern/kern_event.c | 11 +++-- tests/sys/kqueue/libkqueue/timer.c | 84 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 5fa5bf9cad06..3cd7753d4f6d 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -798,13 +798,13 @@ filt_timervalidate(struct knote *kn, sbintime_t *to) return (EINVAL); *to = timer2sbintime(kn->kn_sdata, kn->kn_sfflags); + if (*to < 0) + return (EINVAL); if ((kn->kn_sfflags & NOTE_ABSTIME) != 0) { getboottimebin(&bt); sbt = bttosbt(bt); - *to -= sbt; + *to = MAX(0, *to - sbt); } - if (*to < 0) - return (EINVAL); return (0); } @@ -815,9 +815,14 @@ filt_timerattach(struct knote *kn) sbintime_t to; int error; + to = -1; error = filt_timervalidate(kn, &to); if (error != 0) return (error); + KASSERT((kn->kn_flags & EV_ONESHOT) != 0 || to > 0, + ("%s: periodic timer has a calculated zero timeout", __func__)); + KASSERT(to >= 0, + ("%s: timer has a calculated negative timeout", __func__)); if (atomic_fetchadd_int(&kq_ncallouts, 1) + 1 > kq_calloutmax) { atomic_subtract_int(&kq_ncallouts, 1); diff --git a/tests/sys/kqueue/libkqueue/timer.c b/tests/sys/kqueue/libkqueue/timer.c index cb22887be276..76dfc99e11f0 100644 --- a/tests/sys/kqueue/libkqueue/timer.c +++ b/tests/sys/kqueue/libkqueue/timer.c @@ -247,6 +247,88 @@ test_abstime(void) success(); } +static void +test_abstime_preboot(void) +{ + const char *test_id = "kevent(EVFILT_TIMER (PREBOOT), EV_ONESHOT, NOTE_ABSTIME)"; + struct kevent kev; + struct timespec btp; + uint64_t end, start, stop; + + test_begin(test_id); + + test_no_kevents(); + + /* + * We'll expire it at just before system boot (roughly) with the hope that + * we'll get an ~immediate expiration, just as we do for any value specified + * between system boot and now. + */ + start = now(); + if (clock_gettime(CLOCK_BOOTTIME, &btp) != 0) + err(1, "%s", test_id); + + end = start - SEC_TO_US(btp.tv_sec + 1); + EV_SET(&kev, vnode_fd, EVFILT_TIMER, EV_ADD | EV_ONESHOT, + NOTE_ABSTIME | NOTE_USECONDS, end, NULL); + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + /* Retrieve the event */ + kev.flags = EV_ADD | EV_ONESHOT; + kev.data = 1; + kev.fflags = 0; + kevent_cmp(&kev, kevent_get(kqfd)); + + stop = now(); + if (stop < end) + err(1, "too early %jd %jd", (intmax_t)stop, (intmax_t)end); + /* Check if the event occurs again */ + sleep(3); + test_no_kevents(); + + success(); +} + +static void +test_abstime_postboot(void) +{ + const char *test_id = "kevent(EVFILT_TIMER (POSTBOOT), EV_ONESHOT, NOTE_ABSTIME)"; + struct kevent kev; + uint64_t end, start, stop; + const int timeout_sec = 1; + + test_begin(test_id); + + test_no_kevents(); + + /* + * Set a timer for 1 second ago, it should fire immediately rather than + * being rejected. + */ + start = now(); + end = start - SEC_TO_US(timeout_sec); + EV_SET(&kev, vnode_fd, EVFILT_TIMER, EV_ADD | EV_ONESHOT, + NOTE_ABSTIME | NOTE_USECONDS, end, NULL); + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + /* Retrieve the event */ + kev.flags = EV_ADD | EV_ONESHOT; + kev.data = 1; + kev.fflags = 0; + kevent_cmp(&kev, kevent_get(kqfd)); + + stop = now(); + if (stop < end) + err(1, "too early %jd %jd", (intmax_t)stop, (intmax_t)end); + /* Check if the event occurs again */ + sleep(3); + test_no_kevents(); + + success(); +} + static void test_update(void) { @@ -517,6 +599,8 @@ test_evfilt_timer(void) test_oneshot(); test_periodic(); test_abstime(); + test_abstime_preboot(); + test_abstime_postboot(); test_update(); test_update_equal(); test_update_expired(); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 02:31:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1184675B36; Fri, 1 Oct 2021 02:31: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 4HLDdW4tr7z3FZD; Fri, 1 Oct 2021 02:31:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 751DF17770; Fri, 1 Oct 2021 02:31: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 1912Vh2L054522; Fri, 1 Oct 2021 02:31:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1912Vhip054521; Fri, 1 Oct 2021 02:31:43 GMT (envelope-from git) Date: Fri, 1 Oct 2021 02:31:43 GMT Message-Id: <202110010231.1912Vhip054521@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 4b5554cebb66 - main - kqueue: document how timers with low/past timeouts are handled 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/main X-Git-Reftype: branch X-Git-Commit: 4b5554cebb66020f59dc869b835aebbd66e4bb8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 02:31:44 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4b5554cebb66020f59dc869b835aebbd66e4bb8c commit 4b5554cebb66020f59dc869b835aebbd66e4bb8c Author: Kyle Evans AuthorDate: 2021-09-30 18:19:05 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 02:31:28 +0000 kqueue: document how timers with low/past timeouts are handled Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D32237 --- lib/libc/sys/kqueue.2 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index 3ded4ae3d8f7..72b3e544391c 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2021 +.Dd September 30, 2021 .Dt KQUEUE 2 .Os .Sh NAME @@ -599,6 +599,12 @@ On return, .Va fflags contains the events which triggered the filter. .Pp +Periodic timers with a specified timeout of 0 will be silently adjusted to +timeout after 1 of the time units specified by the requested precision in +.Va fflags . +If an absolute time is specified that has already passed, then it is treated as +if the current time were specified and the event will fire as soon as possible. +.Pp If an existing timer is re-added, the existing timer will be effectively canceled (throwing away any undelivered record of previous timer expiration) and re-started using the new parameters contained in From owner-dev-commits-src-all@freebsd.org Fri Oct 1 02:31:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4C92675C39; Fri, 1 Oct 2021 02:31: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 4HLDdX5jKXz3FdZ; Fri, 1 Oct 2021 02:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FDC217436; Fri, 1 Oct 2021 02:31: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 1912ViMZ054546; Fri, 1 Oct 2021 02:31:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1912VisA054545; Fri, 1 Oct 2021 02:31:44 GMT (envelope-from git) Date: Fri, 1 Oct 2021 02:31:44 GMT Message-Id: <202110010231.1912VisA054545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 0f43c5b55c79 - main - kqueue: clean up some igor and mandoc -Tlint warnings 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/main X-Git-Reftype: branch X-Git-Commit: 0f43c5b55c79f8d4bae8c91e4f0c397944814152 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 02:31:45 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0f43c5b55c79f8d4bae8c91e4f0c397944814152 commit 0f43c5b55c79f8d4bae8c91e4f0c397944814152 Author: Kyle Evans AuthorDate: 2021-09-30 18:22:01 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 02:31:28 +0000 kqueue: clean up some igor and mandoc -Tlint warnings --- lib/libc/sys/kqueue.2 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index 72b3e544391c..f80c89f75d78 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -267,16 +267,17 @@ Causes .Fn kevent to leave unchanged any .Fa udata -associated with an existing event. This allows other aspects of the -event to be modified without requiring the caller to know the +associated with an existing event. +This allows other aspects of the event to be modified without requiring the +caller to know the .Fa udata value presently associated. This is especially useful with .Dv NOTE_TRIGGER or flags like -.Dv EV_ENABLE. +.Dv EV_ENABLE . This flag may not be used with -.Dv EV_ADD. +.Dv EV_ADD . .El .Pp The predefined system filters are listed below. From owner-dev-commits-src-all@freebsd.org Fri Oct 1 04:47:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4526677C20; Fri, 1 Oct 2021 04: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 4HLHdw52H6z3kQb; Fri, 1 Oct 2021 04:47:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C9611915F; Fri, 1 Oct 2021 04: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 1914lGXQ029717; Fri, 1 Oct 2021 04: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 1914lGM4029716; Fri, 1 Oct 2021 04:47:16 GMT (envelope-from git) Date: Fri, 1 Oct 2021 04:47:16 GMT Message-Id: <202110010447.1914lGM4029716@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: cfb9be506285 - main - bootp: remove the USE_BFUNCS knob 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/main X-Git-Reftype: branch X-Git-Commit: cfb9be506285cd65120f9686d532130a3757ce56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 04:47:16 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=cfb9be506285cd65120f9686d532130a3757ce56 commit cfb9be506285cd65120f9686d532130a3757ce56 Author: Kyle Evans AuthorDate: 2021-09-30 03:01:34 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 04:47:06 +0000 bootp: remove the USE_BFUNCS knob We'd likely be better served by converting these to the equivalent mem* calls, but just kill the knob for now. The b* macros being defined get in the way of _FORTIFY_SOURCE. Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D32235 --- libexec/bootpd/bootpd.c | 8 -------- libexec/bootpd/bootpgw/bootpgw.c | 8 -------- libexec/bootpd/dovend.c | 9 --------- libexec/bootpd/dumptab.c | 9 +-------- libexec/bootpd/hash.c | 9 +-------- libexec/bootpd/hwaddr.c | 8 -------- libexec/bootpd/lookup.c | 7 +------ libexec/bootpd/readfile.c | 8 -------- libexec/bootpd/tools/bootpef/bootpef.c | 8 -------- libexec/bootpd/tools/bootptest/bootptest.h | 8 -------- 10 files changed, 3 insertions(+), 79 deletions(-) diff --git a/libexec/bootpd/bootpd.c b/libexec/bootpd/bootpd.c index 86e4f56ab61a..42f1cd8c5912 100644 --- a/libexec/bootpd/bootpd.c +++ b/libexec/bootpd/bootpd.c @@ -73,14 +73,6 @@ __FBSDID("$FreeBSD$"); # include /* for O_RDONLY, etc */ #endif -#ifndef USE_BFUNCS -# include -/* Yes, memcpy is OK here (no overlapped copies). */ -# define bcopy(a,b,c) memcpy(b,a,c) -# define bzero(p,l) memset(p,0,l) -# define bcmp(a,b,c) memcmp(a,b,c) -#endif - #include "bootp.h" #include "hash.h" #include "hwaddr.h" diff --git a/libexec/bootpd/bootpgw/bootpgw.c b/libexec/bootpd/bootpgw/bootpgw.c index 2e2df9e71a2a..3c128c03a9a6 100644 --- a/libexec/bootpd/bootpgw/bootpgw.c +++ b/libexec/bootpd/bootpgw/bootpgw.c @@ -66,14 +66,6 @@ __FBSDID("$FreeBSD$"); # include /* for O_RDONLY, etc */ #endif -#ifndef USE_BFUNCS -# include -/* Yes, memcpy is OK here (no overlapped copies). */ -# define bcopy(a,b,c) memcpy(b,a,c) -# define bzero(p,l) memset(p,0,l) -# define bcmp(a,b,c) memcmp(a,b,c) -#endif - #include "bootp.h" #include "getif.h" #include "hwaddr.h" diff --git a/libexec/bootpd/dovend.c b/libexec/bootpd/dovend.c index cb0b4a0448c4..65543a2700c0 100644 --- a/libexec/bootpd/dovend.c +++ b/libexec/bootpd/dovend.c @@ -15,15 +15,6 @@ #include #include -#ifndef USE_BFUNCS -# include -/* Yes, memcpy is OK here (no overlapped copies). */ -# define bcopy(a,b,c) memcpy(b,a,c) -# define bzero(p,l) memset(p,0,l) -# define bcmp(a,b,c) memcmp(a,b,c) -# define index strchr -#endif - #include "bootp.h" #include "bootpd.h" #include "report.h" diff --git a/libexec/bootpd/dumptab.c b/libexec/bootpd/dumptab.c index 43e94ec4cef2..daab93f609a6 100644 --- a/libexec/bootpd/dumptab.c +++ b/libexec/bootpd/dumptab.c @@ -10,17 +10,10 @@ #include #include +#include #include #include -#ifndef USE_BFUNCS -#include -/* Yes, memcpy is OK here (no overlapped copies). */ -#define bcopy(a,b,c) memcpy(b,a,c) -#define bzero(p,l) memset(p,0,l) -#define bcmp(a,b,c) memcmp(a,b,c) -#endif - #include "bootp.h" #include "hash.h" #include "hwaddr.h" diff --git a/libexec/bootpd/hash.c b/libexec/bootpd/hash.c index 64f49d3b957d..1641a8a092cd 100644 --- a/libexec/bootpd/hash.c +++ b/libexec/bootpd/hash.c @@ -37,14 +37,7 @@ SOFTWARE. #include #include - -#ifndef USE_BFUNCS -#include -/* Yes, memcpy is OK here (no overlapped copies). */ -#define bcopy(a,b,c) memcpy(b,a,c) -#define bzero(p,l) memset(p,0,l) -#define bcmp(a,b,c) memcmp(a,b,c) -#endif +#include #include "hash.h" diff --git a/libexec/bootpd/hwaddr.c b/libexec/bootpd/hwaddr.c index ff996157b911..293c75a6b3be 100644 --- a/libexec/bootpd/hwaddr.c +++ b/libexec/bootpd/hwaddr.c @@ -38,14 +38,6 @@ #endif #include -#ifndef USE_BFUNCS -/* Yes, memcpy is OK here (no overlapped copies). */ -#include -#define bcopy(a,b,c) memcpy(b,a,c) -#define bzero(p,l) memset(p,0,l) -#define bcmp(a,b,c) memcmp(a,b,c) -#endif - #ifndef ATF_INUSE /* Not defined on some systems (i.e. Linux) */ #define ATF_INUSE 0 #endif diff --git a/libexec/bootpd/lookup.c b/libexec/bootpd/lookup.c index 54b3f62242f7..391a1d826d6e 100644 --- a/libexec/bootpd/lookup.c +++ b/libexec/bootpd/lookup.c @@ -17,14 +17,9 @@ extern int ether_hostton(); #endif #include +#include #include -#ifndef USE_BFUNCS -#include -/* Yes, memcpy is OK here (no overlapped copies). */ -#define bcopy(a,b,c) memcpy(b,a,c) -#endif - #include "bootp.h" #include "lookup.h" #include "report.h" diff --git a/libexec/bootpd/readfile.c b/libexec/bootpd/readfile.c index 900d0377279f..c09639300310 100644 --- a/libexec/bootpd/readfile.c +++ b/libexec/bootpd/readfile.c @@ -46,14 +46,6 @@ SOFTWARE. #include #include -#ifndef USE_BFUNCS -#include -/* Yes, memcpy is OK here (no overlapped copies). */ -#define bcopy(a,b,c) memcpy(b,a,c) -#define bzero(p,l) memset(p,0,l) -#define bcmp(a,b,c) memcmp(a,b,c) -#endif - #include "bootp.h" #include "hash.h" #include "hwaddr.h" diff --git a/libexec/bootpd/tools/bootpef/bootpef.c b/libexec/bootpd/tools/bootpef/bootpef.c index 04089c87b560..7ed3786d892e 100644 --- a/libexec/bootpd/tools/bootpef/bootpef.c +++ b/libexec/bootpd/tools/bootpef/bootpef.c @@ -55,14 +55,6 @@ SOFTWARE. #include #include -#ifndef USE_BFUNCS -#include -/* Yes, memcpy is OK here (no overlapped copies). */ -#define bcopy(a,b,c) memcpy(b,a,c) -#define bzero(p,l) memset(p,0,l) -#define bcmp(a,b,c) memcmp(a,b,c) -#endif - #include "bootp.h" #include "hash.h" #include "hwaddr.h" diff --git a/libexec/bootpd/tools/bootptest/bootptest.h b/libexec/bootpd/tools/bootptest/bootptest.h index 2df35dea7ffc..2d9e451bddef 100644 --- a/libexec/bootpd/tools/bootptest/bootptest.h +++ b/libexec/bootpd/tools/bootptest/bootptest.h @@ -6,14 +6,6 @@ #define ESRC(p) (p) #define EDST(p) (p) -#ifndef USE_BFUNCS -/* Use mem/str functions */ -/* There are no overlapped copies, so memcpy is OK. */ -#define bcopy(a,b,c) memcpy(b,a,c) -#define bzero(p,l) memset(p,0,l) -#define bcmp(a,b,c) memcmp(a,b,c) -#endif - extern int vflag; /* verbose flag */ /* global pointers to beginning and end of current packet (during printing) */ From owner-dev-commits-src-all@freebsd.org Fri Oct 1 04:56:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44F9C6779BA; Fri, 1 Oct 2021 04:56: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 4HLHr91J7cz3kYH; Fri, 1 Oct 2021 04:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 096DE19523; Fri, 1 Oct 2021 04:56: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 1914u83T043227; Fri, 1 Oct 2021 04:56:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1914u8xE043226; Fri, 1 Oct 2021 04:56:08 GMT (envelope-from git) Date: Fri, 1 Oct 2021 04:56:08 GMT Message-Id: <202110010456.1914u8xE043226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 5487294d79f9 - main - libc: ssp: sprinkle around some __dead2 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/main X-Git-Reftype: branch X-Git-Commit: 5487294d79f9ebe72a847d0855adb4df85e0d66e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 04:56:09 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5487294d79f9ebe72a847d0855adb4df85e0d66e commit 5487294d79f9ebe72a847d0855adb4df85e0d66e Author: Kyle Evans AuthorDate: 2021-09-29 21:48:20 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 04:55:17 +0000 libc: ssp: sprinkle around some __dead2 This is consistent with, e.g., NetBSD's implementation, which declares these as noreturn in ssp/ssp.h. --- lib/libc/secure/stack_protector.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libc/secure/stack_protector.c b/lib/libc/secure/stack_protector.c index 15460278502d..7ddd6338ec55 100644 --- a/lib/libc/secure/stack_protector.c +++ b/lib/libc/secure/stack_protector.c @@ -64,9 +64,9 @@ extern int __sysctl(const int *name, u_int namelen, void *oldp, long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; static void __guard_setup(void) _GUARD_SETUP_CTOR_ATTR; -static void __fail(const char *); -void __stack_chk_fail(void); -void __chk_fail(void); +static void __fail(const char *) __dead2; +void __stack_chk_fail(void) __dead2; +void __chk_fail(void) __dead2; /*LINTED used*/ static void From owner-dev-commits-src-all@freebsd.org Fri Oct 1 04:56:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 772A66779BB; Fri, 1 Oct 2021 04:56: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 4HLHrB2XHrz3kwb; Fri, 1 Oct 2021 04:56:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D4241971B; Fri, 1 Oct 2021 04:56: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 1914uAge043251; Fri, 1 Oct 2021 04:56:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1914uATv043250; Fri, 1 Oct 2021 04:56:10 GMT (envelope-from git) Date: Fri, 1 Oct 2021 04:56:10 GMT Message-Id: <202110010456.1914uATv043250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 4dbd8c72d303 - main - tcp_wrappers: get rid of duplicate fgets declarations 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/main X-Git-Reftype: branch X-Git-Commit: 4dbd8c72d3030b8f111fdac86ba45ff596595497 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 04:56:10 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4dbd8c72d3030b8f111fdac86ba45ff596595497 commit 4dbd8c72d3030b8f111fdac86ba45ff596595497 Author: Kyle Evans AuthorDate: 2021-09-30 04:21:24 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 04:55:27 +0000 tcp_wrappers: get rid of duplicate fgets declarations This is declared in stdio.h, no need for this one. --- contrib/tcp_wrappers/hosts_access.c | 1 - contrib/tcp_wrappers/misc.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/contrib/tcp_wrappers/hosts_access.c b/contrib/tcp_wrappers/hosts_access.c index f5ab91bebc98..58998055b516 100644 --- a/contrib/tcp_wrappers/hosts_access.c +++ b/contrib/tcp_wrappers/hosts_access.c @@ -46,7 +46,6 @@ static char sccsid[] = "@(#) hosts_access.c 1.21 97/02/12 02:13:22"; #endif #include -extern char *fgets(); extern int errno; #ifndef INADDR_NONE diff --git a/contrib/tcp_wrappers/misc.c b/contrib/tcp_wrappers/misc.c index 8f04f870e1b4..258d7091adce 100644 --- a/contrib/tcp_wrappers/misc.c +++ b/contrib/tcp_wrappers/misc.c @@ -19,8 +19,6 @@ static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29"; #include "tcpd.h" -extern char *fgets(); - #ifndef INADDR_NONE #define INADDR_NONE (-1) /* XXX should be 0xffffffff */ #endif From owner-dev-commits-src-all@freebsd.org Fri Oct 1 06:56:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D72067E570; Fri, 1 Oct 2021 06:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HLLW30Jbpz4qHb; Fri, 1 Oct 2021 06:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DED4B1B020; Fri, 1 Oct 2021 06:56: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 1916uUWK002735; Fri, 1 Oct 2021 06:56:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1916uU9F002734; Fri, 1 Oct 2021 06:56:30 GMT (envelope-from git) Date: Fri, 1 Oct 2021 06:56:30 GMT Message-Id: <202110010656.1916uU9F002734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: b91af716ed87 - stable/13 - loader: dev_net.c should use __func__ with printf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b91af716ed87bc214e8fffcf0f2c33039197fec4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 06:56:31 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=b91af716ed87bc214e8fffcf0f2c33039197fec4 commit b91af716ed87bc214e8fffcf0f2c33039197fec4 Author: Toomas Soome AuthorDate: 2021-09-24 14:07:20 +0000 Commit: Toomas Soome CommitDate: 2021-10-01 06:55:18 +0000 loader: dev_net.c should use __func__ with printf We have printf calls with function name hardwired to string, sometimes wrong name. Use __func__ instead. (cherry picked from commit 1a25c51e38a7c9f46ec195836233636616741f06) --- stand/common/dev_net.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/stand/common/dev_net.c b/stand/common/dev_net.c index 1fa955ac1cf1..db13e618e822 100644 --- a/stand/common/dev_net.c +++ b/stand/common/dev_net.c @@ -141,13 +141,14 @@ net_open(struct open_file *f, ...) if (netdev_sock < 0) { netdev_sock = netif_open(dev); if (netdev_sock < 0) { - printf("net_open: netif_open() failed\n"); + printf("%s: netif_open() failed\n", __func__); return (ENXIO); } netdev_name = strdup(devname); #ifdef NETIF_DEBUG if (debug) - printf("net_open: netif_open() succeeded\n"); + printf("%s: netif_open() succeeded\n", + __func__); #endif } /* @@ -202,7 +203,7 @@ net_close(struct open_file *f) #ifdef NETIF_DEBUG if (debug) - printf("net_close: opens=%d\n", netdev_opens); + printf("%s: opens=%d\n", __func__, netdev_opens); #endif f->f_devdata = NULL; @@ -217,7 +218,7 @@ net_cleanup(void) if (netdev_sock >= 0) { #ifdef NETIF_DEBUG if (debug) - printf("net_cleanup: calling netif_close()\n"); + printf("%s: calling netif_close()\n", __func__); #endif rootip.s_addr = 0; free(netdev_name); @@ -272,7 +273,7 @@ net_getparams(int sock) goto exit; #ifdef NETIF_DEBUG if (debug) - printf("net_open: BOOTP failed, trying RARP/RPC...\n"); + printf("%s: BOOTP failed, trying RARP/RPC...\n", __func__); #endif #endif @@ -281,19 +282,19 @@ net_getparams(int sock) * netmask to the "natural" default for our address. */ if (rarp_getipaddress(sock)) { - printf("net_open: RARP failed\n"); + printf("%s: RARP failed\n", __func__); return (EIO); } - printf("net_open: client addr: %s\n", inet_ntoa(myip)); + printf("%s: client addr: %s\n", __func__, inet_ntoa(myip)); /* Get our hostname, server IP address, gateway. */ if (bp_whoami(sock)) { - printf("net_open: bootparam/whoami RPC failed\n"); + printf("%s: bootparam/whoami RPC failed\n", __func__); return (EIO); } #ifdef NETIF_DEBUG if (debug) - printf("net_open: client name: %s\n", hostname); + printf("%s: client name: %s\n", __func__, hostname); #endif /* @@ -310,17 +311,18 @@ net_getparams(int sock) netmask = smask; #ifdef NETIF_DEBUG if (debug) - printf("net_open: subnet mask: %s\n", intoa(netmask)); + printf("%s: subnet mask: %s\n", __func__, + intoa(netmask)); #endif } #ifdef NETIF_DEBUG if (gateip.s_addr && debug) - printf("net_open: net gateway: %s\n", inet_ntoa(gateip)); + printf("%s: net gateway: %s\n", __func__, inet_ntoa(gateip)); #endif /* Get the root server and pathname. */ if (bp_getfile(sock, "root", &rootip, rootpath)) { - printf("net_open: bootparam/getfile RPC failed\n"); + printf("%s: bootparam/getfile RPC failed\n", __func__); return (EIO); } exit: @@ -329,8 +331,8 @@ exit: #ifdef NETIF_DEBUG if (debug) { - printf("net_open: server addr: %s\n", inet_ntoa(rootip)); - printf("net_open: server path: %s\n", rootpath); + printf("%s: server addr: %s\n", __func__, inet_ntoa(rootip)); + printf("%s: server path: %s\n", __func__, rootpath); } #endif From owner-dev-commits-src-all@freebsd.org Fri Oct 1 09:26:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3D8C6AA0C4; Fri, 1 Oct 2021 09:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HLPqv4mWGz3Phw; Fri, 1 Oct 2021 09:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CD7C1CCED; Fri, 1 Oct 2021 09:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1919QJ0I003813; Fri, 1 Oct 2021 09:26:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1919QJ4f003812; Fri, 1 Oct 2021 09:26:19 GMT (envelope-from git) Date: Fri, 1 Oct 2021 09:26:19 GMT Message-Id: <202110010926.1919QJ4f003812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 8cbbe3510536 - main - arm64: std.nxp Add enetc NIC driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8cbbe351053634f8ef8fbaf0c56d8fee46642bf6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 09:26:19 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=8cbbe351053634f8ef8fbaf0c56d8fee46642bf6 commit 8cbbe351053634f8ef8fbaf0c56d8fee46642bf6 Author: Kornel Duleba AuthorDate: 2021-09-30 07:34:52 +0000 Commit: Wojciech Macek CommitDate: 2021-10-01 09:24:08 +0000 arm64: std.nxp Add enetc NIC driver It was missed during the conversion of kernel configs. Although the driver is already built as a kernel module we might want to have it built-in for diskless booting and such. --- sys/arm64/conf/std.nxp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/arm64/conf/std.nxp b/sys/arm64/conf/std.nxp index f67f4f0267ec..05e74fca5170 100644 --- a/sys/arm64/conf/std.nxp +++ b/sys/arm64/conf/std.nxp @@ -19,6 +19,9 @@ device dwc3 # Synopsys DWC controller # MMC/SD/SDIO Card slot support device sdhci +# Ethernet NICs +device enetc # QorIQ LS1028A NIC + options FDT device acpi From owner-dev-commits-src-all@freebsd.org Fri Oct 1 09:26:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD9776A9BC9; Fri, 1 Oct 2021 09:26: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 4HLPqw4tP6z3PYf; Fri, 1 Oct 2021 09:26:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88CCB1CC35; Fri, 1 Oct 2021 09:26: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 1919QKQ9003843; Fri, 1 Oct 2021 09:26:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1919QK5Z003842; Fri, 1 Oct 2021 09:26:20 GMT (envelope-from git) Date: Fri, 1 Oct 2021 09:26:20 GMT Message-Id: <202110010926.1919QK5Z003842@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: a75400c5addf - main - modules: felix: Remove etherswitch_if.c from Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a75400c5addf905edea7897c5071904556a691f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 09:26:20 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=a75400c5addf905edea7897c5071904556a691f2 commit a75400c5addf905edea7897c5071904556a691f2 Author: Kornel Duleba AuthorDate: 2021-09-30 11:06:34 +0000 Commit: Wojciech Macek CommitDate: 2021-10-01 09:24:08 +0000 modules: felix: Remove etherswitch_if.c from Makefile Having it included confuses KOBJOPLOOKUP resulting in kobj_error_method being called instead of a devmethod from the switch driver. That in turn returns ENXIO which was treated as a pointer and dereferenced by etherswitch ioctl logic causing the kernel to panic. Fixes: b542c9e42ba4 (modules: felix: Add needed dependencies) --- sys/modules/felix/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/modules/felix/Makefile b/sys/modules/felix/Makefile index a9eac1080c91..8f30a0e72a45 100644 --- a/sys/modules/felix/Makefile +++ b/sys/modules/felix/Makefile @@ -29,7 +29,7 @@ .PATH: ${SRCTOP}/sys/dev/etherswitch/felix KMOD = felix -SRCS = felix.c etherswitch_if.c etherswitch_if.h -SRCS += bus_if.h device_if.h miibus_if.h ofw_bus_if.h pci_if.h +SRCS = felix.c +SRCS += bus_if.h device_if.h etherswitch_if.h miibus_if.h ofw_bus_if.h pci_if.h .include From owner-dev-commits-src-all@freebsd.org Fri Oct 1 09:26:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B9E66A9CEA; Fri, 1 Oct 2021 09:26: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 4HLPqx69jRz3PfG; Fri, 1 Oct 2021 09:26:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA3E11CEE6; Fri, 1 Oct 2021 09:26: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 1919QLPo003868; Fri, 1 Oct 2021 09:26:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1919QLX9003867; Fri, 1 Oct 2021 09:26:21 GMT (envelope-from git) Date: Fri, 1 Oct 2021 09:26:21 GMT Message-Id: <202110010926.1919QLX9003867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: ca4a6606f0b8 - main - enetc_mdio: Fix devclass name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca4a6606f0b8c4386e3c05a57e1370e2f215d5b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 09:26:22 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=ca4a6606f0b8c4386e3c05a57e1370e2f215d5b9 commit ca4a6606f0b8c4386e3c05a57e1370e2f215d5b9 Author: Kornel Duleba AuthorDate: 2021-08-05 10:31:33 +0000 Commit: Wojciech Macek CommitDate: 2021-10-01 09:24:08 +0000 enetc_mdio: Fix devclass name Use correct devclass name, due to the mismatch miibus would attach to the wrong thing causing mii_attach to silently fail. Fixes: dfcaa2c18bf9 (enetc_mdio: Support building the driver ...) --- sys/dev/enetc/enetc_mdio_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/enetc/enetc_mdio_pci.c b/sys/dev/enetc/enetc_mdio_pci.c index aac236d1c246..517efa9b9598 100644 --- a/sys/dev/enetc/enetc_mdio_pci.c +++ b/sys/dev/enetc/enetc_mdio_pci.c @@ -177,7 +177,7 @@ static device_method_t enetc_mdio_pci_methods[] ={ }; static driver_t enetc_mdio_pci_driver = { - "enetc_mdio_pci", + "enetc_mdio", enetc_mdio_pci_methods, sizeof(struct enetc_mdio_pci_softc), }; From owner-dev-commits-src-all@freebsd.org Fri Oct 1 10:27:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F1FD6ABA94; Fri, 1 Oct 2021 10:27:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HLRC06pnTz3kYx; Fri, 1 Oct 2021 10:27:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF9141DA9A; Fri, 1 Oct 2021 10:27: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 191ARuAG083603; Fri, 1 Oct 2021 10:27:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191ARuRn083602; Fri, 1 Oct 2021 10:27:56 GMT (envelope-from git) Date: Fri, 1 Oct 2021 10:27:56 GMT Message-Id: <202110011027.191ARuRn083602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 7ec86b660991 - main - Also print symbols when printing arm64 registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ec86b66099124a9c2c88613507a10979cb8b191 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 10:27:57 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7ec86b66099124a9c2c88613507a10979cb8b191 commit 7ec86b66099124a9c2c88613507a10979cb8b191 Author: Andrew Turner AuthorDate: 2021-09-23 10:32:16 +0000 Commit: Andrew Turner CommitDate: 2021-10-01 10:27:32 +0000 Also print symbols when printing arm64 registers When printing arm64 registers because of an exception in the kernel also print the symbol and offset. This can be used to track down why the exception occured without needing external tools. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32077 --- sys/arm64/arm64/trap.c | 58 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index af17a6a2951e..c1566b7df492 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -25,6 +25,8 @@ * */ +#include "opt_ddb.h" + #include __FBSDID("$FreeBSD$"); @@ -68,7 +70,8 @@ __FBSDID("$FreeBSD$"); #endif #ifdef DDB -#include +#include +#include #endif /* Called from exception.S */ @@ -78,6 +81,7 @@ void do_el0_error(struct trapframe *); void do_serror(struct trapframe *); void unhandled_exception(struct trapframe *); +static void print_gp_register(const char *name, uint64_t value); static void print_registers(struct trapframe *frame); int (*dtrace_invop_jump_addr)(struct trapframe *); @@ -207,7 +211,7 @@ align_abort(struct thread *td, struct trapframe *frame, uint64_t esr, { if (!lower) { print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Misaligned access from kernel space!"); } @@ -233,7 +237,7 @@ external_abort(struct thread *td, struct trapframe *frame, uint64_t esr, } print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); panic("Unhandled EL%d external data abort", lower ? 0: 1); } @@ -303,7 +307,7 @@ data_abort(struct thread *td, struct trapframe *frame, uint64_t esr, if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL, "Kernel page fault") != 0) { print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("data abort in critical section or under mutex"); } @@ -336,7 +340,7 @@ bad_far: printf("Fatal data abort:\n"); print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); #ifdef KDB @@ -358,18 +362,44 @@ bad_far: userret(td, frame); } +static void +print_gp_register(const char *name, uint64_t value) +{ +#if defined(DDB) + c_db_sym_t sym; + const char *sym_name; + db_expr_t sym_value; + db_expr_t offset; +#endif + + printf(" %s: %16lx", name, value); +#if defined(DDB) + /* If this looks like a kernel address try to find the symbol */ + if (value >= VM_MIN_KERNEL_ADDRESS) { + sym = db_search_symbol(value, DB_STGY_ANY, &offset); + if (sym != C_DB_SYM_NULL) { + db_symbol_values(sym, &sym_name, &sym_value); + printf(" (%s + %lx)", sym_name, offset); + } + } +#endif + printf("\n"); +} + static void print_registers(struct trapframe *frame) { + char name[4]; u_int reg; for (reg = 0; reg < nitems(frame->tf_x); reg++) { - printf(" %sx%d: %16lx\n", (reg < 10) ? " " : "", reg, - frame->tf_x[reg]); + snprintf(name, sizeof(name), "%sx%d", (reg < 10) ? " " : "", + reg); + print_gp_register(name, frame->tf_x[reg]); } printf(" sp: %16lx\n", frame->tf_sp); - printf(" lr: %16lx\n", frame->tf_lr); - printf(" elr: %16lx\n", frame->tf_elr); + print_gp_register(" lr", frame->tf_lr); + print_gp_register("elr", frame->tf_lr); printf("spsr: %8x\n", frame->tf_spsr); } @@ -424,7 +454,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) abort_handlers[dfsc](td, frame, esr, far, 0); } else { print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Unhandled EL1 %s abort: %x", exception == EXCP_INSN_ABORT ? "instruction" : @@ -459,7 +489,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) /* FALLTHROUGH */ default: print_registers(frame); - printf(" far: %16lx\n", READ_SPECIALREG(far_el1)); + print_gp_register("far", READ_SPECIALREG(far_el1)); panic("Unknown kernel exception %x esr_el1 %lx", exception, esr); } @@ -530,7 +560,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame) abort_handlers[dfsc](td, frame, esr, far, 1); else { print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Unhandled EL0 %s abort: %x", exception == EXCP_INSN_ABORT_L ? "instruction" : @@ -613,7 +643,7 @@ do_serror(struct trapframe *frame) esr = frame->tf_esr; print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Unhandled System Error"); } @@ -627,7 +657,7 @@ unhandled_exception(struct trapframe *frame) esr = frame->tf_esr; print_registers(frame); - printf(" far: %16lx\n", far); + print_gp_register("far", far); printf(" esr: %.8lx\n", esr); panic("Unhandled exception"); } From owner-dev-commits-src-all@freebsd.org Fri Oct 1 10:27:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EBAE6AB5CC; Fri, 1 Oct 2021 10:27: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 4HLRC20QPbz3kZ2; Fri, 1 Oct 2021 10:27:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E20E21DA9B; Fri, 1 Oct 2021 10:27:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 191ARvwa083627; Fri, 1 Oct 2021 10:27:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191ARvMl083626; Fri, 1 Oct 2021 10:27:57 GMT (envelope-from git) Date: Fri, 1 Oct 2021 10:27:57 GMT Message-Id: <202110011027.191ARvMl083626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 3d2533f5c29f - main - Allow ddb and dtrace use the DMAP region on arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d2533f5c29fbf6e63c5e408ba13c2294a7612fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 10:27:58 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3d2533f5c29fbf6e63c5e408ba13c2294a7612fd commit 3d2533f5c29fbf6e63c5e408ba13c2294a7612fd Author: Andrew Turner AuthorDate: 2021-09-21 17:10:57 +0000 Commit: Andrew Turner CommitDate: 2021-10-01 10:27:33 +0000 Allow ddb and dtrace use the DMAP region on arm64 When writing to memory on arm64 we may be trying to be accessing a read-only page. In this case try to access via the DMAP region to get a writable location. While here simplify writing data in DDB and stop trashing the size as it is passed into the cache handling functions. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32053 --- sys/arm64/arm64/db_interface.c | 33 +++++++++------------------------ sys/arm64/arm64/machdep.c | 36 ++++++++++++++++++++++++++++++++++++ sys/arm64/include/cpufunc.h | 1 + sys/cddl/dev/fbt/aarch64/fbt_isa.c | 6 +++++- 4 files changed, 51 insertions(+), 25 deletions(-) diff --git a/sys/arm64/arm64/db_interface.c b/sys/arm64/arm64/db_interface.c index d8ae79715a19..dc0fa8ac5e1e 100644 --- a/sys/arm64/arm64/db_interface.c +++ b/sys/arm64/arm64/db_interface.c @@ -153,39 +153,24 @@ db_write_bytes(vm_offset_t addr, size_t size, char *data) jmp_buf jb; void *prev_jb; char *dst; + size_t i; int ret; - uint64_t tmp64; - uint32_t tmp32; - uint16_t tmp16; prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { - if (size == 8 && (addr & 7) == 0) { - dst = (char *)&tmp64; - while (size-- > 0) - *dst++ = *data++; - *((uint64_t *)addr) = tmp64; - } else if (size == 4 && (addr & 3) == 0) { - dst = (char *)&tmp32; - while (size-- > 0) - *dst++ = *data++; - *((uint32_t *)addr) = tmp32; - } else if (size == 2 && (addr & 1) == 0) { - dst = (char *)&tmp16; - while (size-- > 0) - *dst++ = *data++; - *((uint32_t *)addr) = tmp16; + if (!arm64_get_writable_addr(addr, &addr)) { + ret = 1; } else { dst = (char *)addr; - while (size-- > 0) + for (i = 0; i < size; i++) *dst++ = *data++; - } - dsb(ish); + dsb(ish); - /* Clean D-cache and invalidate I-cache */ - cpu_dcache_wb_range(addr, (vm_size_t)size); - cpu_icache_sync_range(addr, (vm_size_t)size); + /* Clean D-cache and invalidate I-cache */ + cpu_dcache_wb_range(addr, (vm_size_t)size); + cpu_icache_sync_range(addr, (vm_size_t)size); + } } (void)kdb_jmpbuf(prev_jb); diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 89c4f21134f8..30f07bce5551 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -942,6 +942,42 @@ init_proc0(vm_offset_t kstack) serror_enable(); } +/* + * Get an address to be used to write to kernel data that may be mapped + * read-only, e.g. to patch kernel code. + */ +bool +arm64_get_writable_addr(vm_offset_t addr, vm_offset_t *out) +{ + vm_paddr_t pa; + + /* Check if the page is writable */ + if (PAR_SUCCESS(arm64_address_translate_s1e1w(addr))) { + *out = addr; + return (true); + } + + /* + * Find the physical address of the given page. + */ + if (!pmap_klookup(addr, &pa)) { + return (false); + } + + /* + * If it is within the DMAP region and is writable use that. + */ + if (PHYS_IN_DMAP(pa)) { + addr = PHYS_TO_DMAP(pa); + if (PAR_SUCCESS(arm64_address_translate_s1e1w(addr))) { + *out = addr; + return (true); + } + } + + return (false); +} + typedef struct { uint32_t type; uint64_t phys_start; diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h index 94af62380de3..16133903841f 100644 --- a/sys/arm64/include/cpufunc.h +++ b/sys/arm64/include/cpufunc.h @@ -246,6 +246,7 @@ int arm64_icache_sync_range_checked(vm_offset_t, vm_size_t); void arm64_dcache_wbinv_range(vm_offset_t, vm_size_t); void arm64_dcache_inv_range(vm_offset_t, vm_size_t); void arm64_dcache_wb_range(vm_offset_t, vm_size_t); +bool arm64_get_writable_addr(vm_offset_t, vm_offset_t *); #endif /* _KERNEL */ #endif /* _MACHINE_CPUFUNC_H_ */ diff --git a/sys/cddl/dev/fbt/aarch64/fbt_isa.c b/sys/cddl/dev/fbt/aarch64/fbt_isa.c index f9b99febe8d1..4d22f1d584d3 100644 --- a/sys/cddl/dev/fbt/aarch64/fbt_isa.c +++ b/sys/cddl/dev/fbt/aarch64/fbt_isa.c @@ -74,8 +74,12 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t rval) void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { + vm_offset_t addr; - *fbt->fbtp_patchpoint = val; + if (!arm64_get_writable_addr((vm_offset_t)fbt->fbtp_patchpoint, &addr)) + panic("%s: Unable to write new instruction", __func__); + + *(fbt_patchval_t *)addr = val; cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, 4); } From owner-dev-commits-src-all@freebsd.org Fri Oct 1 10:27:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 557EA6AB5CE; Fri, 1 Oct 2021 10:27: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 4HLRC30t3lz3kX2; Fri, 1 Oct 2021 10:27:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED7671DC42; Fri, 1 Oct 2021 10:27: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 191ARwpq083655; Fri, 1 Oct 2021 10:27:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191ARwbl083654; Fri, 1 Oct 2021 10:27:58 GMT (envelope-from git) Date: Fri, 1 Oct 2021 10:27:58 GMT Message-Id: <202110011027.191ARwbl083654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 18c213949540 - main - Add a gic interface to allocate MSI interrupts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 18c2139495401bcc6d0fbc0119daf2103327c3a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 10:27:59 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=18c2139495401bcc6d0fbc0119daf2103327c3a4 commit 18c2139495401bcc6d0fbc0119daf2103327c3a4 Author: Andrew Turner AuthorDate: 2021-09-29 13:33:18 +0000 Commit: Andrew Turner CommitDate: 2021-10-01 10:27:33 +0000 Add a gic interface to allocate MSI interrupts The previous update to handle the gicv2m as a child of the gicv3 driver assumed there was only a single gicv2m child. On some hardware there are multiple children. Support this by removing the mbi ivars and adding a new interface to handle MSI allocation in a given range. Tested by: mw, trasz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32224 --- sys/arm/arm/gic.c | 117 +++++++++++++++++++++-------------------------- sys/arm/arm/gic.h | 6 +-- sys/arm/arm/gic_common.h | 4 -- sys/arm/arm/gic_if.m | 39 ++++++++++++++++ sys/arm64/arm64/gic_v3.c | 117 +++++++++++++++++++++++++++++------------------ sys/conf/files.arm | 1 + sys/conf/files.arm64 | 1 + 7 files changed, 168 insertions(+), 117 deletions(-) diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index 89db4e324600..f281f29125b6 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "gic_if.h" #include "pic_if.h" #include "msi_if.h" @@ -501,12 +502,6 @@ arm_gic_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) ("arm_gic_read_ivar: Invalid bus type %u", sc->gic_bus)); *result = sc->gic_bus; return (0); - case GIC_IVAR_MBI_START: - *result = sc->sc_spi_start; - return (0); - case GIC_IVAR_MBI_COUNT: - *result = sc->sc_spi_count; - return (0); } return (ENOENT); @@ -523,32 +518,6 @@ arm_gic_write_ivar(device_t dev, device_t child, int which, uintptr_t value) case GIC_IVAR_HW_REV: case GIC_IVAR_BUS: return (EINVAL); - case GIC_IVAR_MBI_START: - /* - * GIC_IVAR_MBI_START must be set once and first. This allows - * us to reserve the registers when GIC_IVAR_MBI_COUNT is set. - */ - MPASS(sc->sc_spi_start == 0); - MPASS(sc->sc_spi_count == 0); - MPASS(value >= GIC_FIRST_SPI); - MPASS(value < sc->nirqs); - - sc->sc_spi_start = value; - return (0); - case GIC_IVAR_MBI_COUNT: - MPASS(sc->sc_spi_start != 0); - MPASS(sc->sc_spi_count == 0); - - sc->sc_spi_count = value; - sc->sc_spi_end = sc->sc_spi_start + sc->sc_spi_count; - - MPASS(sc->sc_spi_end <= sc->nirqs); - - /* Reserve these interrupts for MSI/MSI-X use */ - arm_gic_reserve_msi_range(dev, sc->sc_spi_start, - sc->sc_spi_count); - - return (0); } return (ENOENT); @@ -1044,8 +1013,8 @@ arm_gic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc **isrcp) #endif static int -arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, - device_t *pic, struct intr_irqsrc **srcs) +arm_gic_alloc_msi(device_t dev, u_int mbi_start, u_int mbi_count, int count, + int maxcount, struct intr_irqsrc **isrc) { struct arm_gic_softc *sc; int i, irq, end_irq; @@ -1059,7 +1028,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, mtx_lock_spin(&sc->mutex); found = false; - for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { + for (irq = mbi_start; irq < mbi_start + mbi_count; irq++) { /* Start on an aligned interrupt */ if ((irq & (maxcount - 1)) != 0) continue; @@ -1070,7 +1039,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, /* Check this range is valid */ for (end_irq = irq; end_irq != irq + count; end_irq++) { /* No free interrupts */ - if (end_irq == sc->sc_spi_end) { + if (end_irq == mbi_start + mbi_count) { found = false; break; } @@ -1090,7 +1059,7 @@ arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, } /* Not enough interrupts were found */ - if (!found || irq == sc->sc_spi_end) { + if (!found || irq == mbi_start + mbi_count) { mtx_unlock_spin(&sc->mutex); return (ENXIO); } @@ -1102,15 +1071,13 @@ arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, mtx_unlock_spin(&sc->mutex); for (i = 0; i < count; i++) - srcs[i] = (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; - *pic = dev; + isrc[i] = (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; return (0); } static int -arm_gic_release_msi(device_t dev, device_t child, int count, - struct intr_irqsrc **isrc) +arm_gic_release_msi(device_t dev, int count, struct intr_irqsrc **isrc) { struct arm_gic_softc *sc; struct gic_irqsrc *gi; @@ -1134,8 +1101,8 @@ arm_gic_release_msi(device_t dev, device_t child, int count, } static int -arm_gic_alloc_msix(device_t dev, device_t child, device_t *pic, - struct intr_irqsrc **isrcp) +arm_gic_alloc_msix(device_t dev, u_int mbi_start, u_int mbi_count, + struct intr_irqsrc **isrc) { struct arm_gic_softc *sc; int irq; @@ -1144,14 +1111,14 @@ arm_gic_alloc_msix(device_t dev, device_t child, device_t *pic, mtx_lock_spin(&sc->mutex); /* Find an unused interrupt */ - for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { + for (irq = mbi_start; irq < mbi_start + mbi_count; irq++) { KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) != 0, ("%s: Non-MSI interrupt found", __func__)); if ((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) == 0) break; } /* No free interrupt was found */ - if (irq == sc->sc_spi_end) { + if (irq == mbi_start + mbi_count) { mtx_unlock_spin(&sc->mutex); return (ENXIO); } @@ -1160,14 +1127,13 @@ arm_gic_alloc_msix(device_t dev, device_t child, device_t *pic, sc->gic_irqs[irq].gi_flags |= GI_FLAG_MSI_USED; mtx_unlock_spin(&sc->mutex); - *isrcp = (struct intr_irqsrc *)&sc->gic_irqs[irq]; - *pic = dev; + *isrc = (struct intr_irqsrc *)&sc->gic_irqs[irq]; return (0); } static int -arm_gic_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) +arm_gic_release_msix(device_t dev, struct intr_irqsrc *isrc) { struct arm_gic_softc *sc; struct gic_irqsrc *gi; @@ -1211,11 +1177,12 @@ static device_method_t arm_gic_methods[] = { DEVMETHOD(pic_ipi_setup, arm_gic_ipi_setup), #endif - /* MSI/MSI-X */ - DEVMETHOD(msi_alloc_msi, arm_gic_alloc_msi), - DEVMETHOD(msi_release_msi, arm_gic_release_msi), - DEVMETHOD(msi_alloc_msix, arm_gic_alloc_msix), - DEVMETHOD(msi_release_msix, arm_gic_release_msix), + /* GIC */ + DEVMETHOD(gic_reserve_msi_range, arm_gic_reserve_msi_range), + DEVMETHOD(gic_alloc_msi, arm_gic_alloc_msi), + DEVMETHOD(gic_release_msi, arm_gic_release_msi), + DEVMETHOD(gic_alloc_msix, arm_gic_alloc_msix), + DEVMETHOD(gic_release_msix, arm_gic_release_msix), { 0, 0 } }; @@ -1238,7 +1205,6 @@ arm_gicv2m_attach(device_t dev) { struct arm_gicv2m_softc *sc; uint32_t typer; - u_int spi_start, spi_count; int rid; sc = device_get_softc(dev); @@ -1252,16 +1218,18 @@ arm_gicv2m_attach(device_t dev) } typer = bus_read_4(sc->sc_mem, GICV2M_MSI_TYPER); - spi_start = MSI_TYPER_SPI_BASE(typer); - spi_count = MSI_TYPER_SPI_COUNT(typer); - gic_set_mbi_start(dev, spi_start); - gic_set_mbi_count(dev, spi_count); + sc->sc_spi_start = MSI_TYPER_SPI_BASE(typer); + sc->sc_spi_count = MSI_TYPER_SPI_COUNT(typer); + + /* Reserve these interrupts for MSI/MSI-X use */ + GIC_RESERVE_MSI_RANGE(device_get_parent(dev), sc->sc_spi_start, + sc->sc_spi_count); intr_msi_register(dev, sc->sc_xref); if (bootverbose) - device_printf(dev, "using spi %u to %u\n", spi_start, - spi_start + spi_count - 1); + device_printf(dev, "using spi %u to %u\n", sc->sc_spi_start, + sc->sc_spi_start + sc->sc_spi_count - 1); return (0); } @@ -1270,28 +1238,47 @@ static int arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcount, device_t *pic, struct intr_irqsrc **srcs) { - return (MSI_ALLOC_MSI(device_get_parent(dev), child, count, maxcount, - pic, srcs)); + struct arm_gicv2m_softc *sc; + int error; + + sc = device_get_softc(dev); + error = GIC_ALLOC_MSI(device_get_parent(dev), sc->sc_spi_start, + sc->sc_spi_count, count, maxcount, srcs); + if (error != 0) + return (error); + + *pic = dev; + return (0); } static int arm_gicv2m_release_msi(device_t dev, device_t child, int count, struct intr_irqsrc **isrc) { - return (MSI_RELEASE_MSI(device_get_parent(dev), child, count, isrc)); + return (GIC_RELEASE_MSI(device_get_parent(dev), count, isrc)); } static int arm_gicv2m_alloc_msix(device_t dev, device_t child, device_t *pic, struct intr_irqsrc **isrcp) { - return (MSI_ALLOC_MSIX(device_get_parent(dev), child, pic, isrcp)); + struct arm_gicv2m_softc *sc; + int error; + + sc = device_get_softc(dev); + error = GIC_ALLOC_MSIX(device_get_parent(dev), sc->sc_spi_start, + sc->sc_spi_count, isrcp); + if (error != 0) + return (error); + + *pic = dev; + return (0); } static int arm_gicv2m_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) { - return (MSI_RELEASE_MSIX(device_get_parent(dev), child, isrc)); + return (GIC_RELEASE_MSIX(device_get_parent(dev), isrc)); } static int diff --git a/sys/arm/arm/gic.h b/sys/arm/arm/gic.h index 55f7f0cc5e44..ce0c8a6187e1 100644 --- a/sys/arm/arm/gic.h +++ b/sys/arm/arm/gic.h @@ -63,10 +63,6 @@ struct arm_gic_softc { int nranges; struct arm_gic_range * ranges; - - u_int sc_spi_start; - u_int sc_spi_end; - u_int sc_spi_count; }; DECLARE_CLASS(arm_gic_driver); @@ -74,6 +70,8 @@ DECLARE_CLASS(arm_gic_driver); struct arm_gicv2m_softc { struct resource *sc_mem; uintptr_t sc_xref; + u_int sc_spi_start; + u_int sc_spi_count; }; DECLARE_CLASS(arm_gicv2m_driver); diff --git a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h index 52827d03e600..9e8fb19300ca 100644 --- a/sys/arm/arm/gic_common.h +++ b/sys/arm/arm/gic_common.h @@ -33,8 +33,6 @@ #define GIC_IVAR_HW_REV 500 #define GIC_IVAR_BUS 501 -#define GIC_IVAR_MBI_START 510 -#define GIC_IVAR_MBI_COUNT 511 /* GIC_IVAR_BUS values */ #define GIC_BUS_UNKNOWN 0 @@ -44,8 +42,6 @@ __BUS_ACCESSOR(gic, hw_rev, GIC, HW_REV, u_int); __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); -__BUS_ACCESSOR(gic, mbi_start, GIC, MBI_START, u_int); -__BUS_ACCESSOR(gic, mbi_count, GIC, MBI_COUNT, u_int); /* Software Generated Interrupts */ #define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */ diff --git a/sys/arm/arm/gic_if.m b/sys/arm/arm/gic_if.m new file mode 100644 index 000000000000..b9bef7db1a80 --- /dev/null +++ b/sys/arm/arm/gic_if.m @@ -0,0 +1,39 @@ + +INTERFACE gic; + +HEADER { + struct intr_irqsrc; +}; + +METHOD void reserve_msi_range { + device_t dev; + u_int mbi_start; + u_int mbi_count; +}; + +METHOD int alloc_msi { + device_t dev; + u_int mbi_start; + u_int mbi_count; + int count; + int maxcount; + struct intr_irqsrc **isrc; +}; + +METHOD int release_msi { + device_t dev; + int count; + struct intr_irqsrc **isrc; +}; + +METHOD int alloc_msix { + device_t dev; + u_int mbi_start; + u_int mbi_count; + struct intr_irqsrc **isrc; +}; + +METHOD int release_msix { + device_t dev; + struct intr_irqsrc *isrc; +}; diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index 23e1b3632fb8..7d9160f8ae17 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #endif +#include "gic_if.h" #include "pic_if.h" #include "msi_if.h" @@ -95,6 +96,12 @@ static pic_ipi_send_t gic_v3_ipi_send; static pic_ipi_setup_t gic_v3_ipi_setup; #endif +static gic_reserve_msi_range_t gic_v3_reserve_msi_range; +static gic_alloc_msi_t gic_v3_gic_alloc_msi; +static gic_release_msi_t gic_v3_gic_release_msi; +static gic_alloc_msix_t gic_v3_gic_alloc_msix; +static gic_release_msix_t gic_v3_gic_release_msix; + static msi_alloc_msi_t gic_v3_alloc_msi; static msi_release_msi_t gic_v3_release_msi; static msi_alloc_msix_t gic_v3_alloc_msix; @@ -139,6 +146,13 @@ static device_method_t gic_v3_methods[] = { DEVMETHOD(msi_release_msix, gic_v3_release_msix), DEVMETHOD(msi_map_msi, gic_v3_map_msi), + /* GIC */ + DEVMETHOD(gic_reserve_msi_range, gic_v3_reserve_msi_range), + DEVMETHOD(gic_alloc_msi, gic_v3_gic_alloc_msi), + DEVMETHOD(gic_release_msi, gic_v3_gic_release_msi), + DEVMETHOD(gic_alloc_msix, gic_v3_gic_alloc_msix), + DEVMETHOD(gic_release_msix, gic_v3_gic_release_msix), + /* End */ DEVMETHOD_END }; @@ -467,12 +481,6 @@ gic_v3_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) ("gic_v3_read_ivar: Invalid bus type %u", sc->gic_bus)); *result = sc->gic_bus; return (0); - case GIC_IVAR_MBI_START: - *result = sc->gic_mbi_start; - return (0); - case GIC_IVAR_MBI_COUNT: - *result = sc->gic_mbi_end - sc->gic_mbi_start; - return (0); } return (ENOENT); @@ -491,30 +499,6 @@ gic_v3_write_ivar(device_t dev, device_t child, int which, uintptr_t value) case GIC_IVAR_HW_REV: case GIC_IVAR_BUS: return (EINVAL); - case GIC_IVAR_MBI_START: - /* - * GIC_IVAR_MBI_START must be set once and first. This allows - * us to reserve the registers when GIC_IVAR_MBI_COUNT is set. - */ - MPASS(sc->gic_mbi_start == 0); - MPASS(sc->gic_mbi_end == 0); - MPASS(value >= GIC_FIRST_SPI); - MPASS(value < sc->gic_nirqs); - - sc->gic_mbi_start = value; - return (0); - case GIC_IVAR_MBI_COUNT: - MPASS(sc->gic_mbi_start != 0); - MPASS(sc->gic_mbi_end == 0); - - sc->gic_mbi_end = value - sc->gic_mbi_start; - - MPASS(sc->gic_mbi_end <= sc->gic_nirqs); - - /* Reserve these interrupts for MSI/MSI-X use */ - gic_v3_reserve_msi_range(dev, sc->gic_mbi_start, value); - - return (0); } return (ENOENT); @@ -1385,8 +1369,8 @@ gic_v3_redist_init(struct gic_v3_softc *sc) */ static int -gic_v3_alloc_msi(device_t dev, device_t child, int count, int maxcount, - device_t *pic, struct intr_irqsrc **srcs) +gic_v3_gic_alloc_msi(device_t dev, u_int mbi_start, u_int mbi_count, + int count, int maxcount, struct intr_irqsrc **isrc) { struct gic_v3_softc *sc; int i, irq, end_irq; @@ -1400,7 +1384,7 @@ gic_v3_alloc_msi(device_t dev, device_t child, int count, int maxcount, mtx_lock(&sc->gic_mbi_mtx); found = false; - for (irq = sc->gic_mbi_start; irq < sc->gic_mbi_end; irq++) { + for (irq = mbi_start; irq < mbi_start + mbi_count; irq++) { /* Start on an aligned interrupt */ if ((irq & (maxcount - 1)) != 0) continue; @@ -1411,7 +1395,7 @@ gic_v3_alloc_msi(device_t dev, device_t child, int count, int maxcount, /* Check this range is valid */ for (end_irq = irq; end_irq != irq + count; end_irq++) { /* No free interrupts */ - if (end_irq == sc->gic_mbi_end) { + if (end_irq == mbi_start + mbi_count) { found = false; break; } @@ -1431,7 +1415,7 @@ gic_v3_alloc_msi(device_t dev, device_t child, int count, int maxcount, } /* Not enough interrupts were found */ - if (!found || irq == sc->gic_mbi_end) { + if (!found || irq == mbi_start + mbi_count) { mtx_unlock(&sc->gic_mbi_mtx); return (ENXIO); } @@ -1443,15 +1427,13 @@ gic_v3_alloc_msi(device_t dev, device_t child, int count, int maxcount, mtx_unlock(&sc->gic_mbi_mtx); for (i = 0; i < count; i++) - srcs[i] = (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; - *pic = dev; + isrc[i] = (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; return (0); } static int -gic_v3_release_msi(device_t dev, device_t child, int count, - struct intr_irqsrc **isrc) +gic_v3_gic_release_msi(device_t dev, int count, struct intr_irqsrc **isrc) { struct gic_v3_softc *sc; struct gic_v3_irqsrc *gi; @@ -1475,7 +1457,7 @@ gic_v3_release_msi(device_t dev, device_t child, int count, } static int -gic_v3_alloc_msix(device_t dev, device_t child, device_t *pic, +gic_v3_gic_alloc_msix(device_t dev, u_int mbi_start, u_int mbi_count, struct intr_irqsrc **isrcp) { struct gic_v3_softc *sc; @@ -1485,14 +1467,14 @@ gic_v3_alloc_msix(device_t dev, device_t child, device_t *pic, mtx_lock(&sc->gic_mbi_mtx); /* Find an unused interrupt */ - for (irq = sc->gic_mbi_start; irq < sc->gic_mbi_end; irq++) { + for (irq = mbi_start; irq < mbi_start + mbi_count; irq++) { KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) != 0, ("%s: Non-MSI interrupt found", __func__)); if ((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) == 0) break; } /* No free interrupt was found */ - if (irq == sc->gic_mbi_end) { + if (irq == mbi_start + mbi_count) { mtx_unlock(&sc->gic_mbi_mtx); return (ENXIO); } @@ -1502,13 +1484,12 @@ gic_v3_alloc_msix(device_t dev, device_t child, device_t *pic, mtx_unlock(&sc->gic_mbi_mtx); *isrcp = (struct intr_irqsrc *)&sc->gic_irqs[irq]; - *pic = dev; return (0); } static int -gic_v3_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) +gic_v3_gic_release_msix(device_t dev, struct intr_irqsrc *isrc) { struct gic_v3_softc *sc; struct gic_v3_irqsrc *gi; @@ -1526,6 +1507,54 @@ gic_v3_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) return (0); } +static int +gic_v3_alloc_msi(device_t dev, device_t child, int count, int maxcount, + device_t *pic, struct intr_irqsrc **isrc) +{ + struct gic_v3_softc *sc; + int error; + + sc = device_get_softc(dev); + error = gic_v3_gic_alloc_msi(dev, sc->gic_mbi_start, + sc->gic_mbi_end - sc->gic_mbi_start, count, maxcount, isrc); + if (error != 0) + return (error); + + *pic = dev; + return (0); +} + +static int +gic_v3_release_msi(device_t dev, device_t child, int count, + struct intr_irqsrc **isrc) +{ + return (gic_v3_gic_release_msi(dev, count, isrc)); +} + +static int +gic_v3_alloc_msix(device_t dev, device_t child, device_t *pic, + struct intr_irqsrc **isrc) +{ + struct gic_v3_softc *sc; + int error; + + sc = device_get_softc(dev); + error = gic_v3_gic_alloc_msix(dev, sc->gic_mbi_start, + sc->gic_mbi_end - sc->gic_mbi_start, isrc); + if (error != 0) + return (error); + + *pic = dev; + + return (0); +} + +static int +gic_v3_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) +{ + return (gic_v3_gic_release_msix(dev, isrc)); +} + static int gic_v3_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc, uint64_t *addr, uint32_t *data) diff --git a/sys/conf/files.arm b/sys/conf/files.arm index 86e75ef4a2a4..76f62eb2e14e 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -32,6 +32,7 @@ arm/arm/gdb_machdep.c optional gdb arm/arm/generic_timer.c optional generic_timer arm/arm/gic.c optional gic arm/arm/gic_fdt.c optional gic fdt +arm/arm/gic_if.m optional gic arm/arm/identcpu-v6.c standard arm/arm/in_cksum.c optional inet | inet6 arm/arm/in_cksum_arm.S optional inet | inet6 diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 9dd071b97e37..dcd9711ea7da 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -20,6 +20,7 @@ arm/arm/generic_timer.c standard arm/arm/gic.c standard arm/arm/gic_acpi.c optional acpi arm/arm/gic_fdt.c optional fdt +arm/arm/gic_if.m standard arm/arm/pmu.c standard arm/arm/pmu_fdt.c optional fdt arm64/acpica/acpi_iort.c optional acpi From owner-dev-commits-src-all@freebsd.org Fri Oct 1 11:15:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B428F6ACBA4; Fri, 1 Oct 2021 11:15: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 4HLSFP4VQdz3n7x; Fri, 1 Oct 2021 11:15:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A4291E924; Fri, 1 Oct 2021 11:15: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 191BF5pj049968; Fri, 1 Oct 2021 11:15:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191BF5KQ049967; Fri, 1 Oct 2021 11:15:05 GMT (envelope-from git) Date: Fri, 1 Oct 2021 11:15:05 GMT Message-Id: <202110011115.191BF5KQ049967@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Shteryana Shopova Subject: git: 8b959dd6a392 - main - Fix bsnmpd(1) crash with ill-formed Discovery message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: syrinx X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b959dd6a3921c35395bef4a6d7ad2426a3bd88e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 11:15:05 -0000 The branch main has been updated by syrinx: URL: https://cgit.FreeBSD.org/src/commit/?id=8b959dd6a3921c35395bef4a6d7ad2426a3bd88e commit 8b959dd6a3921c35395bef4a6d7ad2426a3bd88e Author: Shteryana Shopova AuthorDate: 2021-10-01 11:10:39 +0000 Commit: Shteryana Shopova CommitDate: 2021-10-01 11:10:39 +0000 Fix bsnmpd(1) crash with ill-formed Discovery message RFC 3414 Section 4. Discovery specifies that a discovery request message has a varBindList left empty. Nonetheless, bsnmpd(1) should not crash when receiving a non-zero var-bindings list in a Discovery Request message. PR: 255214 MFC after: 2 weeks --- contrib/bsnmp/snmpd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/bsnmp/snmpd/main.c b/contrib/bsnmp/snmpd/main.c index b07308165ddd..928b84121f82 100644 --- a/contrib/bsnmp/snmpd/main.c +++ b/contrib/bsnmp/snmpd/main.c @@ -641,7 +641,7 @@ decoded: pdu->engine.engine_boots = snmpd_engine.engine_boots; pdu->engine.engine_time = snmpd_engine.engine_time; } - } else if (usm_user->suser.auth_proto != SNMP_AUTH_NOAUTH && + } else if (pdu->user.auth_proto != SNMP_AUTH_NOAUTH && (pdu->engine.engine_boots == 0 || pdu->engine.engine_time == 0)) { snmpd_usmstats.not_in_time_windows++; ret = SNMPD_INPUT_FAILED; From owner-dev-commits-src-all@freebsd.org Fri Oct 1 12:19:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22A936AE1AB; Fri, 1 Oct 2021 12:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HLThC0Tbpz3r6w; Fri, 1 Oct 2021 12:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4BDA1F04A; Fri, 1 Oct 2021 12:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 191CJsmv030337; Fri, 1 Oct 2021 12:19:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191CJs5c030336; Fri, 1 Oct 2021 12:19:54 GMT (envelope-from git) Date: Fri, 1 Oct 2021 12:19:54 GMT Message-Id: <202110011219.191CJs5c030336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 38c857d956d6 - main - mixer(3): Add symbol versioning. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38c857d956d61b811fb2047bc980b90d64a072bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 12:19:55 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=38c857d956d61b811fb2047bc980b90d64a072bf commit 38c857d956d61b811fb2047bc980b90d64a072bf Author: Hans Petter Selasky AuthorDate: 2021-10-01 12:14:38 +0000 Commit: Hans Petter Selasky CommitDate: 2021-10-01 12:18:43 +0000 mixer(3): Add symbol versioning. Suggested by: kib Differential Revision: https://reviews.freebsd.org/D32254 Sponsored by: NVIDIA Networking --- lib/libmixer/Makefile | 2 ++ lib/libmixer/Symbol.map | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/libmixer/Makefile b/lib/libmixer/Makefile index 12081ee3835b..d7e77f79856e 100644 --- a/lib/libmixer/Makefile +++ b/lib/libmixer/Makefile @@ -4,5 +4,7 @@ LIB= mixer SRCS= ${LIB}.c INCS= ${LIB}.h MAN= ${LIB}.3 +VERSION_DEF= ${LIBCSRCDIR}/Versions.def +SYMBOL_MAPS= ${.CURDIR}/Symbol.map .include diff --git a/lib/libmixer/Symbol.map b/lib/libmixer/Symbol.map new file mode 100644 index 000000000000..6736debe1897 --- /dev/null +++ b/lib/libmixer/Symbol.map @@ -0,0 +1,22 @@ +/* + * $FreeBSD$ + */ + +FBSD_1.7 { + mixer_open; + mixer_close; + mixer_get_dev; + mixer_get_dev_byname; + mixer_add_ctl; + mixer_add_ctl_s; + mixer_remove_ctl; + mixer_get_ctl; + mixer_get_ctl_byname; + mixer_set_vol; + mixer_set_mute; + mixer_mod_recsrc; + mixer_get_default_unit; + mixer_set_default_unit; + mixer_get_mode; + mixer_get_nmixers; +}; From owner-dev-commits-src-all@freebsd.org Fri Oct 1 12:19:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AFA96AE0A2; Fri, 1 Oct 2021 12:19: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 4HLThD1hNPz3rGY; Fri, 1 Oct 2021 12:19:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A0661F432; Fri, 1 Oct 2021 12:19: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 191CJtMv030361; Fri, 1 Oct 2021 12:19:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191CJtEW030360; Fri, 1 Oct 2021 12:19:55 GMT (envelope-from git) Date: Fri, 1 Oct 2021 12:19:55 GMT Message-Id: <202110011219.191CJtEW030360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 433be7f21fd1 - main - mixer(3): Add some manual page symlinks. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 433be7f21fd1606479779125f5b22ba387ff7157 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 12:19:56 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=433be7f21fd1606479779125f5b22ba387ff7157 commit 433be7f21fd1606479779125f5b22ba387ff7157 Author: Hans Petter Selasky AuthorDate: 2021-10-01 12:17:20 +0000 Commit: Hans Petter Selasky CommitDate: 2021-10-01 12:18:43 +0000 mixer(3): Add some manual page symlinks. Submitted by: christos@ Differential Revision: https://reviews.freebsd.org/D32254 Sponsored by: NVIDIA Networking --- lib/libmixer/Makefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/libmixer/Makefile b/lib/libmixer/Makefile index d7e77f79856e..ff7dbbe3cae1 100644 --- a/lib/libmixer/Makefile +++ b/lib/libmixer/Makefile @@ -7,4 +7,27 @@ MAN= ${LIB}.3 VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map +MLINKS+= mixer.3 mixer_open.3 +MLINKS+= mixer.3 mixer_close.3 +MLINKS+= mixer.3 mixer_get_dev.3 +MLINKS+= mixer.3 mixer_get_dev_byname.3 +MLINKS+= mixer.3 mixer_add_ctl.3 +MLINKS+= mixer.3 mixer_add_ctl_s.3 +MLINKS+= mixer.3 mixer_remove_ctl.3 +MLINKS+= mixer.3 mixer_get_ctl.3 +MLINKS+= mixer.3 mixer_get_ctl_byname.3 +MLINKS+= mixer.3 mixer_set_vol.3 +MLINKS+= mixer.3 mixer_set_mute.3 +MLINKS+= mixer.3 mixer_mod_recsrc.3 +MLINKS+= mixer.3 mixer_get_default_unit.3 +MLINKS+= mixer.3 mixer_set_default_unit.3 +MLINKS+= mixer.3 mixer_get_mode.3 +MLINKS+= mixer.3 mixer_get_nmixers.3 +MLINKS+= mixer.3 MIX_ISDEV.3 +MLINKS+= mixer.3 MIX_ISMUTE.3 +MLINKS+= mixer.3 MIX_ISREC.3 +MLINKS+= mixer.3 MIX_ISRECSRC.3 +MLINKS+= mixer.3 MIX_VOLNORM.3 +MLINKS+= mixer.3 MIX_VOLDENORM.3 + .include From owner-dev-commits-src-all@freebsd.org Fri Oct 1 14:09:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BBA46AF6FF; Fri, 1 Oct 2021 14:09: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 4HLX652zjBz4TG0; Fri, 1 Oct 2021 14:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 465B72096A; Fri, 1 Oct 2021 14:09: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 191E910b077312; Fri, 1 Oct 2021 14:09:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191E91R9077311; Fri, 1 Oct 2021 14:09:01 GMT (envelope-from git) Date: Fri, 1 Oct 2021 14:09:01 GMT Message-Id: <202110011409.191E91R9077311@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: 8b1039f91865 - stable/13 - tests/sys/sys: Raise WARNS 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: 8b1039f918658103bdc083c65b393dcc3c15e823 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 14:09:01 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8b1039f918658103bdc083c65b393dcc3c15e823 commit 8b1039f918658103bdc083c65b393dcc3c15e823 Author: Mark Johnston AuthorDate: 2021-09-24 15:31:53 +0000 Commit: Mark Johnston CommitDate: 2021-10-01 14:06:41 +0000 tests/sys/sys: Raise WARNS Sponsored by: The FreeBSD Foundation (cherry picked from commit d7cf1b262f9ff5e799446f0cbbd007905ab4ae24) --- tests/sys/sys/Makefile | 2 -- tests/sys/sys/arb_test.c | 2 +- tests/sys/sys/rb_test.c | 2 +- tests/sys/sys/splay_test.c | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/sys/sys/Makefile b/tests/sys/sys/Makefile index eed87935e6e7..95739c127632 100644 --- a/tests/sys/sys/Makefile +++ b/tests/sys/sys/Makefile @@ -6,8 +6,6 @@ TESTSDIR= ${TESTSBASE}/sys/sys ATF_TESTS_C= arb_test bitstring_test qmath_test rb_test splay_test -WARNS?= 5 - .if ${COMPILER_TYPE} == "gcc" CFLAGS.bitstring_test= -fno-strict-overflow .endif diff --git a/tests/sys/sys/arb_test.c b/tests/sys/sys/arb_test.c index 9cf3f2052688..adbd7794e6f8 100644 --- a/tests/sys/sys/arb_test.c +++ b/tests/sys/sys/arb_test.c @@ -41,7 +41,7 @@ struct node { int key; }; -ARB32_HEAD(tree, node) *root; +static ARB32_HEAD(tree, node) *root; static int compare(const struct node *a, const struct node *b) diff --git a/tests/sys/sys/rb_test.c b/tests/sys/sys/rb_test.c index 287422ccf902..c558ad6098cf 100644 --- a/tests/sys/sys/rb_test.c +++ b/tests/sys/sys/rb_test.c @@ -39,7 +39,7 @@ struct node { int key; }; -RB_HEAD(tree, node) root; +static RB_HEAD(tree, node) root; static int compare(struct node *a, struct node *b) diff --git a/tests/sys/sys/splay_test.c b/tests/sys/sys/splay_test.c index 9b14c7c855cf..f0cf4ecd5eb6 100644 --- a/tests/sys/sys/splay_test.c +++ b/tests/sys/sys/splay_test.c @@ -39,7 +39,7 @@ struct node { int key; }; -SPLAY_HEAD(tree, node) root; +static SPLAY_HEAD(tree, node) root; static int compare(struct node *a, struct node *b) From owner-dev-commits-src-all@freebsd.org Fri Oct 1 14:09:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A15A76AFC9F; Fri, 1 Oct 2021 14:09: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 4HLX6641z5z4Tbw; Fri, 1 Oct 2021 14:09:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B1F8202FE; Fri, 1 Oct 2021 14:09: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 191E92Hp077342; Fri, 1 Oct 2021 14:09:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191E92DG077341; Fri, 1 Oct 2021 14:09:02 GMT (envelope-from git) Date: Fri, 1 Oct 2021 14:09:02 GMT Message-Id: <202110011409.191E92DG077341@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: d04c12765cfa - stable/13 - opencrypto: Disallow requests which pass VERIFY_DIGEST without a MAC 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: d04c12765cfa2bf0f33f7489d48843648073ce06 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 14:09:02 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d04c12765cfa2bf0f33f7489d48843648073ce06 commit d04c12765cfa2bf0f33f7489d48843648073ce06 Author: Mark Johnston AuthorDate: 2021-09-24 19:04:45 +0000 Commit: Mark Johnston CommitDate: 2021-10-01 14:08:30 +0000 opencrypto: Disallow requests which pass VERIFY_DIGEST without a MAC Otherwise we can end up comparing the computed digest with an uninitialized kernel buffer. In cryptoaead_op() we already unconditionally fail the request if a pointer to a digest buffer is not specified. Based on a patch by Simran Kathpalia. Reported by: syzkaller Reviewed by: jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/529 (cherry picked from commit 7c2f227a17ded0934c5941c7911797edb7d770a2) --- sys/opencrypto/cryptodev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 45146284642b..61f8f332e1ca 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -943,7 +943,7 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) dst += cse->ivsize; } - if (cop->mac != NULL && crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { + if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { error = copyin(cop->mac, cod->buf + crp->crp_digest_start, cse->hashsize); if (error) { From owner-dev-commits-src-all@freebsd.org Fri Oct 1 14:35:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 270CB6B098F; Fri, 1 Oct 2021 14:35: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 4HLXhd0ct0z4WPh; Fri, 1 Oct 2021 14:35:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8554210FA; Fri, 1 Oct 2021 14:35: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 191EZS15017154; Fri, 1 Oct 2021 14:35:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191EZSbn017153; Fri, 1 Oct 2021 14:35:28 GMT (envelope-from git) Date: Fri, 1 Oct 2021 14:35:28 GMT Message-Id: <202110011435.191EZSbn017153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 5b40c0aa73c5 - main - mixer(3): Fix buildworld after 38c857d956d61b811fb2047bc980b90d64a072bf . MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b40c0aa73c57e51f07386835237debdea805418 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 14:35:29 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5b40c0aa73c57e51f07386835237debdea805418 commit 5b40c0aa73c57e51f07386835237debdea805418 Author: Hans Petter Selasky AuthorDate: 2021-10-01 14:34:03 +0000 Commit: Hans Petter Selasky CommitDate: 2021-10-01 14:34:10 +0000 mixer(3): Fix buildworld after 38c857d956d61b811fb2047bc980b90d64a072bf . s/default_unit/dunit/g Differential Revision: https://reviews.freebsd.org/D32254 Sponsored by: NVIDIA Networking --- lib/libmixer/Makefile | 4 ++-- lib/libmixer/Symbol.map | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libmixer/Makefile b/lib/libmixer/Makefile index ff7dbbe3cae1..7a2b5f754e5f 100644 --- a/lib/libmixer/Makefile +++ b/lib/libmixer/Makefile @@ -19,8 +19,8 @@ MLINKS+= mixer.3 mixer_get_ctl_byname.3 MLINKS+= mixer.3 mixer_set_vol.3 MLINKS+= mixer.3 mixer_set_mute.3 MLINKS+= mixer.3 mixer_mod_recsrc.3 -MLINKS+= mixer.3 mixer_get_default_unit.3 -MLINKS+= mixer.3 mixer_set_default_unit.3 +MLINKS+= mixer.3 mixer_get_dunit.3 +MLINKS+= mixer.3 mixer_set_dunit.3 MLINKS+= mixer.3 mixer_get_mode.3 MLINKS+= mixer.3 mixer_get_nmixers.3 MLINKS+= mixer.3 MIX_ISDEV.3 diff --git a/lib/libmixer/Symbol.map b/lib/libmixer/Symbol.map index 6736debe1897..cee4e3bdbc18 100644 --- a/lib/libmixer/Symbol.map +++ b/lib/libmixer/Symbol.map @@ -15,8 +15,8 @@ FBSD_1.7 { mixer_set_vol; mixer_set_mute; mixer_mod_recsrc; - mixer_get_default_unit; - mixer_set_default_unit; + mixer_get_dunit; + mixer_set_dunit; mixer_get_mode; mixer_get_nmixers; }; From owner-dev-commits-src-all@freebsd.org Fri Oct 1 14:36:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A79D6B0A10; Fri, 1 Oct 2021 14:36: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 4HLXjz1CQgz4WQB; Fri, 1 Oct 2021 14:36:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09F4921268; Fri, 1 Oct 2021 14:36: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 191Eacwa017420; Fri, 1 Oct 2021 14:36:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191Eackp017419; Fri, 1 Oct 2021 14:36:38 GMT (envelope-from git) Date: Fri, 1 Oct 2021 14:36:38 GMT Message-Id: <202110011436.191Eackp017419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: a36230f75e0a - main - tcp: Make dsack stats available in netstat and also make sure its aware of TLP's. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a36230f75e0ae5090e4ef47393536255b436cca6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 14:36:39 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=a36230f75e0ae5090e4ef47393536255b436cca6 commit a36230f75e0ae5090e4ef47393536255b436cca6 Author: Randall Stewart AuthorDate: 2021-10-01 14:32:30 +0000 Commit: Randall Stewart CommitDate: 2021-10-01 14:36:27 +0000 tcp: Make dsack stats available in netstat and also make sure its aware of TLP's. DSACK accounting has been for quite some time under a NETFLIX_STATS ifdef. Statistics on DSACKs however are very useful in figuring out how much bad retransmissions you are doing. This is further complicated, however, by stacks that do TLP. A TLP when discovering a lost ack in the reverse path will cause the generation of a DSACK. For this situation we introduce a new dsack-tlp-bytes as well as the more traditional dsack-bytes and dsack-packets. These will now all display in netstat -p tcp -s. This also updates all stacks that are currently built to keep track of these stats. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32158 --- sys/netinet/tcp_sack.c | 6 ++++++ sys/netinet/tcp_stacks/bbr.c | 4 +--- sys/netinet/tcp_stacks/rack.c | 14 +++++++++----- sys/netinet/tcp_subr.c | 27 +++++++++++++++++++++++++++ sys/netinet/tcp_var.h | 16 ++++++++++++++-- usr.bin/netstat/inet.c | 6 ++++++ 6 files changed, 63 insertions(+), 10 deletions(-) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 9753536926d5..25eb633fbbd4 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -604,6 +604,12 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) SEQ_GT(sack.end, tp->snd_una) && SEQ_LEQ(sack.end, tp->snd_max)) { sack_blocks[num_sack_blks++] = sack; + } else if (SEQ_LEQ(sack.start, th_ack) && + SEQ_LEQ(sack.end, th_ack)) { + /* + * Its a D-SACK block. + */ + tcp_record_dsack(tp, sack.start, sack.end, 0); } } } diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index c96fec07b6c9..3c4cf0f54d97 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -7593,14 +7593,12 @@ proc_sack: } sack_blocks[num_sack_blks] = sack; num_sack_blks++; -#ifdef NETFLIX_STATS } else if (SEQ_LEQ(sack.start, th_ack) && SEQ_LEQ(sack.end, th_ack)) { /* * Its a D-SACK block. */ - tcp_record_dsack(sack.start, sack.end); -#endif + tcp_record_dsack(tp, sack.start, sack.end, 0); } } if (num_sack_blks == 0) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 2369a1c368bf..00f830caf217 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -9402,11 +9402,12 @@ rack_do_detection(struct tcpcb *tp, struct tcp_rack *rack, uint32_t bytes_this_ } #endif -static void +static int rack_note_dsack(struct tcp_rack *rack, tcp_seq start, tcp_seq end) { uint32_t am, l_end; + int was_tlp = 0; if (SEQ_GT(end, start)) am = end - start; @@ -9422,6 +9423,7 @@ rack_note_dsack(struct tcp_rack *rack, tcp_seq start, tcp_seq end) * our previous retransmit TLP. */ rack_log_dsack_event(rack, 7, __LINE__, start, end); + was_tlp = 1; goto skip_dsack_round; } if (rack->rc_last_sent_tlp_seq_valid) { @@ -9433,6 +9435,7 @@ rack_note_dsack(struct tcp_rack *rack, tcp_seq start, tcp_seq end) * for reordering purposes. */ rack_log_dsack_event(rack, 7, __LINE__, start, end); + was_tlp = 1; goto skip_dsack_round; } } @@ -9462,6 +9465,7 @@ skip_dsack_round: rack->r_ctl.retran_during_recovery = 0; rack->r_ctl.dsack_byte_cnt = 0; } + return (was_tlp); } static void @@ -9614,13 +9618,13 @@ rack_log_ack(struct tcpcb *tp, struct tcpopt *to, struct tcphdr *th, int entered num_sack_blks++; } else if (SEQ_LEQ(sack.start, th_ack) && SEQ_LEQ(sack.end, th_ack)) { -#ifdef NETFLIX_STATS + int was_tlp; + + was_tlp = rack_note_dsack(rack, sack.start, sack.end); /* * Its a D-SACK block. */ - tcp_record_dsack(sack.start, sack.end); -#endif - rack_note_dsack(rack, sack.start, sack.end); + tcp_record_dsack(tp, sack.start, sack.end, was_tlp); } } if (rack->rc_dsack_round_seen) { diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 697ae7d3270b..9d66086a383b 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -390,6 +390,30 @@ static int tcp_fb_cnt = 0; struct tcp_funchead t_functions; static struct tcp_function_block *tcp_func_set_ptr = &tcp_def_funcblk; +void +tcp_record_dsack(struct tcpcb *tp, tcp_seq start, tcp_seq end, int tlp) +{ + TCPSTAT_INC(tcps_dsack_count); + tp->t_dsack_pack++; + if (tlp == 0) { + if (SEQ_GT(end, start)) { + tp->t_dsack_bytes += (end - start); + TCPSTAT_ADD(tcps_dsack_bytes, (end - start)); + } else { + tp->t_dsack_tlp_bytes += (start - end); + TCPSTAT_ADD(tcps_dsack_bytes, (start - end)); + } + } else { + if (SEQ_GT(end, start)) { + tp->t_dsack_bytes += (end - start); + TCPSTAT_ADD(tcps_dsack_tlp_bytes, (end - start)); + } else { + tp->t_dsack_tlp_bytes += (start - end); + TCPSTAT_ADD(tcps_dsack_tlp_bytes, (start - end)); + } + } +} + static struct tcp_function_block * find_tcp_functions_locked(struct tcp_function_set *fs) { @@ -4003,6 +4027,9 @@ tcp_inptoxtp(const struct inpcb *inp, struct xtcpcb *xt) xt->t_snd_wnd = tp->snd_wnd; xt->t_snd_cwnd = tp->snd_cwnd; xt->t_snd_ssthresh = tp->snd_ssthresh; + xt->t_dsack_bytes = tp->t_dsack_bytes; + xt->t_dsack_tlp_bytes = tp->t_dsack_tlp_bytes; + xt->t_dsack_pack = tp->t_dsack_pack; xt->t_maxseg = tp->t_maxseg; xt->xt_ecn = (tp->t_flags2 & TF2_ECN_PERMIT) ? 1 : 0 + (tp->t_flags2 & TF2_ACE_PERMIT) ? 2 : 0; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index c26f503f4a1d..d5b2963ef4dc 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -265,6 +265,9 @@ struct tcpcb { uint64_t t_sndtlpbyte; /* total tail loss probe bytes sent */ uint64_t t_sndbytes; /* total bytes sent */ uint64_t t_snd_rxt_bytes; /* total bytes retransmitted */ + uint32_t t_dsack_bytes; /* Total number of dsack bytes we have received */ + uint32_t t_dsack_tlp_bytes; /* Total number of dsack bytes we have received for TLPs sent */ + uint32_t t_dsack_pack; /* Total dsack packets we have recieved */ uint8_t t_tfo_client_cookie_len; /* TCP Fast Open client cookie length */ uint32_t t_end_info_status; /* Status flag of end info */ @@ -703,7 +706,12 @@ struct tcpstat { uint64_t tcps_tunneled_pkts; /* Packets encap's in UDP received */ uint64_t tcps_tunneled_errs; /* Packets that had errors that were UDP encaped */ - uint64_t _pad[9]; /* 6 UTO, 3 TBD */ + /* Dsack related stats */ + uint64_t tcps_dsack_count; /* Number of ACKs arriving with DSACKs */ + uint64_t tcps_dsack_bytes; /* Number of bytes DSACK'ed no TLP */ + uint64_t tcps_dsack_tlp_bytes; /* Number of bytes DSACK'ed due to TLPs */ + + uint64_t _pad[6]; /* 3 UTO, 3 TBD */ }; #define tcps_rcvmemdrop tcps_rcvreassfull /* compat */ @@ -801,9 +809,12 @@ struct xtcpcb { uint32_t t_rcv_wnd; /* (s) */ uint32_t t_snd_wnd; /* (s) */ uint32_t xt_ecn; /* (s) */ + uint32_t t_dsack_bytes; /* (n) */ + uint32_t t_dsack_tlp_bytes; /* (n) */ + uint32_t t_dsack_pack; /* (n) */ uint16_t xt_encaps_port; /* (s) */ int16_t spare16; - int32_t spare32[25]; + int32_t spare32[22]; } __aligned(8); #ifdef _KERNEL @@ -1064,6 +1075,7 @@ int tcp_twcheck(struct inpcb *, struct tcpopt *, struct tcphdr *, struct mbuf *, int); void tcp_setpersist(struct tcpcb *); void tcp_slowtimo(void); +void tcp_record_dsack(struct tcpcb *tp, tcp_seq start, tcp_seq end, int tlp); struct tcptemp * tcpip_maketemplate(struct inpcb *); void tcpip_fillheaders(struct inpcb *, uint16_t, void *, void *); diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 45c5f05e60b8..2d3a4bb10d52 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -695,6 +695,12 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) "{N:/window probe%s}\n"); p(tcps_rcvwinupd, "\t\t{:receive-window-update-packets/%ju} " "{N:/window update packet%s}\n"); + p(tcps_dsack_count, "\t\t{:received-with-dsack-packets/%ju} " + "{N:/packet%s received with dsack}\n"); + p(tcps_dsack_bytes, "\t\t{:received-with-dsack-bytes/%ju} " + "{N:/dsack byte%s received (no TLP involved)}\n"); + p(tcps_dsack_tlp_bytes, "\t\t{:received-with-dsack-bytes-tlp/%ju} " + "{N:/dsack byte%s received (TLP responsible)}\n"); p(tcps_rcvafterclose, "\t\t{:received-after-close-packets/%ju} " "{N:/packet%s received after close}\n"); p(tcps_rcvbadsum, "\t\t{:discard-bad-checksum/%ju} " From owner-dev-commits-src-all@freebsd.org Fri Oct 1 16:43:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C2C46B2363; Fri, 1 Oct 2021 16:43: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 4HLbWx27hLz4jJ6; Fri, 1 Oct 2021 16:43:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29D6722F1A; Fri, 1 Oct 2021 16:43: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 191Gh91q089804; Fri, 1 Oct 2021 16:43:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191Gh9RT089803; Fri, 1 Oct 2021 16:43:09 GMT (envelope-from git) Date: Fri, 1 Oct 2021 16:43:09 GMT Message-Id: <202110011643.191Gh9RT089803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric van Gyzen Subject: git: 31466594cd09 - main - sem_clockwait_np test: relax time constraint on VMs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31466594cd09d1413dbd8cab516fafc3557c2200 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 16:43:09 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=31466594cd09d1413dbd8cab516fafc3557c2200 commit 31466594cd09d1413dbd8cab516fafc3557c2200 Author: Eric van Gyzen AuthorDate: 2021-10-01 10:37:17 +0000 Commit: Eric van Gyzen CommitDate: 2021-10-01 11:39:30 +0000 sem_clockwait_np test: relax time constraint on VMs In a guest on a busy hypervisor, the time remaining after an interrupted sleep could be much lower than other environments. Relax the lower bound on VMs. MFC after: 1 week Sponsored by: Dell EMC Isilon --- contrib/netbsd-tests/lib/librt/t_sem.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/contrib/netbsd-tests/lib/librt/t_sem.c b/contrib/netbsd-tests/lib/librt/t_sem.c index 5e059238f278..55a416083846 100644 --- a/contrib/netbsd-tests/lib/librt/t_sem.c +++ b/contrib/netbsd-tests/lib/librt/t_sem.c @@ -60,6 +60,11 @@ __COPYRIGHT("@(#) Copyright (c) 2008, 2010\ The NetBSD Foundation, inc. All rights reserved."); __RCSID("$NetBSD: t_sem.c,v 1.3 2017/01/14 20:58:20 christos Exp $"); +#ifdef __FreeBSD__ +#include +#include +#endif + #include #include @@ -78,6 +83,24 @@ __RCSID("$NetBSD: t_sem.c,v 1.3 2017/01/14 20:58:20 christos Exp $"); #define SEM_REQUIRE(x) \ ATF_REQUIRE_EQ_MSG(x, 0, "%s", strerror(errno)) +#ifdef __FreeBSD__ +static bool +machine_is_virtual(void) +{ + char vm_guest[32]; + int error; + + error = sysctlbyname("kern.vm_guest", vm_guest, + &(size_t){sizeof(vm_guest)}, NULL, 0); + ATF_CHECK_EQ_MSG(0, error, "sysctlbyname(kern.vm_guest): %s", + strerror(errno)); + if (error != 0) { + return (false); + } + return (strcmp(vm_guest, "none") != 0); +} +#endif + ATF_TC_WITH_CLEANUP(basic); ATF_TC_HEAD(basic, tc) { @@ -306,15 +329,11 @@ ATF_TC_BODY(timedwait, tc) ATF_REQUIRE_ERRNO(EINTR, sem_clockwait_np(&sem, CLOCK_MONOTONIC, 0, &ts, &remain)); ATF_REQUIRE_MSG(got_sigalrm, "did not get SIGALRM"); - /* - * If this nsec comparison turns out to be unreliable due to timing, - * it could simply check that nsec < 100 ms. - */ ATF_REQUIRE_MSG(remain.tv_sec == 0 && - remain.tv_nsec >= 25*1000*1000 && + (remain.tv_nsec >= 25*1000*1000 || machine_is_virtual()) && remain.tv_nsec <= 75*1000*1000, "the remaining time was not as expected when a relative clockwait" - " got EINTR" ); + " got EINTR: %ld.%09ld", remain.tv_sec, remain.tv_nsec); #endif } From owner-dev-commits-src-all@freebsd.org Fri Oct 1 16:43:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87C2D6B25A5; Fri, 1 Oct 2021 16:43: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 4HLbWy2sJhz4jRt; Fri, 1 Oct 2021 16:43:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4104123004; Fri, 1 Oct 2021 16:43: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 191GhAEn089834; Fri, 1 Oct 2021 16:43:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191GhAdh089833; Fri, 1 Oct 2021 16:43:10 GMT (envelope-from git) Date: Fri, 1 Oct 2021 16:43:10 GMT Message-Id: <202110011643.191GhAdh089833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric van Gyzen Subject: git: 2334abfd01ba - main - sem test: move sem_clockwait_np tests into individual cases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2334abfd01ba92dfa6a7ab6f2c4cc45fa64ffd3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 16:43:10 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=2334abfd01ba92dfa6a7ab6f2c4cc45fa64ffd3c commit 2334abfd01ba92dfa6a7ab6f2c4cc45fa64ffd3c Author: Eric van Gyzen AuthorDate: 2021-10-01 11:24:27 +0000 Commit: Eric van Gyzen CommitDate: 2021-10-01 11:39:34 +0000 sem test: move sem_clockwait_np tests into individual cases Move these tests into individual test cases for all the usual reasons. No functional change intended. MFC after: 1 week Sponsored by: Dell EMC Isilon --- contrib/netbsd-tests/lib/librt/t_sem.c | 126 ++++++++++++++++++++++++++------- 1 file changed, 102 insertions(+), 24 deletions(-) diff --git a/contrib/netbsd-tests/lib/librt/t_sem.c b/contrib/netbsd-tests/lib/librt/t_sem.c index 55a416083846..3156b11e9bf3 100644 --- a/contrib/netbsd-tests/lib/librt/t_sem.c +++ b/contrib/netbsd-tests/lib/librt/t_sem.c @@ -221,14 +221,27 @@ sigalrm_handler(int sig __unused) got_sigalrm = 1; } +#ifdef __FreeBSD__ +/* This is refactored from the timedwait test case. */ +static void +setup_signals(void) +{ + struct sigaction act = { + .sa_handler = sigalrm_handler, + .sa_flags = 0 /* not SA_RESTART */ + }; + + ATF_REQUIRE_MSG(sigemptyset(&act.sa_mask) == 0, + "%s", strerror(errno)); + ATF_REQUIRE_MSG(sigaction(SIGALRM, &act, NULL) == 0, + "%s", strerror(errno)); +} +#endif + ATF_TC(timedwait); ATF_TC_HEAD(timedwait, tc) { - atf_tc_set_md_var(tc, "descr", "Tests sem_timedwait(3)" -#ifdef __FreeBSD__ - " and sem_clockwait_np(3)" -#endif - ); + atf_tc_set_md_var(tc, "descr", "Tests sem_timedwait(3)"); atf_tc_set_md_var(tc, "timeout", "20"); } ATF_TC_BODY(timedwait, tc) @@ -263,14 +276,10 @@ ATF_TC_BODY(timedwait, tc) ATF_REQUIRE_ERRNO(EINVAL, sem_timedwait(&sem, &ts)); /* EINTR */ - struct sigaction act = { - .sa_handler = sigalrm_handler, - .sa_flags = 0 /* not SA_RESTART */ - }; - ATF_REQUIRE_MSG(sigemptyset(&act.sa_mask) == 0, - "%s", strerror(errno)); - ATF_REQUIRE_MSG(sigaction(SIGALRM, &act, NULL) == 0, - "%s", strerror(errno)); +#ifdef __FreeBSD__ + /* This is refactored into a function. */ + setup_signals(); +#endif struct itimerval it = { .it_value.tv_usec = 50*1000 }; @@ -281,9 +290,24 @@ ATF_TC_BODY(timedwait, tc) timespec_add_ms(&ts, 100); ATF_REQUIRE_ERRNO(EINTR, sem_timedwait(&sem, &ts)); ATF_REQUIRE_MSG(got_sigalrm, "did not get SIGALRM"); +} #ifdef __FreeBSD__ - /* CLOCK_MONOTONIC, absolute */ + +ATF_TC(clockwait_monotonic_absolute); +ATF_TC_HEAD(clockwait_monotonic_absolute, tc) +{ + atf_tc_set_md_var(tc, "descr", + "sem_clockwait_np(3) with monotonic clock and absolute time"); + atf_tc_set_md_var(tc, "timeout", "20"); +} +ATF_TC_BODY(clockwait_monotonic_absolute, tc) +{ + struct timespec ts; + sem_t sem; + + SEM_REQUIRE(sem_init(&sem, 0, 0)); + SEM_REQUIRE(sem_post(&sem)); ATF_REQUIRE_MSG(clock_gettime(CLOCK_MONOTONIC, &ts) == 0, "%s", strerror(errno)); @@ -292,8 +316,22 @@ ATF_TC_BODY(timedwait, tc) &ts, NULL)); ATF_REQUIRE_ERRNO(ETIMEDOUT, sem_clockwait_np(&sem, CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL)); +} + +ATF_TC(clockwait_monotonic_relative); +ATF_TC_HEAD(clockwait_monotonic_relative, tc) +{ + atf_tc_set_md_var(tc, "descr", + "sem_clockwait_np(3) with monotonic clock and relative time"); + atf_tc_set_md_var(tc, "timeout", "20"); +} +ATF_TC_BODY(clockwait_monotonic_relative, tc) +{ + struct timespec ts; + sem_t sem; + + SEM_REQUIRE(sem_init(&sem, 0, 0)); - /* CLOCK_MONOTONIC, relative */ SEM_REQUIRE(sem_post(&sem)); ts.tv_sec = 0; ts.tv_nsec = 100*1000*1000; @@ -301,11 +339,28 @@ ATF_TC_BODY(timedwait, tc) &ts, NULL)); ATF_REQUIRE_ERRNO(ETIMEDOUT, sem_clockwait_np(&sem, CLOCK_MONOTONIC, 0, &ts, NULL)); +} + +ATF_TC(clockwait_absolute_intr_remaining); +ATF_TC_HEAD(clockwait_absolute_intr_remaining, tc) +{ + atf_tc_set_md_var(tc, "descr", + "sem_clockwait_np(3) with absolute time does not update " + "remaining time on EINTR"); + atf_tc_set_md_var(tc, "timeout", "20"); +} +ATF_TC_BODY(clockwait_absolute_intr_remaining, tc) +{ + struct timespec ts; + sem_t sem; + + SEM_REQUIRE(sem_init(&sem, 0, 0)); + setup_signals(); - /* absolute does not update remaining time on EINTR */ struct timespec remain = {42, 1000*1000*1000}; - got_sigalrm = 0; - it.it_value.tv_usec = 50*1000; + struct itimerval it = { + .it_value.tv_usec = 50*1000 + }; ATF_REQUIRE_MSG(setitimer(ITIMER_REAL, &it, NULL) == 0, "%s", strerror(errno)); ATF_REQUIRE_MSG(clock_gettime(CLOCK_MONOTONIC, &ts) == 0, @@ -316,12 +371,28 @@ ATF_TC_BODY(timedwait, tc) ATF_REQUIRE_MSG(got_sigalrm, "did not get SIGALRM"); ATF_REQUIRE_MSG(remain.tv_sec == 42 && remain.tv_nsec == 1000*1000*1000, "an absolute clockwait modified the remaining time on EINTR"); +} + +ATF_TC(clockwait_relative_intr_remaining); +ATF_TC_HEAD(clockwait_relative_intr_remaining, tc) +{ + atf_tc_set_md_var(tc, "descr", + "sem_clockwait_np(3) with relative time updates " + "remaining time on EINTR"); + atf_tc_set_md_var(tc, "timeout", "20"); +} +ATF_TC_BODY(clockwait_relative_intr_remaining, tc) +{ + struct timespec ts; + sem_t sem; - /* relative updates remaining time on EINTR */ - remain.tv_sec = 42; - remain.tv_nsec = 1000*1000*1000; - got_sigalrm = 0; - it.it_value.tv_usec = 50*1000; + SEM_REQUIRE(sem_init(&sem, 0, 0)); + setup_signals(); + + struct timespec remain = {42, 1000*1000*1000}; + struct itimerval it = { + .it_value.tv_usec = 50*1000 + }; ATF_REQUIRE_MSG(setitimer(ITIMER_REAL, &it, NULL) == 0, "%s", strerror(errno)); ts.tv_sec = 0; @@ -334,15 +405,22 @@ ATF_TC_BODY(timedwait, tc) remain.tv_nsec <= 75*1000*1000, "the remaining time was not as expected when a relative clockwait" " got EINTR: %ld.%09ld", remain.tv_sec, remain.tv_nsec); -#endif } +#endif /* __FreeBSD__ */ + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, basic); ATF_TP_ADD_TC(tp, child); ATF_TP_ADD_TC(tp, timedwait); +#ifdef __FreeBSD__ + ATF_TP_ADD_TC(tp, clockwait_monotonic_absolute); + ATF_TP_ADD_TC(tp, clockwait_monotonic_relative); + ATF_TP_ADD_TC(tp, clockwait_absolute_intr_remaining); + ATF_TP_ADD_TC(tp, clockwait_relative_intr_remaining); +#endif return atf_no_error(); } From owner-dev-commits-src-all@freebsd.org Fri Oct 1 16:43:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC9586B236C; Fri, 1 Oct 2021 16:43: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 4HLbWz4HjFz4jXJ; Fri, 1 Oct 2021 16:43:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6723422F8E; Fri, 1 Oct 2021 16:43: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 191GhB0X089859; Fri, 1 Oct 2021 16:43:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191GhBEb089858; Fri, 1 Oct 2021 16:43:11 GMT (envelope-from git) Date: Fri, 1 Oct 2021 16:43:11 GMT Message-Id: <202110011643.191GhBEb089858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric van Gyzen Subject: git: 35e4527e88d3 - main - sem_clockwait_np test: fix usage of ATF API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35e4527e88d3843cccf2f15a32b1fa041a01d693 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 16:43:11 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=35e4527e88d3843cccf2f15a32b1fa041a01d693 commit 35e4527e88d3843cccf2f15a32b1fa041a01d693 Author: Eric van Gyzen AuthorDate: 2021-10-01 11:25:48 +0000 Commit: Eric van Gyzen CommitDate: 2021-10-01 11:39:34 +0000 sem_clockwait_np test: fix usage of ATF API ATF_REQUIRE_ERRNO requires the given errno iff the given expression is true. These test cases used it incorrectly, potentially allowing sem_clockwait_np to succeed when it was expected to fail. Use separate ATF calls to require failure and the expected errno. MFC after: 1 week Sponsored by: Dell EMC Isilon --- contrib/netbsd-tests/lib/librt/t_sem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/netbsd-tests/lib/librt/t_sem.c b/contrib/netbsd-tests/lib/librt/t_sem.c index 3156b11e9bf3..1c4290c0b3fb 100644 --- a/contrib/netbsd-tests/lib/librt/t_sem.c +++ b/contrib/netbsd-tests/lib/librt/t_sem.c @@ -366,8 +366,9 @@ ATF_TC_BODY(clockwait_absolute_intr_remaining, tc) ATF_REQUIRE_MSG(clock_gettime(CLOCK_MONOTONIC, &ts) == 0, "%s", strerror(errno)); timespec_add_ms(&ts, 100); - ATF_REQUIRE_ERRNO(EINTR, sem_clockwait_np(&sem, CLOCK_MONOTONIC, + ATF_REQUIRE_EQ(-1, sem_clockwait_np(&sem, CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, &remain)); + ATF_REQUIRE_ERRNO(EINTR, 1); ATF_REQUIRE_MSG(got_sigalrm, "did not get SIGALRM"); ATF_REQUIRE_MSG(remain.tv_sec == 42 && remain.tv_nsec == 1000*1000*1000, "an absolute clockwait modified the remaining time on EINTR"); @@ -397,8 +398,9 @@ ATF_TC_BODY(clockwait_relative_intr_remaining, tc) "%s", strerror(errno)); ts.tv_sec = 0; ts.tv_nsec = 100*1000*1000; - ATF_REQUIRE_ERRNO(EINTR, sem_clockwait_np(&sem, CLOCK_MONOTONIC, 0, &ts, + ATF_REQUIRE_EQ(-1, sem_clockwait_np(&sem, CLOCK_MONOTONIC, 0, &ts, &remain)); + ATF_REQUIRE_ERRNO(EINTR, 1); ATF_REQUIRE_MSG(got_sigalrm, "did not get SIGALRM"); ATF_REQUIRE_MSG(remain.tv_sec == 0 && (remain.tv_nsec >= 25*1000*1000 || machine_is_virtual()) && From owner-dev-commits-src-all@freebsd.org Fri Oct 1 16:56:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76B8F6B282A; Fri, 1 Oct 2021 16:56: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 4HLbqB2cs1z4kF1; Fri, 1 Oct 2021 16:56:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F268230AD; Fri, 1 Oct 2021 16:56:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 191GuMZj004034; Fri, 1 Oct 2021 16:56:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191GuMD0004033; Fri, 1 Oct 2021 16:56:22 GMT (envelope-from git) Date: Fri, 1 Oct 2021 16:56:22 GMT Message-Id: <202110011656.191GuMD0004033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d5fca1dc1d7d - main - nvme_ctrlr_enable: Remove unnecessary 5ms delays 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/main X-Git-Reftype: branch X-Git-Commit: d5fca1dc1d7de15695b65374d6457abd29a747ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 16:56:22 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d5fca1dc1d7de15695b65374d6457abd29a747ee commit d5fca1dc1d7de15695b65374d6457abd29a747ee Author: Warner Losh AuthorDate: 2021-10-01 16:47:27 +0000 Commit: Warner Losh CommitDate: 2021-10-01 16:56:10 +0000 nvme_ctrlr_enable: Remove unnecessary 5ms delays Remove the 5ms delays after writing the administrative queue registers. These delays are from the very earliest days of the driver (they are in the first commit) and were most likely vestiges of the Chatham NVMe prototype card that was used to create this driver. Many of the workarounds necessary for it aren't necessary for standards compliant cards. The original driver had other areas marked for Chatham, but these were not. They are unneeded. There's three lines of supporting evidence. First, the NVMe standards make no mention of a delay time after these registers are written. Second, the Linux driver doesn't have them, even as an option. Third, all my nvme cards work w/o them. To be safe, add a write barrier between setting up the admin queue and enabling the controller. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D32247 --- sys/dev/nvme/nvme_ctrlr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 39cde3f065dd..897d832047ce 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -52,6 +52,12 @@ __FBSDID("$FreeBSD$"); static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); +static void +nvme_ctrlr_barrier(struct nvme_controller *ctrlr, int flags) +{ + bus_barrier(ctrlr->resource, 0, rman_get_size(ctrlr->resource), flags); +} + static void nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const char *msg, ...) { @@ -356,9 +362,7 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr) } nvme_mmio_write_8(ctrlr, asq, ctrlr->adminq.cmd_bus_addr); - DELAY(5000); nvme_mmio_write_8(ctrlr, acq, ctrlr->adminq.cpl_bus_addr); - DELAY(5000); /* acqs and asqs are 0-based. */ qsize = ctrlr->adminq.num_entries - 1; @@ -367,7 +371,6 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr) aqa = (qsize & NVME_AQA_REG_ACQS_MASK) << NVME_AQA_REG_ACQS_SHIFT; aqa |= (qsize & NVME_AQA_REG_ASQS_MASK) << NVME_AQA_REG_ASQS_SHIFT; nvme_mmio_write_4(ctrlr, aqa, aqa); - DELAY(5000); /* Initialization values for CC */ cc = 0; @@ -381,6 +384,7 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr) /* This evaluates to 0, which is according to spec. */ cc |= (PAGE_SIZE >> 13) << NVME_CC_REG_MPS_SHIFT; + nvme_ctrlr_barrier(ctrlr, BUS_SPACE_BARRIER_WRITE); nvme_mmio_write_4(ctrlr, cc, cc); return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 16:56:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 881306B2833; Fri, 1 Oct 2021 16:56: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 4HLbqC3GfKz4kC6; Fri, 1 Oct 2021 16:56:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 509CA23256; Fri, 1 Oct 2021 16:56: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 191GuNuC004058; Fri, 1 Oct 2021 16:56:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191GuNM3004057; Fri, 1 Oct 2021 16:56:23 GMT (envelope-from git) Date: Fri, 1 Oct 2021 16:56:23 GMT Message-Id: <202110011656.191GuNM3004057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 26259f6ab96e - main - nvme: Use MS_2_TICKS rather than rolling our own 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/main X-Git-Reftype: branch X-Git-Commit: 26259f6ab96e68766556b973d3a4ca0ad125e174 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 16:56:23 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=26259f6ab96e68766556b973d3a4ca0ad125e174 commit 26259f6ab96e68766556b973d3a4ca0ad125e174 Author: Warner Losh AuthorDate: 2021-10-01 16:50:04 +0000 Commit: Warner Losh CommitDate: 2021-10-01 16:56:10 +0000 nvme: Use MS_2_TICKS rather than rolling our own Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D32246 --- sys/dev/nvme/nvme_ctrlr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 897d832047ce..f22e21eaf54a 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -262,7 +262,7 @@ nvme_ctrlr_fail_req_task(void *arg, int pending) static int nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) { - int timeout = ticks + (uint64_t)ctrlr->ready_timeout_in_ms * hz / 1000; + int timeout = ticks + MSEC_2_TICKS(ctrlr->ready_timeout_in_ms); uint32_t csts; while (1) { @@ -326,7 +326,7 @@ nvme_ctrlr_disable(struct nvme_controller *ctrlr) * cope with these issues. */ if (ctrlr->quirks & QUIRK_DELAY_B4_CHK_RDY) - pause("nvmeR", B4_CHK_RDY_DELAY_MS * hz / 1000); + pause("nvmeR", MSEC_2_TICKS(B4_CHK_RDY_DELAY_MS)); return (nvme_ctrlr_wait_for_ready(ctrlr, 0)); } From owner-dev-commits-src-all@freebsd.org Fri Oct 1 16:56:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF7AB6B2746; Fri, 1 Oct 2021 16:56: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 4HLbqD3zNHz4kLm; Fri, 1 Oct 2021 16:56:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A4B723257; Fri, 1 Oct 2021 16:56: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 191GuO2C004082; Fri, 1 Oct 2021 16:56:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191GuOnu004081; Fri, 1 Oct 2021 16:56:24 GMT (envelope-from git) Date: Fri, 1 Oct 2021 16:56:24 GMT Message-Id: <202110011656.191GuOnu004081@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a245627a4e95 - main - nvme_ctrlr_enable: Small style nits 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/main X-Git-Reftype: branch X-Git-Commit: a245627a4e9553c84eddea07570daaf85c1067b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 16:56:25 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a245627a4e9553c84eddea07570daaf85c1067b6 commit a245627a4e9553c84eddea07570daaf85c1067b6 Author: Warner Losh AuthorDate: 2021-10-01 16:51:24 +0000 Commit: Warner Losh CommitDate: 2021-10-01 16:56:10 +0000 nvme_ctrlr_enable: Small style nits Rewrite the nested if's using the preferred FreeBSD style for branches of ifs that return. NFC. Minor tweaks to the comments to better fit new code layout. Sponsored by: Netflix Reviewed by: mav, chuck (prior rev, but comments rolled in) Differential Revision: https://reviews.freebsd.org/D32245 --- sys/dev/nvme/nvme_ctrlr.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index f22e21eaf54a..10b30c584f71 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -303,19 +303,17 @@ nvme_ctrlr_disable(struct nvme_controller *ctrlr) * CSTS.RDY is 0 "has undefined results" So make sure that CSTS.RDY * isn't the desired value. Short circuit if we're already disabled. */ - if (en == 1) { - if (rdy == 0) { - /* EN == 1, wait for RDY == 1 or fail */ - err = nvme_ctrlr_wait_for_ready(ctrlr, 1); - if (err != 0) - return (err); - } - } else { - /* EN == 0 already wait for RDY == 0 */ + if (en == 0) { + /* Wait for RDY == 0 or timeout & fail */ if (rdy == 0) return (0); - else - return (nvme_ctrlr_wait_for_ready(ctrlr, 0)); + return (nvme_ctrlr_wait_for_ready(ctrlr, 0)); + } + if (rdy == 0) { + /* EN == 1, wait for RDY == 1 or timeout & fail */ + err = nvme_ctrlr_wait_for_ready(ctrlr, 1); + if (err != 0) + return (err); } cc &= ~NVME_CC_REG_EN_MASK; @@ -352,15 +350,14 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr) if (en == 1) { if (rdy == 1) return (0); - else - return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); - } else { - /* EN == 0 already wait for RDY == 0 or fail */ - err = nvme_ctrlr_wait_for_ready(ctrlr, 0); - if (err != 0) - return (err); + return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); } + /* EN == 0 already wait for RDY == 0 or timeout & fail */ + err = nvme_ctrlr_wait_for_ready(ctrlr, 0); + if (err != 0) + return (err); + nvme_mmio_write_8(ctrlr, asq, ctrlr->adminq.cmd_bus_addr); nvme_mmio_write_8(ctrlr, acq, ctrlr->adminq.cpl_bus_addr); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 16:56:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DABB36B298D; Fri, 1 Oct 2021 16:56: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 4HLbqF5W69z4k2k; Fri, 1 Oct 2021 16:56:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E92122ECA; Fri, 1 Oct 2021 16:56: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 191GuPKE004106; Fri, 1 Oct 2021 16:56:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191GuPrA004105; Fri, 1 Oct 2021 16:56:25 GMT (envelope-from git) Date: Fri, 1 Oct 2021 16:56:25 GMT Message-Id: <202110011656.191GuPrA004105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 77054a897f64 - main - nvme: Explain a workaround a little better 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/main X-Git-Reftype: branch X-Git-Commit: 77054a897f6440632267e75ebe31793c7555b79e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 16:56:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=77054a897f6440632267e75ebe31793c7555b79e commit 77054a897f6440632267e75ebe31793c7555b79e Author: Warner Losh AuthorDate: 2021-10-01 15:53:10 +0000 Commit: Warner Losh CommitDate: 2021-10-01 16:56:10 +0000 nvme: Explain a workaround a little better The don't touch the mmio of the drive after we do a EN 1->0 transition is only for a tiny number of dirves that have this unforunate issue. Sponsored by: Netflix --- sys/dev/nvme/nvme_ctrlr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 10b30c584f71..eb95fa33b90b 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -318,10 +318,10 @@ nvme_ctrlr_disable(struct nvme_controller *ctrlr) cc &= ~NVME_CC_REG_EN_MASK; nvme_mmio_write_4(ctrlr, cc, cc); + /* - * Some drives have issues with accessing the mmio after we - * disable, so delay for a bit after we write the bit to - * cope with these issues. + * A few drives have firmware bugs that freeze the drive if we access + * the mmio too soon after we disable. */ if (ctrlr->quirks & QUIRK_DELAY_B4_CHK_RDY) pause("nvmeR", MSEC_2_TICKS(B4_CHK_RDY_DELAY_MS)); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 17:10:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C0E16B2D85; Fri, 1 Oct 2021 17:10: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 4HLc7M3q0Jz4lMM; Fri, 1 Oct 2021 17:10:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F245230C7; Fri, 1 Oct 2021 17:10: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 191HANEK026522; Fri, 1 Oct 2021 17:10:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191HANo4026521; Fri, 1 Oct 2021 17:10:23 GMT (envelope-from git) Date: Fri, 1 Oct 2021 17:10:23 GMT Message-Id: <202110011710.191HANo4026521@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e5e26e4a24a1 - main - nvme: Remove pause while resetting 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/main X-Git-Reftype: branch X-Git-Commit: e5e26e4a24a1142e02a9b477877e13ed0c194f36 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 17:10:23 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e5e26e4a24a1142e02a9b477877e13ed0c194f36 commit e5e26e4a24a1142e02a9b477877e13ed0c194f36 Author: Warner Losh AuthorDate: 2021-10-01 17:09:05 +0000 Commit: Warner Losh CommitDate: 2021-10-01 17:09:05 +0000 nvme: Remove pause while resetting After some study of the code and the standard, I think we can just drop the pause(), unconditionally. If we're not initialized, then there's nothing to wait for from a software perspective. If we are initialized, then there might be outstanding I/O. If so, then the qpair 'recovery state' will transition to WAITING in nvme_ctrlr_disable_qpairs, which will ignore any interrupts for items that complete before we complete the reset by setting cc.en=0. If we go on to fail the controller, we'll cancel the outstanding I/O transactions. If we reset the controller, the hardware throws away pending transactions and we retry all the pending I/O transactions. Any transactions that happend to complete before cc.en=0 will have the same effect in the end (doing the same transaction twice is just inefficient, it won't affect the state of the device any differently than having done it once). The standard imposes no wait times here, so it isn't needed from that perspective. Unanswered Question: Do we may need to disable interrupts while we disable in legacy mode since those are level-sensitive. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D32248 --- sys/dev/nvme/nvme_ctrlr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index eb95fa33b90b..d0be0da39902 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -410,13 +410,13 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr) int err; TSENTER(); - nvme_ctrlr_disable_qpairs(ctrlr); - pause("nvmehwreset", hz / 10); + nvme_ctrlr_disable_qpairs(ctrlr); err = nvme_ctrlr_disable(ctrlr); if (err != 0) return err; + err = nvme_ctrlr_enable(ctrlr); TSEXIT(); return (err); @@ -1653,13 +1653,10 @@ nvme_ctrlr_suspend(struct nvme_controller *ctrlr) * flushes any metadata the drive may have stored so it can survive * having its power removed and prevents the unsafe shutdown count from * incriminating. Once we delete the qpairs, we have to disable them - * before shutting down. The delay is out of paranoia in - * nvme_ctrlr_hw_reset, and is repeated here (though we should have no - * pending I/O that the delay copes with). + * before shutting down. */ nvme_ctrlr_delete_qpairs(ctrlr); nvme_ctrlr_disable_qpairs(ctrlr); - pause("nvmesusp", hz / 10); nvme_ctrlr_shutdown(ctrlr); return (0); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 17:10:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B12EF6B2AC4; Fri, 1 Oct 2021 17:10: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 4HLc7N4Zwmz4lMQ; Fri, 1 Oct 2021 17:10:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E8112333D; Fri, 1 Oct 2021 17:10: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 191HAODo026552; Fri, 1 Oct 2021 17:10:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191HAO5w026551; Fri, 1 Oct 2021 17:10:24 GMT (envelope-from git) Date: Fri, 1 Oct 2021 17:10:24 GMT Message-Id: <202110011710.191HAO5w026551@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4b3da659bf62 - main - nvme: Only reset once on attach. 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/main X-Git-Reftype: branch X-Git-Commit: 4b3da659bf62b0f5306b5acee9add41b84361498 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 17:10:24 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4b3da659bf62b0f5306b5acee9add41b84361498 commit 4b3da659bf62b0f5306b5acee9add41b84361498 Author: Warner Losh AuthorDate: 2021-10-01 17:09:34 +0000 Commit: Warner Losh CommitDate: 2021-10-01 17:09:34 +0000 nvme: Only reset once on attach. The FreeBSD nvme driver has reset the nvme controller twice on attach to address a theoretical issue assuring the hardware is in a known state. However, exierence has shown the second reset is unnecessary and increases the time to boot. Eliminate the second reset. Should there be a situation when you need a second reset (for buggy or at least somewhat out of the mainstream hardware), the hardware option NVME_2X_RESET will restore the old behavior. Document this in nvme(4). If there's any trouble at all with this, I'll add a sysctl tunable to control it. Sponsored by: Netflix Reviewed by: cperciva, mav Differential Revision: https://reviews.freebsd.org/D32241 --- share/man/man4/nvme.4 | 8 ++++++++ sys/conf/options | 1 + sys/dev/nvme/nvme_ctrlr.c | 27 +++++++++++++++++---------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/share/man/man4/nvme.4 b/share/man/man4/nvme.4 index db31b6f26b3e..eb9f9b222f51 100644 --- a/share/man/man4/nvme.4 +++ b/share/man/man4/nvme.4 @@ -172,6 +172,14 @@ value in hw.nvme.verbose_cmd_dump=1 .Ed .Pp +Prior versions of the driver reset the card twice on boot. +This proved to be unnecessary and inefficient, so the driver now resets drive +controller only once. +The old behavior may be restored in the kernel config file with +.Bd -literal -offset indent +.Cd options NVME_2X_RESET +.Ed +.Pp .Sh SYSCTL VARIABLES The following controller-level sysctls are currently implemented: .Bl -tag -width indent diff --git a/sys/conf/options b/sys/conf/options index 42703b621752..2d99dc8c67db 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1006,6 +1006,7 @@ EKCD opt_ekcd.h # NVME options NVME_USE_NVD opt_nvme.h +NVME_2X_RESET opt_nvme.h # amdsbwd options AMDSBWD_DEBUG opt_amdsbwd.h diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d0be0da39902..ca89e99d2934 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_cam.h" +#include "opt_nvme.h" #include #include @@ -1135,12 +1136,6 @@ nvme_ctrlr_start_config_hook(void *arg) TSENTER(); - /* - * Reset controller twice to ensure we do a transition from cc.en==1 to - * cc.en==0. This is because we don't really know what status the - * controller was left in when boot handed off to OS. Linux doesn't do - * this, however. If we adopt that policy, see also nvme_ctrlr_resume(). - */ if (nvme_ctrlr_hw_reset(ctrlr) != 0) { fail: nvme_ctrlr_fail(ctrlr); @@ -1148,8 +1143,17 @@ fail: return; } +#ifdef NVME_2X_RESET + /* + * Reset controller twice to ensure we do a transition from cc.en==1 to + * cc.en==0. This is because we don't really know what status the + * controller was left in when boot handed off to OS. Linux doesn't do + * this, however, and when the controller is in state cc.en == 0, no + * I/O can happen. + */ if (nvme_ctrlr_hw_reset(ctrlr) != 0) goto fail; +#endif nvme_qpair_reset(&ctrlr->adminq); nvme_admin_qpair_enable(&ctrlr->adminq); @@ -1672,14 +1676,17 @@ nvme_ctrlr_resume(struct nvme_controller *ctrlr) if (ctrlr->is_failed) return (0); - /* - * Have to reset the hardware twice, just like we do on attach. See - * nmve_attach() for why. - */ if (nvme_ctrlr_hw_reset(ctrlr) != 0) goto fail; +#ifdef NVME_2X_RESET + /* + * Prior to FreeBSD 13.1, FreeBSD's nvme driver reset the hardware twice + * to get it into a known good state. However, the hardware's state is + * good and we don't need to do this for proper functioning. + */ if (nvme_ctrlr_hw_reset(ctrlr) != 0) goto fail; +#endif /* * Now that we've reset the hardware, we can restart the controller. Any From owner-dev-commits-src-all@freebsd.org Fri Oct 1 17:31:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC81C6B320A; Fri, 1 Oct 2021 17:31: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 4HLcbj63Snz4mT2; Fri, 1 Oct 2021 17:31:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFE882376B; Fri, 1 Oct 2021 17:31: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 191HVTX5053546; Fri, 1 Oct 2021 17:31:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191HVTTK053545; Fri, 1 Oct 2021 17:31:29 GMT (envelope-from git) Date: Fri, 1 Oct 2021 17:31:29 GMT Message-Id: <202110011731.191HVTTK053545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: b984d153e057 - main - Don't set GELI UMA zone as UMA_ZONE_NOFREE. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b984d153e057b7879632b8e6015a05ce3f177580 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 17:31:30 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b984d153e057b7879632b8e6015a05ce3f177580 commit b984d153e057b7879632b8e6015a05ce3f177580 Author: Gleb Smirnoff AuthorDate: 2021-10-01 17:24:50 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-01 17:31:17 +0000 Don't set GELI UMA zone as UMA_ZONE_NOFREE. That fixes memory leak on last GELI provider destroyed, introduced in 2dbc9a388ee. This patch was originally developed late 2019 and the flag was necessary to prevent zone drainage under memory pressure. Today, with f09cbea31a3f the UMA is fixed not to drain into reserves. Discussed with: jtl, markj Fixes: 2dbc9a388ee PR: 258787 --- sys/geom/eli/g_eli.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index 773b9c829acc..c2fdb70980c0 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -892,13 +892,8 @@ g_eli_init_uma(void) G_ELI_AUTH_SECKEYLEN) * nsw_cluster_max + sizeof(uintptr_t), PAGE_SIZE); - /* - * Create the zone, setting UMA_ZONE_NOFREE so we won't - * drain the zone in a memory shortage. - */ g_eli_uma = uma_zcreate("GELI buffers", g_eli_alloc_sz, - NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); /* Reserve and pre-allocate pages, as appropriate. */ uma_zone_reserve(g_eli_uma, g_eli_minbufs); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 18:16:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3DE36B390F; Fri, 1 Oct 2021 18:16: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 4HLdbX58XNz4pSZ; Fri, 1 Oct 2021 18:16:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 911B42407B; Fri, 1 Oct 2021 18:16: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 191IGO5e011374; Fri, 1 Oct 2021 18:16:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191IGO91011373; Fri, 1 Oct 2021 18:16:24 GMT (envelope-from git) Date: Fri, 1 Oct 2021 18:16:24 GMT Message-Id: <202110011816.191IGO91011373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4aed5c3c9d1d - main - time_t is pathological: use %j + cast to print it. 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/main X-Git-Reftype: branch X-Git-Commit: 4aed5c3c9d1d78986d3feba3f128187c59fb2dfe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 18:16:24 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4aed5c3c9d1d78986d3feba3f128187c59fb2dfe commit 4aed5c3c9d1d78986d3feba3f128187c59fb2dfe Author: Warner Losh AuthorDate: 2021-10-01 18:14:35 +0000 Commit: Warner Losh CommitDate: 2021-10-01 18:16:10 +0000 time_t is pathological: use %j + cast to print it. Sponsored by: Netflix --- contrib/netbsd-tests/lib/librt/t_sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/netbsd-tests/lib/librt/t_sem.c b/contrib/netbsd-tests/lib/librt/t_sem.c index 1c4290c0b3fb..f542c6315528 100644 --- a/contrib/netbsd-tests/lib/librt/t_sem.c +++ b/contrib/netbsd-tests/lib/librt/t_sem.c @@ -406,7 +406,7 @@ ATF_TC_BODY(clockwait_relative_intr_remaining, tc) (remain.tv_nsec >= 25*1000*1000 || machine_is_virtual()) && remain.tv_nsec <= 75*1000*1000, "the remaining time was not as expected when a relative clockwait" - " got EINTR: %ld.%09ld", remain.tv_sec, remain.tv_nsec); + " got EINTR: %jd.%09ld", (uintmax_t)remain.tv_sec, remain.tv_nsec); } #endif /* __FreeBSD__ */ From owner-dev-commits-src-all@freebsd.org Fri Oct 1 18:17:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F04D6B372E; Fri, 1 Oct 2021 18:17:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HLddF0lQyz4pND; Fri, 1 Oct 2021 18:17:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDA9E241C9; Fri, 1 Oct 2021 18:17:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 191IHq8Z011579; Fri, 1 Oct 2021 18:17:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191IHqH1011578; Fri, 1 Oct 2021 18:17:52 GMT (envelope-from git) Date: Fri, 1 Oct 2021 18:17:52 GMT Message-Id: <202110011817.191IHqH1011578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 2f4dbe279f6b - main - kqueue: fix recent assertion 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/main X-Git-Reftype: branch X-Git-Commit: 2f4dbe279f6b5eb87ec493d96f6943ffdb603ba0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 18:17:53 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=2f4dbe279f6b5eb87ec493d96f6943ffdb603ba0 commit 2f4dbe279f6b5eb87ec493d96f6943ffdb603ba0 Author: Kyle Evans AuthorDate: 2021-10-01 16:59:31 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 18:17:30 +0000 kqueue: fix recent assertion NOTE_ABSTIME may also have a zero timeout, which indicates that we should still fire immediately as an absolute time in the past. A test has been added for this one as well. Fixes: 9c999a259f00 ("kqueue: don't arbitrarily restrict long-past...") Point hat: kevans Reported by: syzbot+1c8d1154f560b3930042@syzkaller.appspotmail.com --- sys/kern/kern_event.c | 3 ++- tests/sys/kqueue/libkqueue/timer.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 3cd7753d4f6d..c9b50912a22d 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -819,7 +819,8 @@ filt_timerattach(struct knote *kn) error = filt_timervalidate(kn, &to); if (error != 0) return (error); - KASSERT((kn->kn_flags & EV_ONESHOT) != 0 || to > 0, + KASSERT(to > 0 || (kn->kn_flags & EV_ONESHOT) != 0 || + (kn->kn_sfflags & NOTE_ABSTIME) != 0, ("%s: periodic timer has a calculated zero timeout", __func__)); KASSERT(to >= 0, ("%s: timer has a calculated negative timeout", __func__)); diff --git a/tests/sys/kqueue/libkqueue/timer.c b/tests/sys/kqueue/libkqueue/timer.c index 76dfc99e11f0..330c22c62bc5 100644 --- a/tests/sys/kqueue/libkqueue/timer.c +++ b/tests/sys/kqueue/libkqueue/timer.c @@ -247,6 +247,35 @@ test_abstime(void) success(); } +static void +test_abstime_epoch(void) +{ + const char *test_id = "kevent(EVFILT_TIMER (EPOCH), NOTE_ABSTIME)"; + struct kevent kev; + + test_begin(test_id); + + test_no_kevents(); + + EV_SET(&kev, vnode_fd, EVFILT_TIMER, EV_ADD, NOTE_ABSTIME, 0, + NULL); + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + /* Retrieve the event */ + kev.flags = EV_ADD; + kev.data = 1; + kev.fflags = 0; + kevent_cmp(&kev, kevent_get(kqfd)); + + /* Delete the event */ + kev.flags = EV_DELETE; + if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) + err(1, "%s", test_id); + + success(); +} + static void test_abstime_preboot(void) { @@ -599,6 +628,7 @@ test_evfilt_timer(void) test_oneshot(); test_periodic(); test_abstime(); + test_abstime_epoch(); test_abstime_preboot(); test_abstime_postboot(); test_update(); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 18:33:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28C206B36DA; Fri, 1 Oct 2021 18:33:34 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) (using TLSv1.3 with cipher TLS_AES_256_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 4HLdzL0Bwjz4qw9; Fri, 1 Oct 2021 18:33:33 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from disco.vangyzen.net (unknown [70.99.78.110]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 3F59A56485; Fri, 1 Oct 2021 13:33:27 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=vangyzen.net; s=default; t=1633113207; bh=ulqOzK4vXJnbn3Ez/Yw2gAPnYGfFwE4UAtI0iOJGl0g=; h=Subject:To:References:From:Date:In-Reply-To; b=jLdaV02ZV84O2Bwt098I7sytr0/n5Txih51S1b2ZAd2nsSlA3WxH6yHpsT98tyESE ElZQg/eFzpa0BCFgMlXqrliCy3tD8eyaKWg+sww3MNTwn49rQ1wqN3lVDH98PTnkZG c5L2/85Vv8QRJEnwy4sBVdnnOPveFH1BfbbOtZk82vQLMdja+eb7L74AzO0rKrw1T2 9n49wIu1DCWQODSE0NwNi6MfykRT0XDK7kZC2rqXNwoomzCUHlqWa1GcwOAb+//Zl8 CSS6BaaZTMpbhD22bNKYCGLPQdZAr6bG8EigpSUp83lKfylShH6QYAyg+Zt/Petyhe +6N2xOGxHWA5g== Subject: Re: git: 4aed5c3c9d1d - main - time_t is pathological: use %j + cast to print it. To: Warner Losh , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110011816.191IGO91011373@gitrepo.freebsd.org> From: Eric van Gyzen Message-ID: <8e2186ae-98ba-4ef4-eeea-ed3d3839a338@vangyzen.net> Date: Fri, 1 Oct 2021 13:33:22 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202110011816.191IGO91011373@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HLdzL0Bwjz4qw9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 18:33:34 -0000 On 10/1/21 1:16 PM, Warner Losh wrote: > commit 4aed5c3c9d1d78986d3feba3f128187c59fb2dfe > Author: Warner Losh > AuthorDate: 2021-10-01 18:14:35 +0000 > Commit: Warner Losh > CommitDate: 2021-10-01 18:16:10 +0000 > > time_t is pathological: use %j + cast to print it. You beat me by 14 minutes. Thank you. Yes, time_t is unfortunate, but it's still my fault, because I knew that before I screwed it up. :) Eric From owner-dev-commits-src-all@freebsd.org Fri Oct 1 18:51:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D7FF6B40D5; Fri, 1 Oct 2021 18:51: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 4HLfMv1Kj3z4s9X; Fri, 1 Oct 2021 18:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E191246B4; Fri, 1 Oct 2021 18:51: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 191IpMXi062169; Fri, 1 Oct 2021 18:51:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191IpMqp062168; Fri, 1 Oct 2021 18:51:22 GMT (envelope-from git) Date: Fri, 1 Oct 2021 18:51:22 GMT Message-Id: <202110011851.191IpMqp062168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f54b18fc4d72 - main - freebsd-version(1): Add -j flag to support jails 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/main X-Git-Reftype: branch X-Git-Commit: f54b18fc4d72c566912b9a41601ed87a852960e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 18:51:23 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f54b18fc4d72c566912b9a41601ed87a852960e7 commit f54b18fc4d72c566912b9a41601ed87a852960e7 Author: Faraz Vahedi AuthorDate: 2021-10-01 18:46:23 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 18:50:56 +0000 freebsd-version(1): Add -j flag to support jails Make freebsd-version(1) support jails by adding the -j flag which takes a jail jid or name as an argument. As with other options, -j flags stack and display in the order requested. Reviewed by: bcr (manpages), kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25705 --- bin/freebsd-version/freebsd-version.1 | 13 +++++++++++-- bin/freebsd-version/freebsd-version.sh.in | 29 ++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/bin/freebsd-version/freebsd-version.1 b/bin/freebsd-version/freebsd-version.1 index 710bb23ac4c3..b580c580fcbc 100644 --- a/bin/freebsd-version/freebsd-version.1 +++ b/bin/freebsd-version/freebsd-version.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 14, 2017 +.Dd October 1, 2021 .Dt FREEBSD-VERSION 1 .Os .Sh NAME @@ -34,6 +34,7 @@ .Sh SYNOPSIS .Nm .Op Fl kru +.Op Fl j Ar jail .Sh DESCRIPTION The .Nm @@ -60,12 +61,20 @@ Print the version and patch level of the installed userland. These are hardcoded into .Nm during the build. +.It Fl j Ar jail +Print the version and patch level of the installed userland in the +given jail specified by +.Va jid +or +.Va name . +This option can be specified multiple times. .El .Pp If several of the above options are specified, .Nm will print the installed kernel version first, then the running kernel -version, and finally the userland version, on separate lines. +version, next the userland version, and finally the userland version +of the specified jails, on separate lines. If neither is specified, it will print the userland version only. .Sh IMPLEMENTATION NOTES The diff --git a/bin/freebsd-version/freebsd-version.sh.in b/bin/freebsd-version/freebsd-version.sh.in index 9541b86a2636..be1be366f652 100644 --- a/bin/freebsd-version/freebsd-version.sh.in +++ b/bin/freebsd-version/freebsd-version.sh.in @@ -84,11 +84,20 @@ userland_version() { echo $USERLAND_VERSION } +# +# Print the hardcoded userland version of a jail. +# +jail_version() { + for i in $jail; do + jexec -- $i freebsd-version + done +} + # # Print a usage string and exit. # usage() { - echo "usage: $progname [-kru]" >&2 + echo "usage: $progname [-kru] [-j jail]" >&2 exit 1 } @@ -97,7 +106,8 @@ usage() { # main() { # parse command-line arguments - while getopts "kru" option ; do + local OPTIND=1 OPTARG option + while getopts "kruj:" option ; do case $option in k) opt_k=1 @@ -108,6 +118,14 @@ main() { u) opt_u=1 ;; + j) + if [ $opt_j ] ; then + jail="$jail $OPTARG" + else + opt_j=1 + jail="$OPTARG" + fi + ;; *) usage ;; @@ -118,7 +136,7 @@ main() { fi # default is -u - if [ $((opt_k + opt_r + opt_u)) -eq 0 ] ; then + if [ $((opt_k + opt_r + opt_u + opt_j)) -eq 0 ] ; then opt_u=1 fi @@ -136,6 +154,11 @@ main() { if [ $opt_u ] ; then userland_version fi + + # print jail version + if [ $opt_j ] ; then + jail_version + fi } main "$@" From owner-dev-commits-src-all@freebsd.org Fri Oct 1 18:51:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 802836B3EEF; Fri, 1 Oct 2021 18:51: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 4HLfMw2t3Cz4s2V; Fri, 1 Oct 2021 18:51:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CAA1246B5; Fri, 1 Oct 2021 18:51: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 191IpOhj062193; Fri, 1 Oct 2021 18:51:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191IpOLd062192; Fri, 1 Oct 2021 18:51:24 GMT (envelope-from git) Date: Fri, 1 Oct 2021 18:51:24 GMT Message-Id: <202110011851.191IpOLd062192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: c76da1f01064 - main - freebsd-update(8): Add -j flag to support jails 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/main X-Git-Reftype: branch X-Git-Commit: c76da1f01064b2b9a1903b30d4b4c444b85f8724 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 18:51:24 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=c76da1f01064b2b9a1903b30d4b4c444b85f8724 commit c76da1f01064b2b9a1903b30d4b4c444b85f8724 Author: Faraz Vahedi AuthorDate: 2021-10-01 18:48:57 +0000 Commit: Kyle Evans CommitDate: 2021-10-01 18:51:03 +0000 freebsd-update(8): Add -j flag to support jails Make freebsd-update(8) support jails by adding the -j flag which takes a jail jid or name as an argument. This takes advantage of the recently added -j support to freebsd-version(8) in order to get the version of the installed userland. Reviewed by: dteske, kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25711 --- usr.sbin/freebsd-update/freebsd-update.8 | 11 ++++++++++- usr.sbin/freebsd-update/freebsd-update.sh | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.8 b/usr.sbin/freebsd-update/freebsd-update.8 index 54ec17b5ea36..be477d0cdce7 100644 --- a/usr.sbin/freebsd-update/freebsd-update.8 +++ b/usr.sbin/freebsd-update/freebsd-update.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 14, 2020 +.Dd October 1, 2021 .Dt FREEBSD-UPDATE 8 .Os .Sh NAME @@ -37,6 +37,7 @@ .Op Fl d Ar workdir .Op Fl f Ar conffile .Op Fl F +.Op Fl j Ar jail .Op Fl k Ar KEY .Op Fl r Ar newrelease .Op Fl s Ar server @@ -90,6 +91,14 @@ Read configuration options from Force .Nm Cm fetch to proceed in the case of an unfinished upgrade. +.It Fl j Ar jail +Operate on the given jail specified by +.Va jid +or +.Va name . +(The version of the installed userland is detected and the +.Fl -currently-running +option is no more required.) .It Fl k Ar KEY Trust an RSA key with SHA256 of .Ar KEY . diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 4fbac58cb562..1776115d0776 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -36,7 +36,7 @@ # --no-stats -- don't show progress statistics while fetching files usage () { cat < Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 290BA6B4782; Fri, 1 Oct 2021 18:53: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 4HLfQY0fq6z4sRm; Fri, 1 Oct 2021 18:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB0852476D; Fri, 1 Oct 2021 18:53: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 191IreJ9064050; Fri, 1 Oct 2021 18:53:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191IreQB064049; Fri, 1 Oct 2021 18:53:40 GMT (envelope-from git) Date: Fri, 1 Oct 2021 18:53:40 GMT Message-Id: <202110011853.191IreQB064049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 0177102173f3 - main - arm64, riscv: Fix TRAF_PC() to return the PC, not the return address. 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/main X-Git-Reftype: branch X-Git-Commit: 0177102173f39e17366a32eb22653aeb5248c355 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 18:53:41 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0177102173f39e17366a32eb22653aeb5248c355 commit 0177102173f39e17366a32eb22653aeb5248c355 Author: John Baldwin AuthorDate: 2021-10-01 18:53:12 +0000 Commit: John Baldwin CommitDate: 2021-10-01 18:53:12 +0000 arm64, riscv: Fix TRAF_PC() to return the PC, not the return address. Reviewed by: mhorne Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D31969 --- sys/arm64/include/cpu.h | 2 +- sys/riscv/include/cpu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h index 0b1aa2d93b03..c926372a0ec6 100644 --- a/sys/arm64/include/cpu.h +++ b/sys/arm64/include/cpu.h @@ -45,7 +45,7 @@ #include #include -#define TRAPF_PC(tfp) ((tfp)->tf_lr) +#define TRAPF_PC(tfp) ((tfp)->tf_elr) #define TRAPF_USERMODE(tfp) (((tfp)->tf_spsr & PSR_M_MASK) == PSR_M_EL0t) #define cpu_getstack(td) ((td)->td_frame->tf_sp) diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h index 79c6f730f2a6..453a6af1a0f8 100644 --- a/sys/riscv/include/cpu.h +++ b/sys/riscv/include/cpu.h @@ -41,7 +41,7 @@ #include #include -#define TRAPF_PC(tfp) ((tfp)->tf_ra) +#define TRAPF_PC(tfp) ((tfp)->tf_sepc) #define TRAPF_USERMODE(tfp) (((tfp)->tf_sstatus & SSTATUS_SPP) == 0) #define cpu_getstack(td) ((td)->td_frame->tf_sp) From owner-dev-commits-src-all@freebsd.org Fri Oct 1 19:17:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24AE86B4B40; Fri, 1 Oct 2021 19:17: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 4HLfxs0WBpz4v49; Fri, 1 Oct 2021 19:17:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E637F24DB3; Fri, 1 Oct 2021 19:17: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 191JHKrf091828; Fri, 1 Oct 2021 19:17:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191JHKoJ091827; Fri, 1 Oct 2021 19:17:20 GMT (envelope-from git) Date: Fri, 1 Oct 2021 19:17:20 GMT Message-Id: <202110011917.191JHKoJ091827@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 63cb9308a75b - main - Fix segment size in compressing core dumps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63cb9308a75b99fe057409705bc1b2ac0293f578 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 19:17:21 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=63cb9308a75b99fe057409705bc1b2ac0293f578 commit 63cb9308a75b99fe057409705bc1b2ac0293f578 Author: Justin Hibbits AuthorDate: 2021-10-01 18:39:18 +0000 Commit: Justin Hibbits CommitDate: 2021-10-01 19:16:33 +0000 Fix segment size in compressing core dumps A core segment is bounded in size only by memory size. On 64-bit architectures this means a segment can be much larger than 4GB. However, compress_chunk() takes only a u_int, clamping segment size to 4GB-1, resulting in a truncated core. Everything else, including the compressor internally, uses size_t, so use size_t at the boundary here. This dates back to the original refactor back in 2015 (r279801 / aa14e9b7). MFC after: 1 week Sponsored by: Juniper Networks, Inc. --- sys/kern/kern_exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index cbe0152a8001..4b3035cb7e08 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1884,9 +1884,9 @@ exec_unregister(const struct execsw *execsw_arg) * Write out a core segment to the compression stream. */ static int -compress_chunk(struct coredump_params *cp, char *base, char *buf, u_int len) +compress_chunk(struct coredump_params *cp, char *base, char *buf, size_t len) { - u_int chunk_len; + size_t chunk_len; int error; while (len > 0) { From owner-dev-commits-src-all@freebsd.org Fri Oct 1 20:12:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D90CB6B5334 for ; Fri, 1 Oct 2021 20:12: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 4HLh9T5jhzz3FQg; Fri, 1 Oct 2021 20:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4AC225BB9; Fri, 1 Oct 2021 20:12: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 191KCTtU071009; Fri, 1 Oct 2021 20:12:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191KCTrl071008; Fri, 1 Oct 2021 20:12:29 GMT (envelope-from git) Date: Fri, 1 Oct 2021 20:12:29 GMT Message-Id: <202110012012.191KCTrl071008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: 6fa2a931c122 - Create tag vendor/llvm-project/llvmorg-13.0.0-0-gd7b669b3a303 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/tags/vendor/llvm-project/llvmorg-13.0.0-0-gd7b669b3a303 X-Git-Reftype: annotated tag X-Git-Commit: 6fa2a931c12249ffb273c5c503bbca34f98e8f79 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 20:12:29 -0000 The annotated tag vendor/llvm-project/llvmorg-13.0.0-0-gd7b669b3a303 has been created by dim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/llvm-project/llvmorg-13.0.0-0-gd7b669b3a303 tag vendor/llvm-project/llvmorg-13.0.0-0-gd7b669b3a303 Tagger: Dimitry Andric TaggerDate: 2021-10-01 20:10:47 +0000 Tag llvm-project branch release/13.x llvmorg-13.0.0-0-gd7b669b3a303, a.k.a. 13.0.0 release. commit 3f25e997d96a3150a192777c3c389c258c5cf7ee Author: Dimitry Andric AuthorDate: 2021-09-26 11:14:34 +0000 Commit: Dimitry Andric CommitDate: 2021-09-26 11:14:34 +0000 Vendor import of llvm-project branch release/13.x llvmorg-13.0.0-rc4-0-gd7b669b3a303. From owner-dev-commits-src-all@freebsd.org Fri Oct 1 20:40:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 557706B571F; Fri, 1 Oct 2021 20:40: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 4HLhnb1kmGz3GBH; Fri, 1 Oct 2021 20:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B27925E6F; Fri, 1 Oct 2021 20:40: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 191KeJ4W004919; Fri, 1 Oct 2021 20:40:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191KeJjc004913; Fri, 1 Oct 2021 20:40:19 GMT (envelope-from git) Date: Fri, 1 Oct 2021 20:40:19 GMT Message-Id: <202110012040.191KeJjc004913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: a37e4fd1ea8c - main - Re-style dfcef8771484 to keep the code and variables related to listening sockets separated from code for generic sockets. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a37e4fd1ea8ccb2a5e54083d7cfc7b1b1784072d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 20:40:19 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a37e4fd1ea8ccb2a5e54083d7cfc7b1b1784072d commit a37e4fd1ea8ccb2a5e54083d7cfc7b1b1784072d Author: Gleb Smirnoff AuthorDate: 2021-10-01 20:38:24 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-01 20:38:24 +0000 Re-style dfcef8771484 to keep the code and variables related to listening sockets separated from code for generic sockets. No objection: markj --- sys/kern/uipc_socket.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 1f999108dd71..267a33feac3b 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1225,9 +1225,8 @@ int soclose(struct socket *so) { struct accept_queue lqueue; - struct socket *sp, *tsp; int error = 0; - bool last __diagused; + bool listening, last __diagused; KASSERT(!(so->so_state & SS_NOFDREF), ("soclose: SS_NOFDREF on enter")); @@ -1261,9 +1260,11 @@ drop: if (so->so_proto->pr_usrreqs->pru_close != NULL) (*so->so_proto->pr_usrreqs->pru_close)(so); - TAILQ_INIT(&lqueue); SOCK_LOCK(so); - if (SOLISTENING(so)) { + if ((listening = SOLISTENING(so))) { + struct socket *sp; + + TAILQ_INIT(&lqueue); TAILQ_SWAP(&lqueue, &so->sol_incomp, socket, so_list); TAILQ_CONCAT(&lqueue, &so->sol_comp, so_list); @@ -1282,14 +1283,19 @@ drop: KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); so->so_state |= SS_NOFDREF; sorele(so); - TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) { - SOCK_LOCK(sp); - if (refcount_load(&sp->so_count) == 0) { - SOCK_UNLOCK(sp); - soabort(sp); - } else { - /* See the handling of queued sockets in sofree(). */ - SOCK_UNLOCK(sp); + if (listening) { + struct socket *sp, *tsp; + + TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) { + SOCK_LOCK(sp); + if (refcount_load(&sp->so_count) == 0) { + SOCK_UNLOCK(sp); + soabort(sp); + } else { + /* See the handling of queued sockets + in sofree(). */ + SOCK_UNLOCK(sp); + } } } CURVNET_RESTORE(); From owner-dev-commits-src-all@freebsd.org Fri Oct 1 21:00:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6C686B5D9B; Fri, 1 Oct 2021 21:00: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 4HLjDK5ZSbz3HgD; Fri, 1 Oct 2021 21:00:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A04B92655A; Fri, 1 Oct 2021 21:00: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 191L01jx027166; Fri, 1 Oct 2021 21:00:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191L018T027156; Fri, 1 Oct 2021 21:00:01 GMT (envelope-from git) Date: Fri, 1 Oct 2021 21:00:01 GMT Message-Id: <202110012100.191L018T027156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: fbece7609573 - main - Update Azure release bits MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbece7609573bd51080e949df03fa3d803a637ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 21:00:01 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=fbece7609573bd51080e949df03fa3d803a637ae commit fbece7609573bd51080e949df03fa3d803a637ae Author: Li-Wen Hsu AuthorDate: 2021-10-01 20:59:10 +0000 Commit: Li-Wen Hsu CommitDate: 2021-10-01 20:59:10 +0000 Update Azure release bits Imports the changes for building official images on Azure Marketplace, which fulfill the requirements of Azure and FreeBSD cloud images like disk layout and UEFI for Gen2 VM, along with some minor improvements like configurations to speed up booting. "CLOUDWARE" list will be updated after some more collaborations with re completed. Reviewed by: re (gjb) Sponsored by: The FreeBSD Foundation Technical assistance from: Microsoft Differential Revision: https://reviews.freebsd.org/D23804 --- release/Makefile.azure | 55 +++++++++++++++++++++++++++++--------------- release/Makefile.vm | 2 +- release/tools/azure.conf | 57 ++++++++++++++++++++++++++++++++++------------ release/tools/vmimage.subr | 7 +++++- 4 files changed, 87 insertions(+), 34 deletions(-) diff --git a/release/Makefile.azure b/release/Makefile.azure index 32e91833b766..b8e7418f35f7 100644 --- a/release/Makefile.azure +++ b/release/Makefile.azure @@ -11,8 +11,8 @@ AZURE_UPLOAD_TGTS= azure-check-depends \ CLEANFILES+= ${AZURE_UPLOAD_TGTS} .if defined(AZURE_UPLOAD_CONF) && !empty(AZURE_UPLOAD_CONF) -. for VAR in _STORAGE _ACCOUNT _KEY -AZURE${VAR}!= grep -E ^AZURE${VAR} ${AZURE_UPLOAD_CONF} | awk -F' ' '{print $$2}' +. for VAR in _STORAGE _ACCOUNT _RESOURCEGROUP _KEY _LOCATION +AZURE${VAR}!= grep -E ^AZURE${VAR}= ${AZURE_UPLOAD_CONF} | awk '{print $$2}' . endfor .endif @@ -20,34 +20,53 @@ AZURE${VAR}!= grep -E ^AZURE${VAR} ${AZURE_UPLOAD_CONF} | awk -F' ' '{print $$2} SNAPSHOT_DATE!= date +-${BUILDDATE} .endif -AZURE_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}.vhd +AZURE_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE} + +START_DATE!= date -v-1d -I -u +EXPIRY_DATE!= date -v+1m -I -u azure-upload: ${AZURE_UPLOAD_TGTS} azure-check-depends: -.for VAR in _STORAGE _ACCOUNT _KEY +.for VAR in _STORAGE _ACCOUNT _RESOURCEGROUP _KEY . if !defined(AZURE${VAR}) || empty(AZURE${VAR}) @echo "Variable AZURE${VAR} cannot be empty." @false . endif .endfor -.if !exists(/usr/local/bin/azure) -. if !exists(/usr/local/bin/npm) -. if !exists(${PORTSDIR}/www/npm/Makefile) -. if !exists(/usr/local/sbin/pkg-static) +.if !exists(/usr/local/bin/az) +. if !exists(${PORTSDIR}/sysutils/py-azure-cli/Makefile) +. if !exists(/usr/local/sbin/pkg-static) env ASSUME_ALWAYS_YES=yes pkg bootstrap -yf -. endif - env ASSUME_ALWAYS_YES=yes pkg install -y www/npm -. else - env UNAME_r=${UNAME_r} make -C ${PORTSDIR}/www/npm BATCH=1 all install clean . endif + env ASSUME_ALWAYS_YES=yes pkg install -y py38-azure-cli +. else + env UNAME_r=${UNAME_r} make -C ${PORTSDIR}/sysutils/py-azure-cli BATCH=1 all install clean . endif - npm install -g azure-cli .endif azure-do-upload: - /usr/local/bin/azure storage blob upload \ - ${AZURE_IMG} ${AZURE_STORAGE} ${AZURE_TARGET} \ - -t page -a ${AZURE_ACCOUNT} -k "${AZURE_KEY}" - touch ${.OBJDIR}/${.TARGET} - + /usr/local/bin/az storage blob upload \ + --account-name ${AZURE_ACCOUNT} --account-key ${AZURE_KEY} \ + --container-name ${AZURE_STORAGE} --type page \ + --file ${AZURE_IMG} --name ${AZURE_TARGET}.vhd + @echo "The disk access URL with shared access signature is:" + @echo + @echo -n https://${AZURE_ACCOUNT}.blob.core.windows.net/${AZURE_STORAGE}/${AZURE_TARGET}.vhd? + @/usr/local/bin/az storage container generate-sas \ + --account-name ${AZURE_ACCOUNT} --account-key ${AZURE_KEY} \ + --name ${AZURE_STORAGE} \ + --permissions lr \ + --start ${START_DATE} \ + --expiry ${EXPIRY_DATE} | cut -d '"' -f 2 + @echo + @echo "Please go to Microsoft Partner Center to create a new offer and publish it:" + @echo + @echo "https://partner.microsoft.com/dashboard/commercial-marketplace/overview" + @echo + @echo "After the new offer status is live, you can delete the disk file with:" + @echo + @echo /usr/local/bin/az storage blob delete \ + --account-name ${AZURE_ACCOUNT} --account-key ${AZURE_KEY} \ + --container-name ${AZURE_STORAGE} --name ${AZURE_TARGET}.vhd + @echo diff --git a/release/Makefile.vm b/release/Makefile.vm index 2240a1e5fc57..72b150022ef7 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -174,8 +174,8 @@ cloudware-release: ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDTARGETS} .endif -.include "${.CURDIR}/Makefile.ec2" .include "${.CURDIR}/Makefile.azure" +.include "${.CURDIR}/Makefile.ec2" .include "${.CURDIR}/Makefile.gce" .include "${.CURDIR}/Makefile.vagrant" .include "${.CURDIR}/Makefile.inc1" diff --git a/release/tools/azure.conf b/release/tools/azure.conf index c88651a07745..a9126ed8c389 100644 --- a/release/tools/azure.conf +++ b/release/tools/azure.conf @@ -3,25 +3,54 @@ # $FreeBSD$ # +# Convention of Linux type VM on Azure is 30G +export VMSIZE=30g + # Set to a list of packages to install. -# Example: -#export VM_EXTRA_PACKAGES="www/apache24" -export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} sysutils/azure-agent" +export VM_EXTRA_PACKAGES="azure-agent python python3 firstboot-freebsd-update firstboot-pkgs" # Set to a list of third-party software to enable in rc.conf(5). -# Example: -#export VM_RC_LIST="apache24" -export VM_RC_LIST= +export VM_RC_LIST="ntpd sshd waagent firstboot_freebsd_update firstboot_pkgs" + +# No swap space; waagent will allocate swap space on the resource disk. +# See ResourceDisk.EnableSwap and ResourceDisk.SwapSizeMB in waagent.conf +export NOSWAP=YES + +# https://docs.microsoft.com/en-us/azure/marketplace/azure-vm-create-certification-faq#vm-images-must-have-1mb-free-space +export VM_BOOTPARTSOFFSET=1M vm_extra_pre_umount() { - chroot ${DESTDIR} ln -s /usr/local/sbin/waagent /usr/sbin/waagent - chroot ${DESTDIR} /usr/local/sbin/waagent -verbose -install - yes | chroot ${DESTDIR} /usr/local/sbin/waagent -deprovision - echo 'sshd_enable="YES"' >> ${DESTDIR}/etc/rc.conf - echo 'ifconfig_hn0="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf - echo 'waagent_enable="YES"' >> ${DESTDIR}/etc/rc.conf - echo 'console="comconsole vidconsole"' >> ${DESTDIR}/boot/loader.conf - echo 'comconsole_speed="115200"' >> ${DESTDIR}/boot/loader.conf + # The firstboot_pkgs rc.d script will download the repository + # catalogue and install or update pkg when the instance first + # launches, so these files would just be replaced anyway; removing + # them from the image allows it to boot faster. + mount -t devfs devfs ${DESTDIR}/dev + chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \ + /usr/sbin/pkg delete -f -y pkg + umount ${DESTDIR}/dev + rm ${DESTDIR}/var/db/pkg/repo-*.sqlite + + yes | chroot ${DESTDIR} ${EMULATOR} /usr/local/sbin/waagent -deprovision + + cat << EOF >> ${DESTDIR}/etc/rc.conf +ifconfig_hn0="SYNCDHCP" +ntpd_sync_on_start="YES" +EOF + + cat << EOF >> ${DESTDIR}/boot/loader.conf +autoboot_delay="-1" +beastie_disable="YES" +loader_logo="none" +hw.memtest.tests="0" +console="comconsole efi vidconsole" +comconsole_speed="115200" +boot_multicons="YES" +boot_serial="YES" +mlx4en_load="YES" +mlx5en_load="YES" +EOF + + touch ${DESTDIR}/firstboot rm -f ${DESTDIR}/etc/resolv.conf diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr index c2b2e21200f1..0d9202431822 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -195,6 +195,11 @@ vm_create_disk() { SWAPOPT="-p freebsd-swap/swapfs::${SWAPSIZE}" fi + if [ -n "${VM_BOOTPARTSOFFSET}" ]; then + BOOTPARTSOFFSET=":${VM_BOOTPARTSOFFSET}" + fi + + BOOTFILES="$(env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ WITH_UNIFIED_OBJDIR=yes \ make -C ${WORLDDIR}/stand -V .OBJDIR)" @@ -204,7 +209,7 @@ vm_create_disk() { amd64:amd64 | i386:i386) ESP=yes BOOTPARTS="-b ${BOOTFILES}/i386/pmbr/pmbr \ - -p freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot" + -p freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot${BOOTPARTSOFFSET}" ROOTFSPART="-p freebsd-ufs/rootfs:=${VMBASE}" MAKEFSARGS="-B little" ;; From owner-dev-commits-src-all@freebsd.org Fri Oct 1 21:56:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C14806B68CB; Fri, 1 Oct 2021 21:56: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 4HLkTZ4rGRz3Lk6; Fri, 1 Oct 2021 21:56:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82ABA270F2; Fri, 1 Oct 2021 21:56: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 191LuYgk004210; Fri, 1 Oct 2021 21:56:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191LuYB9004209; Fri, 1 Oct 2021 21:56:34 GMT (envelope-from git) Date: Fri, 1 Oct 2021 21:56:34 GMT Message-Id: <202110012156.191LuYB9004209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: c9536389d732 - main - vfs: hoist cn_thread assert in namei 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/main X-Git-Reftype: branch X-Git-Commit: c9536389d732feecf61afa4632397d67b04b2ab4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 21:56:34 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c9536389d732feecf61afa4632397d67b04b2ab4 commit c9536389d732feecf61afa4632397d67b04b2ab4 Author: Mateusz Guzik AuthorDate: 2021-10-01 21:13:38 +0000 Commit: Mateusz Guzik CommitDate: 2021-10-01 21:56:29 +0000 vfs: hoist cn_thread assert in namei Making it condtional on whether ktrace happens to be enabled makes no sense. --- sys/kern/vfs_lookup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 28d7ada0f434..e262ebde6ae2 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -554,6 +554,8 @@ namei(struct nameidata *ndp) cnp = &ndp->ni_cnd; td = cnp->cn_thread; #ifdef INVARIANTS + KASSERT(cnp->cn_thread == curthread, + ("namei not using curthread")); KASSERT((ndp->ni_debugflags & NAMEI_DBG_CALLED) == 0, ("%s: repeated call to namei without NDREINIT", __func__)); KASSERT(ndp->ni_debugflags == NAMEI_DBG_INITED, @@ -608,8 +610,6 @@ namei(struct nameidata *ndp) #ifdef KTRACE if (KTRPOINT(td, KTR_NAMEI)) { - KASSERT(cnp->cn_thread == curthread, - ("namei not using curthread")); ktrnamei(cnp->cn_pnbuf); } #endif From owner-dev-commits-src-all@freebsd.org Fri Oct 1 22:49:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC7BA6B7048; Fri, 1 Oct 2021 22:49: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 4HLlfr676qz3Px1; Fri, 1 Oct 2021 22:49:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE6F727E1F; Fri, 1 Oct 2021 22:49: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 191Mne9P071501; Fri, 1 Oct 2021 22:49:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191Mnee0071500; Fri, 1 Oct 2021 22:49:40 GMT (envelope-from git) Date: Fri, 1 Oct 2021 22:49:40 GMT Message-Id: <202110012249.191Mnee0071500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 3ff3733991ba - main - sctp: don't keep being locked on a stream which is removed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ff3733991ba049959c4fd2e7179ea96241a396e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 22:49:41 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=3ff3733991ba049959c4fd2e7179ea96241a396e commit 3ff3733991ba049959c4fd2e7179ea96241a396e Author: Michael Tuexen AuthorDate: 2021-10-01 22:48:01 +0000 Commit: Michael Tuexen CommitDate: 2021-10-01 22:48:01 +0000 sctp: don't keep being locked on a stream which is removed Reported by: syzbot+f5f551e8a3a0302a4914@syzkaller.appspotmail.com MFC after: 1 week --- sys/netinet/sctp_ss_functions.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 5293c0fee742..c08bec07c588 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -150,6 +150,9 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } + if (asoc->ss_data.locked_on_sending == strq) { + asoc->ss_data.locked_on_sending = NULL; + } TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); strq->ss_params.scheduled = false; } @@ -466,6 +469,9 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } + if (asoc->ss_data.locked_on_sending == strq) { + asoc->ss_data.locked_on_sending = NULL; + } TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); strq->ss_params.scheduled = false; } @@ -635,6 +641,9 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } + if (asoc->ss_data.locked_on_sending == strq) { + asoc->ss_data.locked_on_sending = NULL; + } TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.fb.next_spoke); strq->ss_params.scheduled = false; } From owner-dev-commits-src-all@freebsd.org Fri Oct 1 23:57:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90ED4670A04 for ; Fri, 1 Oct 2021 23:57: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 4HLn9P3kSdz3mSM; Fri, 1 Oct 2021 23:57:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55C3DCC3; Fri, 1 Oct 2021 23:57: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 191NvjQE064906; Fri, 1 Oct 2021 23:57:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 191NvjY2064905; Fri, 1 Oct 2021 23:57:45 GMT (envelope-from git) Date: Fri, 1 Oct 2021 23:57:45 GMT Message-Id: <202110012357.191NvjY2064905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Ed Maste Subject: git: 5b2defbd2a1a - vendor/libcbor - vendor branch created MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/vendor/libcbor X-Git-Reftype: branch X-Git-Commit: 5b2defbd2a1aa991bd0a2855eef8e15107572747 X-Git-Oldrev: 0000000000000000000000000000000000000000 X-Git-Newrev: 5b2defbd2a1aa991bd0a2855eef8e15107572747 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2021 23:57:45 -0000 The branch vendor/libcbor has been created by emaste: URL: https://cgit.FreeBSD.org/src/log/?id=5b2defbd2a1a 5b2defbd2a1a Vendor import of libcbor 0.8.0 From owner-dev-commits-src-all@freebsd.org Sat Oct 2 00:01:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DE7667072B for ; Sat, 2 Oct 2021 00:01: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 4HLnFB27pfz3mtN; Sat, 2 Oct 2021 00:01:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2106AAD9; Sat, 2 Oct 2021 00:01: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 1920120N074279; Sat, 2 Oct 2021 00:01:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192012Nn074278; Sat, 2 Oct 2021 00:01:02 GMT (envelope-from git) Date: Sat, 2 Oct 2021 00:01:02 GMT Message-Id: <202110020001.192012Nn074278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Ed Maste Subject: git: a58dee945a5d - vendor/libfido2 - vendor branch created MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/vendor/libfido2 X-Git-Reftype: branch X-Git-Commit: a58dee945a5da64d0e97f35a508928e0d17c9cc7 X-Git-Oldrev: 0000000000000000000000000000000000000000 X-Git-Newrev: a58dee945a5da64d0e97f35a508928e0d17c9cc7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 00:01:02 -0000 The branch vendor/libfido2 has been created by emaste: URL: https://cgit.FreeBSD.org/src/log/?id=a58dee945a5d a58dee945a5d Vendor import of libfido2 1.8.0 From owner-dev-commits-src-all@freebsd.org Sat Oct 2 00:58:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69E81671A98; Sat, 2 Oct 2021 00:58: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 4HLpWW2crbz3sjg; Sat, 2 Oct 2021 00:58:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38205163A; Sat, 2 Oct 2021 00:58: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 1920wVNV045060; Sat, 2 Oct 2021 00:58:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1920wVqR045059; Sat, 2 Oct 2021 00:58:31 GMT (envelope-from git) Date: Sat, 2 Oct 2021 00:58:31 GMT Message-Id: <202110020058.1920wVqR045059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: ef7d2c1fc160 - main - nfs: eliminate thread argument from nfsvno_namei 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/main X-Git-Reftype: branch X-Git-Commit: ef7d2c1fc1605acdbffb233925ab69f8d57de22a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 00:58:31 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ef7d2c1fc1605acdbffb233925ab69f8d57de22a commit ef7d2c1fc1605acdbffb233925ab69f8d57de22a Author: Mateusz Guzik AuthorDate: 2021-10-01 21:20:15 +0000 Commit: Mateusz Guzik CommitDate: 2021-10-02 00:57:20 +0000 nfs: eliminate thread argument from nfsvno_namei This is a step towards retiring struct componentname cn_thread Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D32267 --- sys/fs/nfs/nfs_var.h | 2 +- sys/fs/nfsserver/nfs_nfsdport.c | 4 ++-- sys/fs/nfsserver/nfs_nfsdserv.c | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index bae4affa72e2..ebb23d28420b 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -686,7 +686,7 @@ int nfsvno_getfh(vnode_t, fhandle_t *, NFSPROC_T *); int nfsvno_accchk(vnode_t, accmode_t, struct ucred *, struct nfsexstuff *, NFSPROC_T *, int, int, u_int32_t *); int nfsvno_namei(struct nfsrv_descript *, struct nameidata *, - vnode_t, int, struct nfsexstuff *, NFSPROC_T *, vnode_t *); + vnode_t, int, struct nfsexstuff *, vnode_t *); void nfsvno_setpathbuf(struct nameidata *, char **, u_long **); void nfsvno_relpathbuf(struct nameidata *); int nfsvno_readlink(vnode_t, struct ucred *, int, NFSPROC_T *, struct mbuf **, diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 9250c0ce0a23..49cbd2c9de0f 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -594,7 +594,7 @@ nfsvno_setattr(struct vnode *vp, struct nfsvattr *nvap, struct ucred *cred, */ int nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp, - struct vnode *dp, int islocked, struct nfsexstuff *exp, struct thread *p, + struct vnode *dp, int islocked, struct nfsexstuff *exp, struct vnode **retdirp) { struct componentname *cnp = &ndp->ni_cnd; @@ -661,7 +661,7 @@ nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp, * because lookup() will dereference ni_startdir. */ - cnp->cn_thread = p; + cnp->cn_thread = curthread; ndp->ni_startdir = dp; ndp->ni_rootdir = rootvnode; ndp->ni_topdir = NULL; diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 4394d3033fce..3b2e6c82276d 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -612,7 +612,7 @@ nfsrvd_lookup(struct nfsrv_descript *nd, __unused int isdgram, goto out; } if (!nd->nd_repstat) { - nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, p, &dirp); + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, &dirp); } else { vrele(dp); nfsvno_relpathbuf(&named); @@ -1214,7 +1214,7 @@ nfsrvd_create(struct nfsrv_descript *nd, __unused int isdgram, goto out; } - nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, p, &dirp); + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, &dirp); if (dirp) { if (nd->nd_flag & ND_NFSV2) { vrele(dirp); @@ -1420,7 +1420,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram, if (vtyp == VDIR) named.ni_cnd.cn_flags |= WILLBEDIR; - nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, p, &dirp); + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, &dirp); if (nd->nd_repstat) { if (dirp) { if (nd->nd_flag & ND_NFSV3) @@ -1543,7 +1543,7 @@ nfsrvd_remove(struct nfsrv_descript *nd, __unused int isdgram, goto out; } if (!nd->nd_repstat) { - nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, p, &dirp); + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, &dirp); } else { vput(dp); nfsvno_relpathbuf(&named); @@ -1717,7 +1717,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgram, /* * Done parsing, now down to business. */ - nd->nd_repstat = nfsvno_namei(nd, &fromnd, dp, 0, exp, p, &fdirp); + nd->nd_repstat = nfsvno_namei(nd, &fromnd, dp, 0, exp, &fdirp); if (nd->nd_repstat) { if (nd->nd_flag & ND_NFSV3) { nfsrv_wcc(nd, fdirfor_ret, &fdirfor, fdiraft_ret, @@ -1734,7 +1734,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgram, } if (vnode_vtype(fromnd.ni_vp) == VDIR) tond.ni_cnd.cn_flags |= WILLBEDIR; - nd->nd_repstat = nfsvno_namei(nd, &tond, tdp, 0, &tnes, p, &tdirp); + nd->nd_repstat = nfsvno_namei(nd, &tond, tdp, 0, &tnes, &tdirp); nd->nd_repstat = nfsvno_rename(&fromnd, &tond, nd->nd_repstat, nd->nd_flag, nd->nd_cred, p); if (fdirp) @@ -1829,7 +1829,7 @@ nfsrvd_link(struct nfsrv_descript *nd, int isdgram, } if (!nd->nd_repstat) { nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, &tnes, - p, &dirp); + &dirp); } else { if (dp) vrele(dp); @@ -1904,7 +1904,7 @@ nfsrvd_symlink(struct nfsrv_descript *nd, __unused int isdgram, goto out; } if (!nd->nd_repstat) { - nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, p, &dirp); + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, &dirp); } else { vrele(dp); nfsvno_relpathbuf(&named); @@ -2028,7 +2028,7 @@ nfsrvd_mkdir(struct nfsrv_descript *nd, __unused int isdgram, } } if (!nd->nd_repstat) { - nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, p, &dirp); + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, &dirp); } else { vrele(dp); nfsvno_relpathbuf(&named); @@ -3030,7 +3030,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, } if (!nd->nd_repstat) { nd->nd_repstat = nfsvno_namei(nd, &named, dp, 0, exp, - p, &dirp); + &dirp); } else { vrele(dp); nfsvno_relpathbuf(&named); @@ -3688,7 +3688,7 @@ nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram, goto out; } if (!nd->nd_repstat) { - nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, p, &dirp); + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, &dirp); } else { vput(dp); nfsvno_relpathbuf(&named); @@ -3822,7 +3822,7 @@ nfsrvd_secinfononame(struct nfsrv_descript *nd, int isdgram, goto nfsmout; } if (nd->nd_repstat == 0) - nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, p, &dirp); + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, &dirp); else vput(dp); if (dirp != NULL) From owner-dev-commits-src-all@freebsd.org Sat Oct 2 01:18:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D802671F0D; Sat, 2 Oct 2021 01:18: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 4HLpyb3bg9z3t9s; Sat, 2 Oct 2021 01:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B36B1BCC; Sat, 2 Oct 2021 01:18: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 1921IVI7072394; Sat, 2 Oct 2021 01:18:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1921IVr5072393; Sat, 2 Oct 2021 01:18:31 GMT (envelope-from git) Date: Sat, 2 Oct 2021 01:18:31 GMT Message-Id: <202110020118.1921IVr5072393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 83581511d947 - main - nvme: Use adaptive spinning when polling for completion or state change 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/main X-Git-Reftype: branch X-Git-Commit: 83581511d9476ef5084f47e3cc379be7191ae866 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 01:18:31 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=83581511d9476ef5084f47e3cc379be7191ae866 commit 83581511d9476ef5084f47e3cc379be7191ae866 Author: Warner Losh AuthorDate: 2021-10-01 17:32:48 +0000 Commit: Warner Losh CommitDate: 2021-10-02 01:17:55 +0000 nvme: Use adaptive spinning when polling for completion or state change We only use nvme_completion_poll in the initialization path. The commands they queue and wait for finish quickly as they involve no I/O to the drive's media. These command take about 20-200 microsecnds each. Set the wait time to 1us and then increase it by 1.5 each successive iteration (max 1ms). This reduces initialization time by 80ms in cpervica's tests. Use this same technique waiting for RDY state transitions. This saves another 20ms. In total we're down from ~330ms to ~2ms. Tested by: cperciva Sponsored by: Netflix Reviewed by: mav Differential Review: https://reviews.freebsd.org/D32259 --- sys/dev/nvme/nvme_ctrlr.c | 11 ++++++++++- sys/dev/nvme/nvme_private.h | 35 +++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index ca89e99d2934..aa41c8fe5540 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -260,10 +260,17 @@ nvme_ctrlr_fail_req_task(void *arg, int pending) mtx_unlock(&ctrlr->lock); } +/* + * Wait for RDY to change. + * + * Starts sleeping for 1us and geometrically increases it the longer we wait, + * capped at 1ms. + */ static int nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) { int timeout = ticks + MSEC_2_TICKS(ctrlr->ready_timeout_in_ms); + sbintime_t delta_t = SBT_1US; uint32_t csts; while (1) { @@ -278,7 +285,9 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } - pause("nvmerdy", 1); + + pause_sbt("nvmerdy", delta_t, 0, C_PREL(1)); + delta_t = min(SBT_1MS, delta_t * 3 / 2); } return (0); diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index b00130910a82..9c7c1b46eab4 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -455,25 +455,32 @@ int nvme_shutdown(device_t dev); int nvme_detach(device_t dev); /* - * Wait for a command to complete using the nvme_completion_poll_cb. - * Used in limited contexts where the caller knows it's OK to block - * briefly while the command runs. The ISR will run the callback which - * will set status->done to true, usually within microseconds. If not, - * then after one second timeout handler should reset the controller - * and abort all outstanding requests including this polled one. If - * still not after ten seconds, then something is wrong with the driver, - * and panic is the only way to recover. + * Wait for a command to complete using the nvme_completion_poll_cb. Used in + * limited contexts where the caller knows it's OK to block briefly while the + * command runs. The ISR will run the callback which will set status->done to + * true, usually within microseconds. If not, then after one second timeout + * handler should reset the controller and abort all outstanding requests + * including this polled one. If still not after ten seconds, then something is + * wrong with the driver, and panic is the only way to recover. + * + * Most commands using this interface aren't actual I/O to the drive's media so + * complete within a few microseconds. Adaptively spin for one tick to catch the + * vast majority of these without waiting for a tick plus scheduling delays. Since + * these are on startup, this drastically reduces startup time. */ static __inline void nvme_completion_poll(struct nvme_completion_poll_status *status) { - int sanity = hz * 10; - - while (!atomic_load_acq_int(&status->done) && --sanity > 0) - pause("nvme", 1); - if (sanity <= 0) - panic("NVME polled command failed to complete within 10s."); + int timeout = ticks + 10 * hz; + sbintime_t delta_t = SBT_1US; + + while (!atomic_load_acq_int(&status->done)) { + if (timeout - ticks < 0) + panic("NVME polled command failed to complete within 10s."); + pause_sbt("nvme", delta_t, 0, C_PREL(1)); + delta_t = min(SBT_1MS, delta_t * 3 / 2); + } } static __inline void From owner-dev-commits-src-all@freebsd.org Sat Oct 2 02:48:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EB6067286E for ; Sat, 2 Oct 2021 02:48: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 4HLryD3bn1z4YsT; Sat, 2 Oct 2021 02:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51100311C; Sat, 2 Oct 2021 02:48: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 1922mKhs091181; Sat, 2 Oct 2021 02:48:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1922mKAJ091180; Sat, 2 Oct 2021 02:48:20 GMT (envelope-from git) Date: Sat, 2 Oct 2021 02:48:20 GMT Message-Id: <202110020248.1922mKAJ091180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: a5725262945a..9530c11c3570 - vendor/tzdata - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/vendor/tzdata X-Git-Reftype: branch X-Git-Commit: 9530c11c35707c2ed4a95aa90097b30f8a230563 X-Git-Oldrev: a5725262945a2971af3b808088217fe975e8364e X-Git-Newrev: 9530c11c35707c2ed4a95aa90097b30f8a230563 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 02:48:20 -0000 The branch vendor/tzdata has been updated by philip: URL: https://cgit.FreeBSD.org/src/log/?id=a5725262945a..9530c11c3570 9530c11c3570 Import tzdata 2021c From owner-dev-commits-src-all@freebsd.org Sat Oct 2 02:48:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C6FE67286F for ; Sat, 2 Oct 2021 02:48: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 4HLryD45WVz4ZBv; Sat, 2 Oct 2021 02:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6854F2EC6; Sat, 2 Oct 2021 02:48: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 1922mKcn091205; Sat, 2 Oct 2021 02:48:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1922mK3o091204; Sat, 2 Oct 2021 02:48:20 GMT (envelope-from git) Date: Sat, 2 Oct 2021 02:48:20 GMT Message-Id: <202110020248.1922mK3o091204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: 690d1002a21e - Create tag vendor/tzdata/tzdata2021c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/tags/vendor/tzdata/tzdata2021c X-Git-Reftype: annotated tag X-Git-Commit: 690d1002a21e58f0ab6e65c6f1762962c79f5098 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 02:48:20 -0000 The annotated tag vendor/tzdata/tzdata2021c has been created by philip: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/tzdata/tzdata2021c tag vendor/tzdata/tzdata2021c Tagger: Philip Paeps TaggerDate: 2021-10-02 02:47:37 +0000 Tag import of tzdata 2021c commit 9530c11c35707c2ed4a95aa90097b30f8a230563 Author: Philip Paeps AuthorDate: 2021-10-02 02:47:29 +0000 Commit: Philip Paeps CommitDate: 2021-10-02 02:47:29 +0000 Import tzdata 2021c From owner-dev-commits-src-all@freebsd.org Sat Oct 2 02:54:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A35C3672FBC; Sat, 2 Oct 2021 02:54: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 4HLs5g3wv6z4ZLv; Sat, 2 Oct 2021 02:54:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66B122EE7; Sat, 2 Oct 2021 02:54: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 1922slDA004050; Sat, 2 Oct 2021 02:54:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1922siPf004049; Sat, 2 Oct 2021 02:54:44 GMT (envelope-from git) Date: Sat, 2 Oct 2021 02:54:44 GMT Message-Id: <202110020254.1922siPf004049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: 93d120dbc0d0 - main - contrib/tzdata: import tzdata 2021c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93d120dbc0d039ebd3d421aad169b6a2e3ac7dbe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 02:54:47 -0000 The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=93d120dbc0d039ebd3d421aad169b6a2e3ac7dbe commit 93d120dbc0d039ebd3d421aad169b6a2e3ac7dbe Merge: 83581511d947 9530c11c3570 Author: Philip Paeps AuthorDate: 2021-10-02 02:52:02 +0000 Commit: Philip Paeps CommitDate: 2021-10-02 02:52:02 +0000 contrib/tzdata: import tzdata 2021c Merge commit '9530c11c35707c2ed4a95aa90097b30f8a230563' Changes: https://github.com/eggert/tz/blob/2021c/NEWS MFC after: 3 days contrib/tzdata/Makefile | 6 +-- contrib/tzdata/NEWS | 50 ++++++++++++++++++++---- contrib/tzdata/SECURITY | 15 ++++++++ contrib/tzdata/africa | 37 ++++++++++++++++++ contrib/tzdata/asia | 10 ++++- contrib/tzdata/australasia | 5 +++ contrib/tzdata/backward | 93 +-------------------------------------------- contrib/tzdata/backzone | 1 + contrib/tzdata/europe | 26 ++++++++++--- contrib/tzdata/northamerica | 26 ++++++++++++- contrib/tzdata/southamerica | 4 +- contrib/tzdata/version | 2 +- 12 files changed, 163 insertions(+), 112 deletions(-) diff --cc contrib/tzdata/Makefile index 33f31684114b,000000000000..a2220986796c mode 100644,000000..100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@@ -1,1143 -1,0 +1,1143 @@@ +# Make and install tzdb code and data. + +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. + +# Package name for the code distribution. +PACKAGE= tzcode + +# Version number for the distribution, overridden in the 'tarballs' rule below. +VERSION= unknown + +# Email address for bug reports. +BUGEMAIL= tz@iana.org + +# DATAFORM selects the data format. +# Available formats represent essentially the same data, albeit +# possibly with minor discrepancies that users are not likely to notice. +# To get new features and the best data right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +# Rearguard users might also want "ZFLAGS = -b fat"; see below. +DATAFORM= main + +# Change the line below for your timezone (after finding the one you want in +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for LOCALTIME. + +LOCALTIME= GMT + +# The POSIXRULES macro controls interpretation of nonstandard and obsolete +# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules. +# Such a setting uses the rules in a template file to determine +# "spring forward" and "fall back" days and times; the environment +# variable itself specifies UT offsets of standard and daylight saving time. +# +# If POSIXRULES is '-', no template is installed; this is the default. +# +# Any other value for POSIXRULES is obsolete and should not be relied on, as: +# * It does not work correctly in popular implementations such as GNU/Linux. +# * It does not work even in tzcode, except for historical timestamps +# that precede the last explicit transition in the POSIXRULES file. +# Hence it typically does not work for current and future timestamps. +# In short, software should avoid ruleless settings like TZ='EET-2EEST' +# and so should not depend on the value of POSIXRULES. +# +# If, despite the above, you want a template for handling these settings, +# you can change the line below (after finding the timezone you want in the +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for POSIXRULES. + +POSIXRULES= - + +# Also see TZDEFRULESTRING below, which takes effect only +# if the time zone files cannot be accessed. + + +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). + +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local timezone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + +# "Compiled" timezone information is placed in the "TZDIR" directory +# (and subdirectories). +# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. +TZDIR_BASENAME= zoneinfo +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) + +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin + +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) + +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin + +# Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man + +# Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib + + +# Types to try, as an alternative to time_t. +TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) +TIME_T_ALTERNATIVES_HEAD = int_least64_t +TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t + +# What kind of TZif data files to generate. (TZif is the binary time +# zone data format that zic generates; see Internet RFC 8536.) +# If you want only POSIX time, with time values interpreted as +# seconds since the epoch (not counting leap seconds), use +# REDO= posix_only +# below. If you want only "right" time, with values interpreted +# as seconds since the epoch (counting leap seconds), use +# REDO= right_only +# below. If you want both sets of data available, with leap seconds not +# counted normally, use +# REDO= posix_right +# below. If you want both sets of data available, with leap seconds counted +# normally, use +# REDO= right_posix +# below. POSIX mandates that leap seconds not be counted; for compatibility +# with it, use "posix_only" or "posix_right". Use POSIX time on systems with +# leap smearing; this can work better than unsmeared "right" time with +# applications that are not leap second aware, and is closer to unsmeared +# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). + +REDO= posix_right + +# Whether to put an "Expires" line in the leapseconds file. +# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. +# The EXPIRES_LINE value matters only if REDO's value contains "right". +# If you change EXPIRES_LINE, remove the leapseconds file before running "make". +# zic's support for the Expires line was introduced in tzdb 2020a, +# and was modified in tzdb 2021b to generate version 4 TZif files. +# EXPIRES_LINE defaults to 0 for now so that the leapseconds file +# can be given to pre-2020a zic implementations and so that TZif files +# built by newer zic implementations can be read by pre-2021b libraries. +EXPIRES_LINE= 0 + +# To install data in text form that has all the information of the TZif data, +# (optionally incorporating leap second information), use +# TZDATA_TEXT= tzdata.zi leapseconds +# To install text data without leap second information (e.g., because +# REDO='posix_only'), use +# TZDATA_TEXT= tzdata.zi +# To avoid installing text data, use +# TZDATA_TEXT= + +TZDATA_TEXT= leapseconds tzdata.zi + +# For backward-compatibility links for old zone names, use +# BACKWARD= backward +# To omit these links, use +# BACKWARD= + +BACKWARD= backward + +# If you want out-of-scope and often-wrong data from the file 'backzone', use +# PACKRATDATA= backzone +# To omit this data, use +# PACKRATDATA= + +PACKRATDATA= + +# The name of a locale using the UTF-8 encoding, used during self-tests. +# The tests are skipped if the name does not appear to work on this system. + +UTF8_LOCALE= en_US.utf8 + +# Non-default libraries needed to link. +LDLIBS= + +# Add the following to the end of the "CFLAGS=" line as needed to override +# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1". +# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime +# formats that generate only the last two digits of year numbers +# -DEPOCH_LOCAL if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. +# -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# -DHAVE_DECL_ENVIRON if declares 'environ' +# -DHAVE_DIRECT_H if mkdir needs (MS-Windows) +# -DHAVE_GENERIC=0 if _Generic does not work +# -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris) +# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares +# ctime_r and asctime_r incompatibly with the POSIX standard +# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). +# -DHAVE_INTTYPES_H if you have a non-C99 compiler with +# -DHAVE_LINK=0 if your system lacks a link function +# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function +# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz +# localtime_rz can make zdump significantly faster, but is nonstandard. +# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. +# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare +# functions like 'link' or variables like 'tzname' required by POSIX +# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function +# -DHAVE_STDBOOL_H if you have a non-C99 compiler with +# -DHAVE_STDINT_H if you have a non-C99 compiler with +# -DHAVE_STRFTIME_L if declares locale_t and strftime_l +# -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function +# -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_SYS_STAT_H=0 if your compiler lacks a +# -DHAVE_TZSET=0 if your system lacks a tzset function +# -DHAVE_UNISTD_H=0 if your compiler lacks a +# -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. +# -Dssize_t=long on hosts like MS-Windows that lack ssize_t +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use +# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; +# not needed by the main-program tz code, which is single-threaded. +# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. +# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# This is intended for internal use only; it mangles external names. +# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" +# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; +# the default is system-supplied, typically "/usr/lib/locale" +# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified +# DST transitions if the time zone files cannot be accessed +# -DUNINIT_TRAP if reading uninitialized storage can cause problems +# other than simply getting garbage data +# -DUSE_LTZ=0 to build zdump with the system time zone library +# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and +# similarly for "slim". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably readers that mishandle 64-bit +# data in TZif files. Slim TZif files are more efficient and do not +# work around these incompatibilities and bugs. If not given, the +# default is "slim". +# -DZIC_MAX_ABBR_LEN_WO_WARN=3 +# (or some other number) to set the maximum time zone abbreviation length +# that zic will accept without a warning (the default is 6) +# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking +# Select instrumentation via "make GCC_INSTRUMENT='whatever'". +GCC_INSTRUMENT = \ + -fsanitize=undefined -fsanitize-address-use-after-scope \ + -fsanitize-undefined-trap-on-error -fstack-protector +# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. +GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ + $(GCC_INSTRUMENT) \ + -Wall -Wextra \ + -Walloc-size-larger-than=100000 -Warray-bounds=2 \ + -Wbad-function-cast -Wcast-align=strict -Wdate-time \ + -Wdeclaration-after-statement -Wdouble-promotion \ + -Wduplicated-branches -Wduplicated-cond \ + -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ + -Winit-self -Wlogical-op \ + -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ + -Wnull-dereference \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ + -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ + -Wstrict-prototypes -Wstringop-overflow=4 \ + -Wstringop-truncation -Wsuggest-attribute=cold \ + -Wsuggest-attribute=const -Wsuggest-attribute=format \ + -Wsuggest-attribute=malloc \ + -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ + -Wtrampolines -Wundef -Wuninitialized -Wunused-macros \ + -Wvariadic-macros -Wvla -Wwrite-strings \ + -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ + -Wno-type-limits -Wno-unused-parameter +# +# If your system has a "GMT offset" field in its "struct tm"s +# (or if you decide to add such a field in your system's "time.h" file), +# add the name to a define such as +# -DTM_GMTOFF=tm_gmtoff +# to the end of the "CFLAGS=" line. If not defined, the code attempts to +# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. +# Similarly, if your system has a "zone abbreviation" field, define +# -DTM_ZONE=tm_zone +# and define NO_TM_ZONE to suppress any guessing. These two fields are not +# required by POSIX, but are widely available on GNU/Linux and BSD systems. +# +# The next batch of options control support for external variables +# exported by tzcode. In practice these variables are less useful +# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. +# # +# # To omit or support the external variable "tzname", add one of: +# # -DHAVE_TZNAME=0 # do not support "tzname" +# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library +# # -DHAVE_TZNAME=2 # support and define "tzname" +# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later. +# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. +# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause +# # crashes when combined with some platforms' standard libraries, +# # presumably due to memory allocation issues. +# # +# # To omit or support the external variables "timezone" and "daylight", add +# # -DUSG_COMPAT=0 # do not support +# # -DUSG_COMPAT=1 # support, and variables are defined by system library +# # -DUSG_COMPAT=2 # support and define variables +# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by +# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later. +# # If not defined, the code attempts to guess USG_COMPAT from other macros. +# # +# # To support the external variable "altzone", add +# # -DALTZONE=0 # do not support +# # -DALTZONE=1 # support "altzone", which is defined by system library +# # -DALTZONE=2 # support and define "altzone" +# # to the end of the "CFLAGS=" line; although "altzone" appeared in +# # System V Release 3.1 it has not been standardized. +# # If not defined, the code attempts to guess ALTZONE from other macros. +# +# If you want functions that were inspired by early versions of X3J11's work, +# add +# -DSTD_INSPIRED +# to the end of the "CFLAGS=" line. This arranges for the functions +# "offtime", "timelocal", "timegm", "timeoff", +# "posix2time", and "time2posix" to be added to the time conversion library. +# "offtime" is like "gmtime" except that it accepts a second (long) argument +# that gives an offset to add to the time_t when converting it. +# "timelocal" is equivalent to "mktime". +# "timegm" is like "timelocal" except that it turns a struct tm into +# a time_t using UT (rather than local time as "timelocal" does). +# "timeoff" is like "timegm" except that it accepts a second (long) argument +# that gives an offset to use when converting to a time_t. +# "posix2time" and "time2posix" are described in an included manual page. +# X3J11's work does not describe any of these functions. +# These functions may well disappear in future releases of the time +# conversion package. +# +# If you don't want functions that were inspired by NetBSD, add +# -DNETBSD_INSPIRED=0 +# to the end of the "CFLAGS=" line. Otherwise, the functions +# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the +# time library, and if STD_INSPIRED is also defined the functions +# "posix2time_z" and "time2posix_z" are added as well. +# The functions ending in "_z" (or "_rz") are like their unsuffixed +# (or suffixed-by-"_r") counterparts, except with an extra first +# argument of opaque type timezone_t that specifies the timezone. +# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. +# +# If you want to allocate state structures in localtime, add +# -DALL_STATE +# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. +# +# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put +# out by the National Institute of Standards and Technology +# which claims to test C and Posix conformance. If you want to pass PCTS, add +# -DPCTS +# to the end of the "CFLAGS=" line. +# +# If you want strict compliance with XPG4 as of 1994-04-09, add +# -DXPG4_1994_04_09 +# to the end of the "CFLAGS=" line. This causes "strftime" to always return +# 53 as a week number (rather than 52 or 53) for January days before +# January's first Monday when a "%V" format is used and January 1 +# falls on a Friday, Saturday, or Sunday. + +CFLAGS= + +# Linker flags. Default to $(LFLAGS) for backwards compatibility +# to release 2012h and earlier. + +LDFLAGS= $(LFLAGS) + +# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in +# submake command lines. The default is no leap seconds. + +LEAPSECONDS= + +# The zic command and its arguments. + +zic= ./zic +ZIC= $(zic) $(ZFLAGS) + +# To shrink the size of installed TZif files, +# append "-r @N" to omit data before N-seconds-after-the-Epoch. +# To grow the files and work around older application bugs, append "-b fat"; +# see ZIC_BLOAT_DEFAULT above. +# See the zic man page for more about -b and -r. +ZFLAGS= + +# How to use zic to install TZif files. + +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) + +# The name of a Posix-compliant 'awk' on your system. +# Older 'mawk' versions, such as the 'mawk' in Ubuntu 16.04, might dump core; +# on Ubuntu you can work around this with +# AWK= gawk +AWK= awk + +# The full path name of a Posix-compliant shell, preferably one that supports +# the Korn shell's 'select' statement as an extension. +# These days, Bash is the most popular. +# It should be OK to set this to /bin/sh, on platforms where /bin/sh +# lacks 'select' or doesn't completely conform to Posix, but /bin/bash +# is typically nicer if it works. +KSHELL= /bin/bash + +# Name of curl , used for HTML validation. +CURL= curl + +# Name of GNU Privacy Guard , used to sign distributions. +GPG= gpg + +# This expensive test requires USE_LTZ. +# To suppress it, define this macro to be empty. +CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives + +# SAFE_CHAR is a regular expression that matches a safe character. +# Some parts of this distribution are limited to safe characters; +# others can use any UTF-8 character. +# For now, the safe characters are a safe subset of ASCII. +# The caller must set the shell variable 'sharp' to the character '#', +# since Makefile macros cannot contain '#'. +# TAB_CHAR is a single tab character, in single quotes. +TAB_CHAR= ' ' +SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' +SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' +SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' +SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) +SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' + +# These characters are Latin-1, and so are likely to be displayable +# even in editors with limited character sets. +UNUSUAL_OK_LATIN_1 = «°±»½¾× +# This IPA symbol is represented in Unicode as the composition of +# U+0075 and U+032F, and U+032F is not considered alphabetic by some +# grep implementations that do not grok composition. +UNUSUAL_OK_IPA = u̯ +# Non-ASCII non-letters that OK_CHAR allows, as these characters are +# useful in commentary. +UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA) + +# OK_CHAR matches any character allowed in the distributed files. +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +# Other non-letters are limited to ASCII renderings for the +# convenience of maintainers using XEmacs 21.5.34, which by default +# mishandles Unicode characters U+0100 and greater. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' + +# SAFE_LINE matches a line of safe characters. +# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; +# this is so that comments can contain non-ASCII characters. +# OK_LINE matches a line of OK characters. +SAFE_LINE= '^'$(SAFE_CHAR)'*$$' +SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' +OK_LINE= '^'$(OK_CHAR)'*$$' + +# Flags to give 'tar' when making a distribution. +# Try to use flags appropriate for GNU tar. +GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name +TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ + then echo $(GNUTARFLAGS); \ + else :; \ + fi` + +# Flags to give 'gzip' when making a distribution. +GZIPFLAGS= -9n + +############################################################################### + +#MAKE= make + +cc= cc +CC= $(cc) -DTZDIR='"$(TZDIR)"' + +AR= ar + +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : + +TZCOBJS= zic.o +TZDOBJS= zdump.o localtime.o asctime.o strftime.o +DATEOBJS= date.o localtime.o strftime.o asctime.o +LIBSRCS= localtime.c asctime.c difftime.c strftime.c +LIBOBJS= localtime.o asctime.o difftime.o strftime.o +HEADERS= tzfile.h private.h +NONLIBSRCS= zic.c zdump.c +NEWUCBSRCS= date.c +SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ + tzselect.ksh workman.sh +MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ + tzfile.5 tzselect.8 zic.8 zdump.8 +MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ + time2posix.3.txt \ + tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ + date.1.txt +COMMON= calendars CONTRIBUTING LICENSE Makefile \ - NEWS README theory.html version ++ NEWS README SECURITY theory.html version +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html +CHECK_WEB_PAGES=check_theory.html check_tz-art.html \ + check_tz-how-to.html check_tz-link.html +DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) +PRIMARY_YDATA= africa antarctica asia australasia \ + europe northamerica southamerica +YDATA= $(PRIMARY_YDATA) etcetera +NDATA= factory +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward +TDATA= $(YDATA) $(NDATA) $(BACKWARD) +ZONETABLES= zone1970.tab zone.tab +TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) +LEAP_DEPS= leapseconds.awk leap-seconds.list +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ + leapseconds $(ZONETABLES) +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk +MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl +TZS_YEAR= 2050 +TZS_CUTOFF_FLAG= -c $(TZS_YEAR) +TZS= to$(TZS_YEAR).tzs +TZS_NEW= to$(TZS_YEAR)new.tzs +TZS_DEPS= $(YDATA) asctime.c localtime.c \ + private.h tzfile.h zdump.c zic.c +# EIGHT_YARDS is just a yard short of the whole ENCHILADA. +EIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi +ENCHILADA = $(EIGHT_YARDS) $(TZS) + +# Consult these files when deciding whether to rebuild the 'version' file. +# This list is not the same as the output of 'git ls-files', since +# .gitignore is not distributed. +VERSION_DEPS= \ - calendars CONTRIBUTING LICENSE Makefile NEWS README \ ++ calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ + africa antarctica asctime.c asia australasia \ + backward backzone \ + checklinks.awk checktab.awk \ + date.1 date.c difftime.c \ + etcetera europe factory iso3166.tab \ + leap-seconds.list leapseconds.awk localtime.c \ + newctime.3 newstrftime.3 newtzset.3 northamerica \ + private.h southamerica strftime.c theory.html \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ + tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ + workman.sh zdump.8 zdump.c zic.8 zic.c \ + ziguard.awk zishrink.awk \ + zone.tab zone1970.tab zoneinfo2tdf.pl + +# And for the benefit of csh users on systems that assume the user +# shell should be used to handle commands in Makefiles. . . + +SHELL= /bin/sh + +all: tzselect zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi + +ALL: all date $(ENCHILADA) + +install: all $(DATA) $(REDO) $(MANS) + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) \ + `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ + ` $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' + +INSTALL: ALL install date.1 + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' + +# Calculate version number from git, if available. +# Otherwise, use $(VERSION) unless it is "unknown" and there is already +# a 'version' file, in which case reuse the existing 'version' contents +# and append "-dirty" if the contents do not already end in "-dirty". +version: $(VERSION_DEPS) + { (type git) >/dev/null 2>&1 && \ + V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty` || \ + if test '$(VERSION)' = unknown && V=`cat $@`; then \ + case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ + else \ + V='$(VERSION)'; \ + fi; } && \ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ + +# These files can be tailored by setting BACKWARD and PACKRATDATA. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \ + $(TDATA) $(PACKRATDATA) >$@.out + mv $@.out $@ +# This file has a version comment that attempts to capture any tailoring +# via BACKWARD, DATAFORM, PACKRATDATA, and REDO. +tzdata.zi: $(DATAFORM).zi version zishrink.awk + version=`sed 1q version` && \ + LC_ALL=C $(AWK) \ + -v dataform='$(DATAFORM)' \ + -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ + -v redo='$(REDO)' \ + -v version="$$version" \ + -f zishrink.awk \ + $(DATAFORM).zi >$@.out + mv $@.out $@ + +version.h: version + VERSION=`cat version` && printf '%s\n' \ + 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ + "static char const TZVERSION[]=\"$$VERSION\";" \ + 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ + >$@.out + mv $@.out $@ + +zdump: $(TZDOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + +zic: $(TZCOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + +leapseconds: $(LEAP_DEPS) + $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ + -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ + +# Arguments to pass to submakes of install_data. +# They can be overridden by later submake arguments. +INSTALLARGS = \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ + LEAPSECONDS='$(LEAPSECONDS)' \ + PACKRATDATA='$(PACKRATDATA)' \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + ZIC='$(ZIC)' + +INSTALL_DATA_DEPS = zic leapseconds tzdata.zi + +# 'make install_data' installs one set of TZif files. +install_data: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) tzdata.zi + +posix_only: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data + +right_only: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ + install_data + +# In earlier versions of this makefile, the other two directories were +# subdirectories of $(TZDIR). However, this led to configuration errors. +# For example, with posix_right under the earlier scheme, +# TZ='right/Australia/Adelaide' got you localtime with leap seconds, +# but gmtime without leap seconds, which led to problems with applications +# like sendmail that subtract gmtime from localtime. +# Therefore, the other two directories are now siblings of $(TZDIR). +# You must replace all of $(TZDIR) to switch from not using leap seconds +# to using them, or vice versa. +right_posix: right_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + +posix_right: posix_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + +# This obsolescent rule is present for backwards compatibility with +# tz releases 2014g through 2015g. It should go away eventually. +posix_packrat: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only + +zones: $(REDO) + +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ + >$@ + +TZS_NEW_DEPS = tzdata.zi zdump zic +$(TZS_NEW): $(TZS_NEW_DEPS) + rm -fr tzs$(TZS_YEAR).dir + mkdir tzs$(TZS_YEAR).dir + $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi + $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ + tzdata.zi | LC_ALL=C sort >$@.out + wd=`pwd` && \ + x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ + tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2` && \ + set x $$x && \ + shift && \ + ZDS=$$* && \ + $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ + ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs$(TZS_YEAR).dir + mv $@.out $@ + +# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the +# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. +$(TZS): + touch $@ + +force_tzs: $(TZS_NEW) + cp $(TZS_NEW) $(TZS) + +libtz.a: $(LIBOBJS) + rm -f $@ + $(AR) -rc $@ $(LIBOBJS) + $(RANLIB) $@ + +date: $(DATEOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + +tzselect: tzselect.ksh version + VERSION=`cat version` && sed \ + -e 's|#!/bin/bash|#!$(KSHELL)|g' \ + -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ + -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ + -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ + -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ + -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ + <$@.ksh >$@.out + chmod +x $@.out + mv $@.out $@ + +check: check_character_set check_white_space check_links \ + check_name_lengths check_sorted \ + check_tables check_web check_zishrink check_tzs + +check_character_set: $(ENCHILADA) + test ! '$(UTF8_LOCALE)' || \ + ! printf 'A\304\200B\n' | \ + LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ + LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ + sharp='#' && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ + $(MISC) $(SOURCES) $(WEB_PAGES) \ - CONTRIBUTING LICENSE README \ ++ CONTRIBUTING LICENSE README SECURITY \ + version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ + Makefile && \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ + leapseconds zone.tab && \ + ! grep -Env $(OK_LINE) $(ENCHILADA); \ + } + touch $@ + +check_white_space: $(ENCHILADA) + patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ + ! grep -En "$$pat" \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) + touch $@ + +PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ +FILE_NAME_COMPONENT_TOO_LONG = \ + $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} + +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone + touch $@ + +CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } + +check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab + $(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu + $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu + touch $@ + +check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk tzdata.zi + touch $@ + +check_tables: checktab.awk $(YDATA) backward $(ZONETABLES) + for tab in $(ZONETABLES); do \ + test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ + $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ + || exit; \ + done + touch $@ + +check_tzs: $(TZS) $(TZS_NEW) + if test -s $(TZS); then \ + diff -u $(TZS) $(TZS_NEW); \ + else \ + cp $(TZS_NEW) $(TZS); \ + fi + touch $@ + +check_web: $(CHECK_WEB_PAGES) +check_theory.html: theory.html +check_tz-art.html: tz-art.html +check_tz-how-to.html: tz-how-to.html +check_tz-link.html: tz-link.html +check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: + $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ + -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ + test ! -s $@.out || { cat $@.out; exit 1; } + mv $@.out $@ + +# Check that zishrink.awk does not alter the data, and that ziguard.awk +# preserves main-format data. +check_zishrink: check_zishrink_posix check_zishrink_right +check_zishrink_posix check_zishrink_right: \ + zic leapseconds $(PACKRATDATA) $(TDATA) $(DATAFORM).zi tzdata.zi + rm -fr $@.dir $@-t.dir $@-shrunk.dir + mkdir $@.dir $@-t.dir $@-shrunk.dir + case $@ in \ + *_right) leap='-L leapseconds';; \ + *) leap=;; \ + esac && \ + $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ + $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ + case $(DATAFORM) in \ + main) \ + $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ + diff -r $@.dir $@-t.dir;; \ + esac + diff -r $@.dir $@-shrunk.dir + rm -fr $@.dir $@-t.dir $@-shrunk.dir + touch $@ + +clean_misc: + rm -fr check_*.dir + rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ + check_* core typecheck_* \ + date tzselect version.h zdump zic libtz.a +clean: clean_misc + rm -fr *.dir tzdb-*/ + rm -f *.zi $(TZS_NEW) + +maintainer-clean: clean + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* + +names: + @echo $(ENCHILADA) + +public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ + tarballs signatures + +date.1.txt: date.1 +newctime.3.txt: newctime.3 +newstrftime.3.txt: newstrftime.3 +newtzset.3.txt: newtzset.3 +time2posix.3.txt: time2posix.3 +tzfile.5.txt: tzfile.5 +tzselect.8.txt: tzselect.8 +zdump.8.txt: zdump.8 +zic.8.txt: zic.8 + +$(MANTXTS): workman.sh + LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out + mv $@.out $@ + +# Set file timestamps deterministically if possible, +# so that tarballs containing the timestamps are reproducible. +# +# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the +# file DEST to the maximum of the timestamps of the files A B C ..., +# plus N if GNU ls and touch are available. +SET_TIMESTAMP_N = sh -c '\ + n=$$0 dest=$$1; shift; \ + touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \ + if test $$n != 0 && \ + lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \ + set x $$lsout && \ + touch -cmd @`expr $$7 + $$n` "$$dest"; \ + else :; fi' +# If DEST depends on A B C ... in this Makefile, callers should use +# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any +# downstream 'make' that considers equal timestamps to be out of date. +# POSIX allows this 'make' behavior, and HP-UX 'make' does it. +# If all that matters is that the timestamp be reproducible +# and plausible, use $(SET_TIMESTAMP). +SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 +SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 + +# Set the timestamps to those of the git repository, if available, +# and if the files have not changed since then. +# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, +# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. +# If git or GNU is absent, don't bother to sync with git timestamps. +# Also, set the timestamp of each prebuilt file like 'leapseconds' +# to be the maximum of the files it depends on. +set-timestamps.out: $(EIGHT_YARDS) + rm -f $@ + if (type git) >/dev/null 2>&1 && \ + files=`git ls-files $(EIGHT_YARDS)` && \ + touch -md @1 test.out; then \ + rm -f test.out && \ + for file in $$files; do \ + if git diff --quiet $$file; then \ + time=`git log -1 --format='tformat:%ct' $$file` && \ + touch -cmd @$$time $$file; \ + else \ + echo >&2 "$$file: warning: does not match repository"; \ + fi || exit; \ + done; \ + fi + $(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS) + for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ + $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \ + exit; \ + done + $(SET_TIMESTAMP_DEP) version $(VERSION_DEPS) + $(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS) + touch $@ +set-tzs-timestamp.out: $(TZS) + $(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS) + touch $@ *** 203 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Oct 2 04:09:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8086F674008; Sat, 2 Oct 2021 04:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HLtmK2Z5Pz4hGb; Sat, 2 Oct 2021 04:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33FA442C6; Sat, 2 Oct 2021 04:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19249rug099019; Sat, 2 Oct 2021 04:09:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19249rMZ099018; Sat, 2 Oct 2021 04:09:53 GMT (envelope-from git) Date: Sat, 2 Oct 2021 04:09:53 GMT Message-Id: <202110020409.19249rMZ099018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 1c119e173ddc - main - sched_ule(4): Fix possible significance loss. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c119e173ddc7f5603a3b6cf940dc524e494a667 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 04:09:53 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=1c119e173ddc7f5603a3b6cf940dc524e494a667 commit 1c119e173ddc7f5603a3b6cf940dc524e494a667 Author: Alexander Motin AuthorDate: 2021-10-02 03:47:18 +0000 Commit: Alexander Motin CommitDate: 2021-10-02 04:09:45 +0000 sched_ule(4): Fix possible significance loss. Before this change kern.sched.interact sysctl setting above 32 gave all interactive threads identical priority of PRI_MIN_INTERACT due to ((PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) / sched_interact) turning zero. Setting the sysctl lower reduced the range of used priority levels up to half, that is not great either. Change of the operations order should fix the issue, always using full range of priorities, while overflow is impossible there since both score and priority values are small. While there, make the variables unsigned as they really are. MFC after: 1 month --- sys/kern/sched_ule.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 0f873a6a30b6..1b9473b93773 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -207,7 +207,7 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= * sched_slice: Runtime of each thread before rescheduling. * preempt_thresh: Priority threshold for preemption and remote IPIs. */ -static int __read_mostly sched_interact = SCHED_INTERACT_THRESH; +static u_int __read_mostly sched_interact = SCHED_INTERACT_THRESH; static int __read_mostly tickincr = 8 << SCHED_TICK_SHIFT; static int __read_mostly realstathz = 127; /* reset during boot. */ static int __read_mostly sched_slice = 10; /* reset during boot. */ @@ -1616,8 +1616,7 @@ sched_interact_score(struct thread *td) static void sched_priority(struct thread *td) { - int score; - int pri; + u_int pri, score; if (PRI_BASE(td->td_pri_class) != PRI_TIMESHARE) return; @@ -1637,10 +1636,10 @@ sched_priority(struct thread *td) score = imax(0, sched_interact_score(td) + td->td_proc->p_nice); if (score < sched_interact) { pri = PRI_MIN_INTERACT; - pri += ((PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) / - sched_interact) * score; + pri += (PRI_MAX_INTERACT - PRI_MIN_INTERACT + 1) * score / + sched_interact; KASSERT(pri >= PRI_MIN_INTERACT && pri <= PRI_MAX_INTERACT, - ("sched_priority: invalid interactive priority %d score %d", + ("sched_priority: invalid interactive priority %u score %u", pri, score)); } else { pri = SCHED_PRI_MIN; @@ -1649,7 +1648,7 @@ sched_priority(struct thread *td) SCHED_PRI_RANGE - 1); pri += SCHED_PRI_NICE(td->td_proc->p_nice); KASSERT(pri >= PRI_MIN_BATCH && pri <= PRI_MAX_BATCH, - ("sched_priority: invalid priority %d: nice %d, " + ("sched_priority: invalid priority %u: nice %d, " "ticks %d ftick %d ltick %d tick pri %d", pri, td->td_proc->p_nice, td_get_sched(td)->ts_ticks, td_get_sched(td)->ts_ftick, td_get_sched(td)->ts_ltick, @@ -3174,7 +3173,7 @@ SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, "Quantum for timeshare threads in microseconds"); SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, "Quantum for timeshare threads in stathz ticks"); -SYSCTL_INT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, +SYSCTL_UINT(_kern_sched, OID_AUTO, interact, CTLFLAG_RW, &sched_interact, 0, "Interactivity score threshold"); SYSCTL_INT(_kern_sched, OID_AUTO, preempt_thresh, CTLFLAG_RW, &preempt_thresh, 0, From owner-dev-commits-src-all@freebsd.org Sat Oct 2 08:21:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A12CF6770E4; Sat, 2 Oct 2021 08:21:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HM0LT3mXTz3FYm; Sat, 2 Oct 2021 08:21:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61C9E7B2E; Sat, 2 Oct 2021 08:21:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1928LLg3040410; Sat, 2 Oct 2021 08:21:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1928LL1p040409; Sat, 2 Oct 2021 08:21:21 GMT (envelope-from git) Date: Sat, 2 Oct 2021 08:21:21 GMT Message-Id: <202110020821.1928LL1p040409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 0f426dedccf8 - stable/13 - ubsan: Fix a typo in an error message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0f426dedccf8eb2b039074a55dd3cfc99e7b0338 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 08:21:21 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0f426dedccf8eb2b039074a55dd3cfc99e7b0338 commit 0f426dedccf8eb2b039074a55dd3cfc99e7b0338 Author: Gordon Bergling AuthorDate: 2021-09-25 09:47:24 +0000 Commit: Gordon Bergling CommitDate: 2021-10-02 08:21:01 +0000 ubsan: Fix a typo in an error message - s/asumption/assumption/ Obtained from: NetBSD (cherry picked from commit 2aad906266d67eea6ad11d8e0c6fe9263077ee99) --- sys/kern/kern_ubsan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_ubsan.c b/sys/kern/kern_ubsan.c index 93d39103929c..e1482f004d47 100644 --- a/sys/kern/kern_ubsan.c +++ b/sys/kern/kern_ubsan.c @@ -717,7 +717,7 @@ HandleAlignmentAssumption(bool isFatal, struct CAlignmentAssumptionData *pData, if (pData->mAssumptionLocation.mFilename != NULL) { DeserializeLocation(szAssumptionLocation, LOCATION_MAXLEN, &pData->mAssumptionLocation); - Report(isFatal, "UBSan: Undefined Behavior in %s, alignment assumption of %#lx for pointer %#lx (offset %#lx), asumption made in %s\n", + Report(isFatal, "UBSan: Undefined Behavior in %s, alignment assumption of %#lx for pointer %#lx (offset %#lx), assumption made in %s\n", szLocation, ulAlignment, ulRealPointer, ulOffset, szAssumptionLocation); } else { From owner-dev-commits-src-all@freebsd.org Sat Oct 2 08:43:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE0396777BD; Sat, 2 Oct 2021 08:43: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 4HM0qh4MCXz3G5M; Sat, 2 Oct 2021 08:43:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75A927C40; Sat, 2 Oct 2021 08:43: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 1928hCi9070271; Sat, 2 Oct 2021 08:43:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1928hC84070270; Sat, 2 Oct 2021 08:43:12 GMT (envelope-from git) Date: Sat, 2 Oct 2021 08:43:12 GMT Message-Id: <202110020843.1928hC84070270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 9ebd651b5850 - main - netvsc: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ebd651b58502f0572a7832d088f53f7a2ad00a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 08:43:12 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9ebd651b58502f0572a7832d088f53f7a2ad00a5 commit 9ebd651b58502f0572a7832d088f53f7a2ad00a5 Author: Gordon Bergling AuthorDate: 2021-10-02 08:42:18 +0000 Commit: Gordon Bergling CommitDate: 2021-10-02 08:42:18 +0000 netvsc: Fix a typo in a comment - s/prefered/preferred/ MFC after: 3 days --- sys/dev/hyperv/netvsc/hn_rndis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hyperv/netvsc/hn_rndis.c b/sys/dev/hyperv/netvsc/hn_rndis.c index 794a82cf3957..108950aa3f9b 100644 --- a/sys/dev/hyperv/netvsc/hn_rndis.c +++ b/sys/dev/hyperv/netvsc/hn_rndis.c @@ -493,7 +493,7 @@ hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt0) /* * NOTE: - * Toeplitz is at the lowest bit, and it is prefered; so ffs(), + * Toeplitz is at the lowest bit, and it is preferred; so ffs(), * instead of fls(), is used here. */ hash_fnidx = ffs(caps.ndis_caps & NDIS_RSS_CAP_HASHFUNC_MASK); From owner-dev-commits-src-all@freebsd.org Sat Oct 2 08:44:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3C236777C9; Sat, 2 Oct 2021 08:44: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 4HM0rr43tMz3GPR; Sat, 2 Oct 2021 08:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C0C310593; Sat, 2 Oct 2021 08:44: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 1928iCNC070459; Sat, 2 Oct 2021 08:44:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1928iCMW070458; Sat, 2 Oct 2021 08:44:12 GMT (envelope-from git) Date: Sat, 2 Oct 2021 08:44:12 GMT Message-Id: <202110020844.1928iCMW070458@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: efd8749fe5cc - main - evdev: Fix a typo in a commit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: efd8749fe5cccb6c3d6b5f3c3515bf89ad306bcc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 08:44:12 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=efd8749fe5cccb6c3d6b5f3c3515bf89ad306bcc commit efd8749fe5cccb6c3d6b5f3c3515bf89ad306bcc Author: Gordon Bergling AuthorDate: 2021-10-02 08:43:41 +0000 Commit: Gordon Bergling CommitDate: 2021-10-02 08:43:41 +0000 evdev: Fix a typo in a commit - s/prefered/preferred/ MFC after: 3 days --- sys/dev/evdev/evdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index 589bd7cfe563..90bea09b70c9 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -49,7 +49,7 @@ typedef void (evdev_keycode_t)(struct evdev_dev *, * Keyboard and mouse events recipient mask. * evdev_rcpt_mask variable should be respected by keyboard and mouse drivers * that are able to send events through both evdev and sysmouse/kbdmux - * interfaces so user can choose prefered one to not receive one event twice. + * interfaces so user can choose preferred one to not receive one event twice. */ #define EVDEV_RCPT_SYSMOUSE (1<<0) #define EVDEV_RCPT_KBDMUX (1<<1) From owner-dev-commits-src-all@freebsd.org Sat Oct 2 08:46:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15F6E677BD3; Sat, 2 Oct 2021 08:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HM0vq08Vpz3G4H; Sat, 2 Oct 2021 08:46:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9EE110708; Sat, 2 Oct 2021 08:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1928kkU4070744; Sat, 2 Oct 2021 08:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1928kkhg070743; Sat, 2 Oct 2021 08:46:46 GMT (envelope-from git) Date: Sat, 2 Oct 2021 08:46:46 GMT Message-Id: <202110020846.1928kkhg070743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 9599d8141f79 - main - smsc(4): Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9599d8141f79aa721e47d7fd91e7b9bcfef3a7d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 08:46:47 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9599d8141f79aa721e47d7fd91e7b9bcfef3a7d5 commit 9599d8141f79aa721e47d7fd91e7b9bcfef3a7d5 Author: Gordon Bergling AuthorDate: 2021-10-02 08:45:58 +0000 Commit: Gordon Bergling CommitDate: 2021-10-02 08:45:58 +0000 smsc(4): Fix a typo in a comment - s/setings/settings/ MFC after: 3 days --- sys/dev/usb/net/if_smsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/usb/net/if_smsc.c b/sys/dev/usb/net/if_smsc.c index 85cc955b9fbf..33a90259b464 100644 --- a/sys/dev/usb/net/if_smsc.c +++ b/sys/dev/usb/net/if_smsc.c @@ -1411,7 +1411,7 @@ smsc_chip_init(struct smsc_softc *sc) reg_val &= ~SMSC_HW_CFG_RXDOFF; reg_val |= (ETHER_ALIGN << 9) & SMSC_HW_CFG_RXDOFF; - /* The following setings are used for 'turbo mode', a.k.a multiple frames + /* The following settings are used for 'turbo mode', a.k.a multiple frames * per Rx transaction (again info taken form Linux driver). */ if (smsc_rx_packet_batching) From owner-dev-commits-src-all@freebsd.org Sat Oct 2 08:47:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05DF3677B76; Sat, 2 Oct 2021 08:47:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HM0x46VMlz3GY7; Sat, 2 Oct 2021 08:47:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFD1810595; Sat, 2 Oct 2021 08:47:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1928lq70070925; Sat, 2 Oct 2021 08:47:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1928lqKa070924; Sat, 2 Oct 2021 08:47:52 GMT (envelope-from git) Date: Sat, 2 Oct 2021 08:47:52 GMT Message-Id: <202110020847.1928lqKa070924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: fafb1c574d43 - main - vnic: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fafb1c574d43b8c3acb510d925f599fee461c039 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 08:47:53 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fafb1c574d43b8c3acb510d925f599fee461c039 commit fafb1c574d43b8c3acb510d925f599fee461c039 Author: Gordon Bergling AuthorDate: 2021-10-02 08:47:21 +0000 Commit: Gordon Bergling CommitDate: 2021-10-02 08:47:21 +0000 vnic: Fix a typo in a comment - s/setings/settings/ MFC after: 3 days --- sys/dev/vnic/thunder_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/vnic/thunder_mdio.c b/sys/dev/vnic/thunder_mdio.c index 118a01a533ea..c61c0eeecf62 100644 --- a/sys/dev/vnic/thunder_mdio.c +++ b/sys/dev/vnic/thunder_mdio.c @@ -206,7 +206,7 @@ thunder_mdio_set_mode(struct thunder_mdio_softc *sc, smi_clk |= SMI_CLK_MODE; /* Enable sending 32 bit preable on SMI transactions */ smi_clk |= SMI_CLK_PREAMBLE; - /* Saved setings */ + /* Saved settings */ mdio_reg_write(sc, SMI_CLK, smi_clk); sc->mode = mode; } From owner-dev-commits-src-all@freebsd.org Sat Oct 2 08:49:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9BBB6777FD; Sat, 2 Oct 2021 08:49: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 4HM0yf4PPLz3GSR; Sat, 2 Oct 2021 08:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7711D10323; Sat, 2 Oct 2021 08:49: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 1928nEQ5071124; Sat, 2 Oct 2021 08:49:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1928nEcF071123; Sat, 2 Oct 2021 08:49:14 GMT (envelope-from git) Date: Sat, 2 Oct 2021 08:49:14 GMT Message-Id: <202110020849.1928nEcF071123@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 15c5f657a010 - main - cam: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15c5f657a0107c7c1a3c954252a9ac6bb80f2535 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 08:49:14 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=15c5f657a0107c7c1a3c954252a9ac6bb80f2535 commit 15c5f657a0107c7c1a3c954252a9ac6bb80f2535 Author: Gordon Bergling AuthorDate: 2021-10-02 08:48:43 +0000 Commit: Gordon Bergling CommitDate: 2021-10-02 08:48:43 +0000 cam: Fix a typo in a comment - s/perorming/performing/ MFC after: 3 days --- sys/cam/ctl/ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 8ad8bcec434b..980328c1551f 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -8552,7 +8552,7 @@ done: /* * This routine is for handling a message from the other SC pertaining to * persistent reserve out. All the error checking will have been done - * so only perorming the action need be done here to keep the two + * so only performing the action need be done here to keep the two * in sync. */ static void From owner-dev-commits-src-all@freebsd.org Sat Oct 2 08:50:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60B26677D31; Sat, 2 Oct 2021 08:50: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 4HM10T28T1z3GSv; Sat, 2 Oct 2021 08:50:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29DD410615; Sat, 2 Oct 2021 08:50: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 1928onKM079547; Sat, 2 Oct 2021 08:50:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1928onr3079546; Sat, 2 Oct 2021 08:50:49 GMT (envelope-from git) Date: Sat, 2 Oct 2021 08:50:49 GMT Message-Id: <202110020850.1928onr3079546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 957d9ba0c3f9 - main - qlnxe: Fix typos in two error messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 957d9ba0c3f908462915c9aed6900c50c8c76210 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 08:50:49 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=957d9ba0c3f908462915c9aed6900c50c8c76210 commit 957d9ba0c3f908462915c9aed6900c50c8c76210 Author: Gordon Bergling AuthorDate: 2021-10-02 08:49:51 +0000 Commit: Gordon Bergling CommitDate: 2021-10-02 08:49:51 +0000 qlnxe: Fix typos in two error messages - s/erorr/error/ MFC after: 1 week --- sys/dev/qlnx/qlnxe/ecore_int.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/qlnx/qlnxe/ecore_int.c b/sys/dev/qlnx/qlnxe/ecore_int.c index 14285a35afa5..fbf692acfb6c 100644 --- a/sys/dev/qlnx/qlnxe/ecore_int.c +++ b/sys/dev/qlnx/qlnxe/ecore_int.c @@ -364,7 +364,7 @@ enum _ecore_status_t ecore_pglueb_rbc_attn_handler(struct ecore_hwfn *p_hwfn, tmp = ecore_rd(p_hwfn, p_ptt, PGLUE_B_REG_TX_ERR_WR_DETAILS_ICPL); if (tmp & ECORE_PGLUE_ATTENTION_ICPL_VALID) - DP_NOTICE(p_hwfn, false, "ICPL eror - %08x\n", tmp); + DP_NOTICE(p_hwfn, false, "ICPL error - %08x\n", tmp); tmp = ecore_rd(p_hwfn, p_ptt, PGLUE_B_REG_MASTER_ZLR_ERR_DETAILS); if (tmp & ECORE_PGLUE_ATTENTION_ZLR_VALID) { @@ -376,7 +376,7 @@ enum _ecore_status_t ecore_pglueb_rbc_attn_handler(struct ecore_hwfn *p_hwfn, PGLUE_B_REG_MASTER_ZLR_ERR_ADD_63_32); DP_NOTICE(p_hwfn, false, - "ICPL eror - %08x [Address %08x:%08x]\n", + "ICPL error - %08x [Address %08x:%08x]\n", tmp, addr_hi, addr_lo); } From owner-dev-commits-src-all@freebsd.org Sat Oct 2 08:52:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D48AF678183; Sat, 2 Oct 2021 08:52: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 4HM11y5cwnz3H0f; Sat, 2 Oct 2021 08:52:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1231103D2; Sat, 2 Oct 2021 08:52: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 1928q6Np083862; Sat, 2 Oct 2021 08:52:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1928q6Ks083861; Sat, 2 Oct 2021 08:52:06 GMT (envelope-from git) Date: Sat, 2 Oct 2021 08:52:06 GMT Message-Id: <202110020852.1928q6Ks083861@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 42dfad2ef127 - main - ti(4): Fix a typo in an error message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 42dfad2ef12755d27e0e34656a2624f0dac2c502 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 08:52:06 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=42dfad2ef12755d27e0e34656a2624f0dac2c502 commit 42dfad2ef12755d27e0e34656a2624f0dac2c502 Author: Gordon Bergling AuthorDate: 2021-10-02 08:51:29 +0000 Commit: Gordon Bergling CommitDate: 2021-10-02 08:51:29 +0000 ti(4): Fix a typo in an error message - s/chanels/channels/ MFC after: 1 week --- sys/arm/ti/ti_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/ti/ti_adc.c b/sys/arm/ti/ti_adc.c index a0091aebf417..766729fcdab3 100644 --- a/sys/arm/ti/ti_adc.c +++ b/sys/arm/ti/ti_adc.c @@ -809,7 +809,7 @@ ti_adc_attach(device_t dev) /* Sanity check FDT data */ if (sc->sc_tsc_wires + sc->sc_adc_nchannels > TI_ADC_NPINS) { - device_printf(dev, "total number of chanels (%d) is larger than %d\n", + device_printf(dev, "total number of channels (%d) is larger than %d\n", sc->sc_tsc_wires + sc->sc_adc_nchannels, TI_ADC_NPINS); return (ENXIO); } From owner-dev-commits-src-all@freebsd.org Sat Oct 2 11:53:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0EDD67A271; Sat, 2 Oct 2021 11:53: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 4HM53X4hJ8z3mXv; Sat, 2 Oct 2021 11:53:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80E5D12AD2; Sat, 2 Oct 2021 11:53: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 192BriSl024174; Sat, 2 Oct 2021 11:53:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192Bri9Z024173; Sat, 2 Oct 2021 11:53:44 GMT (envelope-from git) Date: Sat, 2 Oct 2021 11:53:44 GMT Message-Id: <202110021153.192Bri9Z024173@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: e08940243162 - stable/13 - ng_ether: Create netgraph nodes for bridge interfaces. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e08940243162f918f01751a70e159c8c7fbfa6a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 11:53:44 -0000 The branch stable/13 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=e08940243162f918f01751a70e159c8c7fbfa6a0 commit e08940243162f918f01751a70e159c8c7fbfa6a0 Author: Yoshihiro Takahashi AuthorDate: 2021-09-25 16:24:33 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-10-02 11:51:14 +0000 ng_ether: Create netgraph nodes for bridge interfaces. Create netgraph nodes for bridge interfaces when the ng_ether module is loaded. If a bridge interface is created after loading the ng_ether module, a netgraph node is created via ether_ifattach(). (cherry picked from commit d653b188e89b5e44b2708342c7d3b789398f9cde) --- sys/netgraph/ng_ether.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c index 5718de235c4c..40e06604b8bb 100644 --- a/sys/netgraph/ng_ether.c +++ b/sys/netgraph/ng_ether.c @@ -414,7 +414,9 @@ ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) node_p node; /* Only ethernet interfaces are of interest. */ - if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) + if (ifp->if_type != IFT_ETHER && + ifp->if_type != IFT_L2VLAN && + ifp->if_type != IFT_BRIDGE) return; /* @@ -868,8 +870,9 @@ vnet_ng_ether_init(const void *unused) /* Create nodes for any already-existing Ethernet interfaces. */ IFNET_RLOCK(); CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type == IFT_ETHER - || ifp->if_type == IFT_L2VLAN) + if (ifp->if_type == IFT_ETHER || + ifp->if_type == IFT_L2VLAN || + ifp->if_type == IFT_BRIDGE) ng_ether_attach(ifp); } IFNET_RUNLOCK(); From owner-dev-commits-src-all@freebsd.org Sat Oct 2 11:55:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CDD567A4D5; Sat, 2 Oct 2021 11:55: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 4HM5501BVKz3mgn; Sat, 2 Oct 2021 11:55:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0883012C42; Sat, 2 Oct 2021 11:55: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 192Bsxoj024374; Sat, 2 Oct 2021 11:54:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192BsxIQ024373; Sat, 2 Oct 2021 11:54:59 GMT (envelope-from git) Date: Sat, 2 Oct 2021 11:54:59 GMT Message-Id: <202110021154.192BsxIQ024373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: db79ace65626 - stable/12 - ng_ether: Create netgraph nodes for bridge interfaces. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: db79ace65626d81834888b69b0f6c12a034c8891 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 11:55:00 -0000 The branch stable/12 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=db79ace65626d81834888b69b0f6c12a034c8891 commit db79ace65626d81834888b69b0f6c12a034c8891 Author: Yoshihiro Takahashi AuthorDate: 2021-09-25 16:24:33 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-10-02 11:54:19 +0000 ng_ether: Create netgraph nodes for bridge interfaces. Create netgraph nodes for bridge interfaces when the ng_ether module is loaded. If a bridge interface is created after loading the ng_ether module, a netgraph node is created via ether_ifattach(). (cherry picked from commit d653b188e89b5e44b2708342c7d3b789398f9cde) --- sys/netgraph/ng_ether.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c index 770cd2bbbafd..e47bad496d65 100644 --- a/sys/netgraph/ng_ether.c +++ b/sys/netgraph/ng_ether.c @@ -414,7 +414,9 @@ ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) node_p node; /* Only ethernet interfaces are of interest. */ - if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) + if (ifp->if_type != IFT_ETHER && + ifp->if_type != IFT_L2VLAN && + ifp->if_type != IFT_BRIDGE) return; /* @@ -868,8 +870,9 @@ vnet_ng_ether_init(const void *unused) /* Create nodes for any already-existing Ethernet interfaces. */ IFNET_RLOCK(); CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type == IFT_ETHER - || ifp->if_type == IFT_L2VLAN) + if (ifp->if_type == IFT_ETHER || + ifp->if_type == IFT_L2VLAN || + ifp->if_type == IFT_BRIDGE) ng_ether_attach(ifp); } IFNET_RUNLOCK(); From owner-dev-commits-src-all@freebsd.org Sat Oct 2 11:56:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9FFA67A786; Sat, 2 Oct 2021 11:56: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 4HM57H5pgvz3mgF; Sat, 2 Oct 2021 11:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A813312D11; Sat, 2 Oct 2021 11:56: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 192BuxFi024634; Sat, 2 Oct 2021 11:56:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192BuxOe024633; Sat, 2 Oct 2021 11:56:59 GMT (envelope-from git) Date: Sat, 2 Oct 2021 11:56:59 GMT Message-Id: <202110021156.192BuxOe024633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: cea130c0b8f5 - stable/13 - unzip: sync with NetBSD upstream to add passphrase support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cea130c0b8f5a32b0e4a22befb89bad73f8663c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 11:56:59 -0000 The branch stable/13 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=cea130c0b8f5a32b0e4a22befb89bad73f8663c2 commit cea130c0b8f5a32b0e4a22befb89bad73f8663c2 Author: Yoshihiro Takahashi AuthorDate: 2021-09-25 16:32:42 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-10-02 11:56:19 +0000 unzip: sync with NetBSD upstream to add passphrase support - Add support for password protected zip archives. We use memset_s() rather than explicit_bzero() for more portable (See PR). - Use success/failure macro in exit() - Mention ZIPX format in unzip(1) Submitted by: Mingye Wang and Alex Kozlov (ak@) PR: 244181 Reviewed by: mizhka Obtained from: NetBSD Differential Revision: https://reviews.freebsd.org/D28892 (cherry picked from commit a4724ff48108840416c83f10e15d666ac8d78937) --- usr.bin/unzip/unzip.1 | 10 ++++++-- usr.bin/unzip/unzip.c | 66 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 66 insertions(+), 10 deletions(-) diff --git a/usr.bin/unzip/unzip.1 b/usr.bin/unzip/unzip.1 index b7c2d858f012..bb43abf43a85 100644 --- a/usr.bin/unzip/unzip.1 +++ b/usr.bin/unzip/unzip.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2015 +.Dd September 25, 2021 .Dt UNZIP 1 .Os .Sh NAME @@ -35,6 +35,8 @@ .Nm .Op Fl aCcfjLlnopqtuvy .Op Fl d Ar dir +.Op Fl x Ar pattern +.Op Fl P Ar password .Ar zipfile .Sh DESCRIPTION .\" ... @@ -81,6 +83,10 @@ When extracting files from the zipfile, they are written to stdout. The normal output is suppressed as if .Fl q was specified. +.It Fl P Ar password +Extract encrypted files using a password. +Putting a password on the command line using this option can be +insecure. .It Fl q Quiet: print less information while extracting. .It Fl t @@ -172,7 +178,7 @@ utility is only able to process ZIP archives handled by .Xr libarchive 3 . Depending on the installed version of .Xr libarchive 3 , -this may or may not include self-extracting archives. +this may or may not include self-extracting or ZIPX archives. .Sh SEE ALSO .Xr libarchive 3 .Sh HISTORY diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c index 937176111a02..e5ca1ff2c939 100644 --- a/usr.bin/unzip/unzip.c +++ b/usr.bin/unzip/unzip.c @@ -51,6 +51,7 @@ #include #include +#include /* command-line options */ static int a_opt; /* convert EOL */ @@ -63,6 +64,7 @@ static int L_opt; /* lowercase names */ static int n_opt; /* never overwrite */ static int o_opt; /* always overwrite */ static int p_opt; /* extract to stdout, quiet */ +static char *P_arg; /* passphrase */ static int q_opt; /* quiet */ static int t_opt; /* test */ static int u_opt; /* update */ @@ -95,6 +97,9 @@ static int tty; */ static int noeol; +/* for an interactive passphrase input */ +static char *passphrase_buf; + /* fatal error message + errno */ static void error(const char *fmt, ...) @@ -109,7 +114,7 @@ error(const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, ": %s\n", strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } /* fatal error message, no errno */ @@ -126,7 +131,7 @@ errorx(const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); - exit(1); + exit(EXIT_FAILURE); } /* non-fatal error message + errno */ @@ -854,6 +859,36 @@ test(struct archive *a, struct archive_entry *e) return error_count; } +/* + * Callback function for reading passphrase. + * Originally from cpio.c and passphrase.c, libarchive. + */ +#define PPBUFF_SIZE 1024 +static const char * +passphrase_callback(struct archive *a, void *_client_data) +{ + char *p; + + (void)a; /* UNUSED */ + (void)_client_data; /* UNUSED */ + + if (passphrase_buf == NULL) { + passphrase_buf = malloc(PPBUFF_SIZE); + if (passphrase_buf == NULL) { + errno = ENOMEM; + error("malloc()"); + } + } + + p = readpassphrase("\nEnter password: ", passphrase_buf, + PPBUFF_SIZE, RPP_ECHO_OFF); + + if (p == NULL && errno != EINTR) + error("Error reading password"); + + return p; +} + /* * Main loop: open the zipfile, iterate over its contents and decide what * to do with each entry. @@ -870,6 +905,13 @@ unzip(const char *fn) error("archive_read_new failed"); ac(archive_read_support_format_zip(a)); + + if (P_arg) + archive_read_add_passphrase(a, P_arg); + else + archive_read_set_passphrase_callback(a, NULL, + &passphrase_callback); + ac(archive_read_open_filename(a, fn, 8192)); if (!zipinfo_mode) { @@ -925,6 +967,11 @@ unzip(const char *fn) ac(archive_read_free(a)); + if (passphrase_buf != NULL) { + memset_s(passphrase_buf, PPBUFF_SIZE, 0, PPBUFF_SIZE); + free(passphrase_buf); + } + if (t_opt) { if (error_count > 0) { errorx("%ju checksum error(s) found.", error_count); @@ -940,9 +987,9 @@ static void usage(void) { - fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] [-x pattern] " - "zipfile\n"); - exit(1); + fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] " + "[-x pattern] [-P password] zipfile\n"); + exit(EXIT_FAILURE); } static int @@ -951,7 +998,7 @@ getopts(int argc, char *argv[]) int opt; optreset = optind = 1; - while ((opt = getopt(argc, argv, "aCcd:fjLlnopqtuvx:yZ1")) != -1) + while ((opt = getopt(argc, argv, "aCcd:fjLlnopP:qtuvx:yZ1")) != -1) switch (opt) { case '1': Z1_opt = 1; @@ -991,6 +1038,9 @@ getopts(int argc, char *argv[]) case 'p': p_opt = 1; break; + case 'P': + P_arg = optarg; + break; case 'q': q_opt = 1; break; @@ -1047,7 +1097,7 @@ main(int argc, char *argv[]) */ if (zipinfo_mode && !Z1_opt) { printf("Zipinfo mode needs additional options\n"); - exit(1); + exit(EXIT_FAILURE); } if (argc <= nopts) @@ -1068,5 +1118,5 @@ main(int argc, char *argv[]) unzip(zipfile); - exit(0); + exit(EXIT_SUCCESS); } From owner-dev-commits-src-all@freebsd.org Sat Oct 2 11:58:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBB7167A624; Sat, 2 Oct 2021 11:58: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 4HM58X5MPCz3mgS; Sat, 2 Oct 2021 11:58:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98D5312DA0; Sat, 2 Oct 2021 11:58: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 192Bw4Oc024822; Sat, 2 Oct 2021 11:58:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192Bw4PD024821; Sat, 2 Oct 2021 11:58:04 GMT (envelope-from git) Date: Sat, 2 Oct 2021 11:58:04 GMT Message-Id: <202110021158.192Bw4PD024821@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: 970c3982cd6a - stable/12 - unzip: sync with NetBSD upstream to add passphrase support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 970c3982cd6a05efe9b4666a8a7f98670f18f36e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 11:58:04 -0000 The branch stable/12 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=970c3982cd6a05efe9b4666a8a7f98670f18f36e commit 970c3982cd6a05efe9b4666a8a7f98670f18f36e Author: Yoshihiro Takahashi AuthorDate: 2021-09-25 16:32:42 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-10-02 11:57:24 +0000 unzip: sync with NetBSD upstream to add passphrase support - Add support for password protected zip archives. We use memset_s() rather than explicit_bzero() for more portable (See PR). - Use success/failure macro in exit() - Mention ZIPX format in unzip(1) Submitted by: Mingye Wang and Alex Kozlov (ak@) PR: 244181 Reviewed by: mizhka Obtained from: NetBSD Differential Revision: https://reviews.freebsd.org/D28892 (cherry picked from commit a4724ff48108840416c83f10e15d666ac8d78937) --- usr.bin/unzip/unzip.1 | 10 ++++++-- usr.bin/unzip/unzip.c | 66 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 66 insertions(+), 10 deletions(-) diff --git a/usr.bin/unzip/unzip.1 b/usr.bin/unzip/unzip.1 index b7c2d858f012..bb43abf43a85 100644 --- a/usr.bin/unzip/unzip.1 +++ b/usr.bin/unzip/unzip.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2015 +.Dd September 25, 2021 .Dt UNZIP 1 .Os .Sh NAME @@ -35,6 +35,8 @@ .Nm .Op Fl aCcfjLlnopqtuvy .Op Fl d Ar dir +.Op Fl x Ar pattern +.Op Fl P Ar password .Ar zipfile .Sh DESCRIPTION .\" ... @@ -81,6 +83,10 @@ When extracting files from the zipfile, they are written to stdout. The normal output is suppressed as if .Fl q was specified. +.It Fl P Ar password +Extract encrypted files using a password. +Putting a password on the command line using this option can be +insecure. .It Fl q Quiet: print less information while extracting. .It Fl t @@ -172,7 +178,7 @@ utility is only able to process ZIP archives handled by .Xr libarchive 3 . Depending on the installed version of .Xr libarchive 3 , -this may or may not include self-extracting archives. +this may or may not include self-extracting or ZIPX archives. .Sh SEE ALSO .Xr libarchive 3 .Sh HISTORY diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c index 937176111a02..e5ca1ff2c939 100644 --- a/usr.bin/unzip/unzip.c +++ b/usr.bin/unzip/unzip.c @@ -51,6 +51,7 @@ #include #include +#include /* command-line options */ static int a_opt; /* convert EOL */ @@ -63,6 +64,7 @@ static int L_opt; /* lowercase names */ static int n_opt; /* never overwrite */ static int o_opt; /* always overwrite */ static int p_opt; /* extract to stdout, quiet */ +static char *P_arg; /* passphrase */ static int q_opt; /* quiet */ static int t_opt; /* test */ static int u_opt; /* update */ @@ -95,6 +97,9 @@ static int tty; */ static int noeol; +/* for an interactive passphrase input */ +static char *passphrase_buf; + /* fatal error message + errno */ static void error(const char *fmt, ...) @@ -109,7 +114,7 @@ error(const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, ": %s\n", strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } /* fatal error message, no errno */ @@ -126,7 +131,7 @@ errorx(const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); - exit(1); + exit(EXIT_FAILURE); } /* non-fatal error message + errno */ @@ -854,6 +859,36 @@ test(struct archive *a, struct archive_entry *e) return error_count; } +/* + * Callback function for reading passphrase. + * Originally from cpio.c and passphrase.c, libarchive. + */ +#define PPBUFF_SIZE 1024 +static const char * +passphrase_callback(struct archive *a, void *_client_data) +{ + char *p; + + (void)a; /* UNUSED */ + (void)_client_data; /* UNUSED */ + + if (passphrase_buf == NULL) { + passphrase_buf = malloc(PPBUFF_SIZE); + if (passphrase_buf == NULL) { + errno = ENOMEM; + error("malloc()"); + } + } + + p = readpassphrase("\nEnter password: ", passphrase_buf, + PPBUFF_SIZE, RPP_ECHO_OFF); + + if (p == NULL && errno != EINTR) + error("Error reading password"); + + return p; +} + /* * Main loop: open the zipfile, iterate over its contents and decide what * to do with each entry. @@ -870,6 +905,13 @@ unzip(const char *fn) error("archive_read_new failed"); ac(archive_read_support_format_zip(a)); + + if (P_arg) + archive_read_add_passphrase(a, P_arg); + else + archive_read_set_passphrase_callback(a, NULL, + &passphrase_callback); + ac(archive_read_open_filename(a, fn, 8192)); if (!zipinfo_mode) { @@ -925,6 +967,11 @@ unzip(const char *fn) ac(archive_read_free(a)); + if (passphrase_buf != NULL) { + memset_s(passphrase_buf, PPBUFF_SIZE, 0, PPBUFF_SIZE); + free(passphrase_buf); + } + if (t_opt) { if (error_count > 0) { errorx("%ju checksum error(s) found.", error_count); @@ -940,9 +987,9 @@ static void usage(void) { - fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] [-x pattern] " - "zipfile\n"); - exit(1); + fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] " + "[-x pattern] [-P password] zipfile\n"); + exit(EXIT_FAILURE); } static int @@ -951,7 +998,7 @@ getopts(int argc, char *argv[]) int opt; optreset = optind = 1; - while ((opt = getopt(argc, argv, "aCcd:fjLlnopqtuvx:yZ1")) != -1) + while ((opt = getopt(argc, argv, "aCcd:fjLlnopP:qtuvx:yZ1")) != -1) switch (opt) { case '1': Z1_opt = 1; @@ -991,6 +1038,9 @@ getopts(int argc, char *argv[]) case 'p': p_opt = 1; break; + case 'P': + P_arg = optarg; + break; case 'q': q_opt = 1; break; @@ -1047,7 +1097,7 @@ main(int argc, char *argv[]) */ if (zipinfo_mode && !Z1_opt) { printf("Zipinfo mode needs additional options\n"); - exit(1); + exit(EXIT_FAILURE); } if (argc <= nopts) @@ -1068,5 +1118,5 @@ main(int argc, char *argv[]) unzip(zipfile); - exit(0); + exit(EXIT_SUCCESS); } From owner-dev-commits-src-all@freebsd.org Sat Oct 2 15:28:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C9E067D36A; Sat, 2 Oct 2021 15:28: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 4HM9q971D4z4TQx; Sat, 2 Oct 2021 15:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1CC2153C2; Sat, 2 Oct 2021 15:28: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 192FSLPM003137; Sat, 2 Oct 2021 15:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192FSLPc003136; Sat, 2 Oct 2021 15:28:21 GMT (envelope-from git) Date: Sat, 2 Oct 2021 15:28:21 GMT Message-Id: <202110021528.192FSLPc003136@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: 0d5184c5fb4c - stable/13 - cam: Avoiding waking up doneq threads if we're dumping 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: 0d5184c5fb4c9110e70eaf230673af34ad262458 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 15:28:22 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0d5184c5fb4c9110e70eaf230673af34ad262458 commit 0d5184c5fb4c9110e70eaf230673af34ad262458 Author: Mark Johnston AuthorDate: 2021-09-25 14:13:56 +0000 Commit: Mark Johnston CommitDate: 2021-10-02 15:28:07 +0000 cam: Avoiding waking up doneq threads if we're dumping Depending on the state of the target doneq thread at the time of the panic, the wakeup can hang indefinitely in thread_lock_block_wait(). That function should likely be modified to return immediately if the scheduler is stopped, but it is also preferable to avoid wakeups in general after a panic. Reported by: pho Reviewed by: mav, imp Sponsored by: The FreeBSD Foundation (cherry picked from commit ed8ef7ae8b05d9f73db2182b5e24b0b76b0783a2) --- sys/cam/cam_xpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index e3b43e70dc61..0e38166b6ba0 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4635,7 +4635,7 @@ xpt_done(union ccb *done_ccb) STAILQ_INSERT_TAIL(&queue->cam_doneq, &done_ccb->ccb_h, sim_links.stqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; mtx_unlock(&queue->cam_doneq_mtx); - if (run) + if (run && !dumping) wakeup(&queue->cam_doneq); } From owner-dev-commits-src-all@freebsd.org Sat Oct 2 16:30:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35AC267E384; Sat, 2 Oct 2021 16:30: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 4HMCC50qBSz4jKX; Sat, 2 Oct 2021 16:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0883162E2; Sat, 2 Oct 2021 16:30: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 192GUeZn091047; Sat, 2 Oct 2021 16:30:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192GUeG4091046; Sat, 2 Oct 2021 16:30:40 GMT (envelope-from git) Date: Sat, 2 Oct 2021 16:30:40 GMT Message-Id: <202110021630.192GUeG4091046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 202692b1a733 - main - arm64: Spell BeagleBone correctly in config file. 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/main X-Git-Reftype: branch X-Git-Commit: 202692b1a733322540723c718288eff3a8054d42 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 16:30:41 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=202692b1a733322540723c718288eff3a8054d42 commit 202692b1a733322540723c718288eff3a8054d42 Author: Tom Hukins AuthorDate: 2021-10-02 11:07:50 +0000 Commit: Warner Losh CommitDate: 2021-10-02 16:30:14 +0000 arm64: Spell BeagleBone correctly in config file. Pull Request: https://github.com/freebsd/freebsd-src/pull/545 --- sys/arm/conf/GENERIC | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 427f354d1f93..e51a04244367 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -184,7 +184,7 @@ device ti_adc device pwm # Watchdog support -# If we don't enable the watchdog driver, the BealeBone could potentially +# If we don't enable the watchdog driver, the BeagleBone could potentially # reboot automatically because the boot loader might have enabled the # watchdog. device ti_wdt From owner-dev-commits-src-all@freebsd.org Sat Oct 2 16:40:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E024767E25D; Sat, 2 Oct 2021 16:40: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 4HMCQ85p98z4jg3; Sat, 2 Oct 2021 16:40:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A424916886; Sat, 2 Oct 2021 16:40: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 192GeGHw001775; Sat, 2 Oct 2021 16:40:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192GeG7w001769; Sat, 2 Oct 2021 16:40:16 GMT (envelope-from git) Date: Sat, 2 Oct 2021 16:40:16 GMT Message-Id: <202110021640.192GeG7w001769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 48556dff3d02 - main - src/bin/sh: Fix spelling errors 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/main X-Git-Reftype: branch X-Git-Commit: 48556dff3d028da85b864c6662534e1388a255c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 16:40:16 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=48556dff3d028da85b864c6662534e1388a255c8 commit 48556dff3d028da85b864c6662534e1388a255c8 Author: Elyes HAOUAS AuthorDate: 2021-10-02 16:33:51 +0000 Commit: Warner Losh CommitDate: 2021-10-02 16:39:24 +0000 src/bin/sh: Fix spelling errors Pull Request: https://github.com/freebsd/freebsd-src/pull/544 Signed-off-by: Elyes HAOUAS --- bin/sh/error.c | 2 +- bin/sh/eval.c | 2 +- bin/sh/nodetypes | 2 +- bin/sh/shell.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/sh/error.c b/bin/sh/error.c index bee2a4fe703b..a6b407907e20 100644 --- a/bin/sh/error.c +++ b/bin/sh/error.c @@ -74,7 +74,7 @@ static void verrorwithstatus(int, const char *, va_list) __printf0like(2, 0) __d * just do a longjmp to the exception handler. The type of exception is * stored in the global variable "exception". * - * Interrupts are disabled; they should be reenabled when the exception is + * Interrupts are disabled; they should be re-enabled when the exception is * caught. */ diff --git a/bin/sh/eval.c b/bin/sh/eval.c index b95689bce006..58cfc522bb14 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -900,7 +900,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) * the hash table isn't filled with items * from the temporary setting. * - * It would be better to forbit using and + * It would be better to forbid using and * updating the table while this command * runs, by the command finding mechanism * is heavily integrated with hash handling, diff --git a/bin/sh/nodetypes b/bin/sh/nodetypes index 496ffba05924..0d0d657d67e8 100644 --- a/bin/sh/nodetypes +++ b/bin/sh/nodetypes @@ -64,7 +64,7 @@ NPIPE npipe # a pipeline backgnd int # set to run pipeline in background cmdlist nodelist # the commands in the pipeline -NREDIR nredir # redirection (of a compex command) +NREDIR nredir # redirection (of a complex command) type int n nodeptr # the command redirect nodeptr # list of file redirections diff --git a/bin/sh/shell.h b/bin/sh/shell.h index c06e737e658f..536efe6ce228 100644 --- a/bin/sh/shell.h +++ b/bin/sh/shell.h @@ -55,7 +55,7 @@ /* #define DEBUG 1 */ /* - * Type of used arithmetics. SUSv3 requires us to have at least signed long. + * Type of used arithmetic. SUSv3 requires us to have at least signed long. */ typedef intmax_t arith_t; #define ARITH_FORMAT_STR "%" PRIdMAX From owner-dev-commits-src-all@freebsd.org Sat Oct 2 16:40:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA1AE67D8F6; Sat, 2 Oct 2021 16:40: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 4HMCQ96GGDz4jQ0; Sat, 2 Oct 2021 16:40:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7D5216985; Sat, 2 Oct 2021 16:40: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 192GeHcS002307; Sat, 2 Oct 2021 16:40:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192GeHlb002301; Sat, 2 Oct 2021 16:40:17 GMT (envelope-from git) Date: Sat, 2 Oct 2021 16:40:17 GMT Message-Id: <202110021640.192GeHlb002301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 28c3c137f64a - main - src/bin/mkdir: Spell occur correctly. 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/main X-Git-Reftype: branch X-Git-Commit: 28c3c137f64a7176d0ca877fb4f35ae17c7c5202 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 16:40:18 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=28c3c137f64a7176d0ca877fb4f35ae17c7c5202 commit 28c3c137f64a7176d0ca877fb4f35ae17c7c5202 Author: Elyes HAOUAS AuthorDate: 2021-10-02 16:34:45 +0000 Commit: Warner Losh CommitDate: 2021-10-02 16:39:31 +0000 src/bin/mkdir: Spell occur correctly. Pull Request: https://github.com/freebsd/freebsd-src/pull/544 Signed-off-by: Elyes HAOUAS --- bin/mkdir/mkdir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mkdir/mkdir.c b/bin/mkdir/mkdir.c index 122ec4458858..cc699d3893dc 100644 --- a/bin/mkdir/mkdir.c +++ b/bin/mkdir/mkdir.c @@ -163,7 +163,7 @@ build(char *path, mode_t omode) * POSIX 1003.2: * For each dir operand that does not name an existing * directory, effects equivalent to those caused by the - * following command shall occcur: + * following command shall occur: * * mkdir -p -m $(umask -S),u+wx $(dirname dir) && * mkdir [-m mode] dir From owner-dev-commits-src-all@freebsd.org Sat Oct 2 16:40:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57EC167E511; Sat, 2 Oct 2021 16:40: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 4HMCQD0cgPz4jXk; Sat, 2 Oct 2021 16:40:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6B1216888; Sat, 2 Oct 2021 16:40: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 192GeJoZ003362; Sat, 2 Oct 2021 16:40:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192GeJTs003356; Sat, 2 Oct 2021 16:40:19 GMT (envelope-from git) Date: Sat, 2 Oct 2021 16:40:19 GMT Message-Id: <202110021640.192GeJTs003356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 3fe686f25a0d - main - src/bin/ps: Fix spelling error 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/main X-Git-Reftype: branch X-Git-Commit: 3fe686f25a0d0844dc3afd0b3b067ec46abdbc99 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 16:40:20 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3fe686f25a0d0844dc3afd0b3b067ec46abdbc99 commit 3fe686f25a0d0844dc3afd0b3b067ec46abdbc99 Author: Elyes HAOUAS AuthorDate: 2021-10-02 16:37:32 +0000 Commit: Warner Losh CommitDate: 2021-10-02 16:39:37 +0000 src/bin/ps: Fix spelling error Spell interruptible correctly. Pull Request: https://github.com/freebsd/freebsd-src/pull/544 Signed-off-by: Elyes HAOUAS --- bin/ps/print.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ps/print.c b/bin/ps/print.c index 2b61c6b0a15a..d4dbd9624011 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -236,7 +236,7 @@ state(KINFO *k, VARENT *ve __unused) break; case SSLEEP: - if (tdflags & TDF_SINTR) /* interruptable (long) */ + if (tdflags & TDF_SINTR) /* interruptible (long) */ *cp = k->ki_p->ki_slptime >= MAXSLP ? 'I' : 'S'; else *cp = 'D'; From owner-dev-commits-src-all@freebsd.org Sat Oct 2 16:40:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4626067DF50; Sat, 2 Oct 2021 16:40: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 4HMCQC1M3Gz4jQ4; Sat, 2 Oct 2021 16:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D100A16887; Sat, 2 Oct 2021 16:40: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 192GeIb7002841; Sat, 2 Oct 2021 16:40:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192GeIXJ002838; Sat, 2 Oct 2021 16:40:18 GMT (envelope-from git) Date: Sat, 2 Oct 2021 16:40:18 GMT Message-Id: <202110021640.192GeIXJ002838@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 8db446034e3e - main - src/bin/pax: Fix spelling error 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/main X-Git-Reftype: branch X-Git-Commit: 8db446034e3e53969db8b211fb8635dd911d1133 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 16:40:19 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8db446034e3e53969db8b211fb8635dd911d1133 commit 8db446034e3e53969db8b211fb8635dd911d1133 Author: Elyes HAOUAS AuthorDate: 2021-10-02 16:36:09 +0000 Commit: Warner Losh CommitDate: 2021-10-02 16:39:34 +0000 src/bin/pax: Fix spelling error "whats" -> "what's" Pull Request: https://github.com/freebsd/freebsd-src/pull/544 Signed-off-by: Elyes HAOUAS --- bin/pax/buf_subs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c index 153b599193d8..6d50a280f29c 100644 --- a/bin/pax/buf_subs.c +++ b/bin/pax/buf_subs.c @@ -540,7 +540,7 @@ rd_wrbuf(char *in, int cpcnt) } /* - * calculate how much data to copy based on whats left and + * calculate how much data to copy based on what's left and * state of buffer */ cnt = MIN(cnt, incnt); From owner-dev-commits-src-all@freebsd.org Sat Oct 2 16:43:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCC8F67E7AD; Sat, 2 Oct 2021 16:43: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 4HMCVD4xVFz4k9Q; Sat, 2 Oct 2021 16:43:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88FCC16917; Sat, 2 Oct 2021 16:43: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 192GhmlI008697; Sat, 2 Oct 2021 16:43:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192GhmO8008696; Sat, 2 Oct 2021 16:43:48 GMT (envelope-from git) Date: Sat, 2 Oct 2021 16:43:48 GMT Message-Id: <202110021643.192GhmO8008696@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: 0c02dd569c72 - stable/12 - ppbus: Set the lock for pps interface, update to latest api MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0c02dd569c72d9a053199385777ea73b21684a13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 16:43:48 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0c02dd569c72d9a053199385777ea73b21684a13 commit 0c02dd569c72d9a053199385777ea73b21684a13 Author: Warner Losh AuthorDate: 2021-09-01 19:37:27 +0000 Commit: Warner Losh CommitDate: 2021-10-02 16:43:21 +0000 ppbus: Set the lock for pps interface, update to latest api Since we take a lock when we enter the ioctl, we need to set driver_mtx in the pps structure so it can be dropped while sleeping during a call to timepps_fetch() with a non-zero timeout (PPS_CANWAIT feature). MFC After: 5 days Sponsored by: Netflix Reviewed by: ian Differential Revision: https://reviews.freebsd.org/D31763 (cherry picked from commit c62aa65b2a7a6492e712a69c58a35347aa441a98) --- sys/dev/ppbus/ppb_base.c | 8 ++++++++ sys/dev/ppbus/ppbconf.h | 1 + sys/dev/ppbus/pps.c | 8 ++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/dev/ppbus/ppb_base.c b/sys/dev/ppbus/ppb_base.c index 20782385acc0..b399f4cc2d17 100644 --- a/sys/dev/ppbus/ppb_base.c +++ b/sys/dev/ppbus/ppb_base.c @@ -220,6 +220,14 @@ ppb_unlock(device_t bus) mtx_unlock(ppb->ppc_lock); } +struct mtx * +ppb_get_lock(device_t bus) +{ + struct ppb_data *ppb = DEVTOSOFTC(bus); + + return (ppb->ppc_lock); +} + void _ppb_assert_locked(device_t bus, const char *file, int line) { diff --git a/sys/dev/ppbus/ppbconf.h b/sys/dev/ppbus/ppbconf.h index c026bf4574d0..924200672cb9 100644 --- a/sys/dev/ppbus/ppbconf.h +++ b/sys/dev/ppbus/ppbconf.h @@ -261,6 +261,7 @@ extern int ppb_release_bus(device_t, device_t); /* bus related functions */ extern void ppb_lock(device_t); extern void ppb_unlock(device_t); +extern struct mtx *ppb_get_lock(device_t); extern void _ppb_assert_locked(device_t, const char *, int); extern void ppb_init_callout(device_t, struct callout *, int); extern int ppb_sleep(device_t, void *, int, const char *, int); diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index c94d8d4a1ffb..03280a86a3c7 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -141,9 +141,11 @@ ppsattach(device_t dev) UID_ROOT, GID_WHEEL, 0600, PPS_NAME "%d", unit); sc->devs[0] = d; sc->pps[0].ppscap = PPS_CAPTUREASSERT | PPS_ECHOASSERT; + sc->pps[0].driver_abi = PPS_ABI_VERSION; + sc->pps[0].driver_mtx = ppb_get_lock(ppbus); d->si_drv1 = sc; d->si_drv2 = (void*)0; - pps_init(&sc->pps[0]); + pps_init_abi(&sc->pps[0]); ppb_lock(ppbus); if (ppb_request_bus(ppbus, dev, PPB_DONTWAIT)) { @@ -193,9 +195,11 @@ ppsattach(device_t dev) UID_ROOT, GID_WHEEL, 0600, PPS_NAME "%db%d", unit, i - 1); sc->devs[i] = d; sc->pps[i].ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; + sc->pps[i].driver_abi = PPS_ABI_VERSION; + sc->pps[i].driver_mtx = ppb_get_lock(ppbus); d->si_drv1 = sc; d->si_drv2 = (void *)(intptr_t)i; - pps_init(&sc->pps[i]); + pps_init_abi(&sc->pps[i]); } ppb_lock(ppbus); } while (0); From owner-dev-commits-src-all@freebsd.org Sat Oct 2 16:43:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA35667E9DE; Sat, 2 Oct 2021 16:43: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 4HMCVF6B9Zz4k0N; Sat, 2 Oct 2021 16:43:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4CB3169BB; Sat, 2 Oct 2021 16:43: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 192Ghnoq008721; Sat, 2 Oct 2021 16:43:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192GhnWF008720; Sat, 2 Oct 2021 16:43:49 GMT (envelope-from git) Date: Sat, 2 Oct 2021 16:43:49 GMT Message-Id: <202110021643.192GhnWF008720@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: e6145db24402 - stable/12 - cdefs.h: Remove redundant #ifdefs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e6145db24402b9791091fa2cc76e161cbb311699 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 16:43:50 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e6145db24402b9791091fa2cc76e161cbb311699 commit e6145db24402b9791091fa2cc76e161cbb311699 Author: Warner Losh AuthorDate: 2021-09-07 15:34:02 +0000 Commit: Warner Losh CommitDate: 2021-10-02 16:43:21 +0000 cdefs.h: Remove redundant #ifdefs Remove redunant #ifdef __GNUC__ inside an #if defined(__GNUC__) block. They are nops. Sponsored by: Netflix (cherry picked from commit 1e7b5f950b2d54ddb257d008592563c4d753aa54) --- sys/sys/cdefs.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index a5e8abc173bd..edb491d80b86 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -99,16 +99,12 @@ #define __GNUCLIKE_BUILTIN_VAALIST 1 #endif -#if defined(__GNUC__) #define __GNUC_VA_LIST_COMPATIBILITY 1 -#endif /* * Compiler memory barriers, specific to gcc and clang. */ -#if defined(__GNUC__) #define __compiler_membar() __asm __volatile(" " : : : "memory") -#endif #ifndef __INTEL_COMPILER #define __GNUCLIKE_BUILTIN_NEXT_ARG 1 From owner-dev-commits-src-all@freebsd.org Sat Oct 2 16:43:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72BD667E653; Sat, 2 Oct 2021 16:43:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMCVH04wmz4k1m; Sat, 2 Oct 2021 16:43:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D738616A8F; Sat, 2 Oct 2021 16:43: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 192GhoYJ008745; Sat, 2 Oct 2021 16:43:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192Gho8d008744; Sat, 2 Oct 2021 16:43:50 GMT (envelope-from git) Date: Sat, 2 Oct 2021 16:43:50 GMT Message-Id: <202110021643.192Gho8d008744@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: a17cf1bed9d0 - stable/12 - genoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a17cf1bed9d0cd3305f5e2bbd66f1bf1dc23714c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 16:43:51 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a17cf1bed9d0cd3305f5e2bbd66f1bf1dc23714c commit a17cf1bed9d0cd3305f5e2bbd66f1bf1dc23714c Author: Warner Losh AuthorDate: 2021-09-07 16:08:51 +0000 Commit: Warner Losh CommitDate: 2021-10-02 16:43:21 +0000 genoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations Linux fails to build now because the mkdtemp in the bootstrapped environment wants 6 or more X's. Use 10 out of an abundance of caution. Sponsored by: Netflix Reviewed by: arichards Differential Revision: https://reviews.freebsd.org/D31863 (cherry picked from commit ecfbb2e30241ee460617ad4e0c0be16d9930945a) --- sys/kern/genoffset.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/genoffset.sh b/sys/kern/genoffset.sh index f7185e7ae396..aedccfd84c6e 100644 --- a/sys/kern/genoffset.sh +++ b/sys/kern/genoffset.sh @@ -42,7 +42,7 @@ work() echo "#define _OFFSET_INC_" echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" last= - temp=$(mktemp -d genoffset.XXXXX) + temp=$(mktemp -d genoffset.XXXXXXXXXX) trap "rm -rf ${temp}" EXIT # Note: we need to print symbol values in decimal so the numeric sort works ${NM:='nm'} ${NMFLAGS} -t d "$1" | grep __assym_offset__ | sed -e 's/__/ /g' | sort -k 4 -k 1 -n | From owner-dev-commits-src-all@freebsd.org Sat Oct 2 21:14:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 115596AA639; Sat, 2 Oct 2021 21:14: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 4HMKVd6wFmz3FYF; Sat, 2 Oct 2021 21:14:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD3EE1A215; Sat, 2 Oct 2021 21:14: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 192LEXn5067778; Sat, 2 Oct 2021 21:14:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192LEXEo067777; Sat, 2 Oct 2021 21:14:33 GMT (envelope-from git) Date: Sat, 2 Oct 2021 21:14:33 GMT Message-Id: <202110022114.192LEXEo067777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 93a32050abac - main - nfsd: Fix pNFS handling of Deallocate 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/main X-Git-Reftype: branch X-Git-Commit: 93a32050abac11d22d849d9cf2014370662269a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 21:14:34 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=93a32050abac11d22d849d9cf2014370662269a7 commit 93a32050abac11d22d849d9cf2014370662269a7 Author: Rick Macklem AuthorDate: 2021-10-02 21:11:15 +0000 Commit: Rick Macklem CommitDate: 2021-10-02 21:11:15 +0000 nfsd: Fix pNFS handling of Deallocate For a pNFS server configuration, an NFSv4.2 Deallocate operation is proxied to the DS(s). The code that parsed the reply for the proxy RPC is broken and did not process the pre-operation attributes. This patch fixes this problem. This bug would only affect pNFS servers built from recent main/FreeBSD14 sources. --- sys/fs/nfsserver/nfs_nfsdport.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 49cbd2c9de0f..0f678cd5640e 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -5732,8 +5732,14 @@ nfsrv_deallocatedsdorpc(struct nfsmount *nmp, fhandle_t *fhp, off_t off, txdr_hyper(len, tl); tl += 2; NFSD_DEBUG(4, "nfsrv_deallocatedsdorpc: len=%jd\n", (intmax_t)len); + /* Do a Getattr for the attributes that change upon writing. */ + NFSZERO_ATTRBIT(&attrbits); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESS); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFY); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SPACEUSED); *tl = txdr_unsigned(NFSV4OP_GETATTR); - NFSGETATTR_ATTRBIT(&attrbits); nfsrv_putattrbit(nd, &attrbits); error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -5741,8 +5747,23 @@ nfsrv_deallocatedsdorpc(struct nfsmount *nmp, fhandle_t *fhp, off_t off, free(nd, M_TEMP); return (error); } - NFSD_DEBUG(4, "nfsrv_deallocatedsdorpc: aft allocaterpc=%d\n", + NFSD_DEBUG(4, "nfsrv_deallocatedsdorpc: aft deallocaterpc=%d\n", nd->nd_repstat); + /* Get rid of weak cache consistency data for now. */ + if ((nd->nd_flag & (ND_NOMOREDATA | ND_NFSV4 | ND_V4WCCATTR)) == + (ND_NFSV4 | ND_V4WCCATTR)) { + error = nfsv4_loadattr(nd, NULL, nap, NULL, NULL, 0, NULL, NULL, + NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL); + NFSD_DEBUG(4, "nfsrv_deallocatedsdorpc: wcc attr=%d\n", error); + if (error != 0) + goto nfsmout; + /* + * Get rid of Op# and status for next op. + */ + NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); + if (*++tl != 0) + nd->nd_flag |= ND_NOMOREDATA; + } if (nd->nd_repstat == 0) { NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); error = nfsv4_loadattr(nd, NULL, nap, NULL, NULL, 0, NULL, NULL, From owner-dev-commits-src-all@freebsd.org Sat Oct 2 23:17:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79F8B6AC05A; Sat, 2 Oct 2021 23:17: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 4HMNDY30gtz3MlR; Sat, 2 Oct 2021 23:17:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46B671BABE; Sat, 2 Oct 2021 23:17: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 192NHXif028065; Sat, 2 Oct 2021 23:17:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192NHXTV028064; Sat, 2 Oct 2021 23:17:33 GMT (envelope-from git) Date: Sat, 2 Oct 2021 23:17:33 GMT Message-Id: <202110022317.192NHXTV028064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 9acea1640411 - main - ffs: retire unused fsckpid mount option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9acea16404117f2f54475640ff036c12130707d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 23:17:33 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=9acea16404117f2f54475640ff036c12130707d8 commit 9acea16404117f2f54475640ff036c12130707d8 Author: Robert Wing AuthorDate: 2021-10-02 23:11:40 +0000 Commit: Robert Wing CommitDate: 2021-10-02 23:11:40 +0000 ffs: retire unused fsckpid mount option The fsckpid mount option was introduced in 927a12ae16433b50 along with a couple sysctl's to support SU+J with snapshots. However, those sysctl's were never used and eventually removed in f2620e9ceb3ede02. There are no in-tree consumers of this mount option. Reviewed by: mckusick, kib Differential Revision: https://reviews.freebsd.org/D32015 --- sys/ufs/ffs/ffs_alloc.c | 3 +- sys/ufs/ffs/ffs_inode.c | 2 +- sys/ufs/ffs/ffs_vfsops.c | 117 ++--------------------------------------------- sys/ufs/ufs/ufsmount.h | 2 - 4 files changed, 6 insertions(+), 118 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 771377b7cefc..6a262a798d1b 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -3236,8 +3236,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) return (EINVAL); } ump = VFSTOUFS(mp); - if ((mp->mnt_flag & MNT_RDONLY) && - ump->um_fsckpid != td->td_proc->p_pid) { + if (mp->mnt_flag & MNT_RDONLY) { vn_finished_write(mp); fdrop(fp, td); return (EROFS); diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 1159259fb2b6..17a9dceeb654 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -132,7 +132,7 @@ ffs_update(vp, waitfor) if (waitfor) ip->i_flag &= ~(IN_SIZEMOD | IN_IBLKDATA); fs = ITOFS(ip); - if (fs->fs_ronly && ITOUMP(ip)->um_fsckpid == 0) + if (fs->fs_ronly) return (0); /* * If we are updating a snapshot and another process is currently diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index fd3b2689c2ee..94afcae05ba6 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -147,7 +147,7 @@ static struct buf_ops ffs_ops = { */ static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr", "noclusterw", "noexec", "export", "force", "from", "groupquota", - "multilabel", "nfsv4acls", "fsckpid", "snapshot", "nosuid", "suiddir", + "multilabel", "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow", "sync", "union", "userquota", "untrusted", NULL }; static int ffs_enxio_enable = 1; @@ -347,7 +347,6 @@ ffs_mount(struct mount *mp) struct thread *td; struct ufsmount *ump = NULL; struct fs *fs; - pid_t fsckpid = 0; int error, error1, flags; uint64_t mntorflags, saved_mnt_flag; accmode_t accmode; @@ -395,31 +394,6 @@ ffs_mount(struct mount *mp) vfs_deleteopt(mp->mnt_opt, "snapshot"); } - if (vfs_getopt(mp->mnt_optnew, "fsckpid", NULL, NULL) == 0 && - vfs_scanopt(mp->mnt_optnew, "fsckpid", "%d", &fsckpid) == 1) { - /* - * Once we have set the restricted PID, do not - * persist "fsckpid" in the options list. - */ - vfs_deleteopt(mp->mnt_optnew, "fsckpid"); - vfs_deleteopt(mp->mnt_opt, "fsckpid"); - if (mp->mnt_flag & MNT_UPDATE) { - if (VFSTOUFS(mp)->um_fs->fs_ronly == 0 && - vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - vfs_mount_error(mp, - "Checker enable: Must be read-only"); - return (EINVAL); - } - } else if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - vfs_mount_error(mp, - "Checker enable: Must be read-only"); - return (EINVAL); - } - /* Set to -1 if we are done */ - if (fsckpid == 0) - fsckpid = -1; - } - if (vfs_getopt(mp->mnt_optnew, "nfsv4acls", NULL, NULL) == 0) { if (mntorflags & MNT_ACLS) { vfs_mount_error(mp, @@ -443,18 +417,6 @@ ffs_mount(struct mount *mp) fs = ump->um_fs; odevvp = ump->um_odevvp; devvp = ump->um_devvp; - if (fsckpid == -1 && ump->um_fsckpid > 0) { - if ((error = ffs_flushfiles(mp, WRITECLOSE, td)) != 0 || - (error = ffs_sbupdate(ump, MNT_WAIT, 0)) != 0) - return (error); - g_topology_lock(); - /* - * Return to normal read-only mode. - */ - error = g_access(ump->um_cp, 0, -1, 0); - g_topology_unlock(); - ump->um_fsckpid = 0; - } if (fs->fs_ronly == 0 && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { /* @@ -542,14 +504,6 @@ ffs_mount(struct mount *mp) return (error); if (fs->fs_ronly && !vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { - /* - * If we are running a checker, do not allow upgrade. - */ - if (ump->um_fsckpid > 0) { - vfs_mount_error(mp, - "Active checker, cannot upgrade to write"); - return (EINVAL); - } /* * If upgrade to read-write by non-root, then verify * that user has necessary permissions on the device. @@ -659,39 +613,6 @@ ffs_mount(struct mount *mp) mp->mnt_flag |= MNT_NFS4ACLS; MNT_IUNLOCK(mp); } - /* - * If this is a request from fsck to clean up the filesystem, - * then allow the specified pid to proceed. - */ - if (fsckpid > 0) { - if (ump->um_fsckpid != 0) { - vfs_mount_error(mp, - "Active checker already running on %s", - fs->fs_fsmnt); - return (EINVAL); - } - KASSERT(MOUNTEDSOFTDEP(mp) == 0, - ("soft updates enabled on read-only file system")); - g_topology_lock(); - /* - * Request write access. - */ - error = g_access(ump->um_cp, 0, 1, 0); - g_topology_unlock(); - if (error) { - vfs_mount_error(mp, - "Checker activation failed on %s", - fs->fs_fsmnt); - return (error); - } - ump->um_fsckpid = fsckpid; - if (fs->fs_snapinum[0] != 0) - ffs_snapshot_mount(mp); - fs->fs_mtime = time_second; - fs->fs_fmod = 1; - fs->fs_clean = 0; - (void) ffs_sbupdate(ump, MNT_WAIT, 0); - } /* * If this is a snapshot request, take the snapshot. @@ -771,29 +692,6 @@ ffs_mount(struct mount *mp) vrele(devvp); return (error); } - if (fsckpid > 0) { - KASSERT(MOUNTEDSOFTDEP(mp) == 0, - ("soft updates enabled on read-only file system")); - ump = VFSTOUFS(mp); - fs = ump->um_fs; - g_topology_lock(); - /* - * Request write access. - */ - error = g_access(ump->um_cp, 0, 1, 0); - g_topology_unlock(); - if (error) { - printf("WARNING: %s: Checker activation " - "failed\n", fs->fs_fsmnt); - } else { - ump->um_fsckpid = fsckpid; - if (fs->fs_snapinum[0] != 0) - ffs_snapshot_mount(mp); - fs->fs_mtime = time_second; - fs->fs_clean = 0; - (void) ffs_sbupdate(ump, MNT_WAIT, 0); - } - } } MNT_ILOCK(mp); @@ -1510,7 +1408,7 @@ ffs_unmount(mp, mntflags) if (MOUNTEDSOFTDEP(mp)) softdep_unmount(mp); MPASS(ump->um_softdep == NULL); - if (fs->fs_ronly == 0 || ump->um_fsckpid > 0) { + if (fs->fs_ronly == 0) { fs->fs_clean = fs->fs_flags & (FS_UNCLEAN|FS_NEEDSFSCK) ? 0 : 1; error = ffs_sbupdate(ump, MNT_WAIT, 0); if (ffs_fsfail_cleanup(ump, error)) @@ -1530,13 +1428,6 @@ ffs_unmount(mp, mntflags) free (ump->um_trimhash, M_TRIM); } g_topology_lock(); - if (ump->um_fsckpid > 0) { - /* - * Return to normal read-only mode. - */ - error = g_access(ump->um_cp, 0, -1, 0); - ump->um_fsckpid = 0; - } g_vfs_close(ump->um_cp); g_topology_unlock(); BO_LOCK(&ump->um_odevvp->v_bufobj); @@ -1800,7 +1691,7 @@ ffs_sync(mp, waitfor) suspended = 0; td = curthread; fs = ump->um_fs; - if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) + if (fs->fs_fmod != 0 && fs->fs_ronly != 0) panic("%s: ffs_sync: modification on read-only filesystem", fs->fs_fsmnt); if (waitfor == MNT_LAZY) { @@ -2272,7 +2163,7 @@ ffs_sbupdate(ump, waitfor, suspended) fs = ump->um_fs; if (fs->fs_ronly == 1 && (ump->um_mountp->mnt_flag & (MNT_RDONLY | MNT_UPDATE)) != - (MNT_RDONLY | MNT_UPDATE) && ump->um_fsckpid == 0) + (MNT_RDONLY | MNT_UPDATE)) panic("ffs_sbupdate: write read-only filesystem"); /* * We use the superblock's buf to serialize calls to ffs_sbupdate(). diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h index da9a22127125..a1a2cdb3f741 100644 --- a/sys/ufs/ufs/ufsmount.h +++ b/sys/ufs/ufs/ufsmount.h @@ -82,7 +82,6 @@ LIST_HEAD(trimlist_hashhead, ffs_blkfree_trim_params); * i - ufsmount interlock (UFS_LOCK / UFS_UNLOCK) * q - associated quota file is locked * r - ref to parent mount structure is held (vfs_busy / vfs_unbusy) - * u - managed by user process fsck_ufs */ struct ufsmount { struct mount *um_mountp; /* (r) filesystem vfs struct */ @@ -102,7 +101,6 @@ struct ufsmount { struct mtx um_lock; /* (c) Protects ufsmount & fs */ struct sx um_checkpath_lock; /* (c) Protects ufs_checkpath() result */ - pid_t um_fsckpid; /* (u) PID can do fsck sysctl */ struct mount_softdeps *um_softdep; /* (c) softdep mgmt structure */ struct vnode *um_quotas[MAXQUOTAS]; /* (q) pointer to quota files */ struct ucred *um_cred[MAXQUOTAS]; /* (q) quota file access cred */ From owner-dev-commits-src-all@freebsd.org Sun Oct 3 01:08:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 952556AD825; Sun, 3 Oct 2021 01:08: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 4HMQht3VnMz3l4J; Sun, 3 Oct 2021 01:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 581CF1D29E; Sun, 3 Oct 2021 01:08: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 19318kif074028; Sun, 3 Oct 2021 01:08:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19318kxT074027; Sun, 3 Oct 2021 01:08:46 GMT (envelope-from git) Date: Sun, 3 Oct 2021 01:08:46 GMT Message-Id: <202110030108.19318kxT074027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 6df1359e5542 - main - sleepqueue(9): Remove sbinuptime() from sleepq_timeout(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6df1359e5542f69179c142be1ea099d447e273d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 01:08:46 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6df1359e5542f69179c142be1ea099d447e273d1 commit 6df1359e5542f69179c142be1ea099d447e273d1 Author: Alexander Motin AuthorDate: 2021-10-03 00:57:55 +0000 Commit: Alexander Motin CommitDate: 2021-10-03 01:08:41 +0000 sleepqueue(9): Remove sbinuptime() from sleepq_timeout(). Callout c_time is always bigger or equal than the scheduled time. It is also smaller than sbinuptime() and can't change while the callback is running. So we reliably can use it instead of sbinuptime() here. In case there was a race and the callout was rescheduled to the later time, the callback will be called again. According to profiles it saves ~5% of the timer interrupt time even with fast TSC timecounter. MFC after: 1 month --- sys/kern/subr_sleepqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index b146a978a60c..61efb1b9f377 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -1040,7 +1040,8 @@ sleepq_timeout(void *arg) (void *)td, (long)td->td_proc->p_pid, (void *)td->td_name); thread_lock(td); - if (td->td_sleeptimo == 0 || td->td_sleeptimo > sbinuptime()) { + if (td->td_sleeptimo == 0 || + td->td_sleeptimo > td->td_slpcallout.c_time) { /* * The thread does not want a timeout (yet). */ From owner-dev-commits-src-all@freebsd.org Sun Oct 3 01:33:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A1C96ADD42; Sun, 3 Oct 2021 01:33: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 4HMRF43mtFz3mSb; Sun, 3 Oct 2021 01:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 610E31D822; Sun, 3 Oct 2021 01:33: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 1931XCpe013117; Sun, 3 Oct 2021 01:33:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1931XCBs013116; Sun, 3 Oct 2021 01:33:12 GMT (envelope-from git) Date: Sun, 3 Oct 2021 01:33:12 GMT Message-Id: <202110030133.1931XCBs013116@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: 4418b03c6759 - stable/13 - ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc' 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: 4418b03c675939033682722fe65e8ddab39cbc25 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 01:33:12 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4418b03c675939033682722fe65e8ddab39cbc25 commit 4418b03c675939033682722fe65e8ddab39cbc25 Author: Kevin Bowling AuthorDate: 2021-09-25 23:12:23 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:32:01 +0000 ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc' Rename the 'struct adapter' to 'struct ixgbe_softc' to avoid type ambiguity in things like kgdb. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32131 (cherry picked from commit b1d5caf3c7504a1ece0498ec3f7360ac760577f7) --- sys/dev/ixgbe/if_bypass.c | 186 +++---- sys/dev/ixgbe/if_fdir.c | 26 +- sys/dev/ixgbe/if_ix.c | 1263 +++++++++++++++++++++--------------------- sys/dev/ixgbe/if_ixv.c | 602 ++++++++++---------- sys/dev/ixgbe/if_sriov.c | 296 +++++----- sys/dev/ixgbe/ix_txrx.c | 47 +- sys/dev/ixgbe/ixgbe.h | 22 +- sys/dev/ixgbe/ixgbe_bypass.h | 2 +- sys/dev/ixgbe/ixgbe_fdir.h | 2 +- sys/dev/ixgbe/ixgbe_osdep.c | 20 +- sys/dev/ixgbe/ixgbe_sriov.h | 8 +- 11 files changed, 1232 insertions(+), 1242 deletions(-) diff --git a/sys/dev/ixgbe/if_bypass.c b/sys/dev/ixgbe/if_bypass.c index 41669e29d475..7e8848512e05 100644 --- a/sys/dev/ixgbe/if_bypass.c +++ b/sys/dev/ixgbe/if_bypass.c @@ -43,11 +43,11 @@ * over other threads. ************************************************************************/ static void -ixgbe_bypass_mutex_enter(struct adapter *adapter) +ixgbe_bypass_mutex_enter(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.low, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.low, 0, 1) == 0) usec_delay(3000); - while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0) usec_delay(3000); return; } /* ixgbe_bypass_mutex_enter */ @@ -56,11 +56,11 @@ ixgbe_bypass_mutex_enter(struct adapter *adapter) * ixgbe_bypass_mutex_clear ************************************************************************/ static void -ixgbe_bypass_mutex_clear(struct adapter *adapter) +ixgbe_bypass_mutex_clear(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0) usec_delay(6000); - while (atomic_cmpset_int(&adapter->bypass.low, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.low, 1, 0) == 0) usec_delay(6000); return; } /* ixgbe_bypass_mutex_clear */ @@ -71,9 +71,9 @@ ixgbe_bypass_mutex_clear(struct adapter *adapter) * Watchdog entry is allowed to simply grab the high priority ************************************************************************/ static void -ixgbe_bypass_wd_mutex_enter(struct adapter *adapter) +ixgbe_bypass_wd_mutex_enter(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0) usec_delay(3000); return; } /* ixgbe_bypass_wd_mutex_enter */ @@ -82,9 +82,9 @@ ixgbe_bypass_wd_mutex_enter(struct adapter *adapter) * ixgbe_bypass_wd_mutex_clear ************************************************************************/ static void -ixgbe_bypass_wd_mutex_clear(struct adapter *adapter) +ixgbe_bypass_wd_mutex_clear(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0) usec_delay(6000); return; } /* ixgbe_bypass_wd_mutex_clear */ @@ -115,13 +115,13 @@ ixgbe_get_bypass_time(u32 *year, u32 *sec) static int ixgbe_bp_version(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int version = 0; u32 cmd; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; cmd |= (BYPASS_EEPROM_VER_ADD << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M; @@ -131,12 +131,12 @@ ixgbe_bp_version(SYSCTL_HANDLER_ARGS) cmd &= ~BYPASS_WE; if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0)) goto err; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); version &= BYPASS_CTL2_DATA_M; error = sysctl_handle_int(oidp, &version, 0, req); return (error); err: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); return (error); } /* ixgbe_bp_version */ @@ -155,16 +155,16 @@ err: static int ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int state = 0; /* Get the current state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &state); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error != 0) return (error); state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3; @@ -182,7 +182,7 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) default: return (EINVAL); } - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MODE_OFF_M, state) != 0)) goto out; @@ -190,7 +190,7 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MODE_OFF_M, BYPASS_AUTO); out: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_set_state */ @@ -217,15 +217,15 @@ out: static int ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int timeout = 0; /* Get the current value */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3; @@ -246,10 +246,10 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_WDTIMEOUT_M, timeout << BYPASS_WDTIMEOUT_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_timeout */ @@ -260,15 +260,15 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int main_on = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on); main_on = (main_on >> BYPASS_MAIN_ON_SHIFT) & 0x3; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); @@ -288,10 +288,10 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MAIN_ON_M, main_on << BYPASS_MAIN_ON_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_main_on */ @@ -302,14 +302,14 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int main_off = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3; @@ -330,10 +330,10 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MAIN_OFF_M, main_off << BYPASS_MAIN_OFF_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_main_off */ @@ -344,14 +344,14 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int aux_on = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3; @@ -372,10 +372,10 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_AUX_ON_M, aux_on << BYPASS_AUX_ON_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_aux_on */ @@ -386,14 +386,14 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int aux_off = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3; @@ -414,10 +414,10 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_AUX_OFF_M, aux_off << BYPASS_AUX_OFF_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_aux_off */ @@ -433,16 +433,16 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error, tmp; static int timeout = 0; u32 mask, arg; /* Get the current hardware value */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &tmp); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); /* @@ -489,9 +489,9 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) } /* Set the new watchdog */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); return (error); } /* ixgbe_bp_wd_set */ @@ -504,8 +504,8 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; u32 sec, year; int cmd, count = 0, error = 0; int reset_wd = 0; @@ -522,7 +522,7 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) cmd |= (sec & BYPASS_CTL1_TIME_M) | BYPASS_CTL1_VALID; cmd |= BYPASS_CTL1_OFFTRST; - ixgbe_bypass_wd_mutex_enter(adapter); + ixgbe_bypass_wd_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, cmd, &reset_wd); /* Read until it matches what we wrote, or we time out */ @@ -539,7 +539,7 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) } while (!hw->mac.ops.bypass_valid_rd(cmd, reset_wd)); reset_wd = 0; - ixgbe_bypass_wd_mutex_clear(adapter); + ixgbe_bypass_wd_mutex_clear(sc); return (error); } /* ixgbe_bp_wd_reset */ @@ -551,8 +551,8 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_log(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; u32 cmd, base, head; u32 log_off, count = 0; static int status = 0; @@ -565,10 +565,10 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) return (error); /* Keep the log display single-threaded */ - while (atomic_cmpset_int(&adapter->bypass.log, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 0, 1) == 0) usec_delay(3000); - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); /* Find Current head of the log eeprom offset */ cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; @@ -586,7 +586,7 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) if (error) goto unlock_err; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); base = status & BYPASS_CTL2_DATA_M; head = (status & BYPASS_CTL2_HEAD_M) >> BYPASS_CTL2_HEAD_SHIFT; @@ -601,19 +601,19 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) /* Log 5 bytes store in on u32 and a u8 */ for (i = 0; i < 4; i++) { - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rd_eep(hw, log_off + i, &data); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); eeprom[count].logs += data << (8 * i); } - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rd_eep(hw, log_off + i, &eeprom[count].actions); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); @@ -668,7 +668,7 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) time %= (60 * 60); min = time / 60; sec = time % 60; - device_printf(adapter->dev, + device_printf(sc->dev, "UT %02d/%02d %02d:%02d:%02d %8.8s -> %7.7s\n", mon, days, hours, min, sec, event_str[event], action_str[action]); @@ -677,14 +677,14 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M; cmd |= ((eeprom[count].logs & ~BYPASS_LOG_CLEAR_M) >> 24); - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, cmd, &status); /* wait for the write to stick */ msec_delay(100); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); @@ -692,14 +692,14 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) status = 0; /* reset */ /* Another log command can now run */ - while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0) usec_delay(3000); return (error); unlock_err: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); status = 0; /* reset */ - while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0) usec_delay(3000); return (EINVAL); } /* ixgbe_bp_log */ @@ -711,15 +711,15 @@ unlock_err: * only enabled for the first port of a bypass adapter. ************************************************************************/ void -ixgbe_bypass_init(struct adapter *adapter) +ixgbe_bypass_init(struct ixgbe_softc *sc) { - struct ixgbe_hw *hw = &adapter->hw; - device_t dev = adapter->dev; + struct ixgbe_hw *hw = &sc->hw; + device_t dev = sc->dev; struct sysctl_oid *bp_node; struct sysctl_oid_list *bp_list; u32 mask, value, sec, year; - if (!(adapter->feat_cap & IXGBE_FEATURE_BYPASS)) + if (!(sc->feat_cap & IXGBE_FEATURE_BYPASS)) return; /* First set up time for the hardware */ @@ -733,9 +733,9 @@ ixgbe_bypass_init(struct adapter *adapter) | BYPASS_CTL1_VALID | BYPASS_CTL1_OFFTRST; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL1, mask, value); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); /* Now set up the SYSCTL infrastructure */ @@ -748,7 +748,7 @@ ixgbe_bypass_init(struct adapter *adapter) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "bypass_log", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_log, "I", "Bypass Log"); + sc, 0, ixgbe_bp_log, "I", "Bypass Log"); /* All other setting are hung from the 'bypass' node */ bp_node = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), @@ -759,40 +759,40 @@ ixgbe_bypass_init(struct adapter *adapter) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "version", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_version, "I", "Bypass Version"); + sc, 0, ixgbe_bp_version, "I", "Bypass Version"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_set_state, "I", "Bypass State"); + sc, 0, ixgbe_bp_set_state, "I", "Bypass State"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "timeout", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_timeout, "I", "Bypass Timeout"); + sc, 0, ixgbe_bp_timeout, "I", "Bypass Timeout"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "main_on", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_main_on, "I", "Bypass Main On"); + sc, 0, ixgbe_bp_main_on, "I", "Bypass Main On"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "main_off", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_main_off, "I", "Bypass Main Off"); + sc, 0, ixgbe_bp_main_off, "I", "Bypass Main Off"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "aux_on", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On"); + sc, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "aux_off", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off"); + sc, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "wd_set", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog"); + sc, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "wd_reset", CTLTYPE_INT | CTLFLAG_WR | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset"); + sc, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset"); - adapter->feat_en |= IXGBE_FEATURE_BYPASS; + sc->feat_en |= IXGBE_FEATURE_BYPASS; } /* ixgbe_bypass_init */ diff --git a/sys/dev/ixgbe/if_fdir.c b/sys/dev/ixgbe/if_fdir.c index 09a5b70464ae..22b71f2bdf09 100644 --- a/sys/dev/ixgbe/if_fdir.c +++ b/sys/dev/ixgbe/if_fdir.c @@ -37,33 +37,33 @@ #ifdef IXGBE_FDIR void -ixgbe_init_fdir(struct adapter *adapter) +ixgbe_init_fdir(struct ixgbe_softc *sc) { u32 hdrm = 32 << fdir_pballoc; - if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) + if (!(sc->feat_en & IXGBE_FEATURE_FDIR)) return; - adapter->hw.mac.ops.setup_rxpba(&adapter->hw, 0, hdrm, + sc->hw.mac.ops.setup_rxpba(&sc->hw, 0, hdrm, PBA_STRATEGY_EQUAL); - ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc); + ixgbe_init_fdir_signature_82599(&sc->hw, fdir_pballoc); } /* ixgbe_init_fdir */ void ixgbe_reinit_fdir(void *context) { if_ctx_t ctx = context; - struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ifnet *ifp = iflib_get_ifp(ctx); - if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) + if (!(sc->feat_en & IXGBE_FEATURE_FDIR)) return; - if (adapter->fdir_reinit != 1) /* Shouldn't happen */ + if (sc->fdir_reinit != 1) /* Shouldn't happen */ return; - ixgbe_reinit_fdir_tables_82599(&adapter->hw); - adapter->fdir_reinit = 0; + ixgbe_reinit_fdir_tables_82599(&sc->hw); + sc->fdir_reinit = 0; /* re-enable flow director interrupts */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); + IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); /* Restart the interface */ ifp->if_drv_flags |= IFF_DRV_RUNNING; } /* ixgbe_reinit_fdir */ @@ -80,7 +80,7 @@ ixgbe_reinit_fdir(void *context) void ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) { - struct adapter *adapter = txr->adapter; + struct ixgbe_softc *sc = txr->sc; struct ix_queue *que; struct ip *ip; struct tcphdr *th; @@ -134,12 +134,12 @@ ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) common.flex_bytes ^= etype; common.ip ^= ip->ip_src.s_addr ^ ip->ip_dst.s_addr; - que = &adapter->queues[txr->me]; + que = &sc->queues[txr->me]; /* * This assumes the Rx queue and Tx * queue are bound to the same CPU */ - ixgbe_fdir_add_signature_filter_82599(&adapter->hw, + ixgbe_fdir_add_signature_filter_82599(&sc->hw, input, common, que->msix); } /* ixgbe_atr */ diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 42523f82cc01..b3960a129c29 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -109,87 +109,82 @@ static pci_vendor_info_t ixgbe_vendor_info_array[] = PVID_END }; -static void *ixgbe_register(device_t dev); -static int ixgbe_if_attach_pre(if_ctx_t ctx); -static int ixgbe_if_attach_post(if_ctx_t ctx); -static int ixgbe_if_detach(if_ctx_t ctx); -static int ixgbe_if_shutdown(if_ctx_t ctx); -static int ixgbe_if_suspend(if_ctx_t ctx); -static int ixgbe_if_resume(if_ctx_t ctx); - -static void ixgbe_if_stop(if_ctx_t ctx); -void ixgbe_if_enable_intr(if_ctx_t ctx); -static void ixgbe_if_disable_intr(if_ctx_t ctx); -static void ixgbe_link_intr_enable(if_ctx_t ctx); -static int ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t qid); -static void ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr); -static int ixgbe_if_media_change(if_ctx_t ctx); +static void *ixgbe_register(device_t); +static int ixgbe_if_attach_pre(if_ctx_t); +static int ixgbe_if_attach_post(if_ctx_t); +static int ixgbe_if_detach(if_ctx_t); +static int ixgbe_if_shutdown(if_ctx_t); +static int ixgbe_if_suspend(if_ctx_t); +static int ixgbe_if_resume(if_ctx_t); + +static void ixgbe_if_stop(if_ctx_t); +void ixgbe_if_enable_intr(if_ctx_t); +static void ixgbe_if_disable_intr(if_ctx_t); +static void ixgbe_link_intr_enable(if_ctx_t); +static int ixgbe_if_rx_queue_intr_enable(if_ctx_t, uint16_t); +static void ixgbe_if_media_status(if_ctx_t, struct ifmediareq *); +static int ixgbe_if_media_change(if_ctx_t); static int ixgbe_if_msix_intr_assign(if_ctx_t, int); -static int ixgbe_if_mtu_set(if_ctx_t ctx, uint32_t mtu); -static void ixgbe_if_crcstrip_set(if_ctx_t ctx, int onoff, int strip); -static void ixgbe_if_multi_set(if_ctx_t ctx); -static int ixgbe_if_promisc_set(if_ctx_t ctx, int flags); -static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, - uint64_t *paddrs, int nrxqs, int nrxqsets); -static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, - uint64_t *paddrs, int nrxqs, int nrxqsets); -static void ixgbe_if_queues_free(if_ctx_t ctx); -static void ixgbe_if_timer(if_ctx_t ctx, uint16_t); -static void ixgbe_if_update_admin_status(if_ctx_t ctx); -static void ixgbe_if_vlan_register(if_ctx_t ctx, u16 vtag); -static void ixgbe_if_vlan_unregister(if_ctx_t ctx, u16 vtag); -static int ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req); -static bool ixgbe_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event); -int ixgbe_intr(void *arg); +static int ixgbe_if_mtu_set(if_ctx_t, uint32_t); +static void ixgbe_if_crcstrip_set(if_ctx_t, int, int); +static void ixgbe_if_multi_set(if_ctx_t); +static int ixgbe_if_promisc_set(if_ctx_t, int); +static int ixgbe_if_tx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int); +static int ixgbe_if_rx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int); +static void ixgbe_if_queues_free(if_ctx_t); +static void ixgbe_if_timer(if_ctx_t, uint16_t); +static void ixgbe_if_update_admin_status(if_ctx_t); +static void ixgbe_if_vlan_register(if_ctx_t, u16); +static void ixgbe_if_vlan_unregister(if_ctx_t, u16); +static int ixgbe_if_i2c_req(if_ctx_t, struct ifi2creq *); +static bool ixgbe_if_needs_restart(if_ctx_t, enum iflib_restart_event); +int ixgbe_intr(void *); /************************************************************************ * Function prototypes ************************************************************************/ -#if __FreeBSD_version >= 1100036 static uint64_t ixgbe_if_get_counter(if_ctx_t, ift_counter); -#endif -static void ixgbe_enable_queue(struct adapter *adapter, u32 vector); -static void ixgbe_disable_queue(struct adapter *adapter, u32 vector); -static void ixgbe_add_device_sysctls(if_ctx_t ctx); -static int ixgbe_allocate_pci_resources(if_ctx_t ctx); -static int ixgbe_setup_low_power_mode(if_ctx_t ctx); +static void ixgbe_enable_queue(struct ixgbe_softc *, u32); +static void ixgbe_disable_queue(struct ixgbe_softc *, u32); +static void ixgbe_add_device_sysctls(if_ctx_t); +static int ixgbe_allocate_pci_resources(if_ctx_t); +static int ixgbe_setup_low_power_mode(if_ctx_t); -static void ixgbe_config_dmac(struct adapter *adapter); -static void ixgbe_configure_ivars(struct adapter *adapter); -static void ixgbe_set_ivar(struct adapter *adapter, u8 entry, u8 vector, - s8 type); +static void ixgbe_config_dmac(struct ixgbe_softc *); +static void ixgbe_configure_ivars(struct ixgbe_softc *); +static void ixgbe_set_ivar(struct ixgbe_softc *, u8, u8, s8); static u8 *ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); -static bool ixgbe_sfp_probe(if_ctx_t ctx); +static bool ixgbe_sfp_probe(if_ctx_t); -static void ixgbe_free_pci_resources(if_ctx_t ctx); +static void ixgbe_free_pci_resources(if_ctx_t); -static int ixgbe_msix_link(void *arg); -static int ixgbe_msix_que(void *arg); -static void ixgbe_initialize_rss_mapping(struct adapter *adapter); -static void ixgbe_initialize_receive_units(if_ctx_t ctx); -static void ixgbe_initialize_transmit_units(if_ctx_t ctx); +static int ixgbe_msix_link(void *); +static int ixgbe_msix_que(void *); +static void ixgbe_initialize_rss_mapping(struct ixgbe_softc *); +static void ixgbe_initialize_receive_units(if_ctx_t); +static void ixgbe_initialize_transmit_units(if_ctx_t); -static int ixgbe_setup_interface(if_ctx_t ctx); -static void ixgbe_init_device_features(struct adapter *adapter); -static void ixgbe_check_fan_failure(struct adapter *, u32, bool); +static int ixgbe_setup_interface(if_ctx_t); +static void ixgbe_init_device_features(struct ixgbe_softc *); +static void ixgbe_check_fan_failure(struct ixgbe_softc *, u32, bool); static void ixgbe_sbuf_fw_version(struct ixgbe_hw *, struct sbuf *); -static void ixgbe_print_fw_version(if_ctx_t ctx); -static void ixgbe_add_media_types(if_ctx_t ctx); -static void ixgbe_update_stats_counters(struct adapter *adapter); -static void ixgbe_config_link(if_ctx_t ctx); -static void ixgbe_get_slot_info(struct adapter *); -static void ixgbe_check_wol_support(struct adapter *adapter); -static void ixgbe_enable_rx_drop(struct adapter *); -static void ixgbe_disable_rx_drop(struct adapter *); - -static void ixgbe_add_hw_stats(struct adapter *adapter); -static int ixgbe_set_flowcntl(struct adapter *, int); -static int ixgbe_set_advertise(struct adapter *, int); -static int ixgbe_get_advertise(struct adapter *); -static void ixgbe_setup_vlan_hw_support(if_ctx_t ctx); -static void ixgbe_config_gpie(struct adapter *adapter); -static void ixgbe_config_delay_values(struct adapter *adapter); +static void ixgbe_print_fw_version(if_ctx_t); +static void ixgbe_add_media_types(if_ctx_t); +static void ixgbe_update_stats_counters(struct ixgbe_softc *); +static void ixgbe_config_link(if_ctx_t); +static void ixgbe_get_slot_info(struct ixgbe_softc *); +static void ixgbe_check_wol_support(struct ixgbe_softc *); +static void ixgbe_enable_rx_drop(struct ixgbe_softc *); +static void ixgbe_disable_rx_drop(struct ixgbe_softc *); + +static void ixgbe_add_hw_stats(struct ixgbe_softc *); +static int ixgbe_set_flowcntl(struct ixgbe_softc *, int); +static int ixgbe_set_advertise(struct ixgbe_softc *, int); +static int ixgbe_get_advertise(struct ixgbe_softc *); +static void ixgbe_setup_vlan_hw_support(if_ctx_t); +static void ixgbe_config_gpie(struct ixgbe_softc *); +static void ixgbe_config_delay_values(struct ixgbe_softc *); /* Sysctl handlers */ static int ixgbe_sysctl_flowcntl(SYSCTL_HANDLER_ARGS); @@ -237,7 +232,7 @@ static device_method_t ix_methods[] = { }; static driver_t ix_driver = { - "ix", ix_methods, sizeof(struct adapter), + "ix", ix_methods, sizeof(struct ixgbe_softc), }; devclass_t ix_devclass; @@ -293,7 +288,7 @@ static device_method_t ixgbe_if_methods[] = { static SYSCTL_NODE(_hw, OID_AUTO, ix, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "IXGBE driver parameters"); static driver_t ixgbe_if_driver = { - "ixgbe_if", ixgbe_if_methods, sizeof(struct adapter) + "ixgbe_if", ixgbe_if_methods, sizeof(struct ixgbe_softc) }; static int ixgbe_max_interrupt_rate = (4000000 / IXGBE_LOW_LATENCY); @@ -412,33 +407,33 @@ static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int ntxqs, int ntxqsets) { - struct adapter *adapter = iflib_get_softc(ctx); - if_softc_ctx_t scctx = adapter->shared; + struct ixgbe_softc *sc = iflib_get_softc(ctx); + if_softc_ctx_t scctx = sc->shared; struct ix_tx_queue *que; int i, j, error; - MPASS(adapter->num_tx_queues > 0); - MPASS(adapter->num_tx_queues == ntxqsets); + MPASS(sc->num_tx_queues > 0); + MPASS(sc->num_tx_queues == ntxqsets); MPASS(ntxqs == 1); /* Allocate queue structure memory */ - adapter->tx_queues = + sc->tx_queues = (struct ix_tx_queue *)malloc(sizeof(struct ix_tx_queue) * ntxqsets, M_IXGBE, M_NOWAIT | M_ZERO); - if (!adapter->tx_queues) { + if (!sc->tx_queues) { device_printf(iflib_get_dev(ctx), "Unable to allocate TX ring memory\n"); return (ENOMEM); } - for (i = 0, que = adapter->tx_queues; i < ntxqsets; i++, que++) { + for (i = 0, que = sc->tx_queues; i < ntxqsets; i++, que++) { struct tx_ring *txr = &que->txr; /* In case SR-IOV is enabled, align the index properly */ - txr->me = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool, + txr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i); - txr->adapter = que->adapter = adapter; + txr->sc = que->sc = sc; /* Allocate report status array */ txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_IXGBE, M_NOWAIT | M_ZERO); @@ -457,13 +452,13 @@ ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, txr->total_packets = 0; /* Set the rate at which we sample packets */ - if (adapter->feat_en & IXGBE_FEATURE_FDIR) + if (sc->feat_en & IXGBE_FEATURE_FDIR) txr->atr_sample = atr_sample_rate; } device_printf(iflib_get_dev(ctx), "allocated for %d queues\n", - adapter->num_tx_queues); + sc->num_tx_queues); return (0); @@ -480,32 +475,32 @@ static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs, int nrxqsets) { - struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; int i; - MPASS(adapter->num_rx_queues > 0); - MPASS(adapter->num_rx_queues == nrxqsets); + MPASS(sc->num_rx_queues > 0); + MPASS(sc->num_rx_queues == nrxqsets); MPASS(nrxqs == 1); /* Allocate queue structure memory */ - adapter->rx_queues = + sc->rx_queues = (struct ix_rx_queue *)malloc(sizeof(struct ix_rx_queue)*nrxqsets, M_IXGBE, M_NOWAIT | M_ZERO); - if (!adapter->rx_queues) { + if (!sc->rx_queues) { device_printf(iflib_get_dev(ctx), "Unable to allocate TX ring memory\n"); return (ENOMEM); } - for (i = 0, que = adapter->rx_queues; i < nrxqsets; i++, que++) { + for (i = 0, que = sc->rx_queues; i < nrxqsets; i++, que++) { struct rx_ring *rxr = &que->rxr; /* In case SR-IOV is enabled, align the index properly */ - rxr->me = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool, + rxr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i); - rxr->adapter = que->adapter = adapter; + rxr->sc = que->sc = sc; /* get the virtual and physical address of the hw queues */ rxr->tail = IXGBE_RDT(rxr->me); @@ -516,7 +511,7 @@ ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, } device_printf(iflib_get_dev(ctx), "allocated for %d rx queues\n", - adapter->num_rx_queues); + sc->num_rx_queues); return (0); } /* ixgbe_if_rx_queues_alloc */ @@ -527,13 +522,13 @@ ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, static void ixgbe_if_queues_free(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - struct ix_tx_queue *tx_que = adapter->tx_queues; - struct ix_rx_queue *rx_que = adapter->rx_queues; + struct ixgbe_softc *sc = iflib_get_softc(ctx); + struct ix_tx_queue *tx_que = sc->tx_queues; + struct ix_rx_queue *rx_que = sc->rx_queues; int i; if (tx_que != NULL) { - for (i = 0; i < adapter->num_tx_queues; i++, tx_que++) { + for (i = 0; i < sc->num_tx_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; if (txr->tx_rsq == NULL) break; @@ -542,12 +537,12 @@ ixgbe_if_queues_free(if_ctx_t ctx) txr->tx_rsq = NULL; } - free(adapter->tx_queues, M_IXGBE); - adapter->tx_queues = NULL; + free(sc->tx_queues, M_IXGBE); + sc->tx_queues = NULL; } if (rx_que != NULL) { - free(adapter->rx_queues, M_IXGBE); - adapter->rx_queues = NULL; + free(sc->rx_queues, M_IXGBE); + sc->rx_queues = NULL; } } /* ixgbe_if_queues_free */ @@ -555,15 +550,15 @@ ixgbe_if_queues_free(if_ctx_t ctx) * ixgbe_initialize_rss_mapping ************************************************************************/ static void -ixgbe_initialize_rss_mapping(struct adapter *adapter) +ixgbe_initialize_rss_mapping(struct ixgbe_softc *sc) { - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_hw *hw = &sc->hw; u32 reta = 0, mrqc, rss_key[10]; int queue_id, table_size, index_mult; int i, j; u32 rss_hash_config; - if (adapter->feat_en & IXGBE_FEATURE_RSS) { + if (sc->feat_en & IXGBE_FEATURE_RSS) { /* Fetch the configured RSS key */ rss_getkey((uint8_t *)&rss_key); *** 5365 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Oct 3 01:33:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAC636ADFA9; Sun, 3 Oct 2021 01:33:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMRF54nPpz3mW9; Sun, 3 Oct 2021 01:33:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84E6F1D6C0; Sun, 3 Oct 2021 01:33:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1931XDvd013141; Sun, 3 Oct 2021 01:33:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1931XDWZ013140; Sun, 3 Oct 2021 01:33:13 GMT (envelope-from git) Date: Sun, 3 Oct 2021 01:33:13 GMT Message-Id: <202110030133.1931XDWZ013140@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: 456b1d96e8c4 - stable/13 - ixgbe: whitespace cleanup pass 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: 456b1d96e8c45742e37d90d92ab1ddb3a47ee860 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 01:33:13 -0000 The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=456b1d96e8c45742e37d90d92ab1ddb3a47ee860 commit 456b1d96e8c45742e37d90d92ab1ddb3a47ee860 Author: Kevin Bowling AuthorDate: 2021-09-26 18:29:00 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:32:19 +0000 ixgbe: whitespace cleanup pass Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32131 (cherry picked from commit 15d077995bd2c56b7b1742ea2d4e9070ff7e9427) --- sys/dev/ixgbe/if_ix.c | 6 +- sys/dev/ixgbe/if_ixv.c | 6 +- sys/dev/ixgbe/ix_txrx.c | 2 - sys/dev/ixgbe/ixgbe.h | 500 ++++++++++++++++++++++-------------------------- 4 files changed, 230 insertions(+), 284 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index b3960a129c29..43b6a6e78b4c 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -32,7 +32,6 @@ ******************************************************************************/ /*$FreeBSD$*/ - #include "opt_inet.h" #include "opt_inet6.h" #include "opt_rss.h" @@ -49,7 +48,6 @@ ************************************************************************/ char ixgbe_driver_version[] = "4.0.1-k"; - /************************************************************************ * PCI Device ID Table * @@ -405,7 +403,7 @@ static struct if_shared_ctx ixgbe_sctx_init = { ************************************************************************/ static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int ntxqs, int ntxqsets) + int ntxqs, int ntxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; @@ -473,7 +471,7 @@ fail: ************************************************************************/ static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int nrxqs, int nrxqsets) + int nrxqs, int nrxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index f2bae7a14cad..1c01add0347b 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -244,7 +244,7 @@ ixv_register(device_t dev) ************************************************************************/ static int ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int ntxqs, int ntxqsets) + int ntxqs, int ntxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; @@ -303,7 +303,7 @@ ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, ************************************************************************/ static int ixv_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int nrxqs, int nrxqsets) + int nrxqs, int nrxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; @@ -1014,7 +1014,7 @@ ixv_identify_hardware(if_ctx_t ctx) static int ixv_if_msix_intr_assign(if_ctx_t ctx, int msix) { - struct ixgbe_softc *sc = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); device_t dev = iflib_get_dev(ctx); struct ix_rx_queue *rx_que = sc->rx_queues; struct ix_tx_queue *tx_que; diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 983bf86ba820..14e0fce11970 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -32,7 +32,6 @@ ******************************************************************************/ /*$FreeBSD$*/ - #ifndef IXGBE_STANDALONE_BUILD #include "opt_inet.h" #include "opt_inet6.h" @@ -41,7 +40,6 @@ #include "ixgbe.h" - /************************************************************************ * Local Function prototypes ************************************************************************/ diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 4c5e6946567a..8581b01b4a37 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -33,11 +33,9 @@ ******************************************************************************/ /*$FreeBSD$*/ - #ifndef _IXGBE_H_ #define _IXGBE_H_ - #include #include #include @@ -99,10 +97,10 @@ * bytes. Performance tests have show the 2K value to be optimal for top * performance. */ -#define DEFAULT_TXD 2048 -#define PERFORM_TXD 2048 -#define MAX_TXD 4096 -#define MIN_TXD 64 +#define DEFAULT_TXD 2048 +#define PERFORM_TXD 2048 +#define MAX_TXD 4096 +#define MIN_TXD 64 /* * RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the @@ -114,40 +112,40 @@ * against the system mbuf pool limit, you can tune nmbclusters * to adjust for this. */ -#define DEFAULT_RXD 2048 -#define PERFORM_RXD 2048 -#define MAX_RXD 4096 -#define MIN_RXD 64 +#define DEFAULT_RXD 2048 +#define PERFORM_RXD 2048 +#define MAX_RXD 4096 +#define MIN_RXD 64 /* Alignment for rings */ -#define DBA_ALIGN 128 +#define DBA_ALIGN 128 /* * This is the max watchdog interval, ie. the time that can * pass between any two TX clean operations, such only happening * when the TX hardware is functioning. */ -#define IXGBE_WATCHDOG (10 * hz) +#define IXGBE_WATCHDOG (10 * hz) /* * This parameters control when the driver calls the routine to reclaim * transmit descriptors. */ -#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8) -#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32) +#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8) +#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32) /* These defines are used in MTU calculations */ -#define IXGBE_MAX_FRAME_SIZE 9728 -#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN) -#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ - ETHER_VLAN_ENCAP_LEN) -#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR) -#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN) +#define IXGBE_MAX_FRAME_SIZE 9728 +#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN) +#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ + ETHER_VLAN_ENCAP_LEN) +#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR) +#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN) /* Flow control constants */ -#define IXGBE_FC_PAUSE 0xFFFF -#define IXGBE_FC_HI 0x20000 -#define IXGBE_FC_LO 0x10000 +#define IXGBE_FC_PAUSE 0xFFFF +#define IXGBE_FC_HI 0x20000 +#define IXGBE_FC_LO 0x10000 /* * Used for optimizing small rx mbufs. Effort is made to keep the copy @@ -159,82 +157,65 @@ * modern Intel CPUs, results in 40 bytes wasted and a significant drop * in observed efficiency of the optimization, 97.9% -> 81.8%. */ -#if __FreeBSD_version < 1002000 -#define MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr)) -#endif -#define IXGBE_RX_COPY_HDR_PADDED ((((MPKTHSIZE - 1) / 32) + 1) * 32) -#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED) -#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE) +#define IXGBE_MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr)) -/* Keep older OS drivers building... */ -#if !defined(SYSCTL_ADD_UQUAD) -#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD -#endif +#define IXGBE_RX_COPY_HDR_PADDED ((((IXGBE_MPKTHSIZE - 1) / 32) + 1) * 32) +#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED) +#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - IXGBE_MPKTHSIZE) /* Defines for printing debug information */ -#define DEBUG_INIT 0 -#define DEBUG_IOCTL 0 -#define DEBUG_HW 0 - -#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") -#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) -#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) -#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") -#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) -#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) -#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") -#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) -#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) - -#define MAX_NUM_MULTICAST_ADDRESSES 128 -#define IXGBE_82598_SCATTER 100 -#define IXGBE_82599_SCATTER 32 -#define IXGBE_TSO_SIZE 262140 -#define IXGBE_RX_HDR 128 -#define IXGBE_VFTA_SIZE 128 -#define IXGBE_BR_SIZE 4096 -#define IXGBE_QUEUE_MIN_FREE 32 -#define IXGBE_MAX_TX_BUSY 10 -#define IXGBE_QUEUE_HUNG 0x80000000 - -#define IXGBE_EITR_DEFAULT 128 +#define DEBUG_INIT 0 +#define DEBUG_IOCTL 0 +#define DEBUG_HW 0 + +#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") +#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) +#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) +#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") +#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) +#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) +#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") +#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) +#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) + +#define MAX_NUM_MULTICAST_ADDRESSES 128 +#define IXGBE_82598_SCATTER 100 +#define IXGBE_82599_SCATTER 32 +#define IXGBE_TSO_SIZE 262140 +#define IXGBE_RX_HDR 128 +#define IXGBE_VFTA_SIZE 128 +#define IXGBE_BR_SIZE 4096 +#define IXGBE_QUEUE_MIN_FREE 32 +#define IXGBE_MAX_TX_BUSY 10 +#define IXGBE_QUEUE_HUNG 0x80000000 + +#define IXGBE_EITR_DEFAULT 128 /* Supported offload bits in mbuf flag */ -#if __FreeBSD_version >= 1000000 -#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ - CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ - CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) -#elif __FreeBSD_version >= 800000 -#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) -#else -#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP) -#endif +#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ + CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ + CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) #define IXGBE_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | IFCAP_TSO | \ - IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \ - IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \ - IFCAP_VLAN_HWFILTER | IFCAP_WOL) - -/* Backward compatibility items for very old versions */ -#ifndef pci_find_cap -#define pci_find_cap pci_find_extcap -#endif + IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \ + IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \ + IFCAP_VLAN_HWFILTER | IFCAP_WOL) #ifndef DEVMETHOD_END -#define DEVMETHOD_END { NULL, NULL } +#define DEVMETHOD_END { NULL, NULL } #endif /* * Interrupt Moderation parameters */ -#define IXGBE_LOW_LATENCY 128 -#define IXGBE_AVE_LATENCY 400 -#define IXGBE_BULK_LATENCY 1200 +#define IXGBE_LOW_LATENCY 128 +#define IXGBE_AVE_LATENCY 400 +#define IXGBE_BULK_LATENCY 1200 /* Using 1FF (the max value), the interval is ~1.05ms */ -#define IXGBE_LINK_ITR_QUANTA 0x1FF -#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \ - IXGBE_EITR_ITR_INT_MASK) +#define IXGBE_LINK_ITR_QUANTA 0x1FF +#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \ + IXGBE_EITR_ITR_INT_MASK) /************************************************************************ @@ -244,60 +225,60 @@ * which the driver should load. ************************************************************************/ typedef struct _ixgbe_vendor_info_t { - unsigned int vendor_id; - unsigned int device_id; - unsigned int subvendor_id; - unsigned int subdevice_id; - unsigned int index; + unsigned int vendor_id; + unsigned int device_id; + unsigned int subvendor_id; + unsigned int subdevice_id; + unsigned int index; } ixgbe_vendor_info_t; struct ixgbe_bp_data { - u32 low; - u32 high; - u32 log; + u32 low; + u32 high; + u32 log; }; /* */ struct ixgbe_dma_alloc { - bus_addr_t dma_paddr; - caddr_t dma_vaddr; - bus_dma_tag_t dma_tag; - bus_dmamap_t dma_map; - bus_dma_segment_t dma_seg; - bus_size_t dma_size; - int dma_nseg; + bus_addr_t dma_paddr; + caddr_t dma_vaddr; + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + bus_dma_segment_t dma_seg; + bus_size_t dma_size; + int dma_nseg; }; struct ixgbe_mc_addr { - u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS]; - u32 vmdq; + u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS]; + u32 vmdq; }; /* * The transmit ring, one per queue */ struct tx_ring { - struct ixgbe_softc *sc; + struct ixgbe_softc *sc; union ixgbe_adv_tx_desc *tx_base; - uint64_t tx_paddr; - u32 tail; - qidx_t *tx_rsq; - qidx_t tx_rs_cidx; - qidx_t tx_rs_pidx; - qidx_t tx_cidx_processed; - uint8_t me; + uint64_t tx_paddr; + u32 tail; + qidx_t *tx_rsq; + qidx_t tx_rs_cidx; + qidx_t tx_rs_pidx; + qidx_t tx_cidx_processed; + uint8_t me; /* Flow Director */ - u16 atr_sample; - u16 atr_count; + u16 atr_sample; + u16 atr_count; - u32 bytes; /* used for AIM */ - u32 packets; + u32 bytes; /* used for AIM */ + u32 packets; /* Soft Stats */ - u64 tso_tx; - u64 total_packets; + u64 tso_tx; + u64 total_packets; }; @@ -305,29 +286,29 @@ struct tx_ring { * The Receive ring, one per rx queue */ struct rx_ring { - struct ix_rx_queue *que; - struct ixgbe_softc *sc; - u32 me; - u32 tail; + struct ix_rx_queue *que; + struct ixgbe_softc *sc; + u32 me; + u32 tail; union ixgbe_adv_rx_desc *rx_base; - bool hw_rsc; - bool vtag_strip; - uint64_t rx_paddr; - bus_dma_tag_t ptag; + bool hw_rsc; + bool vtag_strip; + uint64_t rx_paddr; + bus_dma_tag_t ptag; - u32 bytes; /* Used for AIM calc */ - u32 packets; + u32 bytes; /* Used for AIM calc */ + u32 packets; /* Soft stats */ - u64 rx_irq; - u64 rx_copies; - u64 rx_packets; - u64 rx_bytes; - u64 rx_discarded; - u64 rsc_num; + u64 rx_irq; + u64 rx_copies; + u64 rx_packets; + u64 rx_bytes; + u64 rx_discarded; + u64 rsc_num; /* Flow Director */ - u64 flm; + u64 flm; }; /* @@ -336,67 +317,67 @@ struct rx_ring { */ struct ix_rx_queue { struct ixgbe_softc *sc; - u32 msix; /* This queue's MSIX vector */ + u32 msix; /* This queue's MSIX vector */ u32 eitr_setting; struct resource *res; void *tag; int busy; struct rx_ring rxr; - struct if_irq que_irq; + struct if_irq que_irq; u64 irqs; }; struct ix_tx_queue { struct ixgbe_softc *sc; - u32 msix; /* This queue's MSIX vector */ + u32 msix; /* This queue's MSIX vector */ struct tx_ring txr; }; -#define IXGBE_MAX_VF_MC 30 /* Max number of multicast entries */ +#define IXGBE_MAX_VF_MC 30 /* Max number of multicast entries */ struct ixgbe_vf { - u_int pool; - u_int rar_index; - u_int maximum_frame_size; - uint32_t flags; - uint8_t ether_addr[ETHER_ADDR_LEN]; - uint16_t mc_hash[IXGBE_MAX_VF_MC]; - uint16_t num_mc_hashes; - uint16_t default_vlan; - uint16_t vlan_tag; - uint16_t api_ver; + u_int pool; + u_int rar_index; + u_int maximum_frame_size; + uint32_t flags; + uint8_t ether_addr[ETHER_ADDR_LEN]; + uint16_t mc_hash[IXGBE_MAX_VF_MC]; + uint16_t num_mc_hashes; + uint16_t default_vlan; + uint16_t vlan_tag; + uint16_t api_ver; }; /* Our softc structure */ struct ixgbe_softc { - struct ixgbe_hw hw; - struct ixgbe_osdep osdep; - if_ctx_t ctx; - if_softc_ctx_t shared; -#define num_tx_queues shared->isc_ntxqsets -#define num_rx_queues shared->isc_nrxqsets -#define max_frame_size shared->isc_max_frame_size -#define intr_type shared->isc_intr + struct ixgbe_hw hw; + struct ixgbe_osdep osdep; + if_ctx_t ctx; + if_softc_ctx_t shared; +#define num_tx_queues shared->isc_ntxqsets +#define num_rx_queues shared->isc_nrxqsets +#define max_frame_size shared->isc_max_frame_size +#define intr_type shared->isc_intr - device_t dev; - struct ifnet *ifp; + device_t dev; + struct ifnet *ifp; - struct resource *pci_mem; + struct resource *pci_mem; /* * Interrupt resources: this set is * either used for legacy, or for Link * when doing MSI-X */ - struct if_irq irq; - void *tag; - struct resource *res; + struct if_irq irq; + void *tag; + struct resource *res; - struct ifmedia *media; - int if_flags; - int msix; + struct ifmedia *media; + int if_flags; + int msix; - u16 num_vlans; + u16 num_vlans; /* * Shadow VFTA table, this is needed because @@ -404,31 +385,31 @@ struct ixgbe_softc { * a soft reset and the driver needs to be able * to repopulate it. */ - u32 shadow_vfta[IXGBE_VFTA_SIZE]; + u32 shadow_vfta[IXGBE_VFTA_SIZE]; /* Info about the interface */ - int advertise; /* link speeds */ - int enable_aim; /* adaptive interrupt moderation */ - bool link_active; - u16 num_segs; - u32 link_speed; - bool link_up; - u32 vector; - u16 dmac; - u32 phy_layer; + int advertise; /* link speeds */ + int enable_aim; /* adaptive interrupt moderation */ + bool link_active; + u16 num_segs; + u32 link_speed; + bool link_up; + u32 vector; + u16 dmac; + u32 phy_layer; /* Power management-related */ - bool wol_support; - u32 wufc; + bool wol_support; + u32 wufc; /* Mbuf cluster size */ - u32 rx_mbuf_sz; + u32 rx_mbuf_sz; /* Support for pluggable optics */ - bool sfp_probe; + bool sfp_probe; /* Flow Director */ - int fdir_reinit; + int fdir_reinit; u32 task_requests; @@ -442,125 +423,94 @@ struct ixgbe_softc { struct ix_rx_queue *rx_queues; /* Multicast array memory */ - struct ixgbe_mc_addr *mta; + struct ixgbe_mc_addr *mta; /* SR-IOV */ - int iov_mode; - int num_vfs; - int pool; - struct ixgbe_vf *vfs; + int iov_mode; + int num_vfs; + int pool; + struct ixgbe_vf *vfs; /* Bypass */ - struct ixgbe_bp_data bypass; + struct ixgbe_bp_data bypass; /* Misc stats maintained by the driver */ - unsigned long dropped_pkts; - unsigned long mbuf_header_failed; - unsigned long mbuf_packet_failed; - unsigned long watchdog_events; - unsigned long link_irq; + unsigned long dropped_pkts; + unsigned long mbuf_header_failed; + unsigned long mbuf_packet_failed; + unsigned long watchdog_events; + unsigned long link_irq; union { struct ixgbe_hw_stats pf; struct ixgbevf_hw_stats vf; } stats; -#if __FreeBSD_version >= 1100036 + /* counter(9) stats */ - u64 ipackets; - u64 ierrors; - u64 opackets; - u64 oerrors; - u64 ibytes; - u64 obytes; - u64 imcasts; - u64 omcasts; - u64 iqdrops; - u64 noproto; -#endif + u64 ipackets; + u64 ierrors; + u64 opackets; + u64 oerrors; + u64 ibytes; + u64 obytes; + u64 imcasts; + u64 omcasts; + u64 iqdrops; + u64 noproto; + /* Feature capable/enabled flags. See ixgbe_features.h */ - u32 feat_cap; - u32 feat_en; + u32 feat_cap; + u32 feat_en; }; /* Precision Time Sync (IEEE 1588) defines */ -#define ETHERTYPE_IEEE1588 0x88F7 -#define PICOSECS_PER_TICK 20833 -#define TSYNC_UDP_PORT 319 /* UDP port for the protocol */ -#define IXGBE_ADVTXD_TSTAMP 0x00080000 - -/* For backward compatibility */ -#if !defined(PCIER_LINK_STA) -#define PCIER_LINK_STA PCIR_EXPRESS_LINK_STA -#endif +#define ETHERTYPE_IEEE1588 0x88F7 +#define PICOSECS_PER_TICK 20833 +#define TSYNC_UDP_PORT 319 /* UDP port for the protocol */ +#define IXGBE_ADVTXD_TSTAMP 0x00080000 /* Stats macros */ -#if __FreeBSD_version >= 1100036 -#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count) -#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count) -#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count) -#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count) +#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count) +#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count) +#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count) +#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count) #define IXGBE_SET_COLLISIONS(sc, count) -#define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count) -#define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count) -#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count) -#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count) -#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count) -#else -#define IXGBE_SET_IPACKETS(sc, count) (sc)->ifp->if_ipackets = (count) -#define IXGBE_SET_IERRORS(sc, count) (sc)->ifp->if_ierrors = (count) -#define IXGBE_SET_OPACKETS(sc, count) (sc)->ifp->if_opackets = (count) -#define IXGBE_SET_OERRORS(sc, count) (sc)->ifp->if_oerrors = (count) -#define IXGBE_SET_COLLISIONS(sc, count) (sc)->ifp->if_collisions = (count) -#define IXGBE_SET_IBYTES(sc, count) (sc)->ifp->if_ibytes = (count) -#define IXGBE_SET_OBYTES(sc, count) (sc)->ifp->if_obytes = (count) -#define IXGBE_SET_IMCASTS(sc, count) (sc)->ifp->if_imcasts = (count) -#define IXGBE_SET_OMCASTS(sc, count) (sc)->ifp->if_omcasts = (count) -#define IXGBE_SET_IQDROPS(sc, count) (sc)->ifp->if_iqdrops = (count) -#endif +#define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count) +#define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count) +#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count) +#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count) +#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count) /* External PHY register addresses */ -#define IXGBE_PHY_CURRENT_TEMP 0xC820 -#define IXGBE_PHY_OVERTEMP_STATUS 0xC830 +#define IXGBE_PHY_CURRENT_TEMP 0xC820 +#define IXGBE_PHY_OVERTEMP_STATUS 0xC830 /* Sysctl help messages; displayed with sysctl -d */ -#define IXGBE_SYSCTL_DESC_ADV_SPEED \ - "\nControl advertised link speed using these flags:\n" \ - "\t0x1 - advertise 100M\n" \ - "\t0x2 - advertise 1G\n" \ - "\t0x4 - advertise 10G\n" \ - "\t0x8 - advertise 10M\n\n" \ - "\t100M and 10M are only supported on certain adapters.\n" - -#define IXGBE_SYSCTL_DESC_SET_FC \ - "\nSet flow control mode using these values:\n" \ - "\t0 - off\n" \ - "\t1 - rx pause\n" \ - "\t2 - tx pause\n" \ - "\t3 - tx and rx pause" - -#define IXGBE_SYSCTL_DESC_RX_ERRS \ - "\nSum of the following RX errors counters:\n" \ - " * CRC errors,\n" \ - " * illegal byte error count,\n" \ - " * checksum error count,\n" \ - " * missed packet count,\n" \ - " * length error count,\n" \ - " * undersized packets count,\n" \ - " * fragmented packets count,\n" \ - " * oversized packets count,\n" \ - " * jabber count." - -/* Workaround to make 8.0 buildable */ -#if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504 -static __inline int -drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (1); -#endif - return (!buf_ring_empty(br)); -} -#endif +#define IXGBE_SYSCTL_DESC_ADV_SPEED \ + "\nControl advertised link speed using these flags:\n" \ + "\t0x1 - advertise 100M\n" \ + "\t0x2 - advertise 1G\n" \ + "\t0x4 - advertise 10G\n" \ + "\t0x8 - advertise 10M\n\n" \ + "\t100M and 10M are only supported on certain adapters.\n" + +#define IXGBE_SYSCTL_DESC_SET_FC \ + "\nSet flow control mode using these values:\n" \ + "\t0 - off\n" \ + "\t1 - rx pause\n" \ + "\t2 - tx pause\n" \ + "\t3 - tx and rx pause" + +#define IXGBE_SYSCTL_DESC_RX_ERRS \ + "\nSum of the following RX errors counters:\n" \ + " * CRC errors,\n" \ + " * illegal byte error count,\n" \ + " * checksum error count,\n" \ + " * missed packet count,\n" \ + " * length error count,\n" \ + " * undersized packets count,\n" \ + " * fragmented packets count,\n" \ + " * oversized packets count,\n" \ + " * jabber count." /* * This checks for a zero mac addr, something that will be likely From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:04:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9206A6B08AC; Sun, 3 Oct 2021 05:04: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 4HMWwh3cjmz4Qlr; Sun, 3 Oct 2021 05:04:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58A9E1FE5E; Sun, 3 Oct 2021 05:04: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 19354K2W095049; Sun, 3 Oct 2021 05:04:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19354KSE095048; Sun, 3 Oct 2021 05:04:20 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:04:20 GMT Message-Id: <202110030504.19354KSE095048@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: 90e279aecd64 - stable/12 - ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc' 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: 90e279aecd64859bda63828e817df39485ffd9ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:04:20 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=90e279aecd64859bda63828e817df39485ffd9ef commit 90e279aecd64859bda63828e817df39485ffd9ef Author: Kevin Bowling AuthorDate: 2021-09-25 23:12:23 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:49:25 +0000 ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc' Rename the 'struct adapter' to 'struct ixgbe_softc' to avoid type ambiguity in things like kgdb. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32131 (cherry picked from commit b1d5caf3c7504a1ece0498ec3f7360ac760577f7) --- sys/dev/ixgbe/if_bypass.c | 186 +++---- sys/dev/ixgbe/if_fdir.c | 26 +- sys/dev/ixgbe/if_ix.c | 1254 +++++++++++++++++++++--------------------- sys/dev/ixgbe/if_ixv.c | 606 ++++++++++---------- sys/dev/ixgbe/if_sriov.c | 296 +++++----- sys/dev/ixgbe/ix_txrx.c | 47 +- sys/dev/ixgbe/ixgbe.h | 22 +- sys/dev/ixgbe/ixgbe_bypass.h | 2 +- sys/dev/ixgbe/ixgbe_fdir.h | 2 +- sys/dev/ixgbe/ixgbe_osdep.c | 20 +- sys/dev/ixgbe/ixgbe_sriov.h | 8 +- 11 files changed, 1230 insertions(+), 1239 deletions(-) diff --git a/sys/dev/ixgbe/if_bypass.c b/sys/dev/ixgbe/if_bypass.c index c5e640a53371..4169e2fdfd61 100644 --- a/sys/dev/ixgbe/if_bypass.c +++ b/sys/dev/ixgbe/if_bypass.c @@ -43,11 +43,11 @@ * over other threads. ************************************************************************/ static void -ixgbe_bypass_mutex_enter(struct adapter *adapter) +ixgbe_bypass_mutex_enter(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.low, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.low, 0, 1) == 0) usec_delay(3000); - while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0) usec_delay(3000); return; } /* ixgbe_bypass_mutex_enter */ @@ -56,11 +56,11 @@ ixgbe_bypass_mutex_enter(struct adapter *adapter) * ixgbe_bypass_mutex_clear ************************************************************************/ static void -ixgbe_bypass_mutex_clear(struct adapter *adapter) +ixgbe_bypass_mutex_clear(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0) usec_delay(6000); - while (atomic_cmpset_int(&adapter->bypass.low, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.low, 1, 0) == 0) usec_delay(6000); return; } /* ixgbe_bypass_mutex_clear */ @@ -71,9 +71,9 @@ ixgbe_bypass_mutex_clear(struct adapter *adapter) * Watchdog entry is allowed to simply grab the high priority ************************************************************************/ static void -ixgbe_bypass_wd_mutex_enter(struct adapter *adapter) +ixgbe_bypass_wd_mutex_enter(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0) usec_delay(3000); return; } /* ixgbe_bypass_wd_mutex_enter */ @@ -82,9 +82,9 @@ ixgbe_bypass_wd_mutex_enter(struct adapter *adapter) * ixgbe_bypass_wd_mutex_clear ************************************************************************/ static void -ixgbe_bypass_wd_mutex_clear(struct adapter *adapter) +ixgbe_bypass_wd_mutex_clear(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0) usec_delay(6000); return; } /* ixgbe_bypass_wd_mutex_clear */ @@ -115,13 +115,13 @@ ixgbe_get_bypass_time(u32 *year, u32 *sec) static int ixgbe_bp_version(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int version = 0; u32 cmd; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; cmd |= (BYPASS_EEPROM_VER_ADD << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M; @@ -131,12 +131,12 @@ ixgbe_bp_version(SYSCTL_HANDLER_ARGS) cmd &= ~BYPASS_WE; if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0)) goto err; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); version &= BYPASS_CTL2_DATA_M; error = sysctl_handle_int(oidp, &version, 0, req); return (error); err: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); return (error); } /* ixgbe_bp_version */ @@ -155,16 +155,16 @@ err: static int ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int state = 0; /* Get the current state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &state); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error != 0) return (error); state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3; @@ -182,7 +182,7 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) default: return (EINVAL); } - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MODE_OFF_M, state) != 0)) goto out; @@ -190,7 +190,7 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MODE_OFF_M, BYPASS_AUTO); out: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_set_state */ @@ -217,15 +217,15 @@ out: static int ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int timeout = 0; /* Get the current value */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3; @@ -246,10 +246,10 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_WDTIMEOUT_M, timeout << BYPASS_WDTIMEOUT_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_timeout */ @@ -260,15 +260,15 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int main_on = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on); main_on = (main_on >> BYPASS_MAIN_ON_SHIFT) & 0x3; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); @@ -288,10 +288,10 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MAIN_ON_M, main_on << BYPASS_MAIN_ON_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_main_on */ @@ -302,14 +302,14 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int main_off = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3; @@ -330,10 +330,10 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MAIN_OFF_M, main_off << BYPASS_MAIN_OFF_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_main_off */ @@ -344,14 +344,14 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int aux_on = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3; @@ -372,10 +372,10 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_AUX_ON_M, aux_on << BYPASS_AUX_ON_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_aux_on */ @@ -386,14 +386,14 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int aux_off = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3; @@ -414,10 +414,10 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_AUX_OFF_M, aux_off << BYPASS_AUX_OFF_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_aux_off */ @@ -433,16 +433,16 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error, tmp; static int timeout = 0; u32 mask, arg; /* Get the current hardware value */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &tmp); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); /* @@ -489,9 +489,9 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) } /* Set the new watchdog */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); return (error); } /* ixgbe_bp_wd_set */ @@ -504,8 +504,8 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; u32 sec, year; int cmd, count = 0, error = 0; int reset_wd = 0; @@ -522,7 +522,7 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) cmd |= (sec & BYPASS_CTL1_TIME_M) | BYPASS_CTL1_VALID; cmd |= BYPASS_CTL1_OFFTRST; - ixgbe_bypass_wd_mutex_enter(adapter); + ixgbe_bypass_wd_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, cmd, &reset_wd); /* Read until it matches what we wrote, or we time out */ @@ -539,7 +539,7 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) } while (!hw->mac.ops.bypass_valid_rd(cmd, reset_wd)); reset_wd = 0; - ixgbe_bypass_wd_mutex_clear(adapter); + ixgbe_bypass_wd_mutex_clear(sc); return (error); } /* ixgbe_bp_wd_reset */ @@ -551,8 +551,8 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_log(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; u32 cmd, base, head; u32 log_off, count = 0; static int status = 0; @@ -565,10 +565,10 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) return (error); /* Keep the log display single-threaded */ - while (atomic_cmpset_int(&adapter->bypass.log, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 0, 1) == 0) usec_delay(3000); - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); /* Find Current head of the log eeprom offset */ cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; @@ -586,7 +586,7 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) if (error) goto unlock_err; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); base = status & BYPASS_CTL2_DATA_M; head = (status & BYPASS_CTL2_HEAD_M) >> BYPASS_CTL2_HEAD_SHIFT; @@ -601,19 +601,19 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) /* Log 5 bytes store in on u32 and a u8 */ for (i = 0; i < 4; i++) { - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rd_eep(hw, log_off + i, &data); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); eeprom[count].logs += data << (8 * i); } - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rd_eep(hw, log_off + i, &eeprom[count].actions); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); @@ -668,7 +668,7 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) time %= (60 * 60); min = time / 60; sec = time % 60; - device_printf(adapter->dev, + device_printf(sc->dev, "UT %02d/%02d %02d:%02d:%02d %8.8s -> %7.7s\n", mon, days, hours, min, sec, event_str[event], action_str[action]); @@ -677,14 +677,14 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M; cmd |= ((eeprom[count].logs & ~BYPASS_LOG_CLEAR_M) >> 24); - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, cmd, &status); /* wait for the write to stick */ msec_delay(100); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); @@ -692,14 +692,14 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) status = 0; /* reset */ /* Another log command can now run */ - while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0) usec_delay(3000); return (error); unlock_err: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); status = 0; /* reset */ - while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0) usec_delay(3000); return (EINVAL); } /* ixgbe_bp_log */ @@ -711,15 +711,15 @@ unlock_err: * only enabled for the first port of a bypass adapter. ************************************************************************/ void -ixgbe_bypass_init(struct adapter *adapter) +ixgbe_bypass_init(struct ixgbe_softc *sc) { - struct ixgbe_hw *hw = &adapter->hw; - device_t dev = adapter->dev; + struct ixgbe_hw *hw = &sc->hw; + device_t dev = sc->dev; struct sysctl_oid *bp_node; struct sysctl_oid_list *bp_list; u32 mask, value, sec, year; - if (!(adapter->feat_cap & IXGBE_FEATURE_BYPASS)) + if (!(sc->feat_cap & IXGBE_FEATURE_BYPASS)) return; /* First set up time for the hardware */ @@ -733,9 +733,9 @@ ixgbe_bypass_init(struct adapter *adapter) | BYPASS_CTL1_VALID | BYPASS_CTL1_OFFTRST; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL1, mask, value); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); /* Now set up the SYSCTL infrastructure */ @@ -747,7 +747,7 @@ ixgbe_bypass_init(struct adapter *adapter) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "bypass_log", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_bp_log, "I", "Bypass Log"); + sc, 0, ixgbe_bp_log, "I", "Bypass Log"); /* All other setting are hung from the 'bypass' node */ bp_node = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), @@ -758,40 +758,40 @@ ixgbe_bypass_init(struct adapter *adapter) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "version", CTLTYPE_INT | CTLFLAG_RD, - adapter, 0, ixgbe_bp_version, "I", "Bypass Version"); + sc, 0, ixgbe_bp_version, "I", "Bypass Version"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_bp_set_state, "I", "Bypass State"); + sc, 0, ixgbe_bp_set_state, "I", "Bypass State"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "timeout", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_bp_timeout, "I", "Bypass Timeout"); + sc, 0, ixgbe_bp_timeout, "I", "Bypass Timeout"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "main_on", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_bp_main_on, "I", "Bypass Main On"); + sc, 0, ixgbe_bp_main_on, "I", "Bypass Main On"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "main_off", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_bp_main_off, "I", "Bypass Main Off"); + sc, 0, ixgbe_bp_main_off, "I", "Bypass Main Off"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "aux_on", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On"); + sc, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "aux_off", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off"); + sc, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "wd_set", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog"); + sc, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "wd_reset", CTLTYPE_INT | CTLFLAG_WR, - adapter, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset"); + sc, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset"); - adapter->feat_en |= IXGBE_FEATURE_BYPASS; + sc->feat_en |= IXGBE_FEATURE_BYPASS; } /* ixgbe_bypass_init */ diff --git a/sys/dev/ixgbe/if_fdir.c b/sys/dev/ixgbe/if_fdir.c index 09a5b70464ae..22b71f2bdf09 100644 --- a/sys/dev/ixgbe/if_fdir.c +++ b/sys/dev/ixgbe/if_fdir.c @@ -37,33 +37,33 @@ #ifdef IXGBE_FDIR void -ixgbe_init_fdir(struct adapter *adapter) +ixgbe_init_fdir(struct ixgbe_softc *sc) { u32 hdrm = 32 << fdir_pballoc; - if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) + if (!(sc->feat_en & IXGBE_FEATURE_FDIR)) return; - adapter->hw.mac.ops.setup_rxpba(&adapter->hw, 0, hdrm, + sc->hw.mac.ops.setup_rxpba(&sc->hw, 0, hdrm, PBA_STRATEGY_EQUAL); - ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc); + ixgbe_init_fdir_signature_82599(&sc->hw, fdir_pballoc); } /* ixgbe_init_fdir */ void ixgbe_reinit_fdir(void *context) { if_ctx_t ctx = context; - struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ifnet *ifp = iflib_get_ifp(ctx); - if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) + if (!(sc->feat_en & IXGBE_FEATURE_FDIR)) return; - if (adapter->fdir_reinit != 1) /* Shouldn't happen */ + if (sc->fdir_reinit != 1) /* Shouldn't happen */ return; - ixgbe_reinit_fdir_tables_82599(&adapter->hw); - adapter->fdir_reinit = 0; + ixgbe_reinit_fdir_tables_82599(&sc->hw); + sc->fdir_reinit = 0; /* re-enable flow director interrupts */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); + IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); /* Restart the interface */ ifp->if_drv_flags |= IFF_DRV_RUNNING; } /* ixgbe_reinit_fdir */ @@ -80,7 +80,7 @@ ixgbe_reinit_fdir(void *context) void ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) { - struct adapter *adapter = txr->adapter; + struct ixgbe_softc *sc = txr->sc; struct ix_queue *que; struct ip *ip; struct tcphdr *th; @@ -134,12 +134,12 @@ ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) common.flex_bytes ^= etype; common.ip ^= ip->ip_src.s_addr ^ ip->ip_dst.s_addr; - que = &adapter->queues[txr->me]; + que = &sc->queues[txr->me]; /* * This assumes the Rx queue and Tx * queue are bound to the same CPU */ - ixgbe_fdir_add_signature_filter_82599(&adapter->hw, + ixgbe_fdir_add_signature_filter_82599(&sc->hw, input, common, que->msix); } /* ixgbe_atr */ diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 362bb7fe0cbc..d69a8ef80ef6 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -109,87 +109,82 @@ static pci_vendor_info_t ixgbe_vendor_info_array[] = PVID_END }; -static void *ixgbe_register(device_t dev); -static int ixgbe_if_attach_pre(if_ctx_t ctx); -static int ixgbe_if_attach_post(if_ctx_t ctx); -static int ixgbe_if_detach(if_ctx_t ctx); -static int ixgbe_if_shutdown(if_ctx_t ctx); -static int ixgbe_if_suspend(if_ctx_t ctx); -static int ixgbe_if_resume(if_ctx_t ctx); - -static void ixgbe_if_stop(if_ctx_t ctx); -void ixgbe_if_enable_intr(if_ctx_t ctx); -static void ixgbe_if_disable_intr(if_ctx_t ctx); -static void ixgbe_link_intr_enable(if_ctx_t ctx); -static int ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t qid); -static void ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr); -static int ixgbe_if_media_change(if_ctx_t ctx); +static void *ixgbe_register(device_t); +static int ixgbe_if_attach_pre(if_ctx_t); +static int ixgbe_if_attach_post(if_ctx_t); +static int ixgbe_if_detach(if_ctx_t); +static int ixgbe_if_shutdown(if_ctx_t); +static int ixgbe_if_suspend(if_ctx_t); +static int ixgbe_if_resume(if_ctx_t); + +static void ixgbe_if_stop(if_ctx_t); +void ixgbe_if_enable_intr(if_ctx_t); +static void ixgbe_if_disable_intr(if_ctx_t); +static void ixgbe_link_intr_enable(if_ctx_t); +static int ixgbe_if_rx_queue_intr_enable(if_ctx_t, uint16_t); +static void ixgbe_if_media_status(if_ctx_t, struct ifmediareq *); +static int ixgbe_if_media_change(if_ctx_t); static int ixgbe_if_msix_intr_assign(if_ctx_t, int); -static int ixgbe_if_mtu_set(if_ctx_t ctx, uint32_t mtu); -static void ixgbe_if_crcstrip_set(if_ctx_t ctx, int onoff, int strip); -static void ixgbe_if_multi_set(if_ctx_t ctx); -static int ixgbe_if_promisc_set(if_ctx_t ctx, int flags); -static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, - uint64_t *paddrs, int nrxqs, int nrxqsets); -static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, - uint64_t *paddrs, int nrxqs, int nrxqsets); -static void ixgbe_if_queues_free(if_ctx_t ctx); -static void ixgbe_if_timer(if_ctx_t ctx, uint16_t); -static void ixgbe_if_update_admin_status(if_ctx_t ctx); -static void ixgbe_if_vlan_register(if_ctx_t ctx, u16 vtag); -static void ixgbe_if_vlan_unregister(if_ctx_t ctx, u16 vtag); -static int ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req); -static bool ixgbe_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event); -int ixgbe_intr(void *arg); +static int ixgbe_if_mtu_set(if_ctx_t, uint32_t); +static void ixgbe_if_crcstrip_set(if_ctx_t, int, int); +static void ixgbe_if_multi_set(if_ctx_t); +static int ixgbe_if_promisc_set(if_ctx_t, int); +static int ixgbe_if_tx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int); +static int ixgbe_if_rx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int); +static void ixgbe_if_queues_free(if_ctx_t); +static void ixgbe_if_timer(if_ctx_t, uint16_t); +static void ixgbe_if_update_admin_status(if_ctx_t); +static void ixgbe_if_vlan_register(if_ctx_t, u16); +static void ixgbe_if_vlan_unregister(if_ctx_t, u16); +static int ixgbe_if_i2c_req(if_ctx_t, struct ifi2creq *); +static bool ixgbe_if_needs_restart(if_ctx_t, enum iflib_restart_event); +int ixgbe_intr(void *); /************************************************************************ * Function prototypes ************************************************************************/ -#if __FreeBSD_version >= 1100036 static uint64_t ixgbe_if_get_counter(if_ctx_t, ift_counter); -#endif -static void ixgbe_enable_queue(struct adapter *adapter, u32 vector); -static void ixgbe_disable_queue(struct adapter *adapter, u32 vector); -static void ixgbe_add_device_sysctls(if_ctx_t ctx); -static int ixgbe_allocate_pci_resources(if_ctx_t ctx); -static int ixgbe_setup_low_power_mode(if_ctx_t ctx); +static void ixgbe_enable_queue(struct ixgbe_softc *, u32); +static void ixgbe_disable_queue(struct ixgbe_softc *, u32); +static void ixgbe_add_device_sysctls(if_ctx_t); +static int ixgbe_allocate_pci_resources(if_ctx_t); +static int ixgbe_setup_low_power_mode(if_ctx_t); -static void ixgbe_config_dmac(struct adapter *adapter); -static void ixgbe_configure_ivars(struct adapter *adapter); -static void ixgbe_set_ivar(struct adapter *adapter, u8 entry, u8 vector, - s8 type); +static void ixgbe_config_dmac(struct ixgbe_softc *); +static void ixgbe_configure_ivars(struct ixgbe_softc *); +static void ixgbe_set_ivar(struct ixgbe_softc *, u8, u8, s8); static u8 *ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); -static bool ixgbe_sfp_probe(if_ctx_t ctx); +static bool ixgbe_sfp_probe(if_ctx_t); -static void ixgbe_free_pci_resources(if_ctx_t ctx); +static void ixgbe_free_pci_resources(if_ctx_t); -static int ixgbe_msix_link(void *arg); -static int ixgbe_msix_que(void *arg); -static void ixgbe_initialize_rss_mapping(struct adapter *adapter); -static void ixgbe_initialize_receive_units(if_ctx_t ctx); -static void ixgbe_initialize_transmit_units(if_ctx_t ctx); +static int ixgbe_msix_link(void *); +static int ixgbe_msix_que(void *); +static void ixgbe_initialize_rss_mapping(struct ixgbe_softc *); +static void ixgbe_initialize_receive_units(if_ctx_t); +static void ixgbe_initialize_transmit_units(if_ctx_t); -static int ixgbe_setup_interface(if_ctx_t ctx); -static void ixgbe_init_device_features(struct adapter *adapter); -static void ixgbe_check_fan_failure(struct adapter *, u32, bool); +static int ixgbe_setup_interface(if_ctx_t); +static void ixgbe_init_device_features(struct ixgbe_softc *); +static void ixgbe_check_fan_failure(struct ixgbe_softc *, u32, bool); static void ixgbe_sbuf_fw_version(struct ixgbe_hw *, struct sbuf *); -static void ixgbe_print_fw_version(if_ctx_t ctx); -static void ixgbe_add_media_types(if_ctx_t ctx); -static void ixgbe_update_stats_counters(struct adapter *adapter); -static void ixgbe_config_link(if_ctx_t ctx); -static void ixgbe_get_slot_info(struct adapter *); -static void ixgbe_check_wol_support(struct adapter *adapter); -static void ixgbe_enable_rx_drop(struct adapter *); -static void ixgbe_disable_rx_drop(struct adapter *); - -static void ixgbe_add_hw_stats(struct adapter *adapter); -static int ixgbe_set_flowcntl(struct adapter *, int); -static int ixgbe_set_advertise(struct adapter *, int); -static int ixgbe_get_advertise(struct adapter *); -static void ixgbe_setup_vlan_hw_support(if_ctx_t ctx); -static void ixgbe_config_gpie(struct adapter *adapter); -static void ixgbe_config_delay_values(struct adapter *adapter); +static void ixgbe_print_fw_version(if_ctx_t); +static void ixgbe_add_media_types(if_ctx_t); +static void ixgbe_update_stats_counters(struct ixgbe_softc *); +static void ixgbe_config_link(if_ctx_t); +static void ixgbe_get_slot_info(struct ixgbe_softc *); +static void ixgbe_check_wol_support(struct ixgbe_softc *); +static void ixgbe_enable_rx_drop(struct ixgbe_softc *); +static void ixgbe_disable_rx_drop(struct ixgbe_softc *); + +static void ixgbe_add_hw_stats(struct ixgbe_softc *); +static int ixgbe_set_flowcntl(struct ixgbe_softc *, int); +static int ixgbe_set_advertise(struct ixgbe_softc *, int); +static int ixgbe_get_advertise(struct ixgbe_softc *); +static void ixgbe_setup_vlan_hw_support(if_ctx_t); +static void ixgbe_config_gpie(struct ixgbe_softc *); +static void ixgbe_config_delay_values(struct ixgbe_softc *); /* Sysctl handlers */ static int ixgbe_sysctl_flowcntl(SYSCTL_HANDLER_ARGS); @@ -237,7 +232,7 @@ static device_method_t ix_methods[] = { }; static driver_t ix_driver = { - "ix", ix_methods, sizeof(struct adapter), + "ix", ix_methods, sizeof(struct ixgbe_softc), }; devclass_t ix_devclass; @@ -292,7 +287,7 @@ static device_method_t ixgbe_if_methods[] = { static SYSCTL_NODE(_hw, OID_AUTO, ix, CTLFLAG_RD, 0, "IXGBE driver parameters"); static driver_t ixgbe_if_driver = { - "ixgbe_if", ixgbe_if_methods, sizeof(struct adapter) + "ixgbe_if", ixgbe_if_methods, sizeof(struct ixgbe_softc) }; static int ixgbe_max_interrupt_rate = (4000000 / IXGBE_LOW_LATENCY); @@ -403,34 +398,34 @@ static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int ntxqs, int ntxqsets) { - struct adapter *adapter = iflib_get_softc(ctx); - if_softc_ctx_t scctx = adapter->shared; + struct ixgbe_softc *sc = iflib_get_softc(ctx); + if_softc_ctx_t scctx = sc->shared; struct ix_tx_queue *que; int i, j, error; - MPASS(adapter->num_tx_queues > 0); - MPASS(adapter->num_tx_queues == ntxqsets); + MPASS(sc->num_tx_queues > 0); + MPASS(sc->num_tx_queues == ntxqsets); MPASS(ntxqs == 1); /* Allocate queue structure memory */ - adapter->tx_queues = + sc->tx_queues = (struct ix_tx_queue *)malloc(sizeof(struct ix_tx_queue) * ntxqsets, M_IXGBE, M_NOWAIT | M_ZERO); - if (!adapter->tx_queues) { + if (!sc->tx_queues) { device_printf(iflib_get_dev(ctx), "Unable to allocate TX ring memory\n"); return (ENOMEM); } - for (i = 0, que = adapter->tx_queues; i < ntxqsets; i++, que++) { + for (i = 0, que = sc->tx_queues; i < ntxqsets; i++, que++) { struct tx_ring *txr = &que->txr; /* In case SR-IOV is enabled, align the index properly */ - txr->me = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool, + txr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i); - txr->adapter = que->adapter = adapter; - adapter->active_queues |= (u64)1 << txr->me; + txr->sc = que->sc = sc; + sc->active_queues |= (u64)1 << txr->me; /* Allocate report status array */ txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_IXGBE, M_NOWAIT | M_ZERO); @@ -449,13 +444,13 @@ ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, txr->total_packets = 0; /* Set the rate at which we sample packets */ - if (adapter->feat_en & IXGBE_FEATURE_FDIR) + if (sc->feat_en & IXGBE_FEATURE_FDIR) txr->atr_sample = atr_sample_rate; } device_printf(iflib_get_dev(ctx), "allocated for %d queues\n", - adapter->num_tx_queues); + sc->num_tx_queues); return (0); @@ -472,32 +467,32 @@ static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs, int nrxqsets) { - struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; int i; - MPASS(adapter->num_rx_queues > 0); - MPASS(adapter->num_rx_queues == nrxqsets); + MPASS(sc->num_rx_queues > 0); + MPASS(sc->num_rx_queues == nrxqsets); MPASS(nrxqs == 1); /* Allocate queue structure memory */ - adapter->rx_queues = + sc->rx_queues = (struct ix_rx_queue *)malloc(sizeof(struct ix_rx_queue)*nrxqsets, M_IXGBE, M_NOWAIT | M_ZERO); - if (!adapter->rx_queues) { + if (!sc->rx_queues) { device_printf(iflib_get_dev(ctx), "Unable to allocate TX ring memory\n"); return (ENOMEM); } - for (i = 0, que = adapter->rx_queues; i < nrxqsets; i++, que++) { + for (i = 0, que = sc->rx_queues; i < nrxqsets; i++, que++) { struct rx_ring *rxr = &que->rxr; /* In case SR-IOV is enabled, align the index properly */ - rxr->me = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool, + rxr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i); - rxr->adapter = que->adapter = adapter; + rxr->sc = que->sc = sc; /* get the virtual and physical address of the hw queues */ rxr->tail = IXGBE_RDT(rxr->me); @@ -508,7 +503,7 @@ ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, } device_printf(iflib_get_dev(ctx), "allocated for %d rx queues\n", - adapter->num_rx_queues); + sc->num_rx_queues); return (0); } /* ixgbe_if_rx_queues_alloc */ @@ -519,13 +514,13 @@ ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, static void ixgbe_if_queues_free(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - struct ix_tx_queue *tx_que = adapter->tx_queues; - struct ix_rx_queue *rx_que = adapter->rx_queues; + struct ixgbe_softc *sc = iflib_get_softc(ctx); + struct ix_tx_queue *tx_que = sc->tx_queues; + struct ix_rx_queue *rx_que = sc->rx_queues; int i; if (tx_que != NULL) { - for (i = 0; i < adapter->num_tx_queues; i++, tx_que++) { + for (i = 0; i < sc->num_tx_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; if (txr->tx_rsq == NULL) break; @@ -534,12 +529,12 @@ ixgbe_if_queues_free(if_ctx_t ctx) txr->tx_rsq = NULL; } - free(adapter->tx_queues, M_IXGBE); - adapter->tx_queues = NULL; + free(sc->tx_queues, M_IXGBE); + sc->tx_queues = NULL; } if (rx_que != NULL) { - free(adapter->rx_queues, M_IXGBE); - adapter->rx_queues = NULL; + free(sc->rx_queues, M_IXGBE); + sc->rx_queues = NULL; } } /* ixgbe_if_queues_free */ @@ -547,15 +542,15 @@ ixgbe_if_queues_free(if_ctx_t ctx) * ixgbe_initialize_rss_mapping ************************************************************************/ static void -ixgbe_initialize_rss_mapping(struct adapter *adapter) +ixgbe_initialize_rss_mapping(struct ixgbe_softc *sc) { - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_hw *hw = &sc->hw; u32 reta = 0, mrqc, rss_key[10]; int queue_id, table_size, index_mult; int i, j; u32 rss_hash_config; - if (adapter->feat_en & IXGBE_FEATURE_RSS) { + if (sc->feat_en & IXGBE_FEATURE_RSS) { *** 5335 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:04:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBBEB6B090C; Sun, 3 Oct 2021 05:04: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 4HMWwj4WrGz4QxJ; Sun, 3 Oct 2021 05:04:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BD311FE5F; Sun, 3 Oct 2021 05:04: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 19354Lgd095073; Sun, 3 Oct 2021 05:04:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19354LCt095072; Sun, 3 Oct 2021 05:04:21 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:04:21 GMT Message-Id: <202110030504.19354LCt095072@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: cfb3a1dee11c - stable/12 - ixgbe(4): Fix enabling/disabling and reconfiguration of queues 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: cfb3a1dee11c776a6aedd1c8fb3f86f9b7240e9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:04:21 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=cfb3a1dee11c776a6aedd1c8fb3f86f9b7240e9a commit cfb3a1dee11c776a6aedd1c8fb3f86f9b7240e9a Author: Eric Joyner AuthorDate: 2019-07-23 18:14:32 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:53:12 +0000 ixgbe(4): Fix enabling/disabling and reconfiguration of queues - Wrong order of casting and bit shift caused that enabling and disabling queues didn't work properly for queues number larger than 32. Use literals with right suffix instead. - TX ring tail address was not updated during reinitiailzation of TX structures. It could block sending traffic. - Also remove unused variables 'eims' and 'active_queues'. Submitted by: Krzysztof Galazka Reviewed by: erj@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D20826 (cherry picked from commit 2dc2d580354e95491a033fa9e21c8ef0cbd9bc42) --- sys/dev/ixgbe/if_ix.c | 10 +++++----- sys/dev/ixgbe/if_ixv.c | 3 --- sys/dev/ixgbe/ixgbe.h | 2 -- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index d69a8ef80ef6..fa52b58ac1bd 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -425,7 +425,6 @@ ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, i); txr->sc = que->sc = sc; - sc->active_queues |= (u64)1 << txr->me; /* Allocate report status array */ txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_IXGBE, M_NOWAIT | M_ZERO); @@ -796,6 +795,8 @@ ixgbe_initialize_transmit_units(if_ctx_t ctx) IXGBE_WRITE_REG(hw, IXGBE_TDT(j), 0); /* Cache the tail address */ + txr->tail = IXGBE_TDT(txr->me); + txr->tx_rs_cidx = txr->tx_rs_pidx; txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; for (int k = 0; k < scctx->isc_ntxd[0]; k++) @@ -2052,7 +2053,6 @@ ixgbe_if_msix_intr_assign(if_ctx_t ctx, int msix) } rx_que->msix = vector; - sc->active_queues |= (u64)(1 << rx_que->msix); if (sc->feat_en & IXGBE_FEATURE_RSS) { /* * The queue ID is used as the RSS layer bucket ID. @@ -3740,7 +3740,7 @@ ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que = &sc->rx_queues[rxqid]; - ixgbe_enable_queue(sc, que->rxr.me); + ixgbe_enable_queue(sc, que->msix); return (0); } /* ixgbe_if_rx_queue_intr_enable */ @@ -3752,7 +3752,7 @@ static void ixgbe_enable_queue(struct ixgbe_softc *sc, u32 vector) { struct ixgbe_hw *hw = &sc->hw; - u64 queue = (u64)(1 << vector); + u64 queue = 1ULL << vector; u32 mask; if (hw->mac.type == ixgbe_mac_82598EB) { @@ -3775,7 +3775,7 @@ static void ixgbe_disable_queue(struct ixgbe_softc *sc, u32 vector) { struct ixgbe_hw *hw = &sc->hw; - u64 queue = (u64)(1 << vector); + u64 queue = 1ULL << vector; u32 mask; if (hw->mac.type == ixgbe_mac_82598EB) { diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 25654ff60950..3eb7a1f5a1b7 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -271,7 +271,6 @@ ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, txr->me = i; txr->sc = que->sc = sc; - sc->active_queues |= (u64)1 << txr->me; /* Allocate report status array */ if (!(txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_DEVBUF, M_NOWAIT | M_ZERO))) { @@ -1039,8 +1038,6 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix) } rx_que->msix = vector; - sc->active_queues |= (u64)(1 << rx_que->msix); - } for (int i = 0; i < sc->num_tx_queues; i++) { diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 45f5b88fd1f1..00b01f71c996 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -337,7 +337,6 @@ struct rx_ring { struct ix_rx_queue { struct ixgbe_softc *sc; u32 msix; /* This queue's MSIX vector */ - u32 eims; /* This queue's EIMS bit */ u32 eitr_setting; struct resource *res; void *tag; @@ -440,7 +439,6 @@ struct ixgbe_softc { */ struct ix_tx_queue *tx_queues; struct ix_rx_queue *rx_queues; - u64 active_queues; /* Multicast array memory */ struct ixgbe_mc_addr *mta; From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:04:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F74C6B0983; Sun, 3 Oct 2021 05:04: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 4HMWwk5nDLz4QxN; Sun, 3 Oct 2021 05:04:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C7682017F; Sun, 3 Oct 2021 05:04:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19354Mjk095099; Sun, 3 Oct 2021 05:04:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19354Muo095098; Sun, 3 Oct 2021 05:04:22 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:04:22 GMT Message-Id: <202110030504.19354Muo095098@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: 9c0707ed9ff1 - stable/12 - ixgbe(4): Eliminate bogus sizeof() expressions 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: 9c0707ed9ff150718fe8e0215c4c9fe8f4bc7f4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:04:23 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9c0707ed9ff150718fe8e0215c4c9fe8f4bc7f4a commit 9c0707ed9ff150718fe8e0215c4c9fe8f4bc7f4a Author: Conrad Meyer AuthorDate: 2020-01-29 05:31:40 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:54:38 +0000 ixgbe(4): Eliminate bogus sizeof() expressions All of these uses of sizeof() were on the wrong type in relation to the pointer passed to SYSCTL_ADD_PROC as arg1. Fortunately, none of the handlers actually use arg2. So just don't pass a (non-zero) arg2. Reported by: Coverity CID: 1007701 (cherry picked from commit d09fbcd0b6eae765a190eaa4dc931050af7bd25f) --- sys/dev/ixgbe/if_ix.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index fa52b58ac1bd..339f6a32db2f 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -1587,10 +1587,10 @@ ixgbe_add_hw_stats(struct ixgbe_softc *sc) queue_list = SYSCTL_CHILDREN(queue_node); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", - CTLTYPE_UINT | CTLFLAG_RD, txr, sizeof(txr), + CTLTYPE_UINT | CTLFLAG_RD, txr, 0, ixgbe_sysctl_tdh_handler, "IU", "Transmit Descriptor Head"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail", - CTLTYPE_UINT | CTLFLAG_RD, txr, sizeof(txr), + CTLTYPE_UINT | CTLFLAG_RD, txr, 0, ixgbe_sysctl_tdt_handler, "IU", "Transmit Descriptor Tail"); SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "tso_tx", CTLFLAG_RD, &txr->tso_tx, "TSO"); @@ -1607,18 +1607,17 @@ ixgbe_add_hw_stats(struct ixgbe_softc *sc) queue_list = SYSCTL_CHILDREN(queue_node); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "interrupt_rate", - CTLTYPE_UINT | CTLFLAG_RW, &sc->rx_queues[i], - sizeof(&sc->rx_queues[i]), + CTLTYPE_UINT | CTLFLAG_RW, &sc->rx_queues[i], 0, ixgbe_sysctl_interrupt_rate_handler, "IU", "Interrupt Rate"); SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "irqs", CTLFLAG_RD, &(sc->rx_queues[i].irqs), "irqs on this queue"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head", - CTLTYPE_UINT | CTLFLAG_RD, rxr, sizeof(rxr), + CTLTYPE_UINT | CTLFLAG_RD, rxr, 0, ixgbe_sysctl_rdh_handler, "IU", "Receive Descriptor Head"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail", - CTLTYPE_UINT | CTLFLAG_RD, rxr, sizeof(rxr), + CTLTYPE_UINT | CTLFLAG_RD, rxr, 0, ixgbe_sysctl_rdt_handler, "IU", "Receive Descriptor Tail"); SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_packets", CTLFLAG_RD, &rxr->rx_packets, "Queue Packets Received"); From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:04:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A7256B0A0E; Sun, 3 Oct 2021 05:04: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 4HMWwl6Lh7z3wP3; Sun, 3 Oct 2021 05:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA00820491; Sun, 3 Oct 2021 05:04: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 19354ND9095127; Sun, 3 Oct 2021 05:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19354NJ2095125; Sun, 3 Oct 2021 05:04:23 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:04:23 GMT Message-Id: <202110030504.19354NJ2095125@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: 3a13449e4daa - stable/12 - iflib: Make if_shared_ctx_t a pointer to const 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: 3a13449e4daa28fd7be43c91017212818006ed5c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:04:24 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3a13449e4daa28fd7be43c91017212818006ed5c commit 3a13449e4daa28fd7be43c91017212818006ed5c Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:55:49 +0000 iflib: Make if_shared_ctx_t a pointer to const This structure is shared among multiple instances of a driver, so we should ensure that it doesn't somehow get treated as if there's a separate instance per interface. This is especially important for software-only drivers like wg. DEVICE_REGISTER() still returns a void * and so the per-driver sctx structures are not yet defined with the const qualifier. Reviewed by: gallatin, erj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29102 (cherry picked from commit ffe3def903a5f239c319e5fe12450659658974a5) --- sys/dev/bnxt/if_bnxt.c | 4 +--- sys/dev/e1000/if_em.c | 8 ++------ sys/dev/e1000/igb_txrx.c | 2 -- sys/dev/ixgbe/if_ix.c | 4 +--- sys/dev/ixgbe/if_ixv.c | 4 +--- sys/dev/ixgbe/ix_txrx.c | 2 -- sys/dev/ixl/if_iavf.c | 4 +--- sys/dev/ixl/if_ixl.c | 4 +--- sys/net/iflib.h | 2 +- 9 files changed, 8 insertions(+), 26 deletions(-) diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 381c4df49372..9408da32d78a 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -326,8 +326,6 @@ static struct if_shared_ctx bnxt_sctx_init = { .isc_driver_version = bnxt_driver_version, }; -if_shared_ctx_t bnxt_sctx = &bnxt_sctx_init; - /* * Device Methods */ @@ -335,7 +333,7 @@ if_shared_ctx_t bnxt_sctx = &bnxt_sctx_init; static void * bnxt_register(device_t dev) { - return bnxt_sctx; + return (&bnxt_sctx_init); } /* diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index b7c241cddfc7..50628768dc0b 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -572,8 +572,6 @@ static struct if_shared_ctx em_sctx_init = { .isc_ntxd_default = {EM_DEFAULT_TXD}, }; -if_shared_ctx_t em_sctx = &em_sctx_init; - static struct if_shared_ctx igb_sctx_init = { .isc_magic = IFLIB_MAGIC, .isc_q_align = PAGE_SIZE, @@ -601,8 +599,6 @@ static struct if_shared_ctx igb_sctx_init = { .isc_ntxd_default = {EM_DEFAULT_TXD}, }; -if_shared_ctx_t igb_sctx = &igb_sctx_init; - /***************************************************************** * * Dump Registers @@ -725,13 +721,13 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) static void * em_register(device_t dev) { - return (em_sctx); + return (&em_sctx_init); } static void * igb_register(device_t dev) { - return (igb_sctx); + return (&igb_sctx_init); } static int diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index d62b5c5c9668..548ceee8ab46 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -78,8 +78,6 @@ struct if_txrx igb_txrx = { .ift_legacy_intr = em_intr }; -extern if_shared_ctx_t em_sctx; - /********************************************************************** * * Setup work for hardware segmentation offload (TSO) on diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 339f6a32db2f..0728f4144854 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -389,8 +389,6 @@ static struct if_shared_ctx ixgbe_sctx_init = { .isc_ntxd_default = {DEFAULT_TXD}, }; -if_shared_ctx_t ixgbe_sctx = &ixgbe_sctx_init; - /************************************************************************ * ixgbe_if_tx_queues_alloc ************************************************************************/ @@ -852,7 +850,7 @@ ixgbe_initialize_transmit_units(if_ctx_t ctx) static void * ixgbe_register(device_t dev) { - return (ixgbe_sctx); + return (&ixgbe_sctx_init); } /* ixgbe_register */ /************************************************************************ diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 3eb7a1f5a1b7..7aa8ea3a3367 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -233,12 +233,10 @@ static struct if_shared_ctx ixv_sctx_init = { .isc_ntxd_default = {DEFAULT_TXD}, }; -if_shared_ctx_t ixv_sctx = &ixv_sctx_init; - static void * ixv_register(device_t dev) { - return (ixv_sctx); + return (&ixv_sctx_init); } /************************************************************************ diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 09e15ab6b915..983bf86ba820 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -72,8 +72,6 @@ struct if_txrx ixgbe_txrx = { .ift_legacy_intr = NULL }; -extern if_shared_ctx_t ixgbe_sctx; - /************************************************************************ * ixgbe_tx_ctx_setup * diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index 72853a35138a..0cb6f54a8c92 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -272,13 +272,11 @@ static struct if_shared_ctx iavf_sctx_init = { .isc_ntxd_default = {IXL_DEFAULT_RING}, }; -if_shared_ctx_t iavf_sctx = &iavf_sctx_init; - /*** Functions ***/ static void * iavf_register(device_t dev) { - return (iavf_sctx); + return (&iavf_sctx_init); } static int diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 45ac55ec2da8..52a6fc480d24 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -356,13 +356,11 @@ static struct if_shared_ctx ixl_sctx_init = { .isc_ntxd_default = {IXL_DEFAULT_RING}, }; -if_shared_ctx_t ixl_sctx = &ixl_sctx_init; - /*** Functions ***/ static void * ixl_register(device_t dev) { - return (ixl_sctx); + return (&ixl_sctx_init); } static int diff --git a/sys/net/iflib.h b/sys/net/iflib.h index 66cc4a42c315..662da8748c54 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -49,7 +49,7 @@ typedef uint16_t qidx_t; struct iflib_ctx; typedef struct iflib_ctx *if_ctx_t; struct if_shared_ctx; -typedef struct if_shared_ctx *if_shared_ctx_t; +typedef const struct if_shared_ctx *if_shared_ctx_t; struct if_int_delay_info; typedef struct if_int_delay_info *if_int_delay_info_t; struct if_pseudo; From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:04:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DA616B0989; Sun, 3 Oct 2021 05:04: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 4HMWwn0JR1z3wPB; Sun, 3 Oct 2021 05:04:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D68B820397; Sun, 3 Oct 2021 05:04: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 19354OLb095154; Sun, 3 Oct 2021 05:04:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19354OUG095153; Sun, 3 Oct 2021 05:04:24 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:04:24 GMT Message-Id: <202110030504.19354OUG095153@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: 2b81559f4fd6 - stable/12 - ixgbe: whitespace cleanup pass 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: 2b81559f4fd6bb2c6664df8ae8745f85523dfe41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:04:25 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2b81559f4fd6bb2c6664df8ae8745f85523dfe41 commit 2b81559f4fd6bb2c6664df8ae8745f85523dfe41 Author: Kevin Bowling AuthorDate: 2021-09-26 18:29:00 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:57:44 +0000 ixgbe: whitespace cleanup pass Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32131 (cherry picked from commit 15d077995bd2c56b7b1742ea2d4e9070ff7e9427) --- sys/dev/ixgbe/if_ix.c | 6 +- sys/dev/ixgbe/if_ixv.c | 6 +- sys/dev/ixgbe/ix_txrx.c | 2 - sys/dev/ixgbe/ixgbe.h | 498 ++++++++++++++++++++++-------------------------- 4 files changed, 229 insertions(+), 283 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 0728f4144854..0ce1a5441a62 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -32,7 +32,6 @@ ******************************************************************************/ /*$FreeBSD$*/ - #include "opt_inet.h" #include "opt_inet6.h" #include "opt_rss.h" @@ -49,7 +48,6 @@ ************************************************************************/ char ixgbe_driver_version[] = "4.0.1-k"; - /************************************************************************ * PCI Device ID Table * @@ -394,7 +392,7 @@ static struct if_shared_ctx ixgbe_sctx_init = { ************************************************************************/ static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int ntxqs, int ntxqsets) + int ntxqs, int ntxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; @@ -462,7 +460,7 @@ fail: ************************************************************************/ static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int nrxqs, int nrxqsets) + int nrxqs, int nrxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 7aa8ea3a3367..114a41ea8256 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -244,7 +244,7 @@ ixv_register(device_t dev) ************************************************************************/ static int ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int ntxqs, int ntxqsets) + int ntxqs, int ntxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; @@ -303,7 +303,7 @@ ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, ************************************************************************/ static int ixv_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int nrxqs, int nrxqsets) + int nrxqs, int nrxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; @@ -1014,7 +1014,7 @@ ixv_identify_hardware(if_ctx_t ctx) static int ixv_if_msix_intr_assign(if_ctx_t ctx, int msix) { - struct ixgbe_softc *sc = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); device_t dev = iflib_get_dev(ctx); struct ix_rx_queue *rx_que = sc->rx_queues; struct ix_tx_queue *tx_que; diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 983bf86ba820..14e0fce11970 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -32,7 +32,6 @@ ******************************************************************************/ /*$FreeBSD$*/ - #ifndef IXGBE_STANDALONE_BUILD #include "opt_inet.h" #include "opt_inet6.h" @@ -41,7 +40,6 @@ #include "ixgbe.h" - /************************************************************************ * Local Function prototypes ************************************************************************/ diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 00b01f71c996..19e7e615ab8b 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -33,11 +33,9 @@ ******************************************************************************/ /*$FreeBSD$*/ - #ifndef _IXGBE_H_ #define _IXGBE_H_ - #include #include #include @@ -99,10 +97,10 @@ * bytes. Performance tests have show the 2K value to be optimal for top * performance. */ -#define DEFAULT_TXD 2048 -#define PERFORM_TXD 2048 -#define MAX_TXD 4096 -#define MIN_TXD 64 +#define DEFAULT_TXD 2048 +#define PERFORM_TXD 2048 +#define MAX_TXD 4096 +#define MIN_TXD 64 /* * RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the @@ -114,40 +112,40 @@ * against the system mbuf pool limit, you can tune nmbclusters * to adjust for this. */ -#define DEFAULT_RXD 2048 -#define PERFORM_RXD 2048 -#define MAX_RXD 4096 -#define MIN_RXD 64 +#define DEFAULT_RXD 2048 +#define PERFORM_RXD 2048 +#define MAX_RXD 4096 +#define MIN_RXD 64 /* Alignment for rings */ -#define DBA_ALIGN 128 +#define DBA_ALIGN 128 /* * This is the max watchdog interval, ie. the time that can * pass between any two TX clean operations, such only happening * when the TX hardware is functioning. */ -#define IXGBE_WATCHDOG (10 * hz) +#define IXGBE_WATCHDOG (10 * hz) /* * This parameters control when the driver calls the routine to reclaim * transmit descriptors. */ -#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8) -#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32) +#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8) +#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32) /* These defines are used in MTU calculations */ -#define IXGBE_MAX_FRAME_SIZE 9728 -#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN) -#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ - ETHER_VLAN_ENCAP_LEN) -#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR) -#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN) +#define IXGBE_MAX_FRAME_SIZE 9728 +#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN) +#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ + ETHER_VLAN_ENCAP_LEN) +#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR) +#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN) /* Flow control constants */ -#define IXGBE_FC_PAUSE 0xFFFF -#define IXGBE_FC_HI 0x20000 -#define IXGBE_FC_LO 0x10000 +#define IXGBE_FC_PAUSE 0xFFFF +#define IXGBE_FC_HI 0x20000 +#define IXGBE_FC_LO 0x10000 /* * Used for optimizing small rx mbufs. Effort is made to keep the copy @@ -159,82 +157,65 @@ * modern Intel CPUs, results in 40 bytes wasted and a significant drop * in observed efficiency of the optimization, 97.9% -> 81.8%. */ -#if __FreeBSD_version < 1002000 -#define MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr)) -#endif -#define IXGBE_RX_COPY_HDR_PADDED ((((MPKTHSIZE - 1) / 32) + 1) * 32) -#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED) -#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE) +#define IXGBE_MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr)) -/* Keep older OS drivers building... */ -#if !defined(SYSCTL_ADD_UQUAD) -#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD -#endif +#define IXGBE_RX_COPY_HDR_PADDED ((((IXGBE_MPKTHSIZE - 1) / 32) + 1) * 32) +#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED) +#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - IXGBE_MPKTHSIZE) /* Defines for printing debug information */ -#define DEBUG_INIT 0 -#define DEBUG_IOCTL 0 -#define DEBUG_HW 0 - -#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") -#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) -#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) -#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") -#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) -#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) -#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") -#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) -#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) - -#define MAX_NUM_MULTICAST_ADDRESSES 128 -#define IXGBE_82598_SCATTER 100 -#define IXGBE_82599_SCATTER 32 -#define IXGBE_TSO_SIZE 262140 -#define IXGBE_RX_HDR 128 -#define IXGBE_VFTA_SIZE 128 -#define IXGBE_BR_SIZE 4096 -#define IXGBE_QUEUE_MIN_FREE 32 -#define IXGBE_MAX_TX_BUSY 10 -#define IXGBE_QUEUE_HUNG 0x80000000 - -#define IXGBE_EITR_DEFAULT 128 +#define DEBUG_INIT 0 +#define DEBUG_IOCTL 0 +#define DEBUG_HW 0 + +#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") +#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) +#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) +#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") +#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) +#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) +#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") +#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) +#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) + +#define MAX_NUM_MULTICAST_ADDRESSES 128 +#define IXGBE_82598_SCATTER 100 +#define IXGBE_82599_SCATTER 32 +#define IXGBE_TSO_SIZE 262140 +#define IXGBE_RX_HDR 128 +#define IXGBE_VFTA_SIZE 128 +#define IXGBE_BR_SIZE 4096 +#define IXGBE_QUEUE_MIN_FREE 32 +#define IXGBE_MAX_TX_BUSY 10 +#define IXGBE_QUEUE_HUNG 0x80000000 + +#define IXGBE_EITR_DEFAULT 128 /* Supported offload bits in mbuf flag */ -#if __FreeBSD_version >= 1000000 -#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ - CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ - CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) -#elif __FreeBSD_version >= 800000 -#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) -#else -#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP) -#endif +#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ + CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ + CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) #define IXGBE_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | IFCAP_TSO | \ - IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \ - IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \ - IFCAP_VLAN_HWFILTER | IFCAP_WOL) - -/* Backward compatibility items for very old versions */ -#ifndef pci_find_cap -#define pci_find_cap pci_find_extcap -#endif + IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \ + IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \ + IFCAP_VLAN_HWFILTER | IFCAP_WOL) #ifndef DEVMETHOD_END -#define DEVMETHOD_END { NULL, NULL } +#define DEVMETHOD_END { NULL, NULL } #endif /* * Interrupt Moderation parameters */ -#define IXGBE_LOW_LATENCY 128 -#define IXGBE_AVE_LATENCY 400 -#define IXGBE_BULK_LATENCY 1200 +#define IXGBE_LOW_LATENCY 128 +#define IXGBE_AVE_LATENCY 400 +#define IXGBE_BULK_LATENCY 1200 /* Using 1FF (the max value), the interval is ~1.05ms */ -#define IXGBE_LINK_ITR_QUANTA 0x1FF -#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \ - IXGBE_EITR_ITR_INT_MASK) +#define IXGBE_LINK_ITR_QUANTA 0x1FF +#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \ + IXGBE_EITR_ITR_INT_MASK) /************************************************************************ @@ -244,60 +225,60 @@ * which the driver should load. ************************************************************************/ typedef struct _ixgbe_vendor_info_t { - unsigned int vendor_id; - unsigned int device_id; - unsigned int subvendor_id; - unsigned int subdevice_id; - unsigned int index; + unsigned int vendor_id; + unsigned int device_id; + unsigned int subvendor_id; + unsigned int subdevice_id; + unsigned int index; } ixgbe_vendor_info_t; struct ixgbe_bp_data { - u32 low; - u32 high; - u32 log; + u32 low; + u32 high; + u32 log; }; /* */ struct ixgbe_dma_alloc { - bus_addr_t dma_paddr; - caddr_t dma_vaddr; - bus_dma_tag_t dma_tag; - bus_dmamap_t dma_map; - bus_dma_segment_t dma_seg; - bus_size_t dma_size; - int dma_nseg; + bus_addr_t dma_paddr; + caddr_t dma_vaddr; + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + bus_dma_segment_t dma_seg; + bus_size_t dma_size; + int dma_nseg; }; struct ixgbe_mc_addr { - u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS]; - u32 vmdq; + u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS]; + u32 vmdq; }; /* * The transmit ring, one per queue */ struct tx_ring { - struct ixgbe_softc *sc; + struct ixgbe_softc *sc; union ixgbe_adv_tx_desc *tx_base; - uint64_t tx_paddr; - u32 tail; - qidx_t *tx_rsq; - qidx_t tx_rs_cidx; - qidx_t tx_rs_pidx; - qidx_t tx_cidx_processed; - uint8_t me; + uint64_t tx_paddr; + u32 tail; + qidx_t *tx_rsq; + qidx_t tx_rs_cidx; + qidx_t tx_rs_pidx; + qidx_t tx_cidx_processed; + uint8_t me; /* Flow Director */ - u16 atr_sample; - u16 atr_count; + u16 atr_sample; + u16 atr_count; - u32 bytes; /* used for AIM */ - u32 packets; + u32 bytes; /* used for AIM */ + u32 packets; /* Soft Stats */ - u64 tso_tx; - u64 total_packets; + u64 tso_tx; + u64 total_packets; }; @@ -305,29 +286,29 @@ struct tx_ring { * The Receive ring, one per rx queue */ struct rx_ring { - struct ix_rx_queue *que; - struct ixgbe_softc *sc; - u32 me; - u32 tail; + struct ix_rx_queue *que; + struct ixgbe_softc *sc; + u32 me; + u32 tail; union ixgbe_adv_rx_desc *rx_base; - bool hw_rsc; - bool vtag_strip; - uint64_t rx_paddr; - bus_dma_tag_t ptag; + bool hw_rsc; + bool vtag_strip; + uint64_t rx_paddr; + bus_dma_tag_t ptag; - u32 bytes; /* Used for AIM calc */ - u32 packets; + u32 bytes; /* Used for AIM calc */ + u32 packets; /* Soft stats */ - u64 rx_irq; - u64 rx_copies; - u64 rx_packets; - u64 rx_bytes; - u64 rx_discarded; - u64 rsc_num; + u64 rx_irq; + u64 rx_copies; + u64 rx_packets; + u64 rx_bytes; + u64 rx_discarded; + u64 rsc_num; /* Flow Director */ - u64 flm; + u64 flm; }; /* @@ -336,67 +317,67 @@ struct rx_ring { */ struct ix_rx_queue { struct ixgbe_softc *sc; - u32 msix; /* This queue's MSIX vector */ + u32 msix; /* This queue's MSIX vector */ u32 eitr_setting; struct resource *res; void *tag; int busy; struct rx_ring rxr; - struct if_irq que_irq; + struct if_irq que_irq; u64 irqs; }; struct ix_tx_queue { struct ixgbe_softc *sc; - u32 msix; /* This queue's MSIX vector */ + u32 msix; /* This queue's MSIX vector */ struct tx_ring txr; }; -#define IXGBE_MAX_VF_MC 30 /* Max number of multicast entries */ +#define IXGBE_MAX_VF_MC 30 /* Max number of multicast entries */ struct ixgbe_vf { - u_int pool; - u_int rar_index; - u_int maximum_frame_size; - uint32_t flags; - uint8_t ether_addr[ETHER_ADDR_LEN]; - uint16_t mc_hash[IXGBE_MAX_VF_MC]; - uint16_t num_mc_hashes; - uint16_t default_vlan; - uint16_t vlan_tag; - uint16_t api_ver; + u_int pool; + u_int rar_index; + u_int maximum_frame_size; + uint32_t flags; + uint8_t ether_addr[ETHER_ADDR_LEN]; + uint16_t mc_hash[IXGBE_MAX_VF_MC]; + uint16_t num_mc_hashes; + uint16_t default_vlan; + uint16_t vlan_tag; + uint16_t api_ver; }; /* Our softc structure */ struct ixgbe_softc { - struct ixgbe_hw hw; - struct ixgbe_osdep osdep; - if_ctx_t ctx; - if_softc_ctx_t shared; -#define num_tx_queues shared->isc_ntxqsets -#define num_rx_queues shared->isc_nrxqsets -#define max_frame_size shared->isc_max_frame_size -#define intr_type shared->isc_intr + struct ixgbe_hw hw; + struct ixgbe_osdep osdep; + if_ctx_t ctx; + if_softc_ctx_t shared; +#define num_tx_queues shared->isc_ntxqsets +#define num_rx_queues shared->isc_nrxqsets +#define max_frame_size shared->isc_max_frame_size +#define intr_type shared->isc_intr - device_t dev; - struct ifnet *ifp; + device_t dev; + struct ifnet *ifp; - struct resource *pci_mem; + struct resource *pci_mem; /* * Interrupt resources: this set is * either used for legacy, or for Link * when doing MSI-X */ - struct if_irq irq; - void *tag; - struct resource *res; + struct if_irq irq; + void *tag; + struct resource *res; - struct ifmedia *media; - int if_flags; - int msix; + struct ifmedia *media; + int if_flags; + int msix; - u16 num_vlans; + u16 num_vlans; /* * Shadow VFTA table, this is needed because @@ -404,30 +385,30 @@ struct ixgbe_softc { * a soft reset and the driver needs to be able * to repopulate it. */ - u32 shadow_vfta[IXGBE_VFTA_SIZE]; + u32 shadow_vfta[IXGBE_VFTA_SIZE]; /* Info about the interface */ - int advertise; /* link speeds */ - bool link_active; - u16 num_segs; - u32 link_speed; - bool link_up; - u32 vector; - u16 dmac; - u32 phy_layer; + int advertise; /* link speeds */ + bool link_active; + u16 num_segs; + u32 link_speed; + bool link_up; + u32 vector; + u16 dmac; + u32 phy_layer; /* Power management-related */ - bool wol_support; - u32 wufc; + bool wol_support; + u32 wufc; /* Mbuf cluster size */ - u32 rx_mbuf_sz; + u32 rx_mbuf_sz; /* Support for pluggable optics */ - bool sfp_probe; + bool sfp_probe; /* Flow Director */ - int fdir_reinit; + int fdir_reinit; u32 task_requests; @@ -441,125 +422,94 @@ struct ixgbe_softc { struct ix_rx_queue *rx_queues; /* Multicast array memory */ - struct ixgbe_mc_addr *mta; + struct ixgbe_mc_addr *mta; /* SR-IOV */ - int iov_mode; - int num_vfs; - int pool; - struct ixgbe_vf *vfs; + int iov_mode; + int num_vfs; + int pool; + struct ixgbe_vf *vfs; /* Bypass */ - struct ixgbe_bp_data bypass; + struct ixgbe_bp_data bypass; /* Misc stats maintained by the driver */ - unsigned long dropped_pkts; - unsigned long mbuf_header_failed; - unsigned long mbuf_packet_failed; - unsigned long watchdog_events; - unsigned long link_irq; + unsigned long dropped_pkts; + unsigned long mbuf_header_failed; + unsigned long mbuf_packet_failed; + unsigned long watchdog_events; + unsigned long link_irq; union { struct ixgbe_hw_stats pf; struct ixgbevf_hw_stats vf; } stats; -#if __FreeBSD_version >= 1100036 + /* counter(9) stats */ - u64 ipackets; - u64 ierrors; - u64 opackets; - u64 oerrors; - u64 ibytes; - u64 obytes; - u64 imcasts; - u64 omcasts; - u64 iqdrops; - u64 noproto; -#endif + u64 ipackets; + u64 ierrors; + u64 opackets; + u64 oerrors; + u64 ibytes; + u64 obytes; + u64 imcasts; + u64 omcasts; + u64 iqdrops; + u64 noproto; + /* Feature capable/enabled flags. See ixgbe_features.h */ - u32 feat_cap; - u32 feat_en; + u32 feat_cap; + u32 feat_en; }; /* Precision Time Sync (IEEE 1588) defines */ -#define ETHERTYPE_IEEE1588 0x88F7 -#define PICOSECS_PER_TICK 20833 -#define TSYNC_UDP_PORT 319 /* UDP port for the protocol */ -#define IXGBE_ADVTXD_TSTAMP 0x00080000 - -/* For backward compatibility */ -#if !defined(PCIER_LINK_STA) -#define PCIER_LINK_STA PCIR_EXPRESS_LINK_STA -#endif +#define ETHERTYPE_IEEE1588 0x88F7 +#define PICOSECS_PER_TICK 20833 +#define TSYNC_UDP_PORT 319 /* UDP port for the protocol */ +#define IXGBE_ADVTXD_TSTAMP 0x00080000 /* Stats macros */ -#if __FreeBSD_version >= 1100036 -#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count) -#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count) -#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count) -#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count) +#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count) +#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count) +#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count) +#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count) #define IXGBE_SET_COLLISIONS(sc, count) -#define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count) -#define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count) -#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count) -#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count) -#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count) -#else -#define IXGBE_SET_IPACKETS(sc, count) (sc)->ifp->if_ipackets = (count) -#define IXGBE_SET_IERRORS(sc, count) (sc)->ifp->if_ierrors = (count) -#define IXGBE_SET_OPACKETS(sc, count) (sc)->ifp->if_opackets = (count) -#define IXGBE_SET_OERRORS(sc, count) (sc)->ifp->if_oerrors = (count) -#define IXGBE_SET_COLLISIONS(sc, count) (sc)->ifp->if_collisions = (count) -#define IXGBE_SET_IBYTES(sc, count) (sc)->ifp->if_ibytes = (count) -#define IXGBE_SET_OBYTES(sc, count) (sc)->ifp->if_obytes = (count) -#define IXGBE_SET_IMCASTS(sc, count) (sc)->ifp->if_imcasts = (count) -#define IXGBE_SET_OMCASTS(sc, count) (sc)->ifp->if_omcasts = (count) -#define IXGBE_SET_IQDROPS(sc, count) (sc)->ifp->if_iqdrops = (count) -#endif +#define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count) +#define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count) +#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count) +#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count) +#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count) /* External PHY register addresses */ -#define IXGBE_PHY_CURRENT_TEMP 0xC820 -#define IXGBE_PHY_OVERTEMP_STATUS 0xC830 +#define IXGBE_PHY_CURRENT_TEMP 0xC820 +#define IXGBE_PHY_OVERTEMP_STATUS 0xC830 /* Sysctl help messages; displayed with sysctl -d */ -#define IXGBE_SYSCTL_DESC_ADV_SPEED \ - "\nControl advertised link speed using these flags:\n" \ - "\t0x1 - advertise 100M\n" \ - "\t0x2 - advertise 1G\n" \ - "\t0x4 - advertise 10G\n" \ - "\t0x8 - advertise 10M\n\n" \ - "\t100M and 10M are only supported on certain adapters.\n" - -#define IXGBE_SYSCTL_DESC_SET_FC \ - "\nSet flow control mode using these values:\n" \ - "\t0 - off\n" \ - "\t1 - rx pause\n" \ - "\t2 - tx pause\n" \ - "\t3 - tx and rx pause" - -#define IXGBE_SYSCTL_DESC_RX_ERRS \ - "\nSum of the following RX errors counters:\n" \ - " * CRC errors,\n" \ - " * illegal byte error count,\n" \ - " * checksum error count,\n" \ - " * missed packet count,\n" \ - " * length error count,\n" \ - " * undersized packets count,\n" \ - " * fragmented packets count,\n" \ - " * oversized packets count,\n" \ - " * jabber count." - -/* Workaround to make 8.0 buildable */ -#if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504 -static __inline int -drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (1); -#endif - return (!buf_ring_empty(br)); -} -#endif +#define IXGBE_SYSCTL_DESC_ADV_SPEED \ + "\nControl advertised link speed using these flags:\n" \ + "\t0x1 - advertise 100M\n" \ + "\t0x2 - advertise 1G\n" \ + "\t0x4 - advertise 10G\n" \ + "\t0x8 - advertise 10M\n\n" \ + "\t100M and 10M are only supported on certain adapters.\n" + +#define IXGBE_SYSCTL_DESC_SET_FC \ + "\nSet flow control mode using these values:\n" \ + "\t0 - off\n" \ + "\t1 - rx pause\n" \ + "\t2 - tx pause\n" \ + "\t3 - tx and rx pause" + +#define IXGBE_SYSCTL_DESC_RX_ERRS \ + "\nSum of the following RX errors counters:\n" \ + " * CRC errors,\n" \ + " * illegal byte error count,\n" \ + " * checksum error count,\n" \ + " * missed packet count,\n" \ + " * length error count,\n" \ + " * undersized packets count,\n" \ + " * fragmented packets count,\n" \ + " * oversized packets count,\n" \ + " * jabber count." /* * This checks for a zero mac addr, something that will be likely From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:04:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 709146B074E; Sun, 3 Oct 2021 05:04: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 4HMWwp1D6Vz3wXF; Sun, 3 Oct 2021 05:04:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 046FD20609; Sun, 3 Oct 2021 05:04: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 19354PjR095178; Sun, 3 Oct 2021 05:04:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19354PE1095177; Sun, 3 Oct 2021 05:04:25 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:04:25 GMT Message-Id: <202110030504.19354PE1095177@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: 660b6999cc95 - stable/12 - ixgbe: fix impossible condition 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: 660b6999cc95aa56f5981c538234bd3475b3abc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:04:26 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=660b6999cc95aa56f5981c538234bd3475b3abc5 commit 660b6999cc95aa56f5981c538234bd3475b3abc5 Author: Eric van Gyzen AuthorDate: 2020-08-21 19:34:41 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:59:48 +0000 ixgbe: fix impossible condition Coverity flagged this condition: The condition offset == 0 && offset == 65535 can never be true because offset cannot be equal to two different values at the same time. Submitted by: bret_ketchum@dell.com Reported by: Coverity Reviewed by: tsoome, cem MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D26144 (cherry picked from commit ab1c54fec66803235a8923333fa79f2cbfa33354) --- sys/dev/ixgbe/ixgbe_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index d19f82bc3eab..50e18bcba997 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -5154,8 +5154,8 @@ void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw, nvm_ver->oem_valid = false; hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, &offset); - /* Return is offset to OEM Product Version block is invalid */ - if (offset == 0x0 && offset == NVM_INVALID_PTR) + /* Return if offset to OEM Product Version block is invalid */ + if (offset == 0x0 || offset == NVM_INVALID_PTR) return; /* Read product version block */ From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:04:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97BF56B0916; Sun, 3 Oct 2021 05:04: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 4HMWwq3ZMNz4QtJ; Sun, 3 Oct 2021 05:04:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B50220700; Sun, 3 Oct 2021 05:04: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 19354RJM095202; Sun, 3 Oct 2021 05:04:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19354RLa095201; Sun, 3 Oct 2021 05:04:27 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:04:27 GMT Message-Id: <202110030504.19354RLa095201@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: a5a91bd2a09f - stable/12 - iflib: ensure that tx interrupts enabled and cleanups 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: a5a91bd2a09ffe748b6dd7d5f996fe725c22c774 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:04:27 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a5a91bd2a09ffe748b6dd7d5f996fe725c22c774 commit a5a91bd2a09ffe748b6dd7d5f996fe725c22c774 Author: Matt Macy AuthorDate: 2020-12-19 01:08:33 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 02:03:11 +0000 iflib: ensure that tx interrupts enabled and cleanups Doing a 'dd' over iscsi will reliably cause stalls. Tx cleaning _should_ reliably happen as data is sent. However, currently if the transmit queue fills it will wait until the iflib timer (hz/2) runs. This change causes the the tx taskq thread to be run if there are completed descriptors. While here: - make timer interrupt delay a sysctl - simplify txd_db_check handling - comment on INTR types Background on the change: Initially doorbell updates were minimized by only writing to the register on every fourth packet. If txq_drain would return without writing to the doorbell it scheduled a callout on the next tick to do the doorbell write to ensure that the write otherwise happened "soon". At that time a sysctl was added for users to avoid the potential added latency by simply writing to the doorbell register on every packet. This worked perfectly well for e1000 and ixgbe ... and appeared to work well on ixl. However, as it turned out there was a race to this approach that would lockup the ixl MAC. It was possible for a lower producer index to be written after a higher one. On e1000 and ixgbe this was harmless - on ixl it was fatal. My initial response was to add a lock around doorbell writes - fixing the problem but adding an unacceptable amount of lock contention. The next iteration was to use transmit interrupts to drive delayed doorbell writes. If there were no packets in the queue all doorbell writes would be immediate as the queue started to fill up we could delay doorbell writes further and further. At the start of drain if we've cleaned any packets we know we've moved the state machine along and we write the doorbell (an obvious missing optimization was to skip that doorbell write if db_pending is zero). This change required that tx interrupts be scheduled periodically as opposed to just when the hardware txq was full. However, that just leads to our next problem. Initially dedicated msix vectors were used for both tx and rx. However, it was often possible to use up all available vectors before we set up all the queues we wanted. By having rx and tx share a vector for a given queue we could halve the number of vectors used by a given configuration. The problem here is that with this change only e1000 passed the necessary value to have the fast interrupt drive tx when appropriate. Reported by: mav@ Tested by: mav@ Reviewed by: gallatin@ MFC after: 1 month Sponsored by: iXsystems Differential Revision: https://reviews.freebsd.org/D27683 (cherry picked from commit 81be655266fac2b333e25f386f32c9bcd17f523d) --- sys/dev/bnxt/if_bnxt.c | 2 +- sys/dev/ice/if_ice_iflib.c | 2 +- sys/dev/ixgbe/if_ix.c | 2 +- sys/dev/ixgbe/if_ixv.c | 2 +- sys/dev/ixl/if_iavf.c | 2 +- sys/dev/ixl/if_ixl.c | 2 +- sys/dev/vmware/vmxnet3/if_vmx.c | 2 +- sys/net/iflib.c | 94 +++++++++++++++++++++++++++-------------- sys/net/iflib.h | 17 ++++++++ 9 files changed, 86 insertions(+), 39 deletions(-) diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 9408da32d78a..3a0fdb85e848 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -1524,7 +1524,7 @@ bnxt_msix_intr_assign(if_ctx_t ctx, int msix) for (i=0; iscctx->isc_nrxqsets; i++) { snprintf(irq_name, sizeof(irq_name), "rxq%d", i); rc = iflib_irq_alloc_generic(ctx, &softc->rx_cp_rings[i].irq, - softc->rx_cp_rings[i].ring.id + 1, IFLIB_INTR_RX, + softc->rx_cp_rings[i].ring.id + 1, IFLIB_INTR_RXTX, bnxt_handle_rx_cp, &softc->rx_cp_rings[i], i, irq_name); if (rc) { device_printf(iflib_get_dev(ctx), diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c index 6fdb738b192b..25eaae8ed26d 100644 --- a/sys/dev/ice/if_ice_iflib.c +++ b/sys/dev/ice/if_ice_iflib.c @@ -1493,7 +1493,7 @@ ice_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(irq_name, sizeof(irq_name), "rxq%d", i); err = iflib_irq_alloc_generic(ctx, &sc->irqvs[vector].irq, rid, - IFLIB_INTR_RX, ice_msix_que, + IFLIB_INTR_RXTX, ice_msix_que, rxq, rxq->me, irq_name); if (err) { device_printf(sc->dev, diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 0ce1a5441a62..581944fa6a73 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -2038,7 +2038,7 @@ ixgbe_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(buf, sizeof(buf), "rxq%d", i); error = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, - IFLIB_INTR_RX, ixgbe_msix_que, rx_que, rx_que->rxr.me, buf); + IFLIB_INTR_RXTX, ixgbe_msix_que, rx_que, rx_que->rxr.me, buf); if (error) { device_printf(iflib_get_dev(ctx), diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 114a41ea8256..805701073e0a 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -1026,7 +1026,7 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(buf, sizeof(buf), "rxq%d", i); error = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, - IFLIB_INTR_RX, ixv_msix_que, rx_que, rx_que->rxr.me, buf); + IFLIB_INTR_RXTX, ixv_msix_que, rx_que, rx_que->rxr.me, buf); if (error) { device_printf(iflib_get_dev(ctx), diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index 0cb6f54a8c92..28b76eced25a 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -898,7 +898,7 @@ iavf_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(buf, sizeof(buf), "rxq%d", i); err = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, - IFLIB_INTR_RX, iavf_msix_que, rx_que, rx_que->rxr.me, buf); + IFLIB_INTR_RXTX, iavf_msix_que, rx_que, rx_que->rxr.me, buf); /* XXX: Does the driver work as expected if there are fewer num_rx_queues than * what's expected in the iflib context? */ if (err) { diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 52a6fc480d24..52c9dd293e6b 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -1071,7 +1071,7 @@ ixl_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(buf, sizeof(buf), "rxq%d", i); err = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, - IFLIB_INTR_RX, ixl_msix_que, rx_que, rx_que->rxr.me, buf); + IFLIB_INTR_RXTX, ixl_msix_que, rx_que, rx_que->rxr.me, buf); /* XXX: Does the driver work as expected if there are fewer num_rx_queues than * what's expected in the iflib context? */ if (err) { diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c index a74d09988a2a..b3cddcbc879f 100644 --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -482,7 +482,7 @@ vmxnet3_msix_intr_assign(if_ctx_t ctx, int msix) rxq = &sc->vmx_rxq[i]; error = iflib_irq_alloc_generic(ctx, &rxq->vxrxq_irq, i + 1, - IFLIB_INTR_RX, vmxnet3_rxq_intr, rxq, i, irq_name); + IFLIB_INTR_RXTX, vmxnet3_rxq_intr, rxq, i, irq_name); if (error) { device_printf(iflib_get_dev(ctx), "Failed to register rxq %d interrupt handler\n", i); diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 2d53b1ef8229..3a86671c7443 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -591,6 +591,10 @@ SYSCTL_INT(_net_iflib, OID_AUTO, min_tx_latency, CTLFLAG_RW, static int iflib_no_tx_batch = 0; SYSCTL_INT(_net_iflib, OID_AUTO, no_tx_batch, CTLFLAG_RW, &iflib_no_tx_batch, 0, "minimize transmit latency at the possible expense of throughput"); +static int iflib_timer_default = 1000; +SYSCTL_INT(_net_iflib, OID_AUTO, timer_default, CTLFLAG_RW, + &iflib_timer_default, 0, "number of ticks between iflib_timer calls"); + #if IFLIB_DEBUG_COUNTERS @@ -2462,7 +2466,7 @@ iflib_timer(void *arg) ** can be done without the lock because its RO ** and the HUNG state will be static if set. */ - if (this_tick - txq->ift_last_timer_tick >= hz / 2) { + if (this_tick - txq->ift_last_timer_tick >= iflib_timer_default) { txq->ift_last_timer_tick = this_tick; IFDI_TIMER(ctx, txq->ift_id); if ((txq->ift_qstatus == IFLIB_QUEUE_HUNG) && @@ -2472,7 +2476,8 @@ iflib_timer(void *arg) if (txq->ift_qstatus != IFLIB_QUEUE_IDLE && ifmp_ring_is_stalled(txq->ift_br)) { - KASSERT(ctx->ifc_link_state == LINK_STATE_UP, ("queue can't be marked as hung if interface is down")); + KASSERT(ctx->ifc_link_state == LINK_STATE_UP, + ("queue can't be marked as hung if interface is down")); txq->ift_qstatus = IFLIB_QUEUE_HUNG; } txq->ift_cleaned_prev = txq->ift_cleaned; @@ -2483,7 +2488,8 @@ iflib_timer(void *arg) sctx->isc_pause_frames = 0; if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) - callout_reset_on(&txq->ift_timer, hz / 2, iflib_timer, txq, txq->ift_timer.c_cpu); + callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, + txq, txq->ift_timer.c_cpu); return; hung: @@ -2601,7 +2607,7 @@ done: IFDI_INTR_ENABLE(ctx); txq = ctx->ifc_txqs; for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) - callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, + callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, txq->ift_timer.c_cpu); /* Re-enable txsync/rxsync. */ @@ -3123,26 +3129,37 @@ txq_max_rs_deferred(iflib_txq_t txq) /* XXX we should be setting this to something other than zero */ #define RECLAIM_THRESH(ctx) ((ctx)->ifc_sctx->isc_tx_reclaim_thresh) -#define MAX_TX_DESC(ctx) max((ctx)->ifc_softc_ctx.isc_tx_tso_segments_max, \ +#define MAX_TX_DESC(ctx) MAX((ctx)->ifc_softc_ctx.isc_tx_tso_segments_max, \ (ctx)->ifc_softc_ctx.isc_tx_nsegments) static inline bool -iflib_txd_db_check(if_ctx_t ctx, iflib_txq_t txq, int ring, qidx_t in_use) +iflib_txd_db_check(iflib_txq_t txq, int ring) { + if_ctx_t ctx = txq->ift_ctx; qidx_t dbval, max; - bool rang; - rang = false; - max = TXQ_MAX_DB_DEFERRED(txq, in_use); - if (ring || txq->ift_db_pending >= max) { + max = TXQ_MAX_DB_DEFERRED(txq, txq->ift_in_use); + + /* force || threshold exceeded || at the edge of the ring */ + if (ring || (txq->ift_db_pending >= max) || (TXQ_AVAIL(txq) <= MAX_TX_DESC(ctx) + 2)) { + + /* + * 'npending' is used if the card's doorbell is in terms of the number of descriptors + * pending flush (BRCM). 'pidx' is used in cases where the card's doorbeel uses the + * producer index explicitly (INTC). + */ dbval = txq->ift_npending ? txq->ift_npending : txq->ift_pidx; bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); ctx->isc_txd_flush(ctx->ifc_softc, txq->ift_id, dbval); + + /* + * Absent bugs there are zero packets pending so reset pending counts to zero. + */ txq->ift_db_pending = txq->ift_npending = 0; - rang = true; + return (true); } - return (rang); + return (false); } #ifdef PKT_DEBUG @@ -3603,6 +3620,7 @@ defrag: MPASS(pi.ipi_new_pidx != pidx); MPASS(ndesc > 0); txq->ift_in_use += ndesc; + txq->ift_db_pending += ndesc; /* * We update the last software descriptor again here because there may @@ -3770,8 +3788,8 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) if_ctx_t ctx = txq->ift_ctx; if_t ifp = ctx->ifc_ifp; struct mbuf *m, **mp; - int avail, bytes_sent, consumed, count, err, i, in_use_prev; - int mcast_sent, pkt_sent, reclaimed, txq_avail; + int avail, bytes_sent, skipped, count, err, i; + int mcast_sent, pkt_sent, reclaimed; bool do_prefetch, rang, ring; if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING) || @@ -3780,9 +3798,13 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) return (0); } reclaimed = iflib_completed_tx_reclaim(txq, RECLAIM_THRESH(ctx)); - rang = iflib_txd_db_check(ctx, txq, reclaimed, txq->ift_in_use); + rang = iflib_txd_db_check(txq, reclaimed && txq->ift_db_pending); avail = IDXDIFF(pidx, cidx, r->size); + if (__predict_false(ctx->ifc_flags & IFC_QFLUSH)) { + /* + * The driver is unloading so we need to free all pending packets. + */ DBG_COUNTER_INC(txq_drain_flushing); for (i = 0; i < avail; i++) { if (__predict_true(r->items[(cidx + i) & (r->size-1)] != (void *)txq)) @@ -3800,9 +3822,13 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) DBG_COUNTER_INC(txq_drain_oactive); return (0); } + + /* + * If we've reclaimed any packets this queue cannot be hung. + */ if (reclaimed) txq->ift_qstatus = IFLIB_QUEUE_IDLE; - consumed = mcast_sent = bytes_sent = pkt_sent = 0; + skipped = mcast_sent = bytes_sent = pkt_sent = 0; count = MIN(avail, TX_BATCH_SIZE); #ifdef INVARIANTS if (iflib_verbose_debug) @@ -3810,54 +3836,57 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) avail, ctx->ifc_flags, TXQ_AVAIL(txq)); #endif do_prefetch = (ctx->ifc_flags & IFC_PREFETCH); - txq_avail = TXQ_AVAIL(txq); err = 0; - for (i = 0; i < count && txq_avail > MAX_TX_DESC(ctx) + 2; i++) { + for (i = 0; i < count && TXQ_AVAIL(txq) >= MAX_TX_DESC(ctx) + 2; i++) { int rem = do_prefetch ? count - i : 0; mp = _ring_peek_one(r, cidx, i, rem); MPASS(mp != NULL && *mp != NULL); + + /* + * Completion interrupts will use the address of the txq + * as a sentinel to enqueue _something_ in order to acquire + * the lock on the mp_ring (there's no direct lock call). + * We obviously whave to check for these sentinel cases + * and skip them. + */ if (__predict_false(*mp == (struct mbuf *)txq)) { - consumed++; + skipped++; continue; } - in_use_prev = txq->ift_in_use; err = iflib_encap(txq, mp); if (__predict_false(err)) { /* no room - bail out */ if (err == ENOBUFS) break; - consumed++; + skipped++; /* we can't send this packet - skip it */ continue; } - consumed++; pkt_sent++; m = *mp; DBG_COUNTER_INC(tx_sent); bytes_sent += m->m_pkthdr.len; mcast_sent += !!(m->m_flags & M_MCAST); - txq_avail = TXQ_AVAIL(txq); - txq->ift_db_pending += (txq->ift_in_use - in_use_prev); - ETHER_BPF_MTAP(ifp, m); if (__predict_false(!(ifp->if_drv_flags & IFF_DRV_RUNNING))) break; - rang = iflib_txd_db_check(ctx, txq, false, in_use_prev); + ETHER_BPF_MTAP(ifp, m); + rang = iflib_txd_db_check(txq, false); } /* deliberate use of bitwise or to avoid gratuitous short-circuit */ - ring = rang ? false : (iflib_min_tx_latency | err) || (TXQ_AVAIL(txq) < MAX_TX_DESC(ctx)); - iflib_txd_db_check(ctx, txq, ring, txq->ift_in_use); + ring = rang ? false : (iflib_min_tx_latency | err); + iflib_txd_db_check(txq, ring); if_inc_counter(ifp, IFCOUNTER_OBYTES, bytes_sent); if_inc_counter(ifp, IFCOUNTER_OPACKETS, pkt_sent); if (mcast_sent) if_inc_counter(ifp, IFCOUNTER_OMCASTS, mcast_sent); #ifdef INVARIANTS if (iflib_verbose_debug) - printf("consumed=%d\n", consumed); + printf("consumed=%d\n", skipped + pkt_sent); #endif - return (consumed); + return (skipped + pkt_sent); } static uint32_t @@ -4030,7 +4059,7 @@ _task_fn_admin(void *context) } IFDI_UPDATE_ADMIN_STATUS(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) { - callout_reset_on(&txq->ift_timer, hz / 2, iflib_timer, txq, + callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, txq->ift_timer.c_cpu); } IFDI_LINK_INTR_ENABLE(ctx); @@ -5660,6 +5689,7 @@ iflib_device_iov_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params) static int iflib_module_init(void) { + iflib_timer_default = hz / 2; return (0); } @@ -7096,7 +7126,7 @@ iflib_netdump_transmit(if_t ifp, struct mbuf *m) txq = &ctx->ifc_txqs[0]; error = iflib_encap(txq, &m); if (error == 0) - (void)iflib_txd_db_check(ctx, txq, true, txq->ift_in_use); + (void)iflib_txd_db_check(txq, true); return (error); } diff --git a/sys/net/iflib.h b/sys/net/iflib.h index 662da8748c54..ffbae937808c 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -282,10 +282,27 @@ typedef struct iflib_dma_info { #define IFLIB_MAGIC 0xCAFEF00D typedef enum { + /* Interrupt or softirq handles only receive */ IFLIB_INTR_RX, + + /* Interrupt or softirq handles only transmit */ IFLIB_INTR_TX, + + /* + * Interrupt will check for both pending receive + * and available tx credits and dispatch a task + * for one or both depending on the disposition + * of the respective queues. + */ IFLIB_INTR_RXTX, + + /* + * Other interrupt - typically link status and + * or error conditions. + */ IFLIB_INTR_ADMIN, + + /* Softirq (task) for iov handling */ IFLIB_INTR_IOV, } iflib_intr_type_t; From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:15:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B9096B0E8B; Sun, 3 Oct 2021 05:15: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 4HMX9q061Cz4RT3; Sun, 3 Oct 2021 05:15:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3AC720629; Sun, 3 Oct 2021 05:15: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 1935Fgu8008782; Sun, 3 Oct 2021 05:15:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935Fg0g008781; Sun, 3 Oct 2021 05:15:42 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:15:42 GMT Message-Id: <202110030515.1935Fg0g008781@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: 0760a2e9a4d9 - stable/13 - man: reset OPTIND before parsing args 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: 0760a2e9a4d98047042349aa1bfed9d1d0f2212e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:15:43 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0760a2e9a4d98047042349aa1bfed9d1d0f2212e commit 0760a2e9a4d98047042349aa1bfed9d1d0f2212e Author: Kyle Evans AuthorDate: 2021-09-22 19:58:19 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:14:43 +0000 man: reset OPTIND before parsing args From jilles: POSIX requires that a script set `OPTIND=1` before using different sets of parameters with `getopts`, or the results will be unspecified. The specific problem observed here is that we would execute `man -f` or `man -k` without cleaning up state from man_parse_args()' `getopts` loop. FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the second getopts loop, rendering the following shift harmless; other /bin/sh implementations will leave it at what we came into the loop at (e.g., bash as /bin/sh), shifting off any keywords that we had. Input from: jilles Reviewed by: allanjude, bapt, imp Sponsored by: Klara, Inc. (cherry picked from commit f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb) --- usr.bin/man/man.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index f31c464fcc8f..084f4a06829b 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -243,6 +243,7 @@ is_newer() { manpath_parse_args() { local cmd_arg + OPTIND=1 while getopts 'Ldq' cmd_arg; do case "${cmd_arg}" in L) Lflag=Lflag ;; @@ -426,6 +427,7 @@ man_display_page_groff() { if [ -n "$MANROFFSEQ" ]; then set -- -$MANROFFSEQ + OPTIND=1 while getopts 'egprtv' preproc_arg; do case "${preproc_arg}" in e) pipeline="$pipeline | $EQN" ;; @@ -545,6 +547,7 @@ man_find_and_display() { man_parse_args() { local IFS cmd_arg + OPTIND=1 while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do case "${cmd_arg}" in M) MANPATH=$OPTARG ;; @@ -933,6 +936,7 @@ trim() { # Parse commandline args for whatis and apropos. whatis_parse_args() { local cmd_arg + OPTIND=1 while getopts 'd' cmd_arg; do case "${cmd_arg}" in d) debug=$(( $debug + 1 )) ;; From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:15:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 302D96B0A78; Sun, 3 Oct 2021 05:15: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 4HMX9r0jMnz4RQ8; Sun, 3 Oct 2021 05:15:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED3EA2046B; Sun, 3 Oct 2021 05:15: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 1935Fhpn008806; Sun, 3 Oct 2021 05:15:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935FhYf008805; Sun, 3 Oct 2021 05:15:43 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:15:43 GMT Message-Id: <202110030515.1935FhYf008805@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: 996c4186aa7b - stable/13 - makesyscalls: stop trying to remove . and .. in cleanup 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: 996c4186aa7bd212dec8cd40829533c7e395bab6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:15:44 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=996c4186aa7bd212dec8cd40829533c7e395bab6 commit 996c4186aa7bd212dec8cd40829533c7e395bab6 Author: Kyle Evans AuthorDate: 2021-01-27 17:46:15 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:14:54 +0000 makesyscalls: stop trying to remove . and .. in cleanup lfs.dir() will include these entries, but os.remove() cannot remove them for obvious reasons. (cherry picked from commit 340e009ecc00e5e74d58920ca909968dc7e88af1) --- sys/tools/makesyscalls.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index acae55050752..0ff4d53f924b 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -100,7 +100,9 @@ local function cleanup() if cleantmp then if lfs.dir(tmpspace) then for fname in lfs.dir(tmpspace) do - os.remove(tmpspace .. "/" .. fname) + if fname ~= "." and fname ~= ".." then + os.remove(tmpspace .. "/" .. fname)) + end end end From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:15:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F6F26B0B5F; Sun, 3 Oct 2021 05:15: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 4HMX9s2Wpgz4RL1; Sun, 3 Oct 2021 05:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20A0D2062A; Sun, 3 Oct 2021 05:15: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 1935Fjkd008830; Sun, 3 Oct 2021 05:15:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935Fjpo008829; Sun, 3 Oct 2021 05:15:45 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:15:45 GMT Message-Id: <202110030515.1935Fjpo008829@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: 5129b3f90b50 - stable/13 - makesyscalls: sprinkle some assert() on standard function calls 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: 5129b3f90b5069236ff28717a859fc9d61fe222e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:15:45 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5129b3f90b5069236ff28717a859fc9d61fe222e commit 5129b3f90b5069236ff28717a859fc9d61fe222e Author: Kyle Evans AuthorDate: 2021-01-27 18:12:33 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:14:56 +0000 makesyscalls: sprinkle some assert() on standard function calls Improves our error reporting, ensuring that we aren't just ignoring errors in the common case. Note specifically the boundary where we have to change up our error handling approach. It's fine to error() out up until we create the tempdir, then the rest should try to handle it gracefully and abort(). A future change will clean this up further by pcall'ing all of the bits that cannot currently error() without cleaning up. (cherry picked from commit 6687410af7dba54e19b773684a969e9c590999e4) --- sys/tools/makesyscalls.lua | 64 ++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index 0ff4d53f924b..85b76a44150c 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -95,28 +95,30 @@ local files = {} local function cleanup() for _, v in pairs(files) do - v:close() + assert(v:close()) end if cleantmp then if lfs.dir(tmpspace) then for fname in lfs.dir(tmpspace) do if fname ~= "." and fname ~= ".." then - os.remove(tmpspace .. "/" .. fname)) + assert(os.remove(tmpspace .. "/" .. + fname)) end end end if lfs.attributes(tmpspace) and not lfs.rmdir(tmpspace) then - io.stderr:write("Failed to clean up tmpdir: " .. - tmpspace .. "\n") + assert(io.stderr:write("Failed to clean up tmpdir: " .. + tmpspace .. "\n")) end else - io.stderr:write("Temp files left in " .. tmpspace .. "\n") + assert(io.stderr:write("Temp files left in " .. tmpspace .. + "\n")) end end local function abort(status, msg) - io.stderr:write(msg .. "\n") + assert(io.stderr:write(msg .. "\n")) cleanup() os.exit(status) end @@ -219,14 +221,11 @@ local function process_config(file) -- would need to sanitize the line for potentially special characters. local line_expr = "^([%w%p]+%s*)=(%s*[`\"]?[^\"`]+[`\"]?)" - if file == nil then + if not file then return nil, "No file given" end - local fh = io.open(file) - if fh == nil then - return nil, "Could not open file" - end + local fh = assert(io.open(file)) for nextline in fh:lines() do -- Strip any whole-line comments @@ -291,7 +290,7 @@ local function process_config(file) end end - io.close(fh) + assert(io.close(fh)) return cfg end @@ -320,7 +319,7 @@ local function grab_capenabled(file, open_fail_ok) end end - io.close(fh) + assert(io.close(fh)) return capentries end @@ -398,8 +397,8 @@ local function read_file(tmpfile) end local fh = files[tmpfile] - fh:seek("set") - return fh:read("a") + assert(fh:seek("set")) + return assert(fh:read("a")) end local function write_line(tmpfile, line) @@ -407,13 +406,13 @@ local function write_line(tmpfile, line) print("Not found: " .. tmpfile) return end - files[tmpfile]:write(line) + assert(files[tmpfile]:write(line)) end local function write_line_pfile(tmppat, line) for k in pairs(files) do if k:match(tmppat) ~= nil then - files[k]:write(line) + assert(files[k]:write(line)) end end end @@ -534,7 +533,7 @@ local function process_sysfile(file) process_syscall_def(prevline) end - io.close(fh) + assert(io.close(fh)) return capentries end @@ -1132,7 +1131,7 @@ end -- Entry point if #arg < 1 or #arg > 2 then - abort(1, "usage: " .. arg[0] .. " input-file ") + error("usage: " .. arg[0] .. " input-file ") end local sysfile, configfile = arg[1], arg[2] @@ -1140,13 +1139,7 @@ local sysfile, configfile = arg[1], arg[2] -- process_config either returns nil and a message, or a -- table that we should merge into the global config if configfile ~= nil then - local res, msg = process_config(configfile) - - if res == nil then - -- Error... handle? - print(msg) - os.exit(1) - end + local res = assert(process_config(configfile)) for k, v in pairs(res) do if v ~= config[k] then @@ -1174,17 +1167,28 @@ process_compat() process_abi_flags() if not lfs.mkdir(tmpspace) then - abort(1, "Failed to create tempdir " .. tmpspace) + error("Failed to create tempdir " .. tmpspace) end +-- XXX Revisit the error handling here, we should probably move the rest of this +-- into a function that we pcall() so we can catch the errors and clean up +-- gracefully. for _, v in ipairs(temp_files) do local tmpname = tmpspace .. v files[v] = io.open(tmpname, "w+") + -- XXX Revisit these with a pcall() + error handler + if not files[v] then + abort(1, "Failed to open temp file: " .. tmpname) + end end for _, v in ipairs(output_files) do local tmpname = tmpspace .. v files[v] = io.open(tmpname, "w+") + -- XXX Revisit these with a pcall() + error handler + if not files[v] then + abort(1, "Failed to open temp output file: " .. tmpname) + end end -- Write out all of the preamble bits @@ -1382,12 +1386,12 @@ write_line("systrace", read_file("systraceret")) for _, v in ipairs(output_files) do local target = config[v] if target ~= "/dev/null" then - local fh = io.open(target, "w+") + local fh = assert(io.open(target, "w+")) if fh == nil then abort(1, "Failed to open '" .. target .. "'") end - fh:write(read_file(v)) - fh:close() + assert(fh:write(read_file(v))) + assert(fh:close()) end end From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:15:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB29D6B0E96; Sun, 3 Oct 2021 05:15: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 4HMX9t3qmdz4RTH; Sun, 3 Oct 2021 05:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 415B4206A6; Sun, 3 Oct 2021 05:15: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 1935FkqX008856; Sun, 3 Oct 2021 05:15:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935Fk0F008855; Sun, 3 Oct 2021 05:15:46 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:15:46 GMT Message-Id: <202110030515.1935Fk0F008855@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: 6e9b69d21955 - stable/13 - hostname: avoid strcpy() overlap in -d flag handling 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: 6e9b69d21955e348eeb0e7696a48048621a00520 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:15:46 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6e9b69d21955e348eeb0e7696a48048621a00520 commit 6e9b69d21955e348eeb0e7696a48048621a00520 Author: Kyle Evans AuthorDate: 2021-09-25 05:00:31 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:14:58 +0000 hostname: avoid strcpy() overlap in -d flag handling We don't need the strcpy() anyways, just use a pointer to the hostname buffer and move it forward for `hostname -d`. Sponsored by: Klara, Inc. (cherry picked from commit 33c1e7271ac21a626829289780b88071ae46ec65) --- bin/hostname/hostname.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/hostname/hostname.c b/bin/hostname/hostname.c index d5cc6b1cfff2..3dbafa9d3566 100644 --- a/bin/hostname/hostname.c +++ b/bin/hostname/hostname.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { int ch, sflag, dflag; - char *p, hostname[MAXHOSTNAMELEN]; + char hostname[MAXHOSTNAMELEN], *hostp, *p; sflag = 0; dflag = 0; @@ -90,6 +90,7 @@ main(int argc, char *argv[]) if (sethostname(*argv, (int)strlen(*argv))) err(1, "sethostname"); } else { + hostp = hostname; if (gethostname(hostname, (int)sizeof(hostname))) err(1, "gethostname"); if (sflag) { @@ -99,9 +100,9 @@ main(int argc, char *argv[]) } else if (dflag) { p = strchr(hostname, '.'); if (p != NULL) - strcpy(hostname, ++p); + hostp = p + 1; } - (void)printf("%s\n", hostname); + (void)printf("%s\n", hostp); } exit(0); } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:15:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 047436B0B73; Sun, 3 Oct 2021 05:15: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 4HMX9v3tdBz4Rk7; Sun, 3 Oct 2021 05:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6465420738; Sun, 3 Oct 2021 05:15: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 1935Flcd008887; Sun, 3 Oct 2021 05:15:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935FlGa008886; Sun, 3 Oct 2021 05:15:47 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:15:47 GMT Message-Id: <202110030515.1935FlGa008886@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: 5d3ac4ddf9db - stable/13 - cmp: accept SI suffixes for skip1 and skip2 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: 5d3ac4ddf9db8a42968d31f11a8b18cdc198b4ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:15:48 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5d3ac4ddf9db8a42968d31f11a8b18cdc198b4ff commit 5d3ac4ddf9db8a42968d31f11a8b18cdc198b4ff Author: Kyle Evans AuthorDate: 2021-09-23 05:17:07 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:15:01 +0000 cmp: accept SI suffixes for skip1 and skip2 This is compatible with GNU cmp. Reviewed by: bapt (earlier version), markj, imp Sponsored by: Klara, Inc. (cherry picked from commit f6787614fd4db2a9d5e649af0e819852ebd5a19d) --- usr.bin/cmp/Makefile | 2 ++ usr.bin/cmp/cmp.1 | 16 +++++++++++++++- usr.bin/cmp/cmp.c | 14 ++++++++++++-- usr.bin/cmp/tests/cmp_test2.sh | 17 +++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/usr.bin/cmp/Makefile b/usr.bin/cmp/Makefile index bcde84f0255a..0392fd368503 100644 --- a/usr.bin/cmp/Makefile +++ b/usr.bin/cmp/Makefile @@ -6,6 +6,8 @@ PROG= cmp SRCS= cmp.c link.c misc.c regular.c special.c +LIBADD= util + HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index fc05fb893147..6980f73e7be5 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -31,7 +31,7 @@ .\" @(#)cmp.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 20, 2020 +.Dd September 23, 2021 .Dt CMP 1 .Os .Sh NAME @@ -86,6 +86,11 @@ and respectively, where the comparison will begin. The offset is decimal by default, but may be expressed as a hexadecimal or octal value by preceding it with a leading ``0x'' or ``0''. +.Pp +.Ar skip1 +and +.Ar skip2 +may also be specified with SI size suffixes. .Sh EXIT STATUS The .Nm @@ -164,8 +169,17 @@ The and .Fl z options are extensions to the standard. +.Ar skip1 +and +.Ar skip2 +arguments are extensions to the standard. .Sh HISTORY A .Nm command appeared in .At v1 . +.Sh BUGS +The phrase +.Dq SI size suffixes +above refers to the traditional power of two convention, as described in +.Xr expand_number 3 . diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 47f9b671985c..bab69125e83e 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "extern.h" bool lflag, sflag, xflag, zflag; @@ -81,6 +83,7 @@ main(int argc, char *argv[]) bool special; const char *file1, *file2; + skip1 = skip2 = 0; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+hlsxz", long_opts, NULL)) != -1) switch (ch) { @@ -145,8 +148,15 @@ main(int argc, char *argv[]) exit(ERR_EXIT); } - skip1 = argc > 2 ? strtol(argv[2], NULL, 0) : 0; - skip2 = argc == 4 ? strtol(argv[3], NULL, 0) : 0; + if (argc > 2 && expand_number(argv[2], &skip1) < 0) { + fprintf(stderr, "Invalid skip1: %s\n", argv[2]); + usage(); + } + + if (argc == 4 && expand_number(argv[3], &skip2) < 0) { + fprintf(stderr, "Invalid skip2: %s\n", argv[3]); + usage(); + } if (sflag && skip1 == 0 && skip2 == 0) zflag = true; diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 7f9801fc92bd..334e9f357730 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -75,9 +75,26 @@ pr252542_body() atf_check -s exit:1 -o ignore cmp -z a b 4 3 } +atf_test_case skipsuff +skipsuff_head() +{ + atf_set "descr" "Test cmp(1) accepting SI suffixes on skips" +} +skipsuff_body() +{ + + jot -nb a -s '' 1028 > a + jot -nb b -s '' 1024 > b + jot -nb a -s '' 4 >> b + + atf_check -s exit:1 -o ignore cmp -s a b + atf_check -s exit:0 cmp -s a b 1k 1k +} + atf_init_test_cases() { atf_add_test_case special atf_add_test_case symlink atf_add_test_case pr252542 + atf_add_test_case skipsuff } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:15:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 316046B0EA9; Sun, 3 Oct 2021 05:15:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMX9z0Kvjz4Rl1; Sun, 3 Oct 2021 05:15:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D28EA2046C; Sun, 3 Oct 2021 05:15: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 1935FoZa008959; Sun, 3 Oct 2021 05:15:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935FoU1008958; Sun, 3 Oct 2021 05:15:50 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:15:50 GMT Message-Id: <202110030515.1935FoU1008958@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: 6a1ef178d86a - stable/13 - cmp: add -b, --print-bytes 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: 6a1ef178d86a62a5377496ade866ea31bbfc6ec0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:15:51 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6a1ef178d86a62a5377496ade866ea31bbfc6ec0 commit 6a1ef178d86a62a5377496ade866ea31bbfc6ec0 Author: Kyle Evans AuthorDate: 2021-09-23 05:46:30 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:15:12 +0000 cmp: add -b, --print-bytes This is compatible with GNU cmp. Reviewed by: bapt, markj (earlier version) Sponsored by: Klara, Inc. (cherry picked from commit f66b9b40f403f7c30fec3c4ceed93c6e8fafa8ac) --- usr.bin/cmp/cmp.1 | 5 ++++- usr.bin/cmp/cmp.c | 8 ++++++-- usr.bin/cmp/extern.h | 4 ++-- usr.bin/cmp/link.c | 10 +++++++--- usr.bin/cmp/misc.c | 14 ++++++++++++-- usr.bin/cmp/regular.c | 10 +++++++--- usr.bin/cmp/special.c | 11 ++++++++--- usr.bin/cmp/tests/Makefile | 5 +++++ usr.bin/cmp/tests/b_flag.out | 1 + usr.bin/cmp/tests/bl_flag.out | 1 + usr.bin/cmp/tests/cmp_test2.sh | 17 +++++++++++++++++ 11 files changed, 70 insertions(+), 16 deletions(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 5a56802bd22e..3e616bbe806e 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl l | s | x -.Op Fl hz +.Op Fl bhz .Op Fl -ignore-initial Ns Cm = Ns Ar num1 Ns Op :num2 .Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 @@ -59,6 +59,8 @@ Bytes and lines are numbered beginning with one. .Pp The following options are available: .Bl -tag -width indent +.It Fl b , Fl -print-bytes +Print each byte when a difference is found. .It Fl h Do not follow symbolic links. .It Fl i Ar num1 Ns Oo :num2 Oc , Fl -ignore-initial= Ns Ar num1 Ns Op :num2 @@ -187,6 +189,7 @@ utility is expected to be .St -p1003.2 compatible. The +.Fl b , .Fl h , .Fl i , .Fl n , diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 256cef8a0c31..98ae96c73375 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -62,10 +62,11 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -bool lflag, sflag, xflag, zflag; +bool bflag, lflag, sflag, xflag, zflag; static const struct option long_opts[] = { + {"print-bytes", no_argument, NULL, 'b'}, {"ignore-initial", required_argument, NULL, 'i'}, {"verbose", no_argument, NULL, 'l'}, {"bytes", required_argument, NULL, 'n'}, @@ -106,8 +107,11 @@ main(int argc, char *argv[]) skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hi:ln:sxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+bhi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { + case 'b': /* Print bytes */ + bflag = true; + break; case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; break; diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h index 803319a50ca4..d98daf424995 100644 --- a/usr.bin/cmp/extern.h +++ b/usr.bin/cmp/extern.h @@ -42,7 +42,7 @@ void c_link(const char *, off_t, const char *, off_t, off_t); void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, off_t, off_t); void c_special(int, const char *, off_t, int, const char *, off_t, off_t); -void diffmsg(const char *, const char *, off_t, off_t); +void diffmsg(const char *, const char *, off_t, off_t, int, int); void eofmsg(const char *); -extern bool lflag, sflag, xflag, zflag; +extern bool bflag, lflag, sflag, xflag, zflag; diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c index f0b4482a5792..e01a5911faf7 100644 --- a/usr.bin/cmp/link.c +++ b/usr.bin/cmp/link.c @@ -82,10 +82,14 @@ c_link(const char *file1, off_t skip1, const char *file2, off_t skip2, (long long)byte - 1, ch, *p2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch, *p2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch, ch, *p2, *p2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch, *p2); } else - diffmsg(file1, file2, byte, 1); + diffmsg(file1, file2, byte, 1, ch, *p2); /* NOTREACHED */ } byte++; diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c index 1e84f0d7a527..1dba34d28792 100644 --- a/usr.bin/cmp/misc.c +++ b/usr.bin/cmp/misc.c @@ -56,10 +56,20 @@ eofmsg(const char *file) } void -diffmsg(const char *file1, const char *file2, off_t byte, off_t line) +diffmsg(const char *file1, const char *file2, off_t byte, off_t line, + int b1, int b2) { - if (!sflag) + if (sflag) + goto out; + + if (bflag) { + (void)printf("%s %s differ: char %lld, line %lld is %3o %c %3o %c\n", + file1, file2, (long long)byte, (long long)line, b1, b1, + b2, b2); + } else { (void)printf("%s %s differ: char %lld, line %lld\n", file1, file2, (long long)byte, (long long)line); + } +out: exit(DIFF_EXIT); } diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index a60398620282..d270aeeac396 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -127,10 +127,14 @@ c_regular(int fd1, const char *file1, off_t skip1, off_t len1, (long long)byte - 1, ch, *p2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch, *p2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch, ch, *p2, *p2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch, *p2); } else - diffmsg(file1, file2, byte, line); + diffmsg(file1, file2, byte, line, ch, *p2); /* NOTREACHED */ } if (ch == '\n') diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index 25f755f6e70a..c206a317c0ef 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -88,10 +88,15 @@ c_special(int fd1, const char *file1, off_t skip1, (long long)byte - 1, ch1, ch2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch1, ch2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch1, ch1, ch2, + ch2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch1, ch2); } else { - diffmsg(file1, file2, byte, line); + diffmsg(file1, file2, byte, line, ch1, ch2); /* NOTREACHED */ } } diff --git a/usr.bin/cmp/tests/Makefile b/usr.bin/cmp/tests/Makefile index 087f32f4185f..99469ba42243 100644 --- a/usr.bin/cmp/tests/Makefile +++ b/usr.bin/cmp/tests/Makefile @@ -2,9 +2,14 @@ .include +PACKAGE= tests + ATF_TESTS_SH+= cmp_test2 NETBSD_ATF_TESTS_SH= cmp_test +${PACKAGE}FILES+= b_flag.out +${PACKAGE}FILES+= bl_flag.out + .include .include diff --git a/usr.bin/cmp/tests/b_flag.out b/usr.bin/cmp/tests/b_flag.out new file mode 100644 index 000000000000..bb3d288716b0 --- /dev/null +++ b/usr.bin/cmp/tests/b_flag.out @@ -0,0 +1 @@ +a b differ: char 3, line 1 is 143 c 144 d diff --git a/usr.bin/cmp/tests/bl_flag.out b/usr.bin/cmp/tests/bl_flag.out new file mode 100644 index 000000000000..8ec9007d7ed3 --- /dev/null +++ b/usr.bin/cmp/tests/bl_flag.out @@ -0,0 +1 @@ + 3 143 c 144 d diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 893ee59076c3..c264827646ca 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -118,6 +118,22 @@ limit_body() atf_check -s exit:1 -o ignore -x "cat a | cmp -sn 5 b -" } +atf_test_case bflag +bflag_head() +{ + atf_set "descr" "Test cmp(1) -b (print bytes)" +} +bflag_body() +{ + echo -n "abcd" > a + echo -n "abdd" > b + + atf_check -s exit:1 -o file:$(atf_get_srcdir)/b_flag.out \ + cmp -b a b + atf_check -s exit:1 -o file:$(atf_get_srcdir)/bl_flag.out \ + cmp -bl a b +} + atf_init_test_cases() { atf_add_test_case special @@ -125,4 +141,5 @@ atf_init_test_cases() atf_add_test_case pr252542 atf_add_test_case skipsuff atf_add_test_case limit + atf_add_test_case bflag } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:15:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0E276B0D21; Sun, 3 Oct 2021 05:15: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 4HMX9x5vztz4RqN; Sun, 3 Oct 2021 05:15:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A58C7207F9; Sun, 3 Oct 2021 05:15: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 1935FnXP008935; Sun, 3 Oct 2021 05:15:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935FnZr008934; Sun, 3 Oct 2021 05:15:49 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:15:49 GMT Message-Id: <202110030515.1935FnZr008934@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: 0ab72f80ab69 - stable/13 - cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args 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: 0ab72f80ab69888e69821e996d52180f02158105 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:15:50 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0ab72f80ab69888e69821e996d52180f02158105 commit 0ab72f80ab69888e69821e996d52180f02158105 Author: Kyle Evans AuthorDate: 2021-09-23 05:43:32 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:15:08 +0000 cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. (cherry picked from commit 8d546b6832eea031f95f30eaec3232ec1256a281) --- usr.bin/cmp/cmp.1 | 19 +++++++++++++++++++ usr.bin/cmp/cmp.c | 30 +++++++++++++++++++++++++++++- usr.bin/cmp/tests/cmp_test2.sh | 5 +++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 511e09ac8628..5a56802bd22e 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -41,6 +41,7 @@ .Nm .Op Fl l | s | x .Op Fl hz +.Op Fl -ignore-initial Ns Cm = Ns Ar num1 Ns Op :num2 .Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 .Op Ar skip1 Op Ar skip2 @@ -60,6 +61,23 @@ The following options are available: .Bl -tag -width indent .It Fl h Do not follow symbolic links. +.It Fl i Ar num1 Ns Oo :num2 Oc , Fl -ignore-initial= Ns Ar num1 Ns Op :num2 +Skip +.Ar num1 +bytes from +.Ar file1 , +and optionally skip +.Ar num2 +bytes from +.Ar file2 . +If +.Ar num2 +is not specified, then +.Ar num1 +is applied for both +.Ar file1 +and +.Ar file2 . .It Fl l , Fl -verbose Print the byte number (decimal) and the differing byte values (octal) for each difference. @@ -170,6 +188,7 @@ utility is expected to be compatible. The .Fl h , +.Fl i , .Fl n , .Fl x , and diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 384c273f4632..256cef8a0c31 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -66,6 +66,7 @@ bool lflag, sflag, xflag, zflag; static const struct option long_opts[] = { + {"ignore-initial", required_argument, NULL, 'i'}, {"verbose", no_argument, NULL, 'l'}, {"bytes", required_argument, NULL, 'n'}, {"silent", no_argument, NULL, 's'}, @@ -75,6 +76,25 @@ static const struct option long_opts[] = static void usage(void); +static bool +parse_iskipspec(char *spec, off_t *skip1, off_t *skip2) +{ + char *colon; + + colon = strchr(spec, ':'); + if (colon != NULL) + *colon++ = '\0'; + + if (expand_number(spec, skip1) < 0) + return (false); + + if (colon != NULL) + return (expand_number(colon, skip2) == 0); + + *skip2 = *skip1; + return (true); +} + int main(int argc, char *argv[]) { @@ -86,11 +106,19 @@ main(int argc, char *argv[]) skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hln:sxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+hi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; break; + case 'i': + if (!parse_iskipspec(optarg, &skip1, &skip2)) { + fprintf(stderr, + "Invalid --ignore-initial: %s\n", + optarg); + usage(); + } + break; case 'l': /* print all differences */ lflag = true; break; diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index c513984daf8b..893ee59076c3 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -71,8 +71,13 @@ pr252542_body() { echo -n '1234567890' > a echo -n 'abc567890' > b + echo -n 'xbc567890' > c atf_check -s exit:0 cmp -s a b 4 3 + atf_check -s exit:0 cmp -i 4:3 -s a b + atf_check -s exit:0 cmp -i 1 -s b c atf_check -s exit:1 -o ignore cmp -z a b 4 3 + atf_check -s exit:1 -o ignore cmp -i 4:3 -z a b + atf_check -s exit:1 -o ignore cmp -i 1 -z a b } atf_test_case skipsuff From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:15:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0E2F6B0F01; Sun, 3 Oct 2021 05:15: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 4HMX9w5C6Tz4RkC; Sun, 3 Oct 2021 05:15:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 895B4206A7; Sun, 3 Oct 2021 05:15: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 1935FmLV008911; Sun, 3 Oct 2021 05:15:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935FmlR008910; Sun, 3 Oct 2021 05:15:48 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:15:48 GMT Message-Id: <202110030515.1935FmlR008910@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: 1159a71ad777 - stable/13 - cmp: add -n, --bytes to limit number of bytes to compare 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: 1159a71ad777dbcabd8d62afb8de2b85e0ee975b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:15:49 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1159a71ad777dbcabd8d62afb8de2b85e0ee975b commit 1159a71ad777dbcabd8d62afb8de2b85e0ee975b Author: Kyle Evans AuthorDate: 2021-09-23 05:26:52 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:15:05 +0000 cmp: add -n, --bytes to limit number of bytes to compare This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. (cherry picked from commit 4e380e8474609875c4cf5277b3755ac29079a8b5) --- usr.bin/cmp/cmp.1 | 6 ++++++ usr.bin/cmp/cmp.c | 18 +++++++++++++----- usr.bin/cmp/extern.h | 7 ++++--- usr.bin/cmp/link.c | 6 ++++-- usr.bin/cmp/regular.c | 8 +++++--- usr.bin/cmp/special.c | 4 ++-- usr.bin/cmp/tests/cmp_test2.sh | 23 +++++++++++++++++++++++ 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 6980f73e7be5..511e09ac8628 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -41,6 +41,7 @@ .Nm .Op Fl l | s | x .Op Fl hz +.Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 .Op Ar skip1 Op Ar skip2 .Sh DESCRIPTION @@ -62,6 +63,10 @@ Do not follow symbolic links. .It Fl l , Fl -verbose Print the byte number (decimal) and the differing byte values (octal) for each difference. +.It Fl n Ar num , Fl -bytes= Ns num +Only compare up to +.Ar num +bytes. .It Fl s , Fl -silent , Fl -quiet Print nothing for differing files; return exit status only. @@ -165,6 +170,7 @@ utility is expected to be compatible. The .Fl h , +.Fl n , .Fl x , and .Fl z diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index bab69125e83e..384c273f4632 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -67,6 +67,7 @@ bool lflag, sflag, xflag, zflag; static const struct option long_opts[] = { {"verbose", no_argument, NULL, 'l'}, + {"bytes", required_argument, NULL, 'n'}, {"silent", no_argument, NULL, 's'}, {"quiet", no_argument, NULL, 's'}, {NULL, no_argument, NULL, 0} @@ -78,14 +79,14 @@ int main(int argc, char *argv[]) { struct stat sb1, sb2; - off_t skip1, skip2; + off_t skip1, skip2, limit; int ch, fd1, fd2, oflag; bool special; const char *file1, *file2; skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hlsxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+hln:sxz", long_opts, NULL)) != -1) switch (ch) { case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; @@ -93,6 +94,13 @@ main(int argc, char *argv[]) case 'l': /* print all differences */ lflag = true; break; + case 'n': /* Limit */ + if (expand_number(optarg, &limit) < 0 || limit < 0) { + fprintf(stderr, "Invalid --bytes: %s\n", + optarg); + usage(); + } + break; case 's': /* silent run */ sflag = true; break; @@ -163,7 +171,7 @@ main(int argc, char *argv[]) if (fd1 == -1) { if (fd2 == -1) { - c_link(file1, skip1, file2, skip2); + c_link(file1, skip1, file2, skip2, limit); exit(0); } else if (!sflag) errx(ERR_EXIT, "%s: Not a symbolic link", file2); @@ -201,7 +209,7 @@ main(int argc, char *argv[]) } if (special) - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); else { if (zflag && sb1.st_size != sb2.st_size) { if (!sflag) @@ -210,7 +218,7 @@ main(int argc, char *argv[]) exit(DIFF_EXIT); } c_regular(fd1, file1, skip1, sb1.st_size, - fd2, file2, skip2, sb2.st_size); + fd2, file2, skip2, sb2.st_size, limit); } exit(0); } diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h index 82c5ea42b175..803319a50ca4 100644 --- a/usr.bin/cmp/extern.h +++ b/usr.bin/cmp/extern.h @@ -38,9 +38,10 @@ #define DIFF_EXIT 1 #define ERR_EXIT 2 /* error exit code */ -void c_link(const char *, off_t, const char *, off_t); -void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, off_t); -void c_special(int, const char *, off_t, int, const char *, off_t); +void c_link(const char *, off_t, const char *, off_t, off_t); +void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, + off_t, off_t); +void c_special(int, const char *, off_t, int, const char *, off_t, off_t); void diffmsg(const char *, const char *, off_t, off_t); void eofmsg(const char *); diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c index 9193147e830e..f0b4482a5792 100644 --- a/usr.bin/cmp/link.c +++ b/usr.bin/cmp/link.c @@ -40,7 +40,8 @@ __FBSDID("$FreeBSD$"); #include "extern.h" void -c_link(const char *file1, off_t skip1, const char *file2, off_t skip2) +c_link(const char *file1, off_t skip1, const char *file2, off_t skip2, + off_t limit) { char buf1[PATH_MAX], *p1; char buf2[PATH_MAX], *p2; @@ -72,7 +73,8 @@ c_link(const char *file1, off_t skip1, const char *file2, off_t skip2) dfound = 0; byte = 1; - for (p1 = buf1 + skip1, p2 = buf2 + skip2; *p1 && *p2; p1++, p2++) { + for (p1 = buf1 + skip1, p2 = buf2 + skip2; + *p1 && *p2 && (limit == 0 || byte <= limit); p1++, p2++) { if ((ch = *p1) != *p2) { if (xflag) { dfound = 1; diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index fe639663a560..a60398620282 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -60,7 +60,7 @@ static void segv_handler(int); void c_regular(int fd1, const char *file1, off_t skip1, off_t len1, - int fd2, const char *file2, off_t skip2, off_t len2) + int fd2, const char *file2, off_t skip2, off_t len2, off_t limit) { struct sigaction act, oact; cap_rights_t rights; @@ -86,15 +86,17 @@ c_regular(int fd1, const char *file1, off_t skip1, off_t len1, off2 = ROUNDPAGE(skip2); length = MIN(len1, len2); + if (limit > 0) + length = MIN(length, limit); if ((m1 = remmap(NULL, fd1, off1)) == NULL) { - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); return; } if ((m2 = remmap(NULL, fd2, off2)) == NULL) { munmap(m1, MMAP_CHUNK); - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); return; } diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index 930fcd5492ff..25f755f6e70a 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); void c_special(int fd1, const char *file1, off_t skip1, - int fd2, const char *file2, off_t skip2) + int fd2, const char *file2, off_t skip2, off_t limit) { int ch1, ch2; off_t byte, line; @@ -76,7 +76,7 @@ c_special(int fd1, const char *file1, off_t skip1, if (getc(fp2) == EOF) goto eof; - for (byte = line = 1;; ++byte) { + for (byte = line = 1; limit == 0 || byte <= limit; ++byte) { ch1 = getc(fp1); ch2 = getc(fp2); if (ch1 == EOF || ch2 == EOF) diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 334e9f357730..c513984daf8b 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -91,10 +91,33 @@ skipsuff_body() atf_check -s exit:0 cmp -s a b 1k 1k } +atf_test_case limit +limit_head() +{ + atf_set "descr" "Test cmp(1) -n (limit)" +} +limit_body() +{ + echo -n "aaaabbbb" > a + echo -n "aaaaxxxx" > b + + atf_check -s exit:1 -o ignore cmp -s a b + atf_check -s exit:0 cmp -sn 4 a b + atf_check -s exit:0 cmp -sn 3 a b + atf_check -s exit:1 -o ignore cmp -sn 5 a b + + # Test special, too. The implementation for link is effectively + # identical. + atf_check -s exit:0 -e empty -x "cat a | cmp -sn 4 b -" + atf_check -s exit:0 -e empty -x "cat a | cmp -sn 3 b -" + atf_check -s exit:1 -o ignore -x "cat a | cmp -sn 5 b -" +} + atf_init_test_cases() { atf_add_test_case special atf_add_test_case symlink atf_add_test_case pr252542 atf_add_test_case skipsuff + atf_add_test_case limit } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:20:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EA006B1256; Sun, 3 Oct 2021 05:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMXHm45r8z4SC1; Sun, 3 Oct 2021 05:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DB26207FD; Sun, 3 Oct 2021 05:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1935KqgC020825; Sun, 3 Oct 2021 05:20:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935Kq6f020824; Sun, 3 Oct 2021 05:20:52 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:20:52 GMT Message-Id: <202110030520.1935Kq6f020824@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: a19dcf584263 - stable/12 - cmp(1): Add EXAMPLES section 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/12 X-Git-Reftype: branch X-Git-Commit: a19dcf584263d53038a9ae803f98ceb68842934a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:20:52 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=a19dcf584263d53038a9ae803f98ceb68842934a commit a19dcf584263d53038a9ae803f98ceb68842934a Author: Fernando Apesteguía AuthorDate: 2020-06-16 15:54:59 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:53 +0000 cmp(1): Add EXAMPLES section Add simple examples showing the use of -l, -z, stdin and offsets (cherry picked from commit 022ebaf5432d5a8112c7d75ab9d406176b3dfd39) --- usr.bin/cmp/cmp.1 | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index f3bfdf651b51..094509dda08b 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -31,7 +31,7 @@ .\" @(#)cmp.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 1, 2018 +.Dd June 16, 2020 .Dt CMP 1 .Os .Sh NAME @@ -106,6 +106,40 @@ file (before any differences were found). .It >1 An error occurred. .El +.Sh EXAMPLES +Assuming a file named example.txt with the following contents: +.Bd -literal -offset indent +a +b +c +.Ed +.Pp +Compare stdin with example.txt: +.Bd -literal -offset indent +$ echo -e "a\\nb\\nc" | cmp - example.txt +.Ed +.Pp +Same as above but introducing a change in byte three in stdin. +Show the byte number (decimal) and differing byte (octal): +.Bd -literal -offset indent +$ echo -e "a\\nR\\nc" | cmp -l - example.txt + 3 122 142 +.Ed +.Pp +Compare example.txt and /boot/loader.conf exiting if size differs. +Note that +.Fl z +can only be used with regular files: +.Bd -literal -offset indent +$ cmp -z example.txt /boot/loader.conf +example.txt /boot/loader.conf differ: size +.Ed +.Pp +Compare stdin with file example.txt omitting the 4 first bytes from stdin and +the 2 first bytes from example.txt: +.Bd -literal -offset indent +$ echo -e "a\\nR\\nb\\nc" | cmp - example.txt 4 2 +.Ed .Sh SEE ALSO .Xr diff 1 , .Xr diff3 1 From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:20:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C36656B1299; Sun, 3 Oct 2021 05:20:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMXHn4mR5z4Ryn; Sun, 3 Oct 2021 05:20:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81416205EF; Sun, 3 Oct 2021 05:20:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1935KrAB020849; Sun, 3 Oct 2021 05:20:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935KrAW020848; Sun, 3 Oct 2021 05:20:53 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:20:53 GMT Message-Id: <202110030520.1935KrAW020848@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: ca052baa603a - stable/12 - cmp(1): Add EXAMPLES section 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/12 X-Git-Reftype: branch X-Git-Commit: ca052baa603aa5743c616d89c2fb2dfdb6fcd4ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:20:53 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ca052baa603aa5743c616d89c2fb2dfdb6fcd4ea commit ca052baa603aa5743c616d89c2fb2dfdb6fcd4ea Author: Fernando Apesteguía AuthorDate: 2020-06-20 11:20:16 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:56 +0000 cmp(1): Add EXAMPLES section Add a small number of examples depicting the use of -l, -z and byte offsets (cherry picked from commit 1831993577db18d193e94269e337f6286536814e) --- usr.bin/cmp/cmp.1 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 094509dda08b..fc05fb893147 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -31,7 +31,7 @@ .\" @(#)cmp.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 16, 2020 +.Dd June 20, 2020 .Dt CMP 1 .Os .Sh NAME @@ -107,26 +107,33 @@ file (before any differences were found). An error occurred. .El .Sh EXAMPLES -Assuming a file named example.txt with the following contents: +Assuming a file named +.Pa example.txt +with the following contents: .Bd -literal -offset indent a b c .Ed .Pp -Compare stdin with example.txt: +Compare stdin with +.Pa example.txt : .Bd -literal -offset indent $ echo -e "a\\nb\\nc" | cmp - example.txt .Ed .Pp -Same as above but introducing a change in byte three in stdin. +Same as above but introducing a change in the third byte of stdin. Show the byte number (decimal) and differing byte (octal): .Bd -literal -offset indent $ echo -e "a\\nR\\nc" | cmp -l - example.txt 3 122 142 .Ed .Pp -Compare example.txt and /boot/loader.conf exiting if size differs. +Compare file sizes of +.Pa example.txt +and +.Pa /boot/loader.conf +and return 1 if they are not equal. Note that .Fl z can only be used with regular files: @@ -135,8 +142,10 @@ $ cmp -z example.txt /boot/loader.conf example.txt /boot/loader.conf differ: size .Ed .Pp -Compare stdin with file example.txt omitting the 4 first bytes from stdin and -the 2 first bytes from example.txt: +Compare stdin with +.Pa example.txt +omitting the first 4 bytes from stdin and the first 2 bytes from +.Pa example.txt : .Bd -literal -offset indent $ echo -e "a\\nR\\nb\\nc" | cmp - example.txt 4 2 .Ed From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:20:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78BB86B14CD; Sun, 3 Oct 2021 05:20:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMXHq2MZVz4S1q; Sun, 3 Oct 2021 05:20:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3B46206AB; Sun, 3 Oct 2021 05:20:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1935KsP5020873; Sun, 3 Oct 2021 05:20:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935KsDP020872; Sun, 3 Oct 2021 05:20:54 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:20:54 GMT Message-Id: <202110030520.1935KsDP020872@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: 00d0f1811b71 - stable/12 - man: reset OPTIND before parsing args 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/12 X-Git-Reftype: branch X-Git-Commit: 00d0f1811b719c66ee91b9bf4680cfc0515e65aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:20:55 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=00d0f1811b719c66ee91b9bf4680cfc0515e65aa commit 00d0f1811b719c66ee91b9bf4680cfc0515e65aa Author: Kyle Evans AuthorDate: 2021-09-22 19:58:19 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:56 +0000 man: reset OPTIND before parsing args From jilles: POSIX requires that a script set `OPTIND=1` before using different sets of parameters with `getopts`, or the results will be unspecified. The specific problem observed here is that we would execute `man -f` or `man -k` without cleaning up state from man_parse_args()' `getopts` loop. FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the second getopts loop, rendering the following shift harmless; other /bin/sh implementations will leave it at what we came into the loop at (e.g., bash as /bin/sh), shifting off any keywords that we had. Input from: jilles Reviewed by: allanjude, bapt, imp Sponsored by: Klara, Inc. (cherry picked from commit f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb) --- usr.bin/man/man.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index 12a370cd8efb..68b9bb3e695a 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -243,6 +243,7 @@ is_newer() { manpath_parse_args() { local cmd_arg + OPTIND=1 while getopts 'Ldq' cmd_arg; do case "${cmd_arg}" in L) Lflag=Lflag ;; @@ -426,6 +427,7 @@ man_display_page_groff() { if [ -n "$MANROFFSEQ" ]; then set -- -$MANROFFSEQ + OPTIND=1 while getopts 'egprtv' preproc_arg; do case "${preproc_arg}" in e) pipeline="$pipeline | $EQN" ;; @@ -545,6 +547,7 @@ man_find_and_display() { man_parse_args() { local IFS cmd_arg + OPTIND=1 while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do case "${cmd_arg}" in M) MANPATH=$OPTARG ;; @@ -933,6 +936,7 @@ trim() { # Parse commandline args for whatis and apropos. whatis_parse_args() { local cmd_arg + OPTIND=1 while getopts 'd' cmd_arg; do case "${cmd_arg}" in d) debug=$(( $debug + 1 )) ;; From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:20:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27AAA6B14CE; Sun, 3 Oct 2021 05:20: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 4HMXHr018rz4S7L; Sun, 3 Oct 2021 05:20:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC1D120800; Sun, 3 Oct 2021 05:20: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 1935Kti4020904; Sun, 3 Oct 2021 05:20:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935KtBg020902; Sun, 3 Oct 2021 05:20:55 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:20:55 GMT Message-Id: <202110030520.1935KtBg020902@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: 47c84a0f6d6e - stable/12 - hostname: avoid strcpy() overlap in -d flag handling 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/12 X-Git-Reftype: branch X-Git-Commit: 47c84a0f6d6ece6f3d32a393a382e2a91544f421 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:20:56 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=47c84a0f6d6ece6f3d32a393a382e2a91544f421 commit 47c84a0f6d6ece6f3d32a393a382e2a91544f421 Author: Kyle Evans AuthorDate: 2021-09-25 05:00:31 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:56 +0000 hostname: avoid strcpy() overlap in -d flag handling We don't need the strcpy() anyways, just use a pointer to the hostname buffer and move it forward for `hostname -d`. Sponsored by: Klara, Inc. (cherry picked from commit 33c1e7271ac21a626829289780b88071ae46ec65) --- bin/hostname/hostname.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/hostname/hostname.c b/bin/hostname/hostname.c index d5cc6b1cfff2..3dbafa9d3566 100644 --- a/bin/hostname/hostname.c +++ b/bin/hostname/hostname.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { int ch, sflag, dflag; - char *p, hostname[MAXHOSTNAMELEN]; + char hostname[MAXHOSTNAMELEN], *hostp, *p; sflag = 0; dflag = 0; @@ -90,6 +90,7 @@ main(int argc, char *argv[]) if (sethostname(*argv, (int)strlen(*argv))) err(1, "sethostname"); } else { + hostp = hostname; if (gethostname(hostname, (int)sizeof(hostname))) err(1, "gethostname"); if (sflag) { @@ -99,9 +100,9 @@ main(int argc, char *argv[]) } else if (dflag) { p = strchr(hostname, '.'); if (p != NULL) - strcpy(hostname, ++p); + hostp = p + 1; } - (void)printf("%s\n", hostname); + (void)printf("%s\n", hostp); } exit(0); } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E0DC6B12A9; Sun, 3 Oct 2021 05:20:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMXHs1Y2Vz4SN0; Sun, 3 Oct 2021 05:20:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EACCB207FF; Sun, 3 Oct 2021 05:20: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 1935KucO020930; Sun, 3 Oct 2021 05:20:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935Kupf020929; Sun, 3 Oct 2021 05:20:56 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:20:56 GMT Message-Id: <202110030520.1935Kupf020929@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: 666911766650 - stable/12 - cmp: accept SI suffixes for skip1 and skip2 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/12 X-Git-Reftype: branch X-Git-Commit: 66691176665015a6c44ec78aa7f7ada8b4804a18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:20:57 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=66691176665015a6c44ec78aa7f7ada8b4804a18 commit 66691176665015a6c44ec78aa7f7ada8b4804a18 Author: Kyle Evans AuthorDate: 2021-09-23 05:17:07 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:56 +0000 cmp: accept SI suffixes for skip1 and skip2 This is compatible with GNU cmp. Reviewed by: bapt (earlier version), markj, imp Sponsored by: Klara, Inc. (cherry picked from commit f6787614fd4db2a9d5e649af0e819852ebd5a19d) --- usr.bin/cmp/Makefile | 2 ++ usr.bin/cmp/cmp.1 | 16 +++++++++++++++- usr.bin/cmp/cmp.c | 14 ++++++++++++-- usr.bin/cmp/tests/cmp_test2.sh | 17 +++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/usr.bin/cmp/Makefile b/usr.bin/cmp/Makefile index bcde84f0255a..0392fd368503 100644 --- a/usr.bin/cmp/Makefile +++ b/usr.bin/cmp/Makefile @@ -6,6 +6,8 @@ PROG= cmp SRCS= cmp.c link.c misc.c regular.c special.c +LIBADD= util + HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index fc05fb893147..6980f73e7be5 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -31,7 +31,7 @@ .\" @(#)cmp.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 20, 2020 +.Dd September 23, 2021 .Dt CMP 1 .Os .Sh NAME @@ -86,6 +86,11 @@ and respectively, where the comparison will begin. The offset is decimal by default, but may be expressed as a hexadecimal or octal value by preceding it with a leading ``0x'' or ``0''. +.Pp +.Ar skip1 +and +.Ar skip2 +may also be specified with SI size suffixes. .Sh EXIT STATUS The .Nm @@ -164,8 +169,17 @@ The and .Fl z options are extensions to the standard. +.Ar skip1 +and +.Ar skip2 +arguments are extensions to the standard. .Sh HISTORY A .Nm command appeared in .At v1 . +.Sh BUGS +The phrase +.Dq SI size suffixes +above refers to the traditional power of two convention, as described in +.Xr expand_number 3 . diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 47f9b671985c..bab69125e83e 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "extern.h" bool lflag, sflag, xflag, zflag; @@ -81,6 +83,7 @@ main(int argc, char *argv[]) bool special; const char *file1, *file2; + skip1 = skip2 = 0; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+hlsxz", long_opts, NULL)) != -1) switch (ch) { @@ -145,8 +148,15 @@ main(int argc, char *argv[]) exit(ERR_EXIT); } - skip1 = argc > 2 ? strtol(argv[2], NULL, 0) : 0; - skip2 = argc == 4 ? strtol(argv[3], NULL, 0) : 0; + if (argc > 2 && expand_number(argv[2], &skip1) < 0) { + fprintf(stderr, "Invalid skip1: %s\n", argv[2]); + usage(); + } + + if (argc == 4 && expand_number(argv[3], &skip2) < 0) { + fprintf(stderr, "Invalid skip2: %s\n", argv[3]); + usage(); + } if (sflag && skip1 == 0 && skip2 == 0) zflag = true; diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 7f9801fc92bd..334e9f357730 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -75,9 +75,26 @@ pr252542_body() atf_check -s exit:1 -o ignore cmp -z a b 4 3 } +atf_test_case skipsuff +skipsuff_head() +{ + atf_set "descr" "Test cmp(1) accepting SI suffixes on skips" +} +skipsuff_body() +{ + + jot -nb a -s '' 1028 > a + jot -nb b -s '' 1024 > b + jot -nb a -s '' 4 >> b + + atf_check -s exit:1 -o ignore cmp -s a b + atf_check -s exit:0 cmp -s a b 1k 1k +} + atf_init_test_cases() { atf_add_test_case special atf_add_test_case symlink atf_add_test_case pr252542 + atf_add_test_case skipsuff } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:21:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BFD06B1450; Sun, 3 Oct 2021 05:21: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 4HMXHv3yb6z4S1y; Sun, 3 Oct 2021 05:20:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B6AF20630; Sun, 3 Oct 2021 05:20: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 1935KxXA020978; Sun, 3 Oct 2021 05:20:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935KxqC020977; Sun, 3 Oct 2021 05:20:59 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:20:59 GMT Message-Id: <202110030520.1935KxqC020977@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: b0f46c4b8409 - stable/12 - cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args 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/12 X-Git-Reftype: branch X-Git-Commit: b0f46c4b84093b23e8d40ffbc1f7f63659a0123c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:21:00 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b0f46c4b84093b23e8d40ffbc1f7f63659a0123c commit b0f46c4b84093b23e8d40ffbc1f7f63659a0123c Author: Kyle Evans AuthorDate: 2021-09-23 05:43:32 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:56 +0000 cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. (cherry picked from commit 8d546b6832eea031f95f30eaec3232ec1256a281) --- usr.bin/cmp/cmp.1 | 19 +++++++++++++++++++ usr.bin/cmp/cmp.c | 30 +++++++++++++++++++++++++++++- usr.bin/cmp/tests/cmp_test2.sh | 5 +++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 511e09ac8628..5a56802bd22e 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -41,6 +41,7 @@ .Nm .Op Fl l | s | x .Op Fl hz +.Op Fl -ignore-initial Ns Cm = Ns Ar num1 Ns Op :num2 .Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 .Op Ar skip1 Op Ar skip2 @@ -60,6 +61,23 @@ The following options are available: .Bl -tag -width indent .It Fl h Do not follow symbolic links. +.It Fl i Ar num1 Ns Oo :num2 Oc , Fl -ignore-initial= Ns Ar num1 Ns Op :num2 +Skip +.Ar num1 +bytes from +.Ar file1 , +and optionally skip +.Ar num2 +bytes from +.Ar file2 . +If +.Ar num2 +is not specified, then +.Ar num1 +is applied for both +.Ar file1 +and +.Ar file2 . .It Fl l , Fl -verbose Print the byte number (decimal) and the differing byte values (octal) for each difference. @@ -170,6 +188,7 @@ utility is expected to be compatible. The .Fl h , +.Fl i , .Fl n , .Fl x , and diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 384c273f4632..256cef8a0c31 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -66,6 +66,7 @@ bool lflag, sflag, xflag, zflag; static const struct option long_opts[] = { + {"ignore-initial", required_argument, NULL, 'i'}, {"verbose", no_argument, NULL, 'l'}, {"bytes", required_argument, NULL, 'n'}, {"silent", no_argument, NULL, 's'}, @@ -75,6 +76,25 @@ static const struct option long_opts[] = static void usage(void); +static bool +parse_iskipspec(char *spec, off_t *skip1, off_t *skip2) +{ + char *colon; + + colon = strchr(spec, ':'); + if (colon != NULL) + *colon++ = '\0'; + + if (expand_number(spec, skip1) < 0) + return (false); + + if (colon != NULL) + return (expand_number(colon, skip2) == 0); + + *skip2 = *skip1; + return (true); +} + int main(int argc, char *argv[]) { @@ -86,11 +106,19 @@ main(int argc, char *argv[]) skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hln:sxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+hi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; break; + case 'i': + if (!parse_iskipspec(optarg, &skip1, &skip2)) { + fprintf(stderr, + "Invalid --ignore-initial: %s\n", + optarg); + usage(); + } + break; case 'l': /* print all differences */ lflag = true; break; diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index c513984daf8b..893ee59076c3 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -71,8 +71,13 @@ pr252542_body() { echo -n '1234567890' > a echo -n 'abc567890' > b + echo -n 'xbc567890' > c atf_check -s exit:0 cmp -s a b 4 3 + atf_check -s exit:0 cmp -i 4:3 -s a b + atf_check -s exit:0 cmp -i 1 -s b c atf_check -s exit:1 -o ignore cmp -z a b 4 3 + atf_check -s exit:1 -o ignore cmp -i 4:3 -z a b + atf_check -s exit:1 -o ignore cmp -i 1 -z a b } atf_test_case skipsuff From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:20:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15F5E6B14D5; Sun, 3 Oct 2021 05:20: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 4HMXHt4wffz4SFR; Sun, 3 Oct 2021 05:20:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BF5F206B0; Sun, 3 Oct 2021 05:20: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 1935KvDH020954; Sun, 3 Oct 2021 05:20:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935Kvww020953; Sun, 3 Oct 2021 05:20:57 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:20:57 GMT Message-Id: <202110030520.1935Kvww020953@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: a67180b4b770 - stable/12 - cmp: add -n, --bytes to limit number of bytes to compare 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/12 X-Git-Reftype: branch X-Git-Commit: a67180b4b7706d504351c96359459876e9e0fb4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:20:59 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=a67180b4b7706d504351c96359459876e9e0fb4b commit a67180b4b7706d504351c96359459876e9e0fb4b Author: Kyle Evans AuthorDate: 2021-09-23 05:26:52 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:56 +0000 cmp: add -n, --bytes to limit number of bytes to compare This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. (cherry picked from commit 4e380e8474609875c4cf5277b3755ac29079a8b5) --- usr.bin/cmp/cmp.1 | 6 ++++++ usr.bin/cmp/cmp.c | 18 +++++++++++++----- usr.bin/cmp/extern.h | 7 ++++--- usr.bin/cmp/link.c | 6 ++++-- usr.bin/cmp/regular.c | 8 +++++--- usr.bin/cmp/special.c | 4 ++-- usr.bin/cmp/tests/cmp_test2.sh | 23 +++++++++++++++++++++++ 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 6980f73e7be5..511e09ac8628 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -41,6 +41,7 @@ .Nm .Op Fl l | s | x .Op Fl hz +.Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 .Op Ar skip1 Op Ar skip2 .Sh DESCRIPTION @@ -62,6 +63,10 @@ Do not follow symbolic links. .It Fl l , Fl -verbose Print the byte number (decimal) and the differing byte values (octal) for each difference. +.It Fl n Ar num , Fl -bytes= Ns num +Only compare up to +.Ar num +bytes. .It Fl s , Fl -silent , Fl -quiet Print nothing for differing files; return exit status only. @@ -165,6 +170,7 @@ utility is expected to be compatible. The .Fl h , +.Fl n , .Fl x , and .Fl z diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index bab69125e83e..384c273f4632 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -67,6 +67,7 @@ bool lflag, sflag, xflag, zflag; static const struct option long_opts[] = { {"verbose", no_argument, NULL, 'l'}, + {"bytes", required_argument, NULL, 'n'}, {"silent", no_argument, NULL, 's'}, {"quiet", no_argument, NULL, 's'}, {NULL, no_argument, NULL, 0} @@ -78,14 +79,14 @@ int main(int argc, char *argv[]) { struct stat sb1, sb2; - off_t skip1, skip2; + off_t skip1, skip2, limit; int ch, fd1, fd2, oflag; bool special; const char *file1, *file2; skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hlsxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+hln:sxz", long_opts, NULL)) != -1) switch (ch) { case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; @@ -93,6 +94,13 @@ main(int argc, char *argv[]) case 'l': /* print all differences */ lflag = true; break; + case 'n': /* Limit */ + if (expand_number(optarg, &limit) < 0 || limit < 0) { + fprintf(stderr, "Invalid --bytes: %s\n", + optarg); + usage(); + } + break; case 's': /* silent run */ sflag = true; break; @@ -163,7 +171,7 @@ main(int argc, char *argv[]) if (fd1 == -1) { if (fd2 == -1) { - c_link(file1, skip1, file2, skip2); + c_link(file1, skip1, file2, skip2, limit); exit(0); } else if (!sflag) errx(ERR_EXIT, "%s: Not a symbolic link", file2); @@ -201,7 +209,7 @@ main(int argc, char *argv[]) } if (special) - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); else { if (zflag && sb1.st_size != sb2.st_size) { if (!sflag) @@ -210,7 +218,7 @@ main(int argc, char *argv[]) exit(DIFF_EXIT); } c_regular(fd1, file1, skip1, sb1.st_size, - fd2, file2, skip2, sb2.st_size); + fd2, file2, skip2, sb2.st_size, limit); } exit(0); } diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h index 82c5ea42b175..803319a50ca4 100644 --- a/usr.bin/cmp/extern.h +++ b/usr.bin/cmp/extern.h @@ -38,9 +38,10 @@ #define DIFF_EXIT 1 #define ERR_EXIT 2 /* error exit code */ -void c_link(const char *, off_t, const char *, off_t); -void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, off_t); -void c_special(int, const char *, off_t, int, const char *, off_t); +void c_link(const char *, off_t, const char *, off_t, off_t); +void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, + off_t, off_t); +void c_special(int, const char *, off_t, int, const char *, off_t, off_t); void diffmsg(const char *, const char *, off_t, off_t); void eofmsg(const char *); diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c index 9193147e830e..f0b4482a5792 100644 --- a/usr.bin/cmp/link.c +++ b/usr.bin/cmp/link.c @@ -40,7 +40,8 @@ __FBSDID("$FreeBSD$"); #include "extern.h" void -c_link(const char *file1, off_t skip1, const char *file2, off_t skip2) +c_link(const char *file1, off_t skip1, const char *file2, off_t skip2, + off_t limit) { char buf1[PATH_MAX], *p1; char buf2[PATH_MAX], *p2; @@ -72,7 +73,8 @@ c_link(const char *file1, off_t skip1, const char *file2, off_t skip2) dfound = 0; byte = 1; - for (p1 = buf1 + skip1, p2 = buf2 + skip2; *p1 && *p2; p1++, p2++) { + for (p1 = buf1 + skip1, p2 = buf2 + skip2; + *p1 && *p2 && (limit == 0 || byte <= limit); p1++, p2++) { if ((ch = *p1) != *p2) { if (xflag) { dfound = 1; diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index fe639663a560..a60398620282 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -60,7 +60,7 @@ static void segv_handler(int); void c_regular(int fd1, const char *file1, off_t skip1, off_t len1, - int fd2, const char *file2, off_t skip2, off_t len2) + int fd2, const char *file2, off_t skip2, off_t len2, off_t limit) { struct sigaction act, oact; cap_rights_t rights; @@ -86,15 +86,17 @@ c_regular(int fd1, const char *file1, off_t skip1, off_t len1, off2 = ROUNDPAGE(skip2); length = MIN(len1, len2); + if (limit > 0) + length = MIN(length, limit); if ((m1 = remmap(NULL, fd1, off1)) == NULL) { - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); return; } if ((m2 = remmap(NULL, fd2, off2)) == NULL) { munmap(m1, MMAP_CHUNK); - c_special(fd1, file1, skip1, fd2, file2, skip2); + c_special(fd1, file1, skip1, fd2, file2, skip2, limit); return; } diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index 930fcd5492ff..25f755f6e70a 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); void c_special(int fd1, const char *file1, off_t skip1, - int fd2, const char *file2, off_t skip2) + int fd2, const char *file2, off_t skip2, off_t limit) { int ch1, ch2; off_t byte, line; @@ -76,7 +76,7 @@ c_special(int fd1, const char *file1, off_t skip1, if (getc(fp2) == EOF) goto eof; - for (byte = line = 1;; ++byte) { + for (byte = line = 1; limit == 0 || byte <= limit; ++byte) { ch1 = getc(fp1); ch2 = getc(fp2); if (ch1 == EOF || ch2 == EOF) diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 334e9f357730..c513984daf8b 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -91,10 +91,33 @@ skipsuff_body() atf_check -s exit:0 cmp -s a b 1k 1k } +atf_test_case limit +limit_head() +{ + atf_set "descr" "Test cmp(1) -n (limit)" +} +limit_body() +{ + echo -n "aaaabbbb" > a + echo -n "aaaaxxxx" > b + + atf_check -s exit:1 -o ignore cmp -s a b + atf_check -s exit:0 cmp -sn 4 a b + atf_check -s exit:0 cmp -sn 3 a b + atf_check -s exit:1 -o ignore cmp -sn 5 a b + + # Test special, too. The implementation for link is effectively + # identical. + atf_check -s exit:0 -e empty -x "cat a | cmp -sn 4 b -" + atf_check -s exit:0 -e empty -x "cat a | cmp -sn 3 b -" + atf_check -s exit:1 -o ignore -x "cat a | cmp -sn 5 b -" +} + atf_init_test_cases() { atf_add_test_case special atf_add_test_case symlink atf_add_test_case pr252542 atf_add_test_case skipsuff + atf_add_test_case limit } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:21:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E40F66B1541; Sun, 3 Oct 2021 05:21: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 4HMXHw4LScz4SCR; Sun, 3 Oct 2021 05:21:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 673C6206B1; Sun, 3 Oct 2021 05:21: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 1935L0pI021002; Sun, 3 Oct 2021 05:21:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935L0Bs021001; Sun, 3 Oct 2021 05:21:00 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:21:00 GMT Message-Id: <202110030521.1935L0Bs021001@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: e6eed7d7bc80 - stable/12 - cmp: add -b, --print-bytes 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/12 X-Git-Reftype: branch X-Git-Commit: e6eed7d7bc806c26e52eb0fe6c1c7f7f23eb3ea6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:21:02 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e6eed7d7bc806c26e52eb0fe6c1c7f7f23eb3ea6 commit e6eed7d7bc806c26e52eb0fe6c1c7f7f23eb3ea6 Author: Kyle Evans AuthorDate: 2021-09-23 05:46:30 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:57 +0000 cmp: add -b, --print-bytes This is compatible with GNU cmp. Reviewed by: bapt, markj (earlier version) Sponsored by: Klara, Inc. (cherry picked from commit f66b9b40f403f7c30fec3c4ceed93c6e8fafa8ac) --- usr.bin/cmp/cmp.1 | 5 ++++- usr.bin/cmp/cmp.c | 8 ++++++-- usr.bin/cmp/extern.h | 4 ++-- usr.bin/cmp/link.c | 10 +++++++--- usr.bin/cmp/misc.c | 14 ++++++++++++-- usr.bin/cmp/regular.c | 10 +++++++--- usr.bin/cmp/special.c | 11 ++++++++--- usr.bin/cmp/tests/Makefile | 5 +++++ usr.bin/cmp/tests/b_flag.out | 1 + usr.bin/cmp/tests/bl_flag.out | 1 + usr.bin/cmp/tests/cmp_test2.sh | 17 +++++++++++++++++ 11 files changed, 70 insertions(+), 16 deletions(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 5a56802bd22e..3e616bbe806e 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl l | s | x -.Op Fl hz +.Op Fl bhz .Op Fl -ignore-initial Ns Cm = Ns Ar num1 Ns Op :num2 .Op Fl -bytes Ns Cm = Ns Ar num .Ar file1 file2 @@ -59,6 +59,8 @@ Bytes and lines are numbered beginning with one. .Pp The following options are available: .Bl -tag -width indent +.It Fl b , Fl -print-bytes +Print each byte when a difference is found. .It Fl h Do not follow symbolic links. .It Fl i Ar num1 Ns Oo :num2 Oc , Fl -ignore-initial= Ns Ar num1 Ns Op :num2 @@ -187,6 +189,7 @@ utility is expected to be .St -p1003.2 compatible. The +.Fl b , .Fl h , .Fl i , .Fl n , diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 256cef8a0c31..98ae96c73375 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -62,10 +62,11 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -bool lflag, sflag, xflag, zflag; +bool bflag, lflag, sflag, xflag, zflag; static const struct option long_opts[] = { + {"print-bytes", no_argument, NULL, 'b'}, {"ignore-initial", required_argument, NULL, 'i'}, {"verbose", no_argument, NULL, 'l'}, {"bytes", required_argument, NULL, 'n'}, @@ -106,8 +107,11 @@ main(int argc, char *argv[]) skip1 = skip2 = 0; oflag = O_RDONLY; - while ((ch = getopt_long(argc, argv, "+hi:ln:sxz", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+bhi:ln:sxz", long_opts, NULL)) != -1) switch (ch) { + case 'b': /* Print bytes */ + bflag = true; + break; case 'h': /* Don't follow symlinks */ oflag |= O_NOFOLLOW; break; diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h index 803319a50ca4..d98daf424995 100644 --- a/usr.bin/cmp/extern.h +++ b/usr.bin/cmp/extern.h @@ -42,7 +42,7 @@ void c_link(const char *, off_t, const char *, off_t, off_t); void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, off_t, off_t); void c_special(int, const char *, off_t, int, const char *, off_t, off_t); -void diffmsg(const char *, const char *, off_t, off_t); +void diffmsg(const char *, const char *, off_t, off_t, int, int); void eofmsg(const char *); -extern bool lflag, sflag, xflag, zflag; +extern bool bflag, lflag, sflag, xflag, zflag; diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c index f0b4482a5792..e01a5911faf7 100644 --- a/usr.bin/cmp/link.c +++ b/usr.bin/cmp/link.c @@ -82,10 +82,14 @@ c_link(const char *file1, off_t skip1, const char *file2, off_t skip2, (long long)byte - 1, ch, *p2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch, *p2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch, ch, *p2, *p2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch, *p2); } else - diffmsg(file1, file2, byte, 1); + diffmsg(file1, file2, byte, 1, ch, *p2); /* NOTREACHED */ } byte++; diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c index 1e84f0d7a527..1dba34d28792 100644 --- a/usr.bin/cmp/misc.c +++ b/usr.bin/cmp/misc.c @@ -56,10 +56,20 @@ eofmsg(const char *file) } void -diffmsg(const char *file1, const char *file2, off_t byte, off_t line) +diffmsg(const char *file1, const char *file2, off_t byte, off_t line, + int b1, int b2) { - if (!sflag) + if (sflag) + goto out; + + if (bflag) { + (void)printf("%s %s differ: char %lld, line %lld is %3o %c %3o %c\n", + file1, file2, (long long)byte, (long long)line, b1, b1, + b2, b2); + } else { (void)printf("%s %s differ: char %lld, line %lld\n", file1, file2, (long long)byte, (long long)line); + } +out: exit(DIFF_EXIT); } diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index a60398620282..d270aeeac396 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -127,10 +127,14 @@ c_regular(int fd1, const char *file1, off_t skip1, off_t len1, (long long)byte - 1, ch, *p2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch, *p2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch, ch, *p2, *p2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch, *p2); } else - diffmsg(file1, file2, byte, line); + diffmsg(file1, file2, byte, line, ch, *p2); /* NOTREACHED */ } if (ch == '\n') diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index 25f755f6e70a..c206a317c0ef 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -88,10 +88,15 @@ c_special(int fd1, const char *file1, off_t skip1, (long long)byte - 1, ch1, ch2); } else if (lflag) { dfound = 1; - (void)printf("%6lld %3o %3o\n", - (long long)byte, ch1, ch2); + if (bflag) + (void)printf("%6lld %3o %c %3o %c\n", + (long long)byte, ch1, ch1, ch2, + ch2); + else + (void)printf("%6lld %3o %3o\n", + (long long)byte, ch1, ch2); } else { - diffmsg(file1, file2, byte, line); + diffmsg(file1, file2, byte, line, ch1, ch2); /* NOTREACHED */ } } diff --git a/usr.bin/cmp/tests/Makefile b/usr.bin/cmp/tests/Makefile index 087f32f4185f..99469ba42243 100644 --- a/usr.bin/cmp/tests/Makefile +++ b/usr.bin/cmp/tests/Makefile @@ -2,9 +2,14 @@ .include +PACKAGE= tests + ATF_TESTS_SH+= cmp_test2 NETBSD_ATF_TESTS_SH= cmp_test +${PACKAGE}FILES+= b_flag.out +${PACKAGE}FILES+= bl_flag.out + .include .include diff --git a/usr.bin/cmp/tests/b_flag.out b/usr.bin/cmp/tests/b_flag.out new file mode 100644 index 000000000000..bb3d288716b0 --- /dev/null +++ b/usr.bin/cmp/tests/b_flag.out @@ -0,0 +1 @@ +a b differ: char 3, line 1 is 143 c 144 d diff --git a/usr.bin/cmp/tests/bl_flag.out b/usr.bin/cmp/tests/bl_flag.out new file mode 100644 index 000000000000..8ec9007d7ed3 --- /dev/null +++ b/usr.bin/cmp/tests/bl_flag.out @@ -0,0 +1 @@ + 3 143 c 144 d diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh index 893ee59076c3..c264827646ca 100755 --- a/usr.bin/cmp/tests/cmp_test2.sh +++ b/usr.bin/cmp/tests/cmp_test2.sh @@ -118,6 +118,22 @@ limit_body() atf_check -s exit:1 -o ignore -x "cat a | cmp -sn 5 b -" } +atf_test_case bflag +bflag_head() +{ + atf_set "descr" "Test cmp(1) -b (print bytes)" +} +bflag_body() +{ + echo -n "abcd" > a + echo -n "abdd" > b + + atf_check -s exit:1 -o file:$(atf_get_srcdir)/b_flag.out \ + cmp -b a b + atf_check -s exit:1 -o file:$(atf_get_srcdir)/bl_flag.out \ + cmp -bl a b +} + atf_init_test_cases() { atf_add_test_case special @@ -125,4 +141,5 @@ atf_init_test_cases() atf_add_test_case pr252542 atf_add_test_case skipsuff atf_add_test_case limit + atf_add_test_case bflag } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 06:03:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1EEB6B218E; Sun, 3 Oct 2021 06:03: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 4HMYDr4s0cz4V27; Sun, 3 Oct 2021 06:03:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 865A620F51; Sun, 3 Oct 2021 06:03: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 19363OVB077214; Sun, 3 Oct 2021 06:03:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19363ORK077213; Sun, 3 Oct 2021 06:03:24 GMT (envelope-from git) Date: Sun, 3 Oct 2021 06:03:24 GMT Message-Id: <202110030603.19363ORK077213@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6b88668f0bfc - main - vfs: remove dead fifoop VOP_KQFILTER implementations 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/main X-Git-Reftype: branch X-Git-Commit: 6b88668f0bfcca09035549e25d0f3c181cd537c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 06:03:24 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6b88668f0bfcca09035549e25d0f3c181cd537c8 commit 6b88668f0bfcca09035549e25d0f3c181cd537c8 Author: Kyle Evans AuthorDate: 2021-10-02 05:17:57 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 06:02:51 +0000 vfs: remove dead fifoop VOP_KQFILTER implementations These began to become obsolete in d6d64f0f2c26 (r137739) and the deal was later sealed in 003e18aef4c4 (r137801) when vfs.fifofs.fops was dropped and vop-bypass for pipes became mandatory. PR: 225934 Suggested by: markj Reviewe by: kib, markj Differential Revision: https://reviews.freebsd.org/D32270 --- sys/fs/ext2fs/ext2_vnops.c | 18 ------------------ sys/ufs/ufs/ufs_vnops.c | 19 ------------------- 2 files changed, 37 deletions(-) diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index 367d48ab68f1..e9e8c07090da 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -135,7 +135,6 @@ static vop_listextattr_t ext2_listextattr; static vop_setextattr_t ext2_setextattr; static vop_vptofh_t ext2_vptofh; static vop_close_t ext2fifo_close; -static vop_kqfilter_t ext2fifo_kqfilter; /* Global vfs data structures for ext2. */ struct vop_vector ext2_vnodeops = { @@ -191,7 +190,6 @@ struct vop_vector ext2_fifoops = { .vop_fsync = ext2_fsync, .vop_getattr = ext2_getattr, .vop_inactive = ext2_inactive, - .vop_kqfilter = ext2fifo_kqfilter, .vop_pathconf = ext2_pathconf, .vop_print = ext2_print, .vop_read = VOP_PANIC, @@ -1642,22 +1640,6 @@ ext2fifo_close(struct vop_close_args *ap) return (fifo_specops.vop_close(ap)); } -/* - * Kqfilter wrapper for fifos. - * - * Fall through to ext2 kqfilter routines if needed - */ -static int -ext2fifo_kqfilter(struct vop_kqfilter_args *ap) -{ - int error; - - error = fifo_specops.vop_kqfilter(ap); - if (error) - error = vfs_kqfilter(ap); - return (error); -} - /* * Return POSIX pathconf information applicable to ext2 filesystems. */ diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 00ec8f41f432..e962ef8ca48c 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -130,7 +130,6 @@ static vop_strategy_t ufs_strategy; static vop_symlink_t ufs_symlink; static vop_whiteout_t ufs_whiteout; static vop_close_t ufsfifo_close; -static vop_kqfilter_t ufsfifo_kqfilter; SYSCTL_NODE(_vfs, OID_AUTO, ufs, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "UFS filesystem"); @@ -2578,23 +2577,6 @@ ufsfifo_close(ap) return (fifo_specops.vop_close(ap)); } -/* - * Kqfilter wrapper for fifos. - * - * Fall through to ufs kqfilter routines if needed - */ -static int -ufsfifo_kqfilter(ap) - struct vop_kqfilter_args *ap; -{ - int error; - - error = fifo_specops.vop_kqfilter(ap); - if (error) - error = vfs_kqfilter(ap); - return (error); -} - /* * Return POSIX pathconf information applicable to ufs filesystems. */ @@ -3013,7 +2995,6 @@ struct vop_vector ufs_fifoops = { .vop_close = ufsfifo_close, .vop_getattr = ufs_getattr, .vop_inactive = ufs_inactive, - .vop_kqfilter = ufsfifo_kqfilter, .vop_pathconf = ufs_pathconf, .vop_print = ufs_print, .vop_read = VOP_PANIC, From owner-dev-commits-src-all@freebsd.org Sun Oct 3 16:03:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44BCF66A11A; Sun, 3 Oct 2021 16:03:54 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMpYj1Jr5z3PDN; Sun, 3 Oct 2021 16:03:53 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ed1-f51.google.com with SMTP id bm13so4945644edb.8; Sun, 03 Oct 2021 09:03:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=c4lL/FMycZXkRlTj8HSkHnwY7EPJlAxEjattaxgWL9c=; b=SxOCQTjpIsztys8QMHmuAHyIK1l1DUT+vXs+75Jx0FJFGhSlLKOH1WAIQpPFKuV7a8 cu36Hj3FATE7ZgcSDvs3LFvKEqwGtHTWK/ikKNsjCnaazQzlN0P9heJfpCL+BMkaWO6M T/Bn8Y9YlXmeWJW96vj3zlZ3rxzi9aBLowqFukM7xuL5XIou31l8oGM5usHY/u3Vwl4Z kls+FhkyXpaNbvdT2VF+NkrgVLxxtDeCDWbjCitbbt+If9iXdSYZw9CEosDjAONoCuVW nrg2LJUH2Mw431e7wedlTRP6fuAO8+0junILCfgM512pCypox5d8xemCekXh+jR+mVbM eXhw== X-Gm-Message-State: AOAM530f6MpbU8I4350j5C5qk4hJiqKMABHaGLVQrzheWwx6FQ/txllA HwTExFG3Yh3hxZO+GfGU+WZRgsw8L3FFIg== X-Google-Smtp-Source: ABdhPJwgfH3Mi2/WWGMmwhXaAfgYElhv35UHWP2Wd/EA5LZg3ASvIofsJ3YgjX1tnrVptFjpUzWA9w== X-Received: by 2002:a17:906:5e17:: with SMTP id n23mr8808980eju.258.1633277026533; Sun, 03 Oct 2021 09:03:46 -0700 (PDT) Received: from [192.168.0.15] (ip5f5bd4ef.dynamic.kabel-deutschland.de. [95.91.212.239]) by smtp.gmail.com with ESMTPSA id f10sm6074727edu.70.2021.10.03.09.03.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Oct 2021 09:03:45 -0700 (PDT) Subject: Re: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. To: Hans Petter Selasky , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> From: Mateusz Piotrowski <0mp@FreeBSD.org> Cc: Christos Margiolis Message-ID: <3d6a23c3-ad2c-4c5b-849e-1ef12dbf8955@FreeBSD.org> Date: Sun, 3 Oct 2021 18:03:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 4HMpYj1Jr5z3PDN X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mpp302@gmail.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=mpp302@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.51:from]; FORGED_SENDER(0.30)[0mp@FreeBSD.org,mpp302@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.51:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[0mp@FreeBSD.org,mpp302@gmail.com]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all]; RECEIVED_SPAMHAUS_PBL(0.00)[95.91.212.239:received] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 16:03:54 -0000 On 22/09/2021 20:03, Hans Petter Selasky wrote: > The branch main has been updated by hselasky: > > URL: https://cgit.FreeBSD.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d > > commit 903873ce15600fc02a0ea42cbf888cff232b411d > Author: Hans Petter Selasky > AuthorDate: 2021-09-22 13:42:51 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-09-22 17:43:56 +0000 > > Implement and use new mixer(3) library for FreeBSD. > > Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements > This project was part of Google Summer of Code 2021. > This may be a bit late to discuss but the new mixer has a completely different set of options and command-line arguments. In addition to that, the output of the command is different. Shouldn't we keep supporting the previous way of interacting with mixer? I know that people are scripting mixer and its output in production in order to control soundcards. Are there any good reasons to keep the new mixer(8) as it is now while keeping the old name? Perhaps we could change the name of the new mixer to, e.g., newmixer. Users are going to have to rewrite their scripts for mixer(8) anyway for 14.0. Best, Mateusz Piotrowski From owner-dev-commits-src-all@freebsd.org Sun Oct 3 18:36:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54DC066C8A1; Sun, 3 Oct 2021 18:36: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 4HMsy71xf8z3rwn; Sun, 3 Oct 2021 18:36:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22C3B2E9E; Sun, 3 Oct 2021 18:36: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 193IalnV074862; Sun, 3 Oct 2021 18:36:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193IalKi074861; Sun, 3 Oct 2021 18:36:47 GMT (envelope-from git) Date: Sun, 3 Oct 2021 18:36:47 GMT Message-Id: <202110031836.193IalKi074861@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 1be2e16df1d2 - main - riscv: Add a stub pmap_change_attr implementation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1be2e16df1d29148aee83964330a71ae403c6078 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 18:36:47 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=1be2e16df1d29148aee83964330a71ae403c6078 commit 1be2e16df1d29148aee83964330a71ae403c6078 Author: Jessica Clarke AuthorDate: 2021-10-03 18:33:47 +0000 Commit: Jessica Clarke CommitDate: 2021-10-03 18:33:47 +0000 riscv: Add a stub pmap_change_attr implementation pmap_change_attr is required by drm-kmod so we need the function to exist. Since the Svpbmt extension is on the horizon we will likely end up with a real implementation of it, so this stub implementation does all the necessary page table walking to validate the input, ensuring that no new errors are returned once it's implemented fully (other than due to out of memory conditions when demoting L2 entries) and providing a skeleton for that future implementation. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31996 --- sys/riscv/include/pmap.h | 1 + sys/riscv/riscv/pmap.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/sys/riscv/include/pmap.h b/sys/riscv/include/pmap.h index 599adfa4ce19..024bc3743f67 100644 --- a/sys/riscv/include/pmap.h +++ b/sys/riscv/include/pmap.h @@ -144,6 +144,7 @@ struct thread; void pmap_activate_boot(pmap_t); void pmap_activate_sw(struct thread *); void pmap_bootstrap(vm_offset_t, vm_paddr_t, vm_size_t); +int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 8f76881478b9..df80f07df0ca 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -310,6 +310,8 @@ static void _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free); static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t, struct spglist *); +static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode); + #define pmap_clear(pte) pmap_store(pte, 0) #define pmap_clear_bits(pte, bits) atomic_clear_64(pte, bits) #define pmap_load_store(pte, entry) atomic_swap_64(pte, entry) @@ -4252,6 +4254,98 @@ pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { m->md.pv_memattr = ma; + + /* + * If "m" is a normal page, update its direct mapping. This update + * can be relied upon to perform any cache operations that are + * required for data coherence. + */ + if ((m->flags & PG_FICTITIOUS) == 0 && + pmap_change_attr(PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), PAGE_SIZE, + m->md.pv_memattr) != 0) + panic("memory attribute change on the direct map failed"); +} + +/* + * Changes the specified virtual address range's memory type to that given by + * the parameter "mode". The specified virtual address range must be + * completely contained within either the direct map or the kernel map. + * + * Returns zero if the change completed successfully, and either EINVAL or + * ENOMEM if the change failed. Specifically, EINVAL is returned if some part + * of the virtual address range was not mapped, and ENOMEM is returned if + * there was insufficient memory available to complete the change. In the + * latter case, the memory type may have been changed on some part of the + * virtual address range. + */ +int +pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) +{ + int error; + + PMAP_LOCK(kernel_pmap); + error = pmap_change_attr_locked(va, size, mode); + PMAP_UNLOCK(kernel_pmap); + return (error); +} + +static int +pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) +{ + vm_offset_t base, offset, tmpva; + pd_entry_t *l1, l1e; + pd_entry_t *l2, l2e; + pt_entry_t *l3, l3e; + + PMAP_LOCK_ASSERT(kernel_pmap, MA_OWNED); + base = trunc_page(va); + offset = va & PAGE_MASK; + size = round_page(offset + size); + + if (!VIRT_IN_DMAP(base) && + !(base >= VM_MIN_KERNEL_ADDRESS && base < VM_MAX_KERNEL_ADDRESS)) + return (EINVAL); + + for (tmpva = base; tmpva < base + size; ) { + l1 = pmap_l1(kernel_pmap, tmpva); + if (l1 == NULL || ((l1e = pmap_load(l1)) & PTE_V) == 0) + return (EINVAL); + if ((l1e & PTE_RWX) != 0) { + /* + * TODO: Demote if attributes don't match and there + * isn't an L1 page left in the range, and update the + * L1 entry if the attributes don't match but there is + * an L1 page left in the range, once we support the + * upcoming Svpbmt extension. + */ + tmpva = (tmpva & ~L1_OFFSET) + L1_SIZE; + continue; + } + l2 = pmap_l1_to_l2(l1, tmpva); + if (l2 == NULL || ((l2e = pmap_load(l2)) & PTE_V) == 0) + return (EINVAL); + if ((l2e & PTE_RWX) != 0) { + /* + * TODO: Demote if attributes don't match and there + * isn't an L2 page left in the range, and update the + * L2 entry if the attributes don't match but there is + * an L2 page left in the range, once we support the + * upcoming Svpbmt extension. + */ + tmpva = (tmpva & ~L2_OFFSET) + L2_SIZE; + continue; + } + l3 = pmap_l2_to_l3(l2, tmpva); + if (l3 == NULL || ((l3e = pmap_load(l3)) & PTE_V) == 0) + return (EINVAL); + /* + * TODO: Update the L3 entry if the attributes don't match once + * we support the upcoming Svpbmt extension. + */ + tmpva += PAGE_SIZE; + } + + return (0); } /* From owner-dev-commits-src-all@freebsd.org Sun Oct 3 18:36:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6967B66C7DC; Sun, 3 Oct 2021 18:36: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 4HMsy82bC6z3ryc; Sun, 3 Oct 2021 18:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A7C82B43; Sun, 3 Oct 2021 18:36: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 193Iameg074886; Sun, 3 Oct 2021 18:36:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193IamFT074885; Sun, 3 Oct 2021 18:36:48 GMT (envelope-from git) Date: Sun, 3 Oct 2021 18:36:48 GMT Message-Id: <202110031836.193IamFT074885@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 7047568821a9 - main - libgcc_s: Export 64-bit int to 128-bit float functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7047568821a9019359a8518e1f1481f73d6e5445 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 18:36:48 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=7047568821a9019359a8518e1f1481f73d6e5445 commit 7047568821a9019359a8518e1f1481f73d6e5445 Author: Jessica Clarke AuthorDate: 2021-10-03 18:34:25 +0000 Commit: Jessica Clarke CommitDate: 2021-10-03 18:34:25 +0000 libgcc_s: Export 64-bit int to 128-bit float functions The corresponding 32-bit int and 128-bit int functions were added in 790a6be5a169, as were all combinations of the float to int functions, but these two were overlooked. __floatditf is needed to build curl for riscv as there's a signed 64-bit int to 128-bit float conversion in lib/progress.c's trspeed as of 7.77.0. Reviewed by: dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31997 --- lib/libgcc_s/Symbol.map | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libgcc_s/Symbol.map b/lib/libgcc_s/Symbol.map index 2580623d778b..292932198170 100644 --- a/lib/libgcc_s/Symbol.map +++ b/lib/libgcc_s/Symbol.map @@ -162,8 +162,10 @@ GCC_4.6.0 { __fixunstfdi; __fixunstfsi; __fixunstfti; + __floatditf; __floatsitf; __floattitf; + __floatunditf; __floatunsitf; __floatuntitf; __getf2; From owner-dev-commits-src-all@freebsd.org Sun Oct 3 18:36:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C509E66C7DD; Sun, 3 Oct 2021 18:36: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 4HMsy94ZHJz3s45; Sun, 3 Oct 2021 18:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 575932D9C; Sun, 3 Oct 2021 18:36: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 193IanjD074917; Sun, 3 Oct 2021 18:36:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193Ian5c074916; Sun, 3 Oct 2021 18:36:49 GMT (envelope-from git) Date: Sun, 3 Oct 2021 18:36:49 GMT Message-Id: <202110031836.193Ian5c074916@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 8167c92f65bc - main - LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8167c92f65bc20145467b3b98c842cde57736900 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 18:36:49 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8167c92f65bc20145467b3b98c842cde57736900 commit 8167c92f65bc20145467b3b98c842cde57736900 Author: Jessica Clarke AuthorDate: 2021-10-03 18:34:40 +0000 Commit: Jessica Clarke CommitDate: 2021-10-03 18:34:40 +0000 LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards One of the three uses is already guarded; this guards the remaining ones to support architectures like riscv that do not provide write-combining, and is needed to build drm-kmod on riscv. Reviewed by: hselasky, manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31999 --- sys/compat/linuxkpi/common/include/linux/io.h | 4 ++++ sys/compat/linuxkpi/common/include/linux/page.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h index 0104eea90ace..074417b892f9 100644 --- a/sys/compat/linuxkpi/common/include/linux/io.h +++ b/sys/compat/linuxkpi/common/include/linux/io.h @@ -411,8 +411,12 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr); #define ioremap(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE) #endif +#ifdef VM_MEMATTR_WRITE_COMBINING #define ioremap_wc(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING) +#else +#define ioremap_wc(addr, size) ioremap_nocache(addr, size) +#endif #define ioremap_wb(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK) void iounmap(void *addr); diff --git a/sys/compat/linuxkpi/common/include/linux/page.h b/sys/compat/linuxkpi/common/include/linux/page.h index ca7365419e22..0c3d456d6ec0 100644 --- a/sys/compat/linuxkpi/common/include/linux/page.h +++ b/sys/compat/linuxkpi/common/include/linux/page.h @@ -83,8 +83,12 @@ pgprot2cachemode(pgprot_t prot) #define clear_page(page) memset(page, 0, PAGE_SIZE) #define pgprot_noncached(prot) \ (((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_UNCACHEABLE)) +#ifdef VM_MEMATTR_WRITE_COMBINING #define pgprot_writecombine(prot) \ (((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_WRITE_COMBINING)) +#else +#define pgprot_writecombine(prot) pgprot_noncached(prot) +#endif #undef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE-1)) From owner-dev-commits-src-all@freebsd.org Sun Oct 3 18:36:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6E5E66C6B7; Sun, 3 Oct 2021 18:36: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 4HMsyB4jYCz3rnq; Sun, 3 Oct 2021 18:36:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 824C13008; Sun, 3 Oct 2021 18:36: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 193IaoAJ074941; Sun, 3 Oct 2021 18:36:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193IaoTI074940; Sun, 3 Oct 2021 18:36:50 GMT (envelope-from git) Date: Sun, 3 Oct 2021 18:36:50 GMT Message-Id: <202110031836.193IaoTI074940@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 2404f03fca7e - main - riscv: Add vt and kbdmux to GENERIC for video console support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2404f03fca7e5f62946d0da0f614c9db75a0df09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 18:36:50 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=2404f03fca7e5f62946d0da0f614c9db75a0df09 commit 2404f03fca7e5f62946d0da0f614c9db75a0df09 Author: Jessica Clarke AuthorDate: 2021-10-03 18:34:53 +0000 Commit: Jessica Clarke CommitDate: 2021-10-03 18:34:53 +0000 riscv: Add vt and kbdmux to GENERIC for video console support No in-tree drivers are supported for RISC-V (given it supports UEFI we could enable the EFI framebuffer, but U-Boot has very limited hardware support and EDK2 remains a work in progress), but drm-kmod exists with drivers for video cards that can be used with the HiFive Unmatched. Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32001 --- sys/riscv/conf/GENERIC | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index ae7f1c166273..a02a30d4834f 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -134,6 +134,10 @@ device uart # Generic UART driver device uart_lowrisc # lowRISC UART driver device uart_ns8250 # ns8250-type UART driver +# Console +device vt +device kbdmux + # RTC device goldfish_rtc # QEMU RTC From owner-dev-commits-src-all@freebsd.org Sun Oct 3 18:36:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E06E66CA08; Sun, 3 Oct 2021 18:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMsyC6Pj3z3s4G; Sun, 3 Oct 2021 18:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD2172D34; Sun, 3 Oct 2021 18:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 193IapRp074965; Sun, 3 Oct 2021 18:36:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193IapO6074964; Sun, 3 Oct 2021 18:36:51 GMT (envelope-from git) Date: Sun, 3 Oct 2021 18:36:51 GMT Message-Id: <202110031836.193IapO6074964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 31776afdc79d - main - pci_pci: Support growing bus ranges in bus_adjust_resource for NEW_PCIB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31776afdc79d5fb1ea211cc2a69c17c62b3dc8ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 18:36:52 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=31776afdc79d5fb1ea211cc2a69c17c62b3dc8ff commit 31776afdc79d5fb1ea211cc2a69c17c62b3dc8ff Author: Jessica Clarke AuthorDate: 2021-10-03 18:35:26 +0000 Commit: Jessica Clarke CommitDate: 2021-10-03 18:35:26 +0000 pci_pci: Support growing bus ranges in bus_adjust_resource for NEW_PCIB This is the same underlying problem as 262459806433, just for bus ranges rather than windows. SiFive's HiFive Unmatched has the following topology: Root Port <---> Bridge <---> Bridge <-+-> Bridge <---> (Unused) (pcib0) (pcib1) (pcib2) | (pcib3) +-> Bridge <---> xHCI | (pcib4) +-> Bridge <---> M.2 E-key | (pcib5) +-> Bridge <---> M.2 M-key | (pcib6) +-> Bridge <---> x16 slot (pcib7) If a device is plugged into the x16 slot that itself has a bridge, such as many graphics cards, we currently fail to allocate a bus number for its child bus (and so pcib_attach_child skips adding a child bus for further enumeration) as, when the new child bridge attaches, it attempts to allocate a bus number from its parent (pcib7) which in turn attempts to grow its own bus range by calling bus_adjust_resource on its own parent (pcib2) whose bus rman cannot accommodate the request and needs to itself be extended by calling its own parent (pcib1). Note that pcib3-7 do not face the same issue when they attach since pcib1 ends up managing bus numbers 1-255 from the beginning and so never needs to grow its own range. Reviewed by: jhb, mav MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32011 --- sys/dev/pci/pci_pci.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 2b86f2f50e11..cecf75024d3f 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -2364,7 +2364,20 @@ pcib_adjust_resource(device_t bus, device_t child, int type, struct resource *r, start, end)); #ifdef PCI_RES_BUS - if (type != PCI_RES_BUS) + if (type == PCI_RES_BUS) { + /* + * If our bus range isn't big enough to grow the sub-allocation + * then we need to grow our bus range. Any request that would + * require us to decrease the start of our own bus range is + * invalid, we can only extend the end; ignore such requests + * and let rman_adjust_resource fail below. + */ + if (start >= sc->bus.sec && end > sc->bus.sub) { + error = pcib_grow_subbus(&sc->bus, end); + if (error != 0) + return (error); + } + } else #endif { /* From owner-dev-commits-src-all@freebsd.org Sun Oct 3 19:08:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EFE566D0D3; Sun, 3 Oct 2021 19:08:46 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_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 4HMtg21gMlz3tMw; Sun, 3 Oct 2021 19:08:46 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 1A83D2600F2; Sun, 3 Oct 2021 21:08:38 +0200 (CEST) Subject: Re: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. To: Mateusz Piotrowski <0mp@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Christos Margiolis References: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> <3d6a23c3-ad2c-4c5b-849e-1ef12dbf8955@FreeBSD.org> From: Hans Petter Selasky Message-ID: <487fa0f2-d845-438f-a035-8b7ccba4285a@selasky.org> Date: Sun, 3 Oct 2021 21:08:27 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <3d6a23c3-ad2c-4c5b-849e-1ef12dbf8955@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HMtg21gMlz3tMw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 19:08:46 -0000 On 10/3/21 6:03 PM, Mateusz Piotrowski wrote: > On 22/09/2021 20:03, Hans Petter Selasky wrote: >> The branch main has been updated by hselasky: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d >> >> >> commit 903873ce15600fc02a0ea42cbf888cff232b411d >> Author:     Hans Petter Selasky >> AuthorDate: 2021-09-22 13:42:51 +0000 >> Commit:     Hans Petter Selasky >> CommitDate: 2021-09-22 17:43:56 +0000 >> >>      Implement and use new mixer(3) library for FreeBSD. >>      Wiki article: >> https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements >>      This project was part of Google Summer of Code 2021. > > This may be a bit late to discuss but the new mixer has a completely > different > set of options and command-line arguments. In addition to that, > the output of the command is different. > > Shouldn't we keep supporting the previous way of interacting with mixer? > I know that people are scripting mixer and its output in production > in order to control soundcards. Are there any good reasons to keep the new > mixer(8) as it is now while keeping the old name? Perhaps we could change > the name of the new mixer to, e.g., newmixer. Users are going to have to > rewrite their scripts for mixer(8) anyway for 14.0. > Hi Mateusz, It depends what level of compatibility you need. If you have a script parsing mixer output, then it needs to be binary compatible so to speak. That means some new features like "mute" won't work. It looks like all BSDs have diverged in the mixer area. NetBSD calls it mixerctl: https://man.netbsd.org/mixerctl.1 During the GSoc there was no requirement for binary compatibility for the mixer utility. Only in the kernel APIs are backwards compatible. Would it help to make a port, like "oldmixer", under "audio" ? Christos, feel free to chime in. --HPS From owner-dev-commits-src-all@freebsd.org Sun Oct 3 21:57:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06D5666FEA7; Sun, 3 Oct 2021 21:57: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 4HMyP76Gs5z4gRg; Sun, 3 Oct 2021 21:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B36AE5966; Sun, 3 Oct 2021 21:56: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 193Lux54041353; Sun, 3 Oct 2021 21:56:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193Luxix041352; Sun, 3 Oct 2021 21:56:59 GMT (envelope-from git) Date: Sun, 3 Oct 2021 21:56:59 GMT Message-Id: <202110032156.193Luxix041352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: b841148bbbdc - main - loader: Refactor readahead adjustment in bcache 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/main X-Git-Reftype: branch X-Git-Commit: b841148bbbdc967c871e8742a6f0b7b17b2d1d91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 21:57:00 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=b841148bbbdc967c871e8742a6f0b7b17b2d1d91 commit b841148bbbdc967c871e8742a6f0b7b17b2d1d91 Author: Colin Percival AuthorDate: 2021-10-03 19:10:36 +0000 Commit: Colin Percival CommitDate: 2021-10-03 19:10:36 +0000 loader: Refactor readahead adjustment in bcache While I'm here, add an explanatory comment. No functional change intended. Reviewed by: imp, tsoome (previous version) MFC after: 1 week Sponsored by: https://patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32249 --- stand/common/bcache.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/stand/common/bcache.c b/stand/common/bcache.c index 0eeb7e74ee96..b3b8b22c7d21 100644 --- a/stand/common/bcache.c +++ b/stand/common/bcache.c @@ -238,17 +238,27 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t size, if (BCACHE_LOOKUP(bc, (daddr_t)(blk + i))) { bcache_misses += (nblk - i); complete = 0; - if (nblk - i > BCACHE_MINREADAHEAD && bc->ra > BCACHE_MINREADAHEAD) - bc->ra >>= 1; /* reduce read ahead */ break; } else { bcache_hits++; } } - if (complete) { /* whole set was in cache, return it */ + /* + * Adjust read-ahead size if appropriate. Subject to the requirement + * that bc->ra must stay in between MINREADAHEAD and READAHEAD, we + * increase it when we notice that readahead was useful and decrease + * it when we notice that readahead was not useful. + */ + if (complete) { if (bc->ra < BCACHE_READAHEAD) - bc->ra <<= 1; /* increase read ahead */ + bc->ra <<= 1; /* increase read ahead */ + } else { + if (nblk - i > BCACHE_MINREADAHEAD && bc->ra > BCACHE_MINREADAHEAD) + bc->ra >>= 1; /* reduce read ahead */ + } + + if (complete) { /* whole set was in cache, return it */ bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); goto done; } From owner-dev-commits-src-all@freebsd.org Sun Oct 3 21:57:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16F2E66FCBD; Sun, 3 Oct 2021 21:57: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 4HMyP900vwz4gkV; Sun, 3 Oct 2021 21:57:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D454A5CEC; Sun, 3 Oct 2021 21:57: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 193Lv0kl041377; Sun, 3 Oct 2021 21:57:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193Lv0UP041376; Sun, 3 Oct 2021 21:57:00 GMT (envelope-from git) Date: Sun, 3 Oct 2021 21:57:00 GMT Message-Id: <202110032157.193Lv0UP041376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 04b9b7c507c5 - main - loader bcache: Track unconsumed readahead 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/main X-Git-Reftype: branch X-Git-Commit: 04b9b7c507c52daf7b2999329a50825db098151f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 21:57:01 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=04b9b7c507c52daf7b2999329a50825db098151f commit 04b9b7c507c52daf7b2999329a50825db098151f Author: Colin Percival AuthorDate: 2021-10-03 21:49:41 +0000 Commit: Colin Percival CommitDate: 2021-10-03 21:54:09 +0000 loader bcache: Track unconsumed readahead The loader bcache attempts to determine whether readahead is useful, increasing or decreasing its readahead length based on whether a read could be serviced out of the cache. This resulted in two unfortunate behaviours: 1. A series of consecutive 32 kB reads are requested and bcache performs 16 kB readaheads. For each read, bcache determines that, since only the first 16 kB is already in the cache, the readahead was not useful, and keeps the readahead at the minimum (16 kB) level. 2. A series of consecutive 32 kB reads are requested and bcache starts with a 32 kB readahead resulting in a 64 kB being read on the first request. The second 32 kB request can be serviced out of the cache, and bcache responds by doubling its readahead length to 64 kB. The third 32 kB request cannot be serviced out of the cache, and bcache reduces its readahead length back down to 32 kB. The first syndrome converts a series of 32 kB reads into a series of (misaligned) 32 kB reads, while the second syndrome converts a series of 32 kB reads into a series of 64 kB reads; in both cases we do not increase the readahead length to its limit (currently 128 kB) no matter how many consecutive read requests are made. This change avoids this problem by tracking the "unconsumed readahead" length; readahead is deemed to be useful (and the read-ahead length is potentially increased) not only if a request was completely serviced out of the cache, but also if *any* of the request was serviced out of the cache and that length matches the amount of unconsumed readahead. Conversely, we now only reduce the readahead length in cases where there was unconsumed readahead data. In my testing on an EC2 c5.xlarge instance, this change reduces the boot time by roughly 120 ms. Reviewed by: imp, tsoome MFC after: 1 week Sponsored by: https://patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32250 --- stand/common/bcache.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/stand/common/bcache.c b/stand/common/bcache.c index b3b8b22c7d21..b79d609b198b 100644 --- a/stand/common/bcache.c +++ b/stand/common/bcache.c @@ -67,6 +67,7 @@ struct bcache { size_t bcache_nblks; size_t ra; daddr_t bcache_nextblkno; + size_t ralen; }; static u_int bcache_total_nblks; /* set by bcache_init */ @@ -250,14 +251,23 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t size, * increase it when we notice that readahead was useful and decrease * it when we notice that readahead was not useful. */ - if (complete) { + if (complete || (i == bc->ralen && bc->ralen > 0)) { if (bc->ra < BCACHE_READAHEAD) bc->ra <<= 1; /* increase read ahead */ } else { - if (nblk - i > BCACHE_MINREADAHEAD && bc->ra > BCACHE_MINREADAHEAD) + if (nblk - i > BCACHE_MINREADAHEAD && bc->ralen > 0 && + bc->ra > BCACHE_MINREADAHEAD) bc->ra >>= 1; /* reduce read ahead */ } + /* Adjust our "unconsumed readahead" value. */ + if (blk == bc->bcache_nextblkno) { + if (nblk > bc->ralen) + bc->ralen = 0; + else + bc->ralen -= nblk; + } + if (complete) { /* whole set was in cache, return it */ bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); goto done; @@ -314,7 +324,10 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t size, if (ra != 0 && ra != bc->bcache_nblks) { /* do we have RA space? */ ra = MIN(bc->ra, ra - 1); ra = rounddown(ra, 16); /* multiple of 16 blocks */ + bc->ralen = ra; p_size += ra; + } else { + bc->ralen = 0; } /* invalidate bcache */ From owner-dev-commits-src-all@freebsd.org Sun Oct 3 21:57:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41AA666FD9D; Sun, 3 Oct 2021 21:57: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 4HMyPB14z3z4gkb; Sun, 3 Oct 2021 21:57:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F01945B9B; Sun, 3 Oct 2021 21:57: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 193Lv17Q041401; Sun, 3 Oct 2021 21:57:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193Lv1td041400; Sun, 3 Oct 2021 21:57:01 GMT (envelope-from git) Date: Sun, 3 Oct 2021 21:57:01 GMT Message-Id: <202110032157.193Lv1td041400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 248682a58915 - main - loader bcache: Allow readahead up to 256 kB I/Os 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/main X-Git-Reftype: branch X-Git-Commit: 248682a589159619aa5f2019e415a423e849e327 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 21:57:02 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=248682a589159619aa5f2019e415a423e849e327 commit 248682a589159619aa5f2019e415a423e849e327 Author: Colin Percival AuthorDate: 2021-10-03 21:55:10 +0000 Commit: Colin Percival CommitDate: 2021-10-03 21:55:10 +0000 loader bcache: Allow readahead up to 256 kB I/Os Prior to this commit, the loader would perform readaheads of up to 128 kB; when booting on a UFS filesystem this resulted in a series of 160 kB reads (32 kB request + 128 kB readahead). This commit allows readaheads to be longer, subject to a total I/O size limit of 256 kB; i.e. 32 kB read requests will have added readaheads of up to 224 kB. In my testing on an EC2 c5.xlarge instance, this change reduces the boot time by roughly 80 ms. Reviewed by: tsoome MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32251 --- stand/common/bcache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stand/common/bcache.c b/stand/common/bcache.c index b79d609b198b..99c78b0346b7 100644 --- a/stand/common/bcache.c +++ b/stand/common/bcache.c @@ -86,8 +86,9 @@ static u_int bcache_rablks; #define BHASH(bc, blkno) ((blkno) & ((bc)->bcache_nblks - 1)) #define BCACHE_LOOKUP(bc, blkno) \ ((bc)->bcache_ctl[BHASH((bc), (blkno))].bc_blkno != (blkno)) -#define BCACHE_READAHEAD 256 +#define BCACHE_READAHEAD 512 #define BCACHE_MINREADAHEAD 32 +#define BCACHE_MAXIOWRA 512 static void bcache_invalidate(struct bcache *bc, daddr_t blkno); static void bcache_insert(struct bcache *bc, daddr_t blkno); @@ -324,6 +325,8 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t size, if (ra != 0 && ra != bc->bcache_nblks) { /* do we have RA space? */ ra = MIN(bc->ra, ra - 1); ra = rounddown(ra, 16); /* multiple of 16 blocks */ + if (ra + p_size > BCACHE_MAXIOWRA) + ra = BCACHE_MAXIOWRA - p_size; bc->ralen = ra; p_size += ra; } else { From owner-dev-commits-src-all@freebsd.org Sun Oct 3 22:45:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C26BB6704FF; Sun, 3 Oct 2021 22:45: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 4HMzTT596xz4lFh; Sun, 3 Oct 2021 22:45:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 864DC6153; Sun, 3 Oct 2021 22:45: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 193MjnaU007534; Sun, 3 Oct 2021 22:45:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193MjnRD007533; Sun, 3 Oct 2021 22:45:49 GMT (envelope-from git) Date: Sun, 3 Oct 2021 22:45:49 GMT Message-Id: <202110032245.193MjnRD007533@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: a599f9f7620b - stable/13 - nfscl: Make vfs.nfs.maxcopyrange larger by default 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: a599f9f7620b81550fb40a607067e7c697b0490c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 22:45:49 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a599f9f7620b81550fb40a607067e7c697b0490c commit a599f9f7620b81550fb40a607067e7c697b0490c Author: Rick Macklem AuthorDate: 2021-09-11 22:36:32 +0000 Commit: Rick Macklem CommitDate: 2021-10-03 22:42:41 +0000 nfscl: Make vfs.nfs.maxcopyrange larger by default As of commit 103b207536f9, the NFSv4.2 server will limit the size of a Copy operation based upon a 1 second timeout. The Linux 5.2 kernel server also limits Copy operation size to 4Mbytes. As such, the NFSv4.2 client can attempt a large Copy without resulting in a long RPC RTT for these servers. This patch changes vfs.nfs.maxcopyrange to 64bits and sets the default to the maximum possible size of SSIZE_MAX, since a larger size makes the Copy operation more efficient and allows for copying to complete with fewer RPCs. The sysctl may be need to be made smaller for other non-FreeBSD NFSv4.2 servers. (cherry picked from commit 55089ef4f8bb7c4d18ee964b4214024e35ae4b0e) --- sys/fs/nfs/nfs_commonsubs.c | 4 ---- sys/fs/nfsclient/nfs_clrpcops.c | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 817d89284091..42b839c8567e 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -95,10 +95,6 @@ int nfsrv_maxpnfsmirror = 1; SYSCTL_INT(_vfs_nfs, OID_AUTO, pnfsmirror, CTLFLAG_RD, &nfsrv_maxpnfsmirror, 0, "Mirror level for pNFS service"); -int nfs_maxcopyrange = 10 * 1024 * 1024; -SYSCTL_INT(_vfs_nfs, OID_AUTO, maxcopyrange, CTLFLAG_RW, - &nfs_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable"); - /* * This array of structures indicates, for V4: * retfh - which of 3 types of calling args are used diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 2f6226e38415..984a63484777 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -62,6 +62,10 @@ static int nfscl_dssameconn = 0; SYSCTL_INT(_vfs_nfs, OID_AUTO, dssameconn, CTLFLAG_RW, &nfscl_dssameconn, 0, "Use same TCP connection to multiple DSs"); +static uint64_t nfs_maxcopyrange = SSIZE_MAX; +SYSCTL_U64(_vfs_nfs, OID_AUTO, maxcopyrange, CTLFLAG_RW, + &nfs_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable"); + /* * Global variables */ @@ -75,7 +79,6 @@ extern char nfsv4_callbackaddr[INET6_ADDRSTRLEN]; extern int nfscl_debuglevel; extern int nfs_pnfsiothreads; extern u_long sb_max_adj; -extern int nfs_maxcopyrange; NFSCLSTATEMUTEX; int nfstest_outofseq = 0; int nfscl_assumeposixlocks = 1; From owner-dev-commits-src-all@freebsd.org Sun Oct 3 22:46:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF4A3670C03; Sun, 3 Oct 2021 22:46:11 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) (using TLSv1.3 with cipher TLS_AES_256_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 4HMzTv5Gtkz4kws; Sun, 3 Oct 2021 22:46:11 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtpclient.apple (unknown [70.99.78.110]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 0E25A56485; Sun, 3 Oct 2021 17:46:05 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=vangyzen.net; s=default; t=1633301165; bh=pv0u12ZFF/6C7hDYQGBNF7Oob1ag+RD/y4uSt6DqABE=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=JUzho3l7gjnbEZLCJO82w4g8+YFPg1xRKWsj4AvqqL0zx/Qpwziur0Q3k04RcaJ6P HpSM90/hMR8qUu20PZZpkeTdl+Q/WvuRVyzRMEiKytlMtzuJ9bm8OABoOSzxJ6NarX xKcD3JlWV1tpBgz8g0yPol7EowVofKiQwlFX7KJDqLiK8SxWoZy1s2+cx7sSMT2Gpo 1yllXbFrCdisAa+acrtU9yI1poW9LWWk5dJPrLjIQmB40OGadZX+M8zyh/4BJbVQOb g7wYSuTneXf8/WhLmHk0bwP7GT+62dyfNk5GtQagnAdBp7qGLLvhkTDCWmUOmWv2f1 aA+vKnOUfikVA== Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. From: Eric van Gyzen In-Reply-To: <3d6a23c3-ad2c-4c5b-849e-1ef12dbf8955@FreeBSD.org> Date: Sun, 3 Oct 2021 17:46:04 -0500 Cc: Hans Petter Selasky , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , Christos Margiolis Content-Transfer-Encoding: quoted-printable Message-Id: <8D7B0F4D-D996-4AE5-85DC-FB74B8D7510F@vangyzen.net> References: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> <3d6a23c3-ad2c-4c5b-849e-1ef12dbf8955@FreeBSD.org> To: Mateusz Piotrowski <0mp@freebsd.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HMzTv5Gtkz4kws X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 22:46:11 -0000 > On Oct 3, 2021, at 11:03 AM, Mateusz Piotrowski <0mp@freebsd.org> = wrote: >=20 > Perhaps we could change the name of the new mixer to, e.g., newmixer. I realize that suggestion was just a quick example, but please don=E2=80=99= t call anything =E2=80=9Cnew,=E2=80=9D because it isn=E2=80=99t new for = long. ;) Eric= From owner-dev-commits-src-all@freebsd.org Sun Oct 3 22:53:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F961670CF5; Sun, 3 Oct 2021 22:53: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 4HMzfW1J39z4lW9; Sun, 3 Oct 2021 22:53:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C5CA6954; Sun, 3 Oct 2021 22:53: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 193MrcNg020944; Sun, 3 Oct 2021 22:53:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193Mrc5T020943; Sun, 3 Oct 2021 22:53:38 GMT (envelope-from git) Date: Sun, 3 Oct 2021 22:53:38 GMT Message-Id: <202110032253.193Mrc5T020943@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: c0dab9026c27 - stable/13 - param.h: Bump __FreeBSD_version for commit a599f9f7620b 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: c0dab9026c27997811eba0e9751e5bdf99412919 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 22:53:39 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c0dab9026c27997811eba0e9751e5bdf99412919 commit c0dab9026c27997811eba0e9751e5bdf99412919 Author: Rick Macklem AuthorDate: 2021-10-03 22:50:46 +0000 Commit: Rick Macklem CommitDate: 2021-10-03 22:50:46 +0000 param.h: Bump __FreeBSD_version for commit a599f9f7620b Commit a599f9f7620b deleted the variable called nfs_maxcopyrange from nfscommon.ko, since it no longer needs to be global. As such, the other nfs modules must be rebuilt from up to date sources. Bump __FreeBSD_version to 1300516. --- 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 c1066baa59f2..67c663de8b76 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 1300515 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300516 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Sun Oct 3 22:57:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD0ED670FC2; Sun, 3 Oct 2021 22:57: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 4HMzkm5PGZz4lZQ; Sun, 3 Oct 2021 22:57:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96F926983; Sun, 3 Oct 2021 22:57: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 193MvKWt021321; Sun, 3 Oct 2021 22:57:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193MvKpO021320; Sun, 3 Oct 2021 22:57:20 GMT (envelope-from git) Date: Sun, 3 Oct 2021 22:57:20 GMT Message-Id: <202110032257.193MvKpO021320@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: 501cf43202a2 - stable/13 - UPDATING: Add entry for commit a599f9f7620b 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: 501cf43202a248767da500005d87c7f62a5f557c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 22:57:20 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=501cf43202a248767da500005d87c7f62a5f557c commit 501cf43202a248767da500005d87c7f62a5f557c Author: Rick Macklem AuthorDate: 2021-10-03 22:54:33 +0000 Commit: Rick Macklem CommitDate: 2021-10-03 22:54:33 +0000 UPDATING: Add entry for commit a599f9f7620b --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index ba5ec4f6d205..46212b9047a2 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,12 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20211003: + Commit a599f9f7620b deleted the variable called nfs_maxcopyrange + from nfscommon.ko, since it no longer needs to be global. As such, + the other nfs modules must be rebuilt from up to date sources. + Bump __FreeBSD_version to 1300516 for this. + 20210823: As of commit 622809b0868f OpenSSL no longer enables kernel TLS by default. Users can enable kernel TLS via the "KTLS" SSL From owner-dev-commits-src-all@freebsd.org Sun Oct 3 23:03:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6567671097; Sun, 3 Oct 2021 23:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMztP5yfjz4m1k; Sun, 3 Oct 2021 23:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC501677F; Sun, 3 Oct 2021 23:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 193N3vhm035088; Sun, 3 Oct 2021 23:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193N3vKi035087; Sun, 3 Oct 2021 23:03:57 GMT (envelope-from git) Date: Sun, 3 Oct 2021 23:03:57 GMT Message-Id: <202110032303.193N3vKi035087@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: 263a7cc1379f - stable/13 - nfscl: Add vfs.nfs.maxalloclen to limit Allocate RPC RTT 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: 263a7cc1379f5b8afb8781f365db76736b9222de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 23:03:58 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=263a7cc1379f5b8afb8781f365db76736b9222de commit 263a7cc1379f5b8afb8781f365db76736b9222de Author: Rick Macklem AuthorDate: 2021-09-16 00:29:45 +0000 Commit: Rick Macklem CommitDate: 2021-10-03 22:58:59 +0000 nfscl: Add vfs.nfs.maxalloclen to limit Allocate RPC RTT Unlike Copy, the NFSv4.2 Allocate operation does not allow a reply with partial completion. As such, the only way to limit the time the operation takes to provide a reasonable RPC RTT is to limit the size of the allocation in the NFSv4.2 client. This patch adds a sysctl called vfs.nfs.maxalloclen to set the limit on the size of the Allocate operation. There is no way to know how long a server will take to do an allocate operation, but 64Mbytes results in a reasonable RPC RTT for the slow hardware I test on, so that is what the default value for vfs.nfs.maxalloclen is set to. For an 8Gbyte allocation, the elapsed time for doing it in 64Mbyte chunks was the same as the elapsed time taken for a single large allocation operation for a FreeBSD server with a UFS file system. (cherry picked from commit 9ebe4b8c67bf823e62617ba9fbd3c9c1768c8b3b) --- sys/fs/nfsclient/nfs_clvnops.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 72d9eac8e962..29b0cdce4bbc 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -299,6 +299,10 @@ int newnfs_directio_allow_mmap = 1; SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap, CTLFLAG_RW, &newnfs_directio_allow_mmap, 0, "Enable mmaped IO on file with O_DIRECT opens"); +static uint64_t nfs_maxalloclen = 64 * 1024 * 1024; +SYSCTL_U64(_vfs_nfs, OID_AUTO, maxalloclen, CTLFLAG_RW, + &nfs_maxalloclen, 0, "NFS max allocate/deallocate length"); + #define NFSACCESS_ALL (NFSACCESS_READ | NFSACCESS_MODIFY \ | NFSACCESS_EXTEND | NFSACCESS_EXECUTE \ | NFSACCESS_DELETE | NFSACCESS_LOOKUP) @@ -3617,6 +3621,7 @@ nfs_allocate(struct vop_allocate_args *ap) struct thread *td = curthread; struct nfsvattr nfsva; struct nfsmount *nmp; + off_t alen; int attrflag, error, ret; attrflag = 0; @@ -3630,12 +3635,16 @@ nfs_allocate(struct vop_allocate_args *ap) * file's allocation on the server. */ error = ncl_flush(vp, MNT_WAIT, td, 1, 0); - if (error == 0) - error = nfsrpc_allocate(vp, *ap->a_offset, *ap->a_len, + if (error == 0) { + alen = *ap->a_len; + if ((uint64_t)alen > nfs_maxalloclen) + alen = nfs_maxalloclen; + error = nfsrpc_allocate(vp, *ap->a_offset, alen, &nfsva, &attrflag, td->td_ucred, td, NULL); + } if (error == 0) { - *ap->a_offset += *ap->a_len; - *ap->a_len = 0; + *ap->a_offset += alen; + *ap->a_len -= alen; } else if (error == NFSERR_NOTSUPP) { mtx_lock(&nmp->nm_mtx); nmp->nm_privflag |= NFSMNTP_NOALLOCATE; From owner-dev-commits-src-all@freebsd.org Sun Oct 3 23:08:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 112A16711CB for ; Sun, 3 Oct 2021 23:08:22 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMzzT6l52z4mLc for ; Sun, 3 Oct 2021 23:08:21 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf2e.google.com with SMTP id 11so8989466qvd.11 for ; Sun, 03 Oct 2021 16:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rnuZCFM62ZttgrAoDGOzNFO3c3AY3KgmH6knAvktaRI=; b=g4xPOQhzZ8a0YHKUNYNu1cJMqrraiFCZs66BKCodLYfG0uD/exz3bPr0gGYU6iP640 7+DbR9EU6moxXAiAJih1PoZSjpiFAZZ9L0Z1KPMIxz5C+ysK1TaB4ZtNHX1f8kgmEk9I QuU3UbunYE3xb1ZwqVjo+GlUs85MplyWTWJQgmeqimNCGrYJsL5yLLhwCgdIO86zBRMm b0tD17THUMoF8RDXZgAWP609wys0oRCHpzzEVrf3FCtpWBLd++go841tIZnECLGRozL3 KPKjUZONZc+XGzAEtbxvRR+ncS9GPgBYaai1C9BkhuXMkv+7QG36pDtFByXrVol7wTgr Chxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rnuZCFM62ZttgrAoDGOzNFO3c3AY3KgmH6knAvktaRI=; b=AOtAIqU4HqttBvSEYvkmbtd+4APeGfNKC6MAdqFqFaFmfUInIUr0b92it/Gz3b6BaG BH95WxGFLjL9OU5sry70mEqk02bgx9yqEjc9nw9E3q3Dvp7GyYCKSCIpFBkYEYirwAfA t+ZlbGKVzELpuihoPC0fmBf2lWElxalRngJH4T/T7yrF0BNAqwme/1Xv4g+DgZN7ZfLu M89I3EHJmBf6JeFCG1xAhRspnSJgI6nj70ck0v6m/SQDnfAYbiSKvACFZ1VyDB51QtK6 59niDXflVMGS9MZDMRIsjOV+MUvVXcVV+gN7YHHM4qEemgJJN7vNio78OYs9LPWad0Sw A+GA== X-Gm-Message-State: AOAM531k4nAzm9030CmweUYIUJ5FDo8+SRqLnKUlbHi3MUhEjhT6Gqh3 CAKO2U+9ronwRkiieGtqpj09tfGP15YYr/1Nmgsu4w== X-Google-Smtp-Source: ABdhPJwJpxbhAFp/r0muJJ4QBBomuMf9jtP3dPbzsb8FV8CJLCOrhJRcCCkMySKDx7bEl+DpXL2rsw== X-Received: by 2002:a0c:9d07:: with SMTP id m7mr19537803qvf.60.1633302495216; Sun, 03 Oct 2021 16:08:15 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id y13sm5507640qtw.62.2021.10.03.16.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 16:08:14 -0700 (PDT) Date: Sun, 3 Oct 2021 19:08:14 -0400 From: Shawn Webb To: Eric van Gyzen Cc: Mateusz Piotrowski <0mp@freebsd.org>, Hans Petter Selasky , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , Christos Margiolis Subject: Re: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. Message-ID: <20211003230814.pqfaioaqu2yvileg@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> <3d6a23c3-ad2c-4c5b-849e-1ef12dbf8955@FreeBSD.org> <8D7B0F4D-D996-4AE5-85DC-FB74B8D7510F@vangyzen.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="brq5zzsach3avhx5" Content-Disposition: inline In-Reply-To: <8D7B0F4D-D996-4AE5-85DC-FB74B8D7510F@vangyzen.net> X-Rspamd-Queue-Id: 4HMzzT6l52z4mLc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 23:08:22 -0000 --brq5zzsach3avhx5 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 03, 2021 at 05:46:04PM -0500, Eric van Gyzen wrote: >=20 > > On Oct 3, 2021, at 11:03 AM, Mateusz Piotrowski <0mp@freebsd.org> wrote: > >=20 > > Perhaps we could change the name of the new mixer to, e.g., newmixer. >=20 > I realize that suggestion was just a quick example, but please don=E2=80= =99t call anything =E2=80=9Cnew,=E2=80=9D because it isn=E2=80=99t new for = long. ;) My bikeshed is now painted with a color called "Freshmixer". What's your bikeshed called? ;-) (This is meant in jest.) --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --brq5zzsach3avhx5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmFaN9sACgkQ/y5nonf4 4fpZ3w/+K4otgLu0AuYCo6NAoiIwoE1trPV8xxsT1f24oh2sH+EVMwa+LxxgDOhM Gy2Nkwow0R5gep9CR0Z1kHOLiHtU9EYLjYBk2OSQ698+rg8wJ3up3XlRoTerghUA S3B5ROKgQmgP7rpJQBe2cdHtm5/bX3T+7AEs4ABdHmjRhu1P2ll0nu/haim/hEjC DlRPC+Jgw3iI1lsp5O+7ktwoE2if2KOae5hOvzC7plltOn4VHE6dAAGHcMXaazuo fjSTiP5v2risFyWeyWe+iIP+TE12HEVTzkY8a4UAWcz8w64lIZHM24dad7qqk9Yv 66h4fqK9kcLNfNgY/t8ydNpu+45b7mpiKmXnXF2jJd7I+sThVDVerG5E21DNpXSs L2O4wtoyXg7w+DDUnoLvyYwbIutrzeGuM2UhST6dpT7vlag3MNiryLDZ2dzqsqvO aUIb9DLHnNpaDZR71SPTb5OcHCRbHmc+tNB9BsawiRd88F969IKreeauwqByCFfo BIWVO4KuuRJm3wKv1+pdYR7cxTWwtbwPxXjI/nr+SAZMEy9OEEa0jiTyBAv+eQRC hjF+2llVxmJf1OJbP5XOL/pvoxaA+EG5QHkXbEYvRx5gZyeeNeQvBHE4iDJAgU5R XIQ68CKakhR6+RG1g4/RYYDGqWlZzFjJ63jc1z5gFjJjevvL/tk= =1rss -----END PGP SIGNATURE----- --brq5zzsach3avhx5--