From owner-dev-commits-src-branches@freebsd.org Mon Sep 27 00:24:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 00:24:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 00:25:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 00:54:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 14:08:39 -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-branches@freebsd.org Mon Sep 27 14:08:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Mon Sep 27 14:08:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-branches@freebsd.org Tue Sep 28 00:34:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 03:15:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 07:33:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 07:33:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 07:33:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 07:33:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 07:36:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 13:22:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 13:22:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 14:22:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 14:24:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 16:33:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 16:35:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 16:57:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 16:57:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 16:57:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 16:57:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 16:57:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 16:57:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 17:30:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 17:30:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 17:30:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 17:30:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 17:30:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 17:30:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Tue Sep 28 17:30:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-branches@freebsd.org Wed Sep 29 00:43:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 00:44:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 00:44:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 00:44:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 04:49:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 04:49:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 04:50:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 17:19:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 17:19:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 17:19:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 17:19:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 17:24:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 17:24:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 17:24:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 17:24:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 19:38:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 20:44:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Wed Sep 29 20:44:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-branches@freebsd.org Thu Sep 30 00:23:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-branches@freebsd.org Thu Sep 30 00:24:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-branches@freebsd.org Thu Sep 30 03:57:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-branches@freebsd.org Thu Sep 30 03:59:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-branches@freebsd.org Thu Sep 30 05:52:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-branches@freebsd.org Thu Sep 30 11:35:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-branches@freebsd.org Thu Sep 30 12:21:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-branches@freebsd.org Thu Sep 30 12:21:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-branches@freebsd.org Fri Oct 1 00:33:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-branches@freebsd.org Fri Oct 1 00:33:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-branches@freebsd.org Fri Oct 1 00:33:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-branches@freebsd.org Fri Oct 1 00:33:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-branches@freebsd.org Fri Oct 1 00:33:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-branches@freebsd.org Fri Oct 1 06:56:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-branches@freebsd.org Fri Oct 1 14:09:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-branches@freebsd.org Fri Oct 1 14:09:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-branches@freebsd.org Sat Oct 2 08:21:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sat Oct 2 11:53:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sat Oct 2 11:55:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sat Oct 2 11:56:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sat Oct 2 11:58:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sat Oct 2 15:28:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sat Oct 2 16:43:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sat Oct 2 16:43:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sat Oct 2 16:43:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-branches@freebsd.org Sun Oct 3 01:33:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 01:33:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:04:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:04:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:04:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:04:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:04:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:04:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:04:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:15:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:15:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:15:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:15:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:15:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:15:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:15:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:15:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:20:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:20:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:20:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:20:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:20:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:20:58 -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-branches@freebsd.org Sun Oct 3 05:20:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:21:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 05:21:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:21:03 -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-branches@freebsd.org Sun Oct 3 22:45:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 22:53:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 22:57:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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-branches@freebsd.org Sun Oct 3 23:03:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: 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;